12 |
|
#include <stdio.h> |
13 |
|
#include <stdlib.h> |
14 |
|
#include <ctype.h> |
15 |
+ |
#include <string.h> |
16 |
+ |
|
17 |
+ |
#include "rtio.h" |
18 |
+ |
|
19 |
|
/* |
20 |
|
* rexpr.c - regular expression parser (ala grep) |
21 |
|
*/ |
34 |
|
|
35 |
|
#define same(a,b) (a==b || (iflag && (a^b)==' ' && isalpha(a))) |
36 |
|
|
33 |
– |
#ifdef BSD |
34 |
– |
#define memcpy(to,from,len) bcopy(from,to,len) |
35 |
– |
#endif |
37 |
|
|
38 |
< |
static int advance(), cclass(); |
38 |
> |
static int advance(char *, char *); |
39 |
> |
static int cclass(char *, int c, int af); |
40 |
|
|
41 |
|
static char expbuf[ESIZE]; |
42 |
|
static int iflag; |
49 |
|
register char *sp; |
50 |
|
int iflg, wflag; |
51 |
|
{ |
52 |
< |
register c; |
52 |
> |
register int c; |
53 |
|
register char *ep; |
54 |
< |
char *lastep; |
54 |
> |
char *lastep = NULL; |
55 |
|
int cclcnt; |
56 |
|
|
57 |
|
iflag = iflg; |
167 |
|
return(NULL); |
168 |
|
/* fast check for first character */ |
169 |
|
if (expbuf[0]==CCHR) { |
170 |
< |
register c = expbuf[1]; |
170 |
> |
register int c = expbuf[1]; |
171 |
|
while (*++sp) |
172 |
|
if (same(*sp, c) && advance(sp, expbuf)) |
173 |
|
return(sp); |
271 |
|
static int |
272 |
|
cclass(set, c, af) |
273 |
|
register char *set; |
274 |
< |
register c; |
274 |
> |
register int c; |
275 |
|
int af; |
276 |
|
{ |
277 |
< |
register n; |
277 |
> |
register int n; |
278 |
|
|
279 |
|
if (c == 0) |
280 |
|
return(0); |