Fix copyright comments and file comments.
[deliverable/binutils-gdb.git] / gdb / gnu-regex.c
index 844d71dc417aa9e8b6bdc91c12b06d1e08ef711c..f7faa8c864730a4e27cf6a7dca276626984be5c3 100644 (file)
@@ -1,3 +1,4 @@
+/* *INDENT-OFF* */ /* keep in sync with glibc */
 /* Extended regular expression matching and search library,
    version 0.12.
    (Implements POSIX draft P1003.2/D11.2, except for some of the
@@ -5,7 +6,7 @@
    Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the 
-   GNU C Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+   GNU C Library.  Bugs can be reported to bug-glibc@gnu.org.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -19,7 +20,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software Foundation, 
-   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* AIX requires this to be the first thing in the file. */
 #if defined _AIX && !defined REGEX_MALLOC
@@ -57,7 +59,8 @@
 #endif
 
 /* This is for other GNU distributions with internationalized messages.  */
-#if HAVE_LIBINTL_H || defined _LIBC
+/* CYGNUS LOCAL: ../intl will handle this for us */
+#ifdef ENABLE_NLS
 # include <libintl.h>
 #else
 # define gettext(msgid) (msgid)
@@ -142,6 +145,11 @@ char *realloc ();
 /* How many characters in the character set.  */
 # define CHAR_SET_SIZE 256
 
+/* GDB LOCAL: define _REGEX_RE_COMP to get BSD style re_comp and re_exec */
+#ifndef _REGEX_RE_COMP
+#define _REGEX_RE_COMP
+#endif
+
 # ifdef SYNTAX_TABLE
 
 extern char *re_syntax_table;
@@ -1694,7 +1702,11 @@ typedef struct
        }                                                               \
     }
 
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+/* Use this only if they have btowc(), since wctype() is used below
+   together with btowc().  btowc() is defined in the 1994 Amendment 1
+   to ISO C and may not be present on systems where we have wchar.h
+   and wctype.h.  */
+#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_BTOWC)
 /* The GNU C library provides support for user-defined character classes
    and the functions from ISO C amendement 1.  */
 # ifdef CHARCLASS_NAME_MAX
@@ -2198,7 +2210,10 @@ regex_compile (pattern, size, syntax, bufp)
                        the leading `:' and `[' (but set bits for them).  */
                     if (c == ':' && *p == ']')
                       {
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+/* CYGNUS LOCAL: Skip this code if we don't have btowc().  btowc() is */
+/* defined in the 1994 Amendment 1 to ISO C and may not be present on */
+/* systems where we have wchar.h and wctype.h.   */
+#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_BTOWC)
                         boolean is_lower = STREQ (str, "lower");
                         boolean is_upper = STREQ (str, "upper");
                        wctype_t wt;
@@ -5489,12 +5504,12 @@ re_comp (s)
     {
       re_comp_buf.buffer = (unsigned char *) malloc (200);
       if (re_comp_buf.buffer == NULL)
-        return gettext (re_error_msgid[(int) REG_ESPACE]);
+        return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
       re_comp_buf.allocated = 200;
 
       re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
       if (re_comp_buf.fastmap == NULL)
-       return gettext (re_error_msgid[(int) REG_ESPACE]);
+       return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
     }
 
   /* Since `re_exec' always passes NULL for the `regs' argument, we
@@ -5715,7 +5730,7 @@ weak_alias (__regexec, regexec)
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-__regerror (errcode, preg, errbuf, errbuf_size)
+regerror (errcode, preg, errbuf, errbuf_size)
     int errcode;
     const regex_t *preg;
     char *errbuf;
This page took 0.024735 seconds and 4 git commands to generate.