summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.in2
-rw-r--r--lib/ChangeLog7
-rw-r--r--lib/Makefile.am6
-rw-r--r--lib/strpbrk.c45
-rw-r--r--lib/strpbrk.h36
6 files changed, 96 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 25c9280..dc91786 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
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.
2001-09-02 Bruno Haible <haible@clisp.cons.org>
diff --git a/configure.in b/configure.in
index fa50a4b..f143702 100644
--- a/configure.in
+++ b/configure.in
@@ -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)
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 584f054..b61da9f 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -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'.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 4902fc9..d0fea87 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -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
index 0000000..a49d2b1
--- /dev/null
+++ b/lib/strpbrk.c
@@ -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
index 0000000..bc01c3d
--- /dev/null
+++ b/lib/strpbrk.h
@@ -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