add USL's copyright notice
[unix-history] / usr / src / include / regex.h
CommitLineData
2827e0f4
KB
1/*-
2 * Copyright (c) 1992 Henry Spencer.
56559b70
KB
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
2827e0f4
KB
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Henry Spencer of the University of Toronto.
8 *
9 * %sccs.include.redist.c%
10 *
9c4c036c 11 * @(#)regex.h 8.2 (Berkeley) %G%
2827e0f4
KB
12 */
13
14#ifndef _REGEX_H_
15#define _REGEX_H_
16
374816be
KB
17#include <sys/cdefs.h>
18
2827e0f4
KB
19/* types */
20typedef off_t regoff_t;
21
22typedef struct {
23 int re_magic;
24 size_t re_nsub; /* number of parenthesized subexpressions */
9c4c036c 25 __const char *re_endp; /* end pointer for REG_PEND */
2827e0f4
KB
26 struct re_guts *re_g; /* none of your business :-) */
27} regex_t;
28
29typedef struct {
30 regoff_t rm_so; /* start of match */
31 regoff_t rm_eo; /* end of match */
32} regmatch_t;
33
2827e0f4 34/* regcomp() flags */
5b882fd2
KB
35#define REG_BASIC 0000
36#define REG_EXTENDED 0001
37#define REG_ICASE 0002
38#define REG_NOSUB 0004
39#define REG_NEWLINE 0010
40#define REG_NOSPEC 0020
41#define REG_PEND 0040
42#define REG_DUMP 0200
43
44/* regerror() flags */
45#define REG_NOMATCH 1
46#define REG_BADPAT 2
47#define REG_ECOLLATE 3
48#define REG_ECTYPE 4
49#define REG_EESCAPE 5
50#define REG_ESUBREG 6
51#define REG_EBRACK 7
52#define REG_EPAREN 8
53#define REG_EBRACE 9
54#define REG_BADBR 10
55#define REG_ERANGE 11
56#define REG_ESPACE 12
57#define REG_BADRPT 13
58#define REG_EMPTY 14
59#define REG_ASSERT 15
60#define REG_INVARG 16
61#define REG_ATOI 255 /* convert name to number (!) */
62#define REG_ITOA 0400 /* convert number to name (!) */
2827e0f4
KB
63
64/* regexec() flags */
65#define REG_NOTBOL 00001
66#define REG_NOTEOL 00002
67#define REG_STARTEND 00004
5b882fd2
KB
68#define REG_TRACE 00400 /* tracing of execution */
69#define REG_LARGE 01000 /* force large representation */
70#define REG_BACKR 02000 /* force use of backref code */
2827e0f4 71
7147ea66
KB
72__BEGIN_DECLS
73int regcomp __P((regex_t *, const char *, int));
74size_t regerror __P((int, const regex_t *, char *, size_t));
75int regexec __P((const regex_t *,
76 const char *, size_t, regmatch_t [], int));
77void regfree __P((regex_t *));
78__END_DECLS
79
2827e0f4 80#endif /* !_REGEX_H_ */