]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
strsep() is not available on any platform, this add an own implementation.
authorserassio <>
Mon, 3 Jul 2006 01:27:17 +0000 (01:27 +0000)
committerserassio <>
Mon, 3 Jul 2006 01:27:17 +0000 (01:27 +0000)
configure.in
lib/Makefile.am
lib/strsep.c [new file with mode: 0755]

index 2a0b2287847e98a4c52e9e90cd14a9b39ceb2ee9..ef30180f8b20c9a7d45b53568d62ab348f007aa4 100644 (file)
@@ -1,7 +1,7 @@
 
 dnl  Configuration input file for Squid
 dnl
-dnl  $Id: configure.in,v 1.425 2006/07/02 16:53:46 serassio Exp $
+dnl  $Id: configure.in,v 1.426 2006/07/02 19:27:17 serassio Exp $
 dnl
 dnl
 dnl
@@ -11,7 +11,7 @@ AM_CONFIG_HEADER(include/autoconf.h)
 AC_CONFIG_AUX_DIR(cfgaux)
 AC_CONFIG_SRCDIR([src/main.cc])
 AM_INIT_AUTOMAKE([tar-ustar])
-AC_REVISION($Revision: 1.425 $)dnl
+AC_REVISION($Revision: 1.426 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -2512,6 +2512,7 @@ AC_CHECK_FUNCS(\
        srand48 \
        srandom \
        statfs \
+       strsep \
        sysconf \
        syslog \
        timegm \
@@ -2580,6 +2581,11 @@ if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; t
   AM_CONDITIONAL(NEED_OWN_SNPRINTF, true)
 fi
 
+AM_CONDITIONAL(NEED_OWN_STRSEP, false)
+if test "$ac_cv_func_strsep" = "no" ; then
+  AM_CONDITIONAL(NEED_OWN_STRSEP, true)
+fi
+
 dnl
 dnl Test for va_copy
 dnl
index 901fe024cc108fcf744e3d8bbb97acf4b491f2d7..672221f9472a98312528ff9322fb5b7a9e82f3bf 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 #
-#  $Id: Makefile.am,v 1.21 2006/05/27 00:58:15 hno Exp $
+#  $Id: Makefile.am,v 1.22 2006/07/02 19:27:17 serassio Exp $
 #
 
 DIST_SUBDIRS = libTrie cppunit-1.10.0
@@ -23,6 +23,11 @@ SNPRINTFSOURCE=snprintf.c
 else
 SNPRINTFSOURCE=
 endif
+if NEED_OWN_STRSEP
+STRSEPSOURCE=strsep.c
+else
+STRSEPSOURCE=
+endif
 if NEED_OWN_MD5
 MD5SOURCE=md5.c
 else
@@ -48,7 +53,8 @@ noinst_LIBRARIES = \
 EXTRA_libmiscutil_a_SOURCES = \
        md5.c \
        Profiler.c \
-       snprintf.c
+       snprintf.c \
+       strsep.c
 libmiscutil_a_SOURCES = \
        MemPool.cc \
        base64.c \
@@ -66,6 +72,7 @@ libmiscutil_a_SOURCES = \
        safe_inet_addr.c \
        $(SNPRINTFSOURCE) \
        Splay.cc \
+       $(STRSEPSOURCE) \
        stub_memaccount.c \
        util.c \
        uudecode.c \
diff --git a/lib/strsep.c b/lib/strsep.c
new file mode 100755 (executable)
index 0000000..62a475b
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * $Id: strsep.c,v 1.1 2006/07/02 19:27:17 serassio Exp $
+ */
+
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ * Written by Yoann Vandoorselaere <yoann@prelude-ids.org>
+ *
+ * The file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; 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
+
+/* Specification.  */
+#include "strsep.h"
+
+#include <string.h>
+
+char *
+strsep (char **stringp, const char *delim)
+{
+  char *start = *stringp;
+  char *ptr;
+
+  if (!start)
+    return NULL;
+
+  if (!*delim)
+    ptr = start + strlen (start);
+  else
+    {
+      ptr = strpbrk (start, delim);
+      if (!ptr)
+       {
+         *stringp = NULL;
+         return start;
+       }
+    }
+
+  *ptr = '\0';
+  *stringp = ptr + 1;
+
+  return start;
+}