gnulib: add module stpcpy
* lib/stpcpy.c, m4/stpcpy.m4: New files. * lib/Makefile.am, m4/gnulib-cache.m4, m4/gnulib-comp.m4: Update.
This commit is contained in:
parent
5b0bf8ef09
commit
ab3a4f54c2
5 changed files with 95 additions and 2 deletions
|
|
@ -21,7 +21,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=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files argmatch argp error gethrxtime isatty mkstemp progname sys_wait
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files argmatch argp error gethrxtime isatty mkstemp progname stpcpy sys_wait
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.9.6 gnits
|
||||
|
||||
|
|
@ -1043,6 +1043,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 strcase
|
||||
|
||||
|
||||
|
|
|
|||
49
lib/stpcpy.c
Normal file
49
lib/stpcpy.c
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/* stpcpy.c -- copy a string and return pointer to end of new string
|
||||
Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2013 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 General Public License as published by the
|
||||
Free Software Foundation; either version 3 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU 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
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files argmatch argp error gethrxtime isatty mkstemp progname sys_wait
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files argmatch argp error gethrxtime isatty mkstemp progname stpcpy sys_wait
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
|
|
@ -39,6 +39,7 @@ gl_MODULES([
|
|||
isatty
|
||||
mkstemp
|
||||
progname
|
||||
stpcpy
|
||||
sys_wait
|
||||
])
|
||||
gl_AVOID([])
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module stdint:
|
||||
# Code from module stdio:
|
||||
# Code from module stdlib:
|
||||
# Code from module stpcpy:
|
||||
# Code from module strcase:
|
||||
# Code from module strchrnul:
|
||||
# Code from module streq:
|
||||
|
|
@ -307,6 +308,12 @@ AC_SUBST([LTALLOCA])
|
|||
gl_STDINT_H
|
||||
gl_STDIO_H
|
||||
gl_STDLIB_H
|
||||
gl_FUNC_STPCPY
|
||||
if test $HAVE_STPCPY = 0; then
|
||||
AC_LIBOBJ([stpcpy])
|
||||
gl_PREREQ_STPCPY
|
||||
fi
|
||||
gl_STRING_MODULE_INDICATOR([stpcpy])
|
||||
gl_STRCASE
|
||||
if test $HAVE_STRCASECMP = 0; then
|
||||
AC_LIBOBJ([strcasecmp])
|
||||
|
|
@ -595,6 +602,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/stdint.in.h
|
||||
lib/stdio.in.h
|
||||
lib/stdlib.in.h
|
||||
lib/stpcpy.c
|
||||
lib/strcasecmp.c
|
||||
lib/strchrnul.c
|
||||
lib/strchrnul.valgrind
|
||||
|
|
@ -699,6 +707,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/stdint_h.m4
|
||||
m4/stdio_h.m4
|
||||
m4/stdlib_h.m4
|
||||
m4/stpcpy.m4
|
||||
m4/strcase.m4
|
||||
m4/strchrnul.m4
|
||||
m4/strerror.m4
|
||||
|
|
|
|||
25
m4/stpcpy.m4
Normal file
25
m4/stpcpy.m4
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# stpcpy.m4 serial 8
|
||||
dnl Copyright (C) 2002, 2007, 2009-2013 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_CHECK_FUNCS([stpcpy])
|
||||
if test $ac_cv_func_stpcpy = no; then
|
||||
HAVE_STPCPY=0
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/stpcpy.c.
|
||||
AC_DEFUN([gl_PREREQ_STPCPY], [
|
||||
:
|
||||
])
|
||||
Loading…
Add table
Add a link
Reference in a new issue