]> 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:54:55 +0000 (01:54 +0000)
committerserassio <>
Mon, 3 Jul 2006 01:54:55 +0000 (01:54 +0000)
include/strsep.h [new file with mode: 0755]
src/squid.h

diff --git a/include/strsep.h b/include/strsep.h
new file mode 100755 (executable)
index 0000000..5b5383f
--- /dev/null
@@ -0,0 +1,53 @@
+/* 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.
+ */
+
+#ifndef GNULIB_STRSEP_H_
+#define GNULIB_STRSEP_H_
+
+#if HAVE_STRSEP
+
+/*
+ * Get strsep() declaration.
+ */
+#include <string.h>
+
+#else
+
+/* Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
+   If one is found, it is overwritten with a NUL, and *STRINGP is advanced
+   to point to the next char after it.  Otherwise, *STRINGP is set to NULL.
+   If *STRINGP was already NULL, nothing happens.
+   Returns the old value of *STRINGP.
+
+   This is a variant of strtok() that is multithread-safe and supports
+   empty fields.
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+           characters are ASCII characters < 0x30.
+
+   See also strtok_r().  */
+
+extern char *strsep (char **stringp, const char *delim);
+
+#endif
+
+#endif /* GNULIB_STRSEP_H_ */
index f2c9513a1086943fb69cb0588647e0e3d47add44..15169ff647765593dc11299a8efafb6a96264bcb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.254 2006/05/26 23:35:44 hno Exp $
+ * $Id: squid.h,v 1.255 2006/07/02 19:58:34 serassio Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -367,6 +367,10 @@ extern "C"
 #include "snprintf.h"
 #endif
 
+#if !HAVE_STRSEP
+#include "strsep.h"
+#endif
+
 #if !HAVE_INITGROUPS
 #include "initgroups.h"
 #endif