]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
use gnulib's stpcpy module
authorJim Meyering <meyering@redhat.com>
Tue, 27 Jan 2009 10:30:30 +0000 (10:30 +0000)
committerJim Meyering <meyering@redhat.com>
Tue, 27 Jan 2009 10:30:30 +0000 (10:30 +0000)
* bootstrap (modules): Add stpcpy, and pull in gnulib bits:
* gnulib/lib/stpcpy.c: New file.
* gnulib/m4/stpcpy.m4: New file.
* gnulib/lib/Makefile.am: Update.
* gnulib/m4/gnulib-cache.m4: Update.
* gnulib/m4/gnulib-comp.m4: Update.

ChangeLog
bootstrap
gnulib/lib/Makefile.am
gnulib/lib/stpcpy.c [new file with mode: 0644]
gnulib/m4/gnulib-cache.m4
gnulib/m4/gnulib-comp.m4
gnulib/m4/stpcpy.m4 [new file with mode: 0644]

index 15facf3848cd8e1ea159b5a781beec553e3bf9fb..68e27dd625eede5201950db80a7b9a319d0961be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Jan 27 10:38:09 +0100 2009 Jim Meyering <meyering@redhat.com>
+
+       use gnulib's stpcpy module
+       * bootstrap (modules): Add stpcpy, and pull in gnulib bits:
+       * gnulib/lib/stpcpy.c: New file.
+       * gnulib/m4/stpcpy.m4: New file.
+       * gnulib/lib/Makefile.am: Update.
+       * gnulib/m4/gnulib-cache.m4: Update.
+       * gnulib/m4/gnulib-comp.m4: Update.
+
 Tue Jan 27 10:38:09 +0100 2009 Jim Meyering <meyering@redhat.com>
 
        update from gnulib
index b4eed3ec393292f2619e3c7c15db5196ab0b5714..baf52e7dfdcfb807d779d73301c31fa8438a026f 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -85,6 +85,7 @@ random_r
 send
 setsockopt
 socket
+stpcpy
 strndup
 strerror
 strsep
index 1e23d0985817b418d9632b68c5820abd886aa496..62ded7b300cd20f618451ca50f810a0511910489 100644 (file)
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl --no-vc-files c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton ioctl mkstemp mktempd perror physmem poll posix-shell random_r recv send setsockopt socket strerror strndup strsep sys_stat time_r useless-if-before-free vasprintf vc-list-files verify
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl --no-vc-files c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton ioctl mkstemp mktempd perror physmem poll posix-shell random_r recv send setsockopt socket stpcpy strerror strndup strsep sys_stat time_r useless-if-before-free vasprintf vc-list-files verify
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
@@ -733,6 +733,15 @@ EXTRA_DIST += stdlib.in.h
 
 ## end   gnulib module stdlib
 
+## begin gnulib module stpcpy
+
+
+EXTRA_DIST += stpcpy.c
+
+EXTRA_libgnu_la_SOURCES += stpcpy.c
+
+## end   gnulib module stpcpy
+
 ## begin gnulib module strdup-posix
 
 
diff --git a/gnulib/lib/stpcpy.c b/gnulib/lib/stpcpy.c
new file mode 100644 (file)
index 0000000..71b5091
--- /dev/null
@@ -0,0 +1,48 @@
+/* stpcpy.c -- copy a string and return pointer to end of new string
+   Copyright (C) 1992, 1995, 1997-1998, 2006 Free Software Foundation, Inc.
+
+   NOTE: The canonical source of this file is maintained with the GNU C Library.
+   Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+   This program 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 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <string.h>
+
+#undef __stpcpy
+#ifdef _LIBC
+# undef stpcpy
+#endif
+
+#ifndef weak_alias
+# define __stpcpy stpcpy
+#endif
+
+/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
+char *
+__stpcpy (char *dest, const char *src)
+{
+  register char *d = dest;
+  register const char *s = src;
+
+  do
+    *d++ = *s;
+  while (*s++ != '\0');
+
+  return d - 1;
+}
+#ifdef weak_alias
+weak_alias (__stpcpy, stpcpy)
+#endif
index 74b2139610c7118513f45535adafd18b4174374b..43106262ebcaa9458440de54b853be59c2c06e2c 100644 (file)
@@ -15,7 +15,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl --no-vc-files c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton ioctl mkstemp mktempd perror physmem poll posix-shell random_r recv send setsockopt socket strerror strndup strsep sys_stat time_r useless-if-before-free vasprintf vc-list-files verify
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl --no-vc-files c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton ioctl mkstemp mktempd perror physmem poll posix-shell random_r recv send setsockopt socket stpcpy strerror strndup strsep sys_stat time_r useless-if-before-free vasprintf vc-list-files verify
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -40,6 +40,7 @@ gl_MODULES([
   send
   setsockopt
   socket
+  stpcpy
   strerror
   strndup
   strsep
index 80281c3c0759bab716c22482209607d23c975e0d..9589b935312773ba8d4b8dffb7c3a5797a2c398d 100644 (file)
@@ -138,6 +138,8 @@ AC_SUBST([LTALLOCA])
   gl_STDINT_H
   gl_STDIO_H
   gl_STDLIB_H
+  gl_FUNC_STPCPY
+  gl_STRING_MODULE_INDICATOR([stpcpy])
   gl_FUNC_STRDUP_POSIX
   gl_STRING_MODULE_INDICATOR([strdup])
   gl_FUNC_STRERROR
@@ -385,6 +387,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/stdio-write.c
   lib/stdio.in.h
   lib/stdlib.in.h
+  lib/stpcpy.c
   lib/strdup.c
   lib/strerror.c
   lib/string.in.h
@@ -477,6 +480,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/stdint_h.m4
   m4/stdio_h.m4
   m4/stdlib_h.m4
+  m4/stpcpy.m4
   m4/strdup.m4
   m4/strerror.m4
   m4/string_h.m4
diff --git a/gnulib/m4/stpcpy.m4 b/gnulib/m4/stpcpy.m4
new file mode 100644 (file)
index 0000000..96de867
--- /dev/null
@@ -0,0 +1,26 @@
+# stpcpy.m4 serial 7
+dnl Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_STPCPY],
+[
+  dnl Persuade glibc <string.h> to declare stpcpy().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'.
+  AC_REQUIRE([AC_C_RESTRICT])
+
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+  AC_REPLACE_FUNCS([stpcpy])
+  if test $ac_cv_func_stpcpy = no; then
+    HAVE_STPCPY=0
+    gl_PREREQ_STPCPY
+  fi
+])
+
+# Prerequisites of lib/stpcpy.c.
+AC_DEFUN([gl_PREREQ_STPCPY], [
+  :
+])