Code

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