summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xConfigure64
-rw-r--r--Cross/config.sh-arm-linux1
-rw-r--r--NetWare/config.wc1
-rw-r--r--Porting/Glossary6
-rw-r--r--configure.com1
-rw-r--r--epoc/config.sh1
-rw-r--r--symbian/config.sh1
-rwxr-xr-xuconfig.sh1
-rw-r--r--win32/config.bc1
-rw-r--r--win32/config.gc1
-rw-r--r--win32/config.vc1
-rw-r--r--win32/config.vc641
-rw-r--r--wince/config.ce1
13 files changed, 81 insertions, 0 deletions
diff --git a/Configure b/Configure
index b282a16a10..72028b561c 100755
--- a/Configure
+++ b/Configure
@@ -775,6 +775,7 @@ d_voidsig=''
signal_t=''
d_volatile=''
d_charvspr=''
+d_sprintf_returns_strlen=''
d_vprintf=''
d_wait4=''
d_waitpid=''
@@ -14185,6 +14186,68 @@ EOCP
esac
+: see if sprintf returns the length of the string in the buffer as per ANSI
+$echo "Checking whether sprintf returns the length of the string..." >&4
+$cat <<EOP >try.c
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#$i_string I_STRING
+#ifdef I_STRING
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+#$i_math I_MATH
+#ifdef I_MATH
+#include <math.h>
+#endif
+
+char buffer[256];
+
+int check (size_t expect, int test) {
+ size_t got = strlen(buffer);
+ if (expect == got)
+ return 0;
+
+ printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
+ test, buffer);
+ exit (test);
+}
+
+int main(int argc, char **argv) {
+ int test = 0;
+
+ check(sprintf(buffer, ""), ++test);
+ check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
+ check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
+
+ return 0;
+}
+EOP
+set try
+
+d_sprintf_returns_strlen="$undef"
+if eval $compile; then
+ xxx="`$run ./try`"
+ case "$?" in
+ 0) cat >&4 <<EOM
+sprintf returns the length of the string (as ANSI says it should)
+EOM
+ d_sprintf_returns_strlen="$define"
+ ;;
+ *) cat >&4 <<EOM
+sprintf does not return the length of the string (how old is this system?)
+EOM
+ d_sprintf_returns_strlen="$undef"
+ ;;
+ esac
+fi
+
+$rm -f try.* try
+
: see if link exists
set link d_link
eval $inlibc
@@ -21347,6 +21410,7 @@ d_void_closedir='$d_void_closedir'
d_voidsig='$d_voidsig'
d_voidtty='$d_voidtty'
d_volatile='$d_volatile'
+d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
d_vprintf='$d_vprintf'
d_wait4='$d_wait4'
d_waitpid='$d_waitpid'
diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux
index 94accb7f47..785102285d 100644
--- a/Cross/config.sh-arm-linux
+++ b/Cross/config.sh-arm-linux
@@ -419,6 +419,7 @@ d_socket='define'
d_socklen_t='define'
d_sockpair='define'
d_socks5_init='undef'
+d_sprintf_returns_strlen='define'
d_sqrtl='define'
d_srand48_r='undef'
d_srandom_r='undef'
diff --git a/NetWare/config.wc b/NetWare/config.wc
index 77fe849648..b995b304e5 100644
--- a/NetWare/config.wc
+++ b/NetWare/config.wc
@@ -384,6 +384,7 @@ d_sigsetjmp='undef'
d_socket='define'
d_socklen_t='undef'
d_sockpair='undef'
+d_sprintf_returns_strlen='undef'
d_sqrtl='undef'
d_srand48_r='undef'
d_srandom_r='undef'
diff --git a/Porting/Glossary b/Porting/Glossary
index 12c720725d..96911432bc 100644
--- a/Porting/Glossary
+++ b/Porting/Glossary
@@ -1914,6 +1914,12 @@ d_socks5_init (d_socks5_init.U):
This variable conditionally defines the HAS_SOCKS5_INIT symbol, which
indicates to the C program that the socks5_init() routine is available.
+d_sprintf_returns_strlen (d_sprintf_returns_strlen.U):
+ This variable defines whether sprintf returns the length of the string
+ (as per the ANSI spec). Some C libraries retain compatibility with
+ pre-ANSI C and return a pointer to the passed in buffer; for these
+ this variable will be undef.
+
d_sqrtl (d_sqrtl.U):
This variable conditionally defines the HAS_SQRTL symbol, which
indicates to the C program that the sqrtl() routine is available.
diff --git a/configure.com b/configure.com
index f415c8e0f0..f9a8469b26 100644
--- a/configure.com
+++ b/configure.com
@@ -5906,6 +5906,7 @@ $ WC "d_socket='" + d_socket + "'"
$ WC "d_socklen_t='" + d_socklen_t + "'"
$ WC "d_sockpair='" + d_sockpair + "'"
$ WC "d_socks5_init='undef'"
+$ WC "d_sprintf_returns_strlen='undef'"
$ WC "d_sqrtl='define'"
$ WC "d_sresgproto='undef'"
$ WC "d_sresgproto='undef'"
diff --git a/epoc/config.sh b/epoc/config.sh
index 489da5b086..dfbf8b7ccf 100644
--- a/epoc/config.sh
+++ b/epoc/config.sh
@@ -926,6 +926,7 @@ u64size='8'
d_fs_data_s='undef'
d_fseeko='undef'
d_ldbl_dig='undef'
+d_sprintf_returns_strlen='undef'
d_sqrtl='undef'
d_getmnt='undef'
d_statfs_f_flags='undef'
diff --git a/symbian/config.sh b/symbian/config.sh
index 313bc40715..0d129892b6 100644
--- a/symbian/config.sh
+++ b/symbian/config.sh
@@ -364,6 +364,7 @@ d_socket='define'
d_socklen_t='undef'
d_sockpair='undef'
d_socks5_init='undef'
+d_sprintf_returns_strlen='define'
d_sqrtl='undef'
d_srand48_r='undef'
d_srandom_r='undef'
diff --git a/uconfig.sh b/uconfig.sh
index 4ce7ec7da8..733f06f093 100755
--- a/uconfig.sh
+++ b/uconfig.sh
@@ -352,6 +352,7 @@ d_socket='undef'
d_socklen_t='undef'
d_sockpair='undef'
d_socks5_init='undef'
+d_sprintf_returns_strlen='undef'
d_sqrtl='undef'
d_srand48_r='undef'
d_srandom_r='undef'
diff --git a/win32/config.bc b/win32/config.bc
index 8e5133312f..549bedc80e 100644
--- a/win32/config.bc
+++ b/win32/config.bc
@@ -411,6 +411,7 @@ d_socket='define'
d_socklen_t='undef'
d_sockpair='undef'
d_socks5_init='undef'
+d_sprintf_returns_strlen='define'
d_sqrtl='undef'
d_srand48_r='undef'
d_srandom_r='undef'
diff --git a/win32/config.gc b/win32/config.gc
index f054ba541c..368901cb07 100644
--- a/win32/config.gc
+++ b/win32/config.gc
@@ -411,6 +411,7 @@ d_socket='define'
d_socklen_t='undef'
d_sockpair='undef'
d_socks5_init='undef'
+d_sprintf_returns_strlen='define'
d_sqrtl='undef'
d_srand48_r='undef'
d_srandom_r='undef'
diff --git a/win32/config.vc b/win32/config.vc
index c744b264a5..40b38159be 100644
--- a/win32/config.vc
+++ b/win32/config.vc
@@ -411,6 +411,7 @@ d_socket='define'
d_socklen_t='undef'
d_sockpair='undef'
d_socks5_init='undef'
+d_sprintf_returns_strlen='define'
d_sqrtl='undef'
d_srand48_r='undef'
d_srandom_r='undef'
diff --git a/win32/config.vc64 b/win32/config.vc64
index 2dd40fa05d..43cef8a6da 100644
--- a/win32/config.vc64
+++ b/win32/config.vc64
@@ -411,6 +411,7 @@ d_socket='define'
d_socklen_t='undef'
d_sockpair='undef'
d_socks5_init='undef'
+d_sprintf_returns_strlen='define'
d_sqrtl='undef'
d_srand48_r='undef'
d_srandom_r='undef'
diff --git a/wince/config.ce b/wince/config.ce
index a20841db24..5708091c6f 100644
--- a/wince/config.ce
+++ b/wince/config.ce
@@ -381,6 +381,7 @@ d_sigsetjmp='undef'
d_socket='define'
d_socklen_t='undef'
d_sockpair='undef'
+d_sprintf_returns_strlen='undef'
d_sqrtl='undef'
d_srand48_r='undef'
d_srandom_r='undef'