skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

openslurpnclose.c (241B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/djbunix.h>
      4 
      5 int openslurpnclose (char const *fn, stralloc *sa, size_t max)
      6 {
      7   int r ;
      8   int fd = openbc_read(fn) ;
      9   if (fd == -1) return 0 ;
     10   r = slurpn(fd, sa, max) ;
     11   fd_close(fd) ;
     12   return r ;
     13 }