diff options
| author | christos <christos@NetBSD.org> | 2020-01-10 18:35:29 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2020-01-10 18:35:29 +0000 |
| commit | ce181699bebaffee09cdf6da40344784ffee67e1 (patch) | |
| tree | 78a01e283b89610dd17726148a785e0fdbc36c80 /usr.bin/error/input.c | |
| parent | ee46ea5b81ecb2c886c7cd1d36680bf1b8a56f61 (diff) | |
use getline(3)
Diffstat (limited to 'usr.bin/error/input.c')
| -rw-r--r-- | usr.bin/error/input.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/error/input.c b/usr.bin/error/input.c index 0c82fd88b43..81032074a5a 100644 --- a/usr.bin/error/input.c +++ b/usr.bin/error/input.c @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.17 2011/07/18 21:46:15 christos Exp $ */ +/* $NetBSD: input.c,v 1.18 2020/01/10 18:35:29 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: input.c,v 1.17 2011/07/18 21:46:15 christos Exp $"); +__RCSID("$NetBSD: input.c,v 1.18 2020/01/10 18:35:29 christos Exp $"); #endif /* not lint */ #include <stdio.h> @@ -71,15 +71,13 @@ eaterrors(int *r_errorc, Eptr **r_errorv) { Errorclass errorclass = C_SYNC; char *line; - const char *inbuffer; size_t inbuflen; for (;;) { - if ((inbuffer = fgetln(errorfile, &inbuflen)) == NULL) + line = NULL; + inbuflen = 0; + if (getline(&line, &inbuflen, errorfile) == -1) break; - line = Calloc(inbuflen + 1, sizeof(char)); - memcpy(line, inbuffer, inbuflen); - line[inbuflen] = '\0'; wordvbuild(line, &cur_wordc, &cur_wordv); /* |
