diff -urN gnulib.orig/lib/strsep.c gnulib/lib/strsep.c
--- gnulib.orig/lib/strsep.c 1970-01-01 01:00:00.000000000 +0100
+++ gnulib/lib/strsep.c 2004-10-01 17:23:57.695582032 +0200
@@ -0,0 +1,52 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ * Written by Yoann Vandoorselaere
+ *
+ * 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
+#endif
+
+#include
+
+#include "strsep.h"
+
+char *
+strsep (char **stringp, const char *delim)
+{
+ char *ptr, *start = *stringp;
+
+ 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;
+}
diff -urN gnulib.orig/lib/strsep.h gnulib/lib/strsep.h
--- gnulib.orig/lib/strsep.h 1970-01-01 01:00:00.000000000 +0100
+++ gnulib/lib/strsep.h 2004-10-01 17:24:04.736511648 +0200
@@ -0,0 +1,30 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ * Written by Yoann Vandoorselaere
+ *
+ * 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_
+
+/*
+ * Get strsep, if available.
+ */
+#include
+
+extern char *strsep (char **stringp, const char *delim);
+
+#endif /* GNULIB_STRSEP_H_ */
diff -urN gnulib.orig/lib/vsnprintf.c gnulib/lib/vsnprintf.c
--- gnulib.orig/lib/vsnprintf.c 1970-01-01 01:00:00.000000000 +0100
+++ gnulib/lib/vsnprintf.c 2004-10-01 17:24:24.718473928 +0200
@@ -0,0 +1,62 @@
+/* Formatted output to strings.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Written by Yoann Vandoorselaere
+
+ 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. */
+
+#ifdef HAVE_CONFIG_H
+# include
+#endif
+
+/* Get specification. */
+#include "vsnprintf.h"
+
+/* Get vasnprintf. */
+#include "vasnprintf.h"
+
+/* Get MIN. */
+#include
+
+#include
+#include
+#include
+#include
+
+/* Print formatted output to string STR. Similar to vsprintf, but
+ additional length SIZE limit how much is written into STR. Returns
+ string length of formatted string (which may be larger than SIZE).
+ STR may be NULL, in which case nothing will be written. On error,
+ return a negative value. */
+int
+vsnprintf (char *str, size_t size, const char *format, va_list ap)
+{
+ char *out;
+ size_t len;
+
+ out = vasnprintf (NULL, &len, format, ap);
+
+ if (!out)
+ return -1;
+
+ if (str && size > 0)
+ {
+ memcpy (str, out, MIN (len + 1, size));
+ str[size - 1] = '\0';
+ }
+
+ free (out);
+
+ return len;
+}
diff -urN gnulib.orig/lib/vsnprintf.h gnulib/lib/vsnprintf.h
--- gnulib.orig/lib/vsnprintf.h 1970-01-01 01:00:00.000000000 +0100
+++ gnulib/lib/vsnprintf.h 2004-10-01 17:24:53.660074136 +0200
@@ -0,0 +1,29 @@
+/* Formatted output to strings.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Written by Yoann Vandoorselaere
+
+ 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 VSNPRINTF_H
+#define VSNPRINTF_H
+
+/* Get snprintf declaration, if available. */
+#include
+
+#if defined HAVE_DECL_VSNPRINTF && !HAVE_DECL_VSNPRINTF
+int vsnprintf(char *str, size_t size, const char *format, va_list ap);
+#endif
+
+#endif /* VSNPRINTF_H */
diff -urN gnulib.orig/m4/strsep.m4 gnulib/m4/strsep.m4
--- gnulib.orig/m4/strsep.m4 1970-01-01 01:00:00.000000000 +0100
+++ gnulib/m4/strsep.m4 2004-09-29 22:58:31.000000000 +0200
@@ -0,0 +1,17 @@
+# strdup.m4 serial 4
+dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_STRSEP],
+[
+ AC_REPLACE_FUNCS(strsep)
+ AC_CHECK_DECLS_ONCE(strsep)
+ gl_PREREQ_STRSEP
+])
+
+# Prerequisites of lib/strsep.c.
+AC_DEFUN([gl_PREREQ_STRSEP], [:])
diff -urN gnulib.orig/m4/vsnprintf.m4 gnulib/m4/vsnprintf.m4
--- gnulib.orig/m4/vsnprintf.m4 1970-01-01 01:00:00.000000000 +0100
+++ gnulib/m4/vsnprintf.m4 2004-10-01 01:37:16.000000000 +0200
@@ -0,0 +1,16 @@
+dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_VSNPRINTF],
+[
+ AC_REPLACE_FUNCS(vsnprintf)
+ AC_CHECK_DECLS_ONCE(vsnprintf)
+ gl_PREREQ_VSNPRINTF
+])
+
+# Prerequisites of lib/vsnprintf.c.
+AC_DEFUN([gl_PREREQ_VSNPRINTF], [:])
diff -urN gnulib.orig/modules/strsep gnulib/modules/strsep
--- gnulib.orig/modules/strsep 1970-01-01 01:00:00.000000000 +0100
+++ gnulib/modules/strsep 2004-09-29 22:52:05.000000000 +0200
@@ -0,0 +1,25 @@
+Description:
+strsep() function: extract token from string.
+
+Files:
+lib/strsep.h
+lib/strsep.c
+m4/strsep.m4
+
+Depends-on:
+strpbrk
+
+configure.ac:
+gl_FUNC_STRSEP
+
+Makefile.am:
+lib_SOURCES += strsep.h
+
+Include:
+"strsep.h"
+
+License:
+LGPL
+
+Maintainer:
+Yoann Vandoorselaere
diff -urN gnulib.orig/modules/vsnprintf gnulib/modules/vsnprintf
--- gnulib.orig/modules/vsnprintf 1970-01-01 01:00:00.000000000 +0100
+++ gnulib/modules/vsnprintf 2004-10-01 01:36:34.000000000 +0200
@@ -0,0 +1,26 @@
+Description:
+vsnprintf() function: format output of a stdarg argument list
+
+Files:
+lib/vsnprintf.h
+lib/vsnprintf.c
+m4/vsnprintf.m4
+
+Depends-on:
+vasnprintf
+minmax
+
+configure.ac:
+gl_FUNC_VSNPRINTF
+
+Makefile.am:
+lib_SOURCES += vsnprintf.h
+
+Include:
+"vsnprintf.h"
+
+License:
+LGPL
+
+Maintainer:
+Yoann Vandoorselaere