diff options
author | 2009-01-27 10:30:30 +0000 | |
---|---|---|
committer | 2009-01-27 10:30:30 +0000 | |
commit | 4e8f63fdaa44e8d2b29a056caae105bcf15a0846 (patch) | |
tree | d30f6d9bcaf995d9055efdeef317fa5de7afe602 /gnulib | |
parent | update from gnulib (diff) | |
download | libvirt-4e8f63fdaa44e8d2b29a056caae105bcf15a0846.tar.gz libvirt-4e8f63fdaa44e8d2b29a056caae105bcf15a0846.tar.bz2 libvirt-4e8f63fdaa44e8d2b29a056caae105bcf15a0846.zip |
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.
Diffstat (limited to 'gnulib')
-rw-r--r-- | gnulib/lib/Makefile.am | 11 | ||||
-rw-r--r-- | gnulib/lib/stpcpy.c | 48 | ||||
-rw-r--r-- | gnulib/m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | gnulib/m4/gnulib-comp.m4 | 4 | ||||
-rw-r--r-- | gnulib/m4/stpcpy.m4 | 26 |
5 files changed, 90 insertions, 2 deletions
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am index 1e23d0985..62ded7b30 100644 --- a/gnulib/lib/Makefile.am +++ b/gnulib/lib/Makefile.am @@ -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 index 000000000..71b5091ed --- /dev/null +++ b/gnulib/lib/stpcpy.c @@ -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 diff --git a/gnulib/m4/gnulib-cache.m4 b/gnulib/m4/gnulib-cache.m4 index 74b213961..43106262e 100644 --- a/gnulib/m4/gnulib-cache.m4 +++ b/gnulib/m4/gnulib-cache.m4 @@ -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 diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4 index 80281c3c0..9589b9353 100644 --- a/gnulib/m4/gnulib-comp.m4 +++ b/gnulib/m4/gnulib-comp.m4 @@ -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 index 000000000..96de86795 --- /dev/null +++ b/gnulib/m4/stpcpy.m4 @@ -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], [ + : +]) |