xref: /netbsd-src/external/gpl2/xcvs/dist/lib/regex.c (revision 5a6c14c844c4c665da5632061aebde7bb2cb5766)
1 /* Extended regular expression matching and search library.
2    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License along
17    with this program; if not, write to the Free Software Foundation,
18    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 #include <sys/cdefs.h>
20 __RCSID("$NetBSD: regex.c,v 1.2 2016/05/17 14:00:09 christos Exp $");
21 
22 
23 #ifdef HAVE_CONFIG_H
24 # include <config.h>
25 #endif
26 
27 #ifdef _LIBC
28 /* We have to keep the namespace clean.  */
29 # define regfree(preg) __regfree (preg)
30 # define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
31 # define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
32 # define regerror(errcode, preg, errbuf, errbuf_size) \
33 	__regerror(errcode, preg, errbuf, errbuf_size)
34 # define re_set_registers(bu, re, nu, st, en) \
35 	__re_set_registers (bu, re, nu, st, en)
36 # define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
37 	__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
38 # define re_match(bufp, string, size, pos, regs) \
39 	__re_match (bufp, string, size, pos, regs)
40 # define re_search(bufp, string, size, startpos, range, regs) \
41 	__re_search (bufp, string, size, startpos, range, regs)
42 # define re_compile_pattern(pattern, length, bufp) \
43 	__re_compile_pattern (pattern, length, bufp)
44 # define re_set_syntax(syntax) __re_set_syntax (syntax)
45 # define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
46 	__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
47 # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
48 
49 # include "../locale/localeinfo.h"
50 #endif
51 
52 /* On some systems, limits.h sets RE_DUP_MAX to a lower value than
53    GNU regex allows.  Include it before <regex.h>, which correctly
54    #undefs RE_DUP_MAX and sets it to the right value.  */
55 #include <limits.h>
56 
57 #include <regex.h>
58 #include "regex_internal.h"
59 
60 #include "regex_internal.c"
61 #include "regcomp.c"
62 #include "regexec.c"
63 
64 /* Binary backward compatibility.  */
65 #if _LIBC
66 # include <shlib-compat.h>
67 # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
68 link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
69 int re_max_failures = 2000;
70 # endif
71 #endif
72