File: regexpr.c

package info (click to toggle)
ifmail 2.14tx8.10-32
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,056 kB
  • sloc: ansic: 30,328; perl: 4,955; yacc: 839; makefile: 716; sh: 424; cpp: 235; lex: 206; awk: 24
file content (30 lines) | stat: -rw-r--r-- 497 bytes parent folder | download | duplicates (17)
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'));
}