summaryrefslogtreecommitdiff
path: root/src/libstddjb/openslurpclose.c
blob: 8485413d613a6b719f11f23170ece6c12f8a0f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>

int openslurpclose (stralloc *sa, char const *fn)
{
  int r ;
  int fd = openbc_read(fn) ;
  if (fd == -1) return 0 ;
  r = slurp(sa, fd) ;
  fd_close(fd) ;
  return r ;
}