$NetBSD: patch-ar,v 1.1 2002/04/03 16:27:03 joda Exp $ --- src/lid.c~ Wed Apr 3 15:02:41 2002 +++ src/lid.c Wed Apr 3 16:01:38 2002 @@ -532,7 +532,8 @@ void report_grep (char const *name, struct file_link **flinkv) { - char line[BUFSIZ]; + char *line = xmalloc(BUFSIZ); + size_t line_len = BUFSIZ; char const *pattern = 0; regex_t compiled; int line_number; @@ -568,8 +569,14 @@ } line_number = 0; - while (fgets (&line[1], sizeof (line) - 1, gid_FILE)) + while (fgets (line + 1, line_len - 1, gid_FILE)) { + while(strlen(line) == line_len - 1 && line[line_len - 2] != '\n') { + line = xrealloc(line, line_len + BUFSIZ); + line_len += BUFSIZ; + if(fgets(line + strlen(line), BUFSIZ, gid_FILE) == NULL) + break; + } line_number++; if (pattern) { @@ -585,6 +592,7 @@ } fclose (gid_FILE); } + free(line); } void @@ -1314,7 +1322,7 @@ continue; } /* march down both strings as long as we match */ - while (*++name == *++line) + while (*name != '\0' && *++name == *++line) ; /* is this the end of `name', is there a word delimiter ?? */ if (*name == '\0' && !IS_ALNUM (*line))