]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Support the strpbrk function in lib/.
authorBruno Haible <bruno@clisp.org>
Sat, 15 Sep 2001 00:19:25 +0000 (00:19 +0000)
committerBruno Haible <bruno@clisp.org>
Sat, 15 Sep 2001 00:19:25 +0000 (00:19 +0000)
ChangeLog
configure.in
lib/ChangeLog
lib/Makefile.am
lib/strpbrk.c [new file with mode: 0644]
lib/strpbrk.h [new file with mode: 0644]

index 25c92803d57a860dc45cbae2aa2b35759b99783e..dc917865948290320407024782fbde7fa12f4abd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-06  Bruno Haible  <haible@clisp.cons.org>
+
+       * configure.in: Add AC_REPLACE_FUNCS of strpbrk.
+
 2001-09-06  Bruno Haible  <haible@clisp.cons.org>
 
        * configure.in: Call gt_FUNC_SETENV.
index fa50a4b1495c256d480a91e2b5e3bdd159006e72..f1437028df23996bf252f412a1f38bb63ca7d472 100644 (file)
@@ -51,7 +51,7 @@ AC_FUNC_ALLOCA
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([getcwd mblen memcpy posix_spawn select strchr strerror uname])
 AC_REPLACE_FUNCS([memmove memset stpcpy stpncpy strcspn \
-strcasecmp strncasecmp strstr strtoul vasprintf])
+strcasecmp strncasecmp strpbrk strstr strtoul vasprintf])
 AM_FUNC_GETLINE
 if test $am_cv_func_working_getline != yes; then
   AC_CHECK_FUNCS(getdelim)
index 584f0546f1c10c7e3e8880cf9242c4bc1ad569e6..b61da9fd7e89ff5efac093baaf67ae29e25f90a7 100644 (file)
@@ -1,3 +1,10 @@
+2001-09-06  Bruno Haible  <haible@clisp.cons.org>
+
+       * strpbrk.h: New file.
+       * strpbrk.c: New file, from glibc-2.2.4.
+       * Makefile.am (EXTRA_DIST): Add strpbrk.c.
+       (noinst_HEADERS): Add strpbrk.h.
+
 2001-09-13  Bruno Haible  <haible@clisp.cons.org>
 
        * alloca.c (alloca): Replace 'REGISTER' with 'register'.
index 4902fc9d49291db172b946c6f4008fb9ce8c8fae..d0fea8797fffbe77810dae1f1f42ab9020d57c78 100644 (file)
@@ -23,7 +23,7 @@ noinst_LIBRARIES = libnlsut.a
 
 EXTRA_DIST = alloca.c config.charset error.c getline.c memset.c memmove.c \
 mkdtemp.c ref-add.sin ref-del.sin setenv.c stpcpy.c stpncpy.c strcasecmp.c \
-strcspn.c strncasecmp.c strstr.c strtol.c strtoul.c vasprintf.c \
+strcspn.c strncasecmp.c strpbrk.c strstr.c strtol.c strtoul.c vasprintf.c \
 stdbool.h.in \
 gen-lbrkprop.c 3level.h
 
@@ -37,8 +37,8 @@ libnlsut_a_LIBADD = @ALLOCA@ @LIBOBJS@
 
 noinst_HEADERS = c-ctype.h error.h execute.h findprog.h fstrcmp.h \
 full-write.h gcd.h getline.h getopt.h hash.h lbrkprop.h linebreak.h mbswidth.h \
-mkdtemp.h obstack.h pathmax.h pipe.h progname.h safe-read.h setenv.h system.h \
-tmpdir.h utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h
+mkdtemp.h obstack.h pathmax.h pipe.h progname.h safe-read.h setenv.h strpbrk.h \
+system.h tmpdir.h utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h
 
 DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@
 INCLUDES = -I. -I$(srcdir) -I.. -I../intl
diff --git a/lib/strpbrk.c b/lib/strpbrk.c
new file mode 100644 (file)
index 0000000..a49d2b1
--- /dev/null
@@ -0,0 +1,45 @@
+/* Copyright (C) 1991, 1994, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined _LIBC || defined HAVE_CONFIG_H
+# include <string.h>
+#endif
+
+#undef strpbrk
+
+/* Find the first occurrence in S of any character in ACCEPT.  */
+char *
+strpbrk (s, accept)
+     const char *s;
+     const char *accept;
+{
+  while (*s != '\0')
+    {
+      const char *a = accept;
+      while (*a != '\0')
+       if (*a++ == *s)
+         return (char *) s;
+      ++s;
+    }
+
+  return NULL;
+}
diff --git a/lib/strpbrk.h b/lib/strpbrk.h
new file mode 100644 (file)
index 0000000..bc01c3d
--- /dev/null
@@ -0,0 +1,36 @@
+/* Searching in a string.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+
+   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 Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   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.  */
+
+#ifndef PARAMS
+# if defined (__GNUC__) || __STDC__
+#  define PARAMS(Args) Args
+# else
+#  define PARAMS(Args) ()
+# endif
+#endif
+
+#if HAVE_STRPBRK
+
+/* Get strpbrk() declaration.  */
+#include <string.h>
+
+#else
+
+/* Find the first occurrence in S of any character in ACCEPT.  */
+extern char *strpbrk PARAMS ((const char *s, const char *accept));
+
+#endif