diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-05-18 02:19:59 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-05-18 02:19:59 +0000 |
commit | 2af587d68d11b1826c356364b4e9679199eee2ed (patch) | |
tree | 4cffead67aea555d1306495e60fc30ce1185db7b /src/libstddjb/openslurpnclose.c | |
parent | 8ef88c7d9a7108409c1e58c21b3d0590c859384f (diff) | |
download | skalibs-2af587d68d11b1826c356364b4e9679199eee2ed.tar.xz |
Add slurpn, refactor slurp, fix avltree/cdbmake bugs, add strerr_warnf
Signed-off-by: Laurent Bercot <ska@appnovation.com>
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 ; +} |