diff options
Diffstat (limited to 'src/libstddjb/openslurpnclose.c')
-rw-r--r-- | src/libstddjb/openslurpnclose.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstddjb/openslurpnclose.c b/src/libstddjb/openslurpnclose.c new file mode 100644 index 0000000..3672e16 --- /dev/null +++ b/src/libstddjb/openslurpnclose.c @@ -0,0 +1,13 @@ +/* ISC license. */ + +#include <skalibs/djbunix.h> + +int openslurpnclose (char const *fn, stralloc *sa, size_t max) +{ + int r ; + int fd = openbc_read(fn) ; + if (fd == -1) return 0 ; + r = slurpn(fd, sa, max) ; + fd_close(fd) ; + return r ; +} |