summaryrefslogtreecommitdiff
path: root/src/libstddjb/openslurpclose.c
blob: 6a431d035f54816879f2ec226185c934ccf9c2d4 (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 = openb_readcoe(fn) ;
  if (fd == -1) return 0 ;
  r = slurp(sa, fd) ;
  fd_close(fd) ;
  return r ;
}