version 1.13, 2003/04/19 17:22:29 |
version 1.14, 2003/05/06 22:10:11 |
|
|
} |
} |
if (sc->sc_type == PATTERN) { |
if (sc->sc_type == PATTERN) { |
for (nl = sc->sc_args; nl != NULL; nl = nl->n_next) { |
for (nl = sc->sc_args; nl != NULL; nl = nl->n_next) { |
char *cp, *re_comp(); |
char ebuf[BUFSIZ]; |
|
int ecode = 0; |
|
|
if ((cp = re_comp(nl->n_name)) != NULL) { |
/* allocate and compile n_regex as needed */ |
|
if (nl->n_regex == NULL) { |
|
nl->n_regex = (regex_t *) |
|
xmalloc(sizeof(regex_t)); |
|
ecode = regcomp(nl->n_regex, nl->n_name, |
|
REG_NOSUB); |
|
} |
|
if (ecode == 0) { |
|
ecode = regexec(nl->n_regex, file, 0, |
|
NULL, 0); |
|
} |
|
switch (ecode) { |
|
case REG_NOMATCH: |
|
break; |
|
case 0: |
|
return(1); /* match! */ |
|
default: |
|
regerror(ecode, nl->n_regex, ebuf, |
|
sizeof(ebuf)); |
error("Regex error \"%s\" for \"%s\".", |
error("Regex error \"%s\" for \"%s\".", |
cp, nl->n_name); |
ebuf, nl->n_name); |
return(0); |
|
} |
} |
if (re_exec(file) > 0) |
|
return(1); |
|
} |
} |
} |
} |
} |
} |