1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <stdlib.h>
#if defined(HAS_REGEX_H)
#include <regex.h>
#elif defined(HAS_LIBGEN_H)
#include <libgen.h>
#else
char *regcmp();
char *regex();
#endif
static char *compiled_reg=NULL;
extern char *__loc1;
char *re_comp(mask)
char *mask;
{
if (compiled_reg) free(compiled_reg);
compiled_reg=regcmp(mask,NULL);
return NULL;
}
int re_exec(str)
char *str;
{
char *first_unmatched;
return ((first_unmatched=regex(compiled_reg,str)) &&
(__loc1 == str) &&
(*first_unmatched == '\0'));
}
|