1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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.
This commit is contained in:
Jim Meyering 2009-01-27 10:30:30 +00:00
parent aa7c4102aa
commit 4e8f63fdaa
7 changed files with 101 additions and 2 deletions

View File

@ -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

View File

@ -85,6 +85,7 @@ random_r
send
setsockopt
socket
stpcpy
strndup
strerror
strsep

View 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

48
gnulib/lib/stpcpy.c Normal file
View File

@ -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

View 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

View 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

26
gnulib/m4/stpcpy.m4 Normal file
View File

@ -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], [
:
])