summaryrefslogtreecommitdiffstats
path: root/test/misc/stdarg.c
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2006-08-22 01:56:31 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2006-08-22 01:56:31 +0000
commitc969ef4b8fc1d06c13203b36f8cf5bb61a7730f0 (patch)
treeeb2da173a5661b2b2e615045f26f7b69e774290d /test/misc/stdarg.c
parentfea84e591f94b025ef7c2da843ae80b809f93dbe (diff)
downloaduClibc-alpine-c969ef4b8fc1d06c13203b36f8cf5bb61a7730f0.tar.bz2
uClibc-alpine-c969ef4b8fc1d06c13203b36f8cf5bb61a7730f0.tar.xz
Merge from trunk. Whoa crap.
Diffstat (limited to 'test/misc/stdarg.c')
-rw-r--r--test/misc/stdarg.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/misc/stdarg.c b/test/misc/stdarg.c
new file mode 100644
index 000000000..561fd2c3b
--- /dev/null
+++ b/test/misc/stdarg.c
@@ -0,0 +1,23 @@
+/* copied from rsync */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <stdarg.h>
+int foo(const char *format, ...)
+{
+ va_list ap;
+ size_t len;
+ char buf[5];
+
+ va_start(ap, format);
+ len = vsnprintf(0, 0, format, ap);
+ va_end(ap);
+ if (len != 5) return(1);
+
+ if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) return(1);
+
+ return(0);
+}
+int main(void) { return foo("hello"); }