OSDN Git Service
(root)
/
uclinux-h8
/
uclibc-ng.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
d874cc6
)
simple stdarg test
author
Mike Frysinger
<vapier@gentoo.org>
Sat, 14 Jan 2006 00:15:52 +0000
(
00:15
-0000)
committer
Mike Frysinger
<vapier@gentoo.org>
Sat, 14 Jan 2006 00:15:52 +0000
(
00:15
-0000)
test/misc/stdarg.c
[new file with mode: 0644]
patch
|
blob
diff --git a/test/misc/stdarg.c
b/test/misc/stdarg.c
new file mode 100644
(file)
index 0000000..
ca72335
--- /dev/null
+++ b/
test/misc/stdarg.c
@@ -0,0
+1,19
@@
+/* copied from rsync */
+
+#include <sys/types.h>
+#include <stdarg.h>
+void foo(const char *format, ...) {
+ va_list ap;
+ int len;
+ char buf[5];
+
+ va_start(ap, format);
+ len = vsnprintf(0, 0, format, ap);
+ va_end(ap);
+ if (len != 5) exit(1);
+
+ if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
+
+ exit(0);
+}
+int main() { foo("hello"); }