diff options
| author | christos <christos@NetBSD.org> | 1995-09-10 15:55:13 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 1995-09-10 15:55:13 +0000 |
| commit | 49a4e14351ec704c91fe8a35aea8d08ce5006e58 (patch) | |
| tree | 1042b1ec00561ca7ad76e2b8c2c9bfb2bcd47fc6 /usr.bin/error/input.c | |
| parent | c08d930690da1ddbe45be45d4452ad67b3084d5d (diff) | |
Handle long lines without core-dumping.
Diffstat (limited to 'usr.bin/error/input.c')
| -rw-r--r-- | usr.bin/error/input.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.bin/error/input.c b/usr.bin/error/input.c index c779b8ec414..37a7d3b2d8d 100644 --- a/usr.bin/error/input.c +++ b/usr.bin/error/input.c @@ -1,4 +1,4 @@ -/* $NetBSD: input.c,v 1.3 1995/09/02 06:15:32 jtc Exp $ */ +/* $NetBSD: input.c,v 1.4 1995/09/10 15:55:13 christos Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$NetBSD: input.c,v 1.3 1995/09/02 06:15:32 jtc Exp $"; +static char rcsid[] = "$NetBSD: input.c,v 1.4 1995/09/10 15:55:13 christos Exp $"; #endif /* not lint */ #include <stdio.h> @@ -70,19 +70,23 @@ Errorclass mod2(); * Eat all of the lines in the input file, attempting to categorize * them by their various flavors */ -static char inbuffer[BUFSIZ]; - eaterrors(r_errorc, r_errorv) int *r_errorc; Eptr **r_errorv; { extern boolean piflag; Errorclass errorclass = C_SYNC; + char *line; + char *inbuffer; + size_t inbuflen; for (;;){ - if (fgets(inbuffer, BUFSIZ, errorfile) == NULL) + if ((inbuffer = fgetln(errorfile, &inbuflen)) == NULL) break; - wordvbuild(inbuffer, &wordc, &wordv); + line = Calloc(inbuflen + 1, sizeof(char)); + memcpy(line, inbuffer, inbuflen); + line[inbuflen] = '\0'; + wordvbuild(line, &wordc, &wordv); /* * for convience, convert wordv to be 1 based, instead * of 0 based. |
