From: Paul Smith Date: Mon, 4 Jul 2022 22:10:08 +0000 (-0400) Subject: * configure.ac: Check for stpcpy() support. X-Git-Tag: 4.3.90~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e33af0fb4a2ac8c3bb3220e892a013bb53c286fc;p=thirdparty%2Fmake.git * configure.ac: Check for stpcpy() support. * src/misc.c (stpcpy): Define it if not provided. --- diff --git a/configure.ac b/configure.ac index e0b7d060..b2c45d97 100644 --- a/configure.ac +++ b/configure.ac @@ -133,8 +133,8 @@ AS_IF([test "$ac_cv_func_gettimeofday" = yes], [Define to 1 if you have a standard gettimeofday function]) ]) -AC_CHECK_FUNCS([strtoll strdup strndup memrchr mempcpy umask mkstemp mktemp \ - fdopen dup dup2 getcwd realpath sigsetmask sigaction \ +AC_CHECK_FUNCS([strtoll strdup strndup stpcpy memrchr mempcpy umask mkstemp \ + mktemp fdopen dup dup2 getcwd realpath sigsetmask sigaction \ getgroups seteuid setegid setlinebuf setreuid setregid \ getrlimit setrlimit setvbuf pipe strerror strsignal \ lstat readlink atexit isatty ttyname pselect posix_spawn \ diff --git a/src/misc.c b/src/misc.c index eed1693b..0e889647 100644 --- a/src/misc.c +++ b/src/misc.c @@ -636,6 +636,21 @@ mempcpy (void *dest, const void *src, size_t n) } #endif +#if !HAVE_STPCPY +char * +stpcpy (char *dest, const char *src) +{ + char *d = dest; + const char *s = src; + + do + *d++ = *s; + while (*s++ != '\0'); + + return d - 1; +} +#endif + #if !HAVE_STRTOLL # undef UNSIGNED # undef USE_NUMBER_GROUPING