diff options
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r-- | lib/xwrap.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c index 26fcb8df..22f00f2b 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -1072,18 +1072,18 @@ void xparsedate(char *str, time_t *t, unsigned *nano, int endian) free(oldtz); } -char *xgetline(FILE *fp, int *len) +// Return line of text from file. Strips trailing newline (if any). +char *xgetline(FILE *fp) { char *new = 0; - size_t linelen = 0; + size_t len = 0; long ll; errno = 0; - if (1>(ll = getline(&new, &linelen, fp))) { + if (1>(ll = getline(&new, &len, fp))) { if (errno && errno != EINTR) perror_msg("getline"); new = 0; } else if (new[ll-1] == '\n') new[--ll] = 0; - if (len) *len = ll; return new; } |