[4372] in Athena Bugs
Re: vax 6.4R: grep
daemon@ATHENA.MIT.EDU (epeisach@ATHENA.MIT.EDU)
Fri Mar 2 17:06:04 1990
From: epeisach@ATHENA.MIT.EDU
Date: Fri, 2 Mar 90 17:05:18 -0500
To: bugs@ATHENA.MIT.EDU
I remember Cliff Tse (sctse) working on this problem a while back. I just
dug through his directory and pulled up his differences. I remember looking
at them a while ago and finding a problem but he may have fixed it.
I'm sending it in without looking at the differences right now as I don't have time at the moment.
*** grep.c.orig Tue Jul 25 21:55:45 1989
--- grep.c Fri Aug 4 09:44:46 1989
***************
*** 134,141 ****
*s++ = toupper(*p);
*s++ = *p++;
*s++ = ']';
! } else
*s++ = *p++;
if (s >= ybuf+ESIZE-5)
errexit("grep: argument too long\n", (char *)NULL);
}
--- 134,146 ----
*s++ = toupper(*p);
*s++ = *p++;
*s++ = ']';
! } else if (isupper(*p)) {
! *s++ = '[';
! *s++ = tolower(*p);
*s++ = *p++;
+ *s++ = ']';
+ } else
+ *s++ = *p++;
if (s >= ybuf+ESIZE-5)
errexit("grep: argument too long\n", (char *)NULL);
}
***************
*** 292,297 ****
--- 297,303 ----
{
register char *p1, *p2;
register c;
+ int eof = 0;
if (file) {
if (freopen(file, "r", stdin) == NULL) {
***************
*** 306,318 ****
p1 = linebuf;
while ((c = getchar()) != '\n') {
if (c == EOF) {
! if (cflag) {
! if (nfile>1)
! printf("%s:", file);
! printf("%D\n", tln);
! fflush(stdout);
! }
! return;
}
*p1++ = c;
if (p1 >= &linebuf[LBSIZE-1])
--- 312,319 ----
p1 = linebuf;
while ((c = getchar()) != '\n') {
if (c == EOF) {
! eof = 1;
! break;
}
*p1++ = c;
if (p1 >= &linebuf[LBSIZE-1])
***************
*** 345,355 ****
nfound:
if (vflag)
succeed(file);
! continue;
found:
if (vflag==0)
succeed(file);
! }
}
advance(lp, ep)
--- 346,367 ----
nfound:
if (vflag)
succeed(file);
! goto checkeof;
found:
if (vflag==0)
succeed(file);
!
! checkeof:
! if (eof) {
! if (cflag) {
! if (nfile>1)
! printf("%s:",file);
! printf("%D\n",tln);
! fflush(stdout);
! }
! return;
! }
! }
}
advance(lp, ep)