2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
23 char linebuf
[LBSIZE
+1];
27 0000,0001,0002,0003,0004,0005,0006,0007,
28 0010,0011,0012,0013,0014,0015,0016,0017,
29 0020,0021,0022,0023,0024,0025,0026,0027,
30 0030,0031,0032,0033,0034,0035,0036,0037,
31 0040,0041,0042,0043,0044,0045,0046,0047,
32 0050,0051,0052,0053,0054,0055,0056,0057,
33 0060,0061,0062,0063,0064,0065,0066,0067,
34 0070,0071,0072,0073,0074,0075,0076,0077,
35 0100,0141,0142,0143,0144,0145,0146,0147,
36 0150,0151,0152,0153,0154,0155,0156,0157,
37 0160,0161,0162,0163,0164,0165,0166,0167,
38 0170,0171,0172,0133,0134,0135,0136,0137,
39 0140,0141,0142,0143,0144,0145,0146,0147,
40 0150,0151,0152,0153,0154,0155,0156,0157,
41 0160,0161,0162,0163,0164,0165,0166,0167,
42 0170,0171,0172,0173,0174,0175,0176,0177,
50 register char *ep
, *sp
;
61 if (ep
>= &expbuf
[ESIZE
])
63 if ((c
= *sp
++) != '*')
91 if ((c
= *sp
++) == '^') {
98 if (c
=='\0' || ep
>= &expbuf
[ESIZE
])
100 } while ((c
= *sp
++) != ']');
105 if ((c
= *sp
++) == '\0')
121 register char *p1
, *p2
;
126 if ((f
= open(file
, 0)) < 0) {
127 fprintf(stderr
, "Grep: Can't open %s\n", file
);
139 if ((c
= read(f
, ibuf
, sizeof ibuf
)) <= 0) {
141 if(lf
) break; /* bodyless comp! */
148 if(lf
) if(c
!= ' ' && c
!= '\t') {
164 if(c
&& p1
< &linebuf
[LBSIZE
-1])
176 /* fast check for first character */
180 if(*p1
==c
|| cc
[*p1
]==c
)
186 /* regular algorithm */
202 register char *lp
, *ep
, *curlp
;
206 for (;;) switch (*ep
++) {
209 if (*ep
++ == *lp
++ || ep
[-1] == cc
[lp
[-1]])
227 if (cclass(ep
, *lp
++, 1)) {
234 if (cclass(ep
, *lp
++, 0)) {
247 while (*lp
++ == *ep
|| cc
[lp
[-1]] == *ep
) ;
254 while (cclass(ep
, *lp
++, ep
[-1]==(CCL
|STAR
)));
263 } while (lp
> curlp
);
267 printf("RE botch\n");
276 register char *set
, c
;