* fgrep -- print all lines containing any of a set of keywords
* 0 - ok, and some matches
int bflag
, cflag
, fflag
, lflag
, nflag
, vflag
, xflag
;
while (--argc
> 0 && (++argv
)[0][0]=='-')
fprintf(stderr
, "fgrep: unknown flag\n");
wordf
= fopen(*argv
, "r");
fprintf(stderr
, "fgrep: can't open %s\n", *argv
);
else while (--argc
>= 0) {
register struct words
*c
;
if ((f
= open(file
, 0)) < 0) {
fprintf(stderr
, "fgrep: can't open %s\n", file
);
if (p
== &buf
[BUFSIZ
*2]) p
= buf
;
if ((ccount
= read(f
, p
, &buf
[BUFSIZ
] - p
)) <= 0) break;
else if ((ccount
= read(f
, p
, BUFSIZ
)) <= 0) break;
if (p
== &buf
[BUFSIZ
*2]) p
= buf
;
if ((ccount
= read(f
, p
, &buf
[BUFSIZ
] - p
)) <= 0) break;
else if ((ccount
= read(f
, p
, BUFSIZ
)) <= 0) break;
if (failed
|| ecnt
> 1) goto nogood
;
if (nfile
> 1 && hflag
) printf("%s:", file
);
if (bflag
) printf("%d:", blkno
);
if (nflag
) printf("%ld:", lnum
);
while (nlp
< &buf
[BUFSIZ
*2]) putchar(*nlp
++);
while (nlp
< p
) putchar(*nlp
++);
if ((c
= *argptr
++) == '\0')
register struct words
*s
;
if (s
->inp
== 0) goto nenter
;
if (smax
>= &w
[MAXSIZ
-1]) overflo();
if (s
->inp
== 0) goto enter
;
if (smax
>= &w
[MAXSIZ
- 1]) overflo();
if (smax
>= &w
[MAXSIZ
- 1]) overflo();
} while ((c
= getargc()) != '\n' && c
!=EOF
);
if (smax
>= &w
[MAXSIZ
-1]) overflo();
fprintf(stderr
, "wordlist too large\n");
struct words
*queue
[QSIZE
];
struct words
**front
, **rear
;
register struct words
*s
;
init
: if ((s
->inp
) != 0) {
if (rear
>= &queue
[QSIZE
- 1]) overflo();
if ((s
= s
->link
) != 0) {
if (front
== &queue
[QSIZE
-1])
cloop
: if ((c
= s
->inp
) != 0) {
if (rear
>= &queue
[QSIZE
-1])
if (front
== queue
) overflo();
if (++rear
== front
) overflo();
floop
: if (state
== 0) state
= w
;
if ((state
->nst
)->out
== 1) q
->out
= 1;
else if ((state
= state
->link
) != 0)