# HG changeset patch # User Ben Schmidt # Date 1288560668 -39600 # Node ID 5bab557020a66c4c888fb6bc5231573ea3d3a79b # Parent b9b60f3dd694e1a528b28a6224f0d74e0ed87c27 More readable interface to mygetuntil() when reading to EOF diff -r b9b60f3dd694 -r 5bab557020a6 src/mygetline.c --- a/src/mygetline.c Fri Oct 29 22:25:56 2010 +1100 +++ b/src/mygetline.c Mon Nov 01 08:31:08 2010 +1100 @@ -26,11 +26,12 @@ #include #include #include +#include #include "mygetline.h" #include "memory.h" -static char *mygetuntil(int fd, char eof) +static char *mygetuntil(int fd, int eof) { size_t i = 0, res, buf_size = BUFSIZE; /* initial buffer size */ char *buf, ch; @@ -62,7 +63,7 @@ buf = myrealloc(buf, buf_size); } buf[i++] = ch; - if(ch == eof) { + if(eof != EOF && ch == eof) { buf[i] = '\0'; return buf; } @@ -76,5 +77,5 @@ char *mygetcontent(int fd) { - return mygetuntil(fd, '\0'); + return mygetuntil(fd, EOF); }