]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* configure.ac: Check for stpcpy() support.
authorPaul Smith <psmith@gnu.org>
Mon, 4 Jul 2022 22:10:08 +0000 (18:10 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 9 Jul 2022 14:47:13 +0000 (10:47 -0400)
* src/misc.c (stpcpy): Define it if not provided.

configure.ac
src/misc.c

index e0b7d060f233f27dd9cc879294e9ab616bfee51c..b2c45d97805afe2ca49e957fdb7dcff50128e53d 100644 (file)
@@ -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 \
index eed1693b022f71a80ab2eb5c25ed35fe1ca3fe6d..0e88964784953a1798907c21e68513a21ee2e327 100644 (file)
@@ -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