summaryrefslogtreecommitdiff
path: root/source4/lib/replace/config.m4
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-09-04 16:30:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:17:08 -0500
commit62e60274131ae4968560bbd58fb847cb9f9e8f9f (patch)
treec95e21b6966dc42f64cc1e624ddb4a4529796f67 /source4/lib/replace/config.m4
parentc13ea9b3a6601406d29c5970734891fbc7eccaac (diff)
downloadsamba-62e60274131ae4968560bbd58fb847cb9f9e8f9f.tar.gz
samba-62e60274131ae4968560bbd58fb847cb9f9e8f9f.tar.bz2
samba-62e60274131ae4968560bbd58fb847cb9f9e8f9f.zip
r18046: Add 'z' specifier support and a configure test.
Jeremy should I backport this to samba3 too? (This used to be commit dc689b5579987da8ee5397b9758a42b01e44fb73)
Diffstat (limited to 'source4/lib/replace/config.m4')
-rw-r--r--source4/lib/replace/config.m412
1 files changed, 8 insertions, 4 deletions
diff --git a/source4/lib/replace/config.m4 b/source4/lib/replace/config.m4
index c2e0e5e6f4..8bfd836189 100644
--- a/source4/lib/replace/config.m4
+++ b/source4/lib/replace/config.m4
@@ -91,7 +91,9 @@ AC_CHECK_HEADERS(strings.h)
AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([
#include <sys/types.h>
+#include <stdio.h>
#include <stdarg.h>
+#include <stdlib.h>
void foo(const char *format, ...) {
va_list ap;
int len;
@@ -107,12 +109,14 @@ void foo(const char *format, ...) {
va_start(ap, format);
len = vsnprintf(0, 0, format, ap);
va_end(ap);
- if (len != 5) exit(1);
+ if (len != 5) exit(2);
- if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
+ if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(3);
- if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(1);
- if (snprintf(buf, 20, "%s", 0) < 3) exit(1);
+ if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(4);
+ if (snprintf(buf, 20, "%zu", 123456789) != 9 || strcmp(buf, "123456789") != 0) exit(5);
+ if (snprintf(buf, 20, "%2\$d %1\$d", 3, 4) != 3 || strcmp(buf, "4 3") != 0) exit(6);
+ if (snprintf(buf, 20, "%s", 0) < 3) exit(7);
exit(0);
}