In perl.git, the branch snprintf_l has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/2b4607da0a8ee155486b52f3a14e16a484b912f7?hp=a57586d6228158c6d8c1c750b6fa9eebfd7a76e1>

- Log -----------------------------------------------------------------
commit 2b4607da0a8ee155486b52f3a14e16a484b912f7
Author: Karl Williamson <[email protected]>
Date:   Tue Nov 14 10:29:27 2017 -0700

    f

-----------------------------------------------------------------------

Summary of changes:
 Configure | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 79 insertions(+), 2 deletions(-)

diff --git a/Configure b/Configure
index c478f407d5..d80bb8276c 100755
--- a/Configure
+++ b/Configure
@@ -807,6 +807,8 @@ d_signbit=''
 d_sigprocmask=''
 d_sigsetjmp=''
 usesitecustomize=''
+d_snprintf=''
+d_vsnprintf=''
 d_snprintf_l=''
 d_vsnprintf_l=''
 d_sockatmark=''
@@ -18333,8 +18335,72 @@ set d_sigsetjmp
 eval $setvar
 $rm_try
 
-: see if snprintf_l exists.  We assume that if present it works properly,
-: since we should have tested plain 'snprintf' for proper function
+: see if snprintf exists
+set snprintf d_snprintf
+eval $inlibc
+
+: see if vsnprintf exists
+set vsnprintf d_vsnprintf
+eval $inlibc
+
+case "$d_snprintf-$d_vsnprintf" in
+"$define-$define")
+    $cat <<EOM
+Checking whether your snprintf() and vsnprintf() work okay...
+EOM
+    $cat >try.c <<'EOCP'
+/* v?snprintf testing logic courtesy of Russ Allbery.
+ * According to C99:
+ * - if the buffer is too short it still must be \0-terminated
+ * - if the buffer is too short the potentially required length
+ *   must be returned and not -1
+ * - if the buffer is NULL the potentially required length
+ *   must be returned and not -1 or core dump
+ */
+#include <stdio.h>
+#include <stdarg.h>
+
+char buf[2];
+
+int test (char *format, ...)
+{
+    va_list args;
+    int count;
+
+    va_start (args, format);
+    count = vsnprintf (buf, sizeof buf, format, args);
+    va_end (args);
+    return count;
+}
+
+int main ()
+{
+    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
+             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
+}
+EOCP
+    set try
+    if eval $compile; then
+       `$run ./try`
+       case "$?" in
+       0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
+       *) cat <<EOM >&4
+Your snprintf() and snprintf() don't seem to be working okay.
+EOM
+          d_snprintf="$undef"
+          d_vsnprintf="$undef"
+          ;;
+       esac
+    else
+       echo "(I can't seem to compile the test program--assuming they don't)"
+       d_snprintf="$undef"
+       d_vsnprintf="$undef"
+    fi
+    $rm_try
+    ;;
+esac
+
+: see if snprintf_l exists
 set snprintf_l d_snprintf_l
 eval $inlibc
 
@@ -18342,6 +18408,15 @@ eval $inlibc
 set vsnprintf_l d_vsnprintf_l
 eval $inlibc
 
+case "$d_snprintf-$d_vsnprintf-$d_snprintf_l-$d_vsnprintf_l" in
+"$define-$define-$define-$define")
+    ;;
+*) echo "(These require the basic snprintf and vsnprintf to also be available, 
which they aren't"
+       d_snprintf_l="$undef"
+       d_vsnprintf_l="$undef"
+    ;;
+esac
+
 : see if sockatmark exists
 set sockatmark d_sockatmark
 eval $inlibc
@@ -24144,6 +24219,7 @@ d_sigprocmask='$d_sigprocmask'
 d_sigsetjmp='$d_sigsetjmp'
 d_sin6_scope_id='$d_sin6_scope_id'
 d_sitearch='$d_sitearch'
+d_snprintf='$d_snprintf'
 d_snprintf_l='$d_snprintf_l'
 d_sockaddr_in6='$d_sockaddr_in6'
 d_sockaddr_sa_len='$d_sockaddr_sa_len'
@@ -24234,6 +24310,7 @@ d_vfork='$d_vfork'
 d_void_closedir='$d_void_closedir'
 d_voidsig='$d_voidsig'
 d_voidtty='$d_voidtty'
+d_vsnprintf='$d_vsnprintf'
 d_vsnprintf_l='$d_vsnprintf_l'
 d_wait4='$d_wait4'
 d_waitpid='$d_waitpid'

-- 
Perl5 Master Repository

Reply via email to