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