New module 'xstrndup'.
+2003-08-17 Simon Josefsson <jas@extundo.com>
+
+ * modules/xstrndup: New file.
+ * MODULES.html.sh (func_all_modules): Add xstrndup.
+
+2003-08-17 Bruno Haible <bruno@clisp.org>
+
+ * modules/strndup (Files, Include): Add lib/strndup.h.
+
2003-08-17 Bruno Haible <bruno@clisp.org>
* gnulib-tool (func_create_testdir): Handle gl_USE_SYSTEM_EXTENSIONS
func_module strnlen
func_module strndup
#func_module fstrcmp
+ func_module xstrndup
func_end_table
element="Numeric conversion functions <stdlib.h>"
+2003-08-17 Simon Josefsson <jas@extundo.com>
+ Bruno Haible <bruno@clisp.org>
+
+ * xstrndup.h: New file.
+ * xstrndup.c: New file.
+
+2003-08-17 Bruno Haible <bruno@clisp.org>
+
+ * strndup.h: New file.
+
2003-08-16 Paul Eggert <eggert@twinsun.com>
* regex.h, strdup.c, strtoll.c, strtoul.c: Do not normalize white
--- /dev/null
+/* Duplicate a size-bounded string.
+ Copyright (C) 2003 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. */
+
+#if HAVE_STRNDUP
+
+/* Get strndup() declaration. */
+#include <string.h>
+
+#else
+
+#include <stddef.h>
+
+/* Return a newly allocated copy of at most N bytes of STRING. */
+extern char *strndup (const char *string, size_t n);
+
+#endif
--- /dev/null
+/* Duplicate a bounded initial segment of a string, with out-of-memory
+ checking.
+ Copyright (C) 2003 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. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification. */
+#include "xstrndup.h"
+
+#include "strndup.h"
+#include "xalloc.h"
+
+/* Return a newly allocated copy of at most N bytes of STRING.
+ In other words, return a copy of the initial segment of length N of
+ STRING. */
+char *
+xstrndup (const char *string, size_t n)
+{
+ char *s = strndup (string, n);
+ if (! s)
+ xalloc_die ();
+ return s;
+}
--- /dev/null
+/* Duplicate a bounded initial segment of a string, with out-of-memory
+ checking.
+ Copyright (C) 2003 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. */
+
+#include <stddef.h>
+
+/* Return a newly allocated copy of at most N bytes of STRING.
+ In other words, return a copy of the initial segment of length N of
+ STRING. */
+extern char *xstrndup (const char *string, size_t n);
+2003-08-17 Simon Josefsson <jas@extundo.com>
+
+ * xstrndup.m4: New file.
+
2003-08-16 Jim Meyering <jim@meyering.net>
* utimes.m4 (gl_FUNC_UTIMES): New file.
--- /dev/null
+# xstrndup.m4 serial 1
+dnl Copyright (C) 2003 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_XSTRNDUP],
+[
+ gl_PREREQ_XSTRNDUP
+])
+
+# Prerequisites of lib/xstrndup.c.
+AC_DEFUN([gl_PREREQ_XSTRNDUP], [
+ :
+])
strndup() function: duplicate a size-bounded string.
Files:
+lib/strndup.h
lib/strndup.c
m4/strndup.m4
Makefile.am:
Include:
+"strndup.h"
Maintainer:
glibc
--- /dev/null
+Description:
+Duplicate a bounded initial segment of a string, with out-of-memory checking.
+
+Files:
+lib/xstrndup.h
+lib/xstrndup.c
+m4/xstrndup.m4
+
+Depends-on:
+strndup
+xalloc
+
+configure.ac:
+gl_XSTRNDUP
+
+Makefile.am:
+lib_SOURCES += xstrndup.h xstrndup.c
+
+Include:
+"xstrndup.h"
+
+Maintainer:
+Simon Josefsson
+