Commit | Line | Data |
---|---|---|
5b62e993 MW |
1 | #include "stralloc.h" |
2 | #include "slurp.h" | |
3 | #include "error.h" | |
4 | #include "open.h" | |
5 | ||
6 | int slurp(fn,sa,bufsize) | |
7 | char *fn; | |
8 | stralloc *sa; | |
9 | int bufsize; | |
10 | { | |
11 | int fd; | |
12 | fd = open_read(fn); | |
13 | if (fd == -1) { | |
14 | if (errno == error_noent) return 0; | |
15 | return -1; | |
16 | } | |
17 | if (slurpclose(fd,sa,bufsize) == -1) return -1; | |
18 | return 1; | |
19 | } |