void urlhack_set_regular_expression(const char* expression) { is_regexp_compiled = 0; urlhack_disabled = 0; set_regerror_func(rtfm); urlhack_rx = regcomp(const_cast<char*>(expression)); if (urlhack_rx == 0) { urlhack_disabled = 1; } is_regexp_compiled = 1; }
/* ARGSUSED */ main( int argc, char *argv[]) { regexp *r; int i; set_regerror_func( try_regerror); #ifdef ERRAVAIL progname = mkprogname(argv[0]); #endif if (argc == 1) { multiple(); exit(status); } r = regcomp(argv[1]); if (r == NULL) error("regcomp failure", ""); #ifdef DEBUG regdump(r); if (argc > 4) regnarrate++; #endif if (argc > 2) { i = regexec(r, argv[2]); printf("%d", i); for (i = 1; i < NSUBEXP; i++) if (r->startp[i] != NULL && r->endp[i] != NULL) printf(" \\%d", i); printf("\n"); } if (argc > 3) { regsub(r, argv[3], buf); printf("%s\n", buf); } exit(status); }