From 380ba23e2dabeb2280ebf353cba27867ef027fbe Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 14 Jan 2006 00:15:52 +0000 Subject: simple stdarg test --- test/misc/stdarg.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/misc/stdarg.c (limited to 'test/misc/stdarg.c') diff --git a/test/misc/stdarg.c b/test/misc/stdarg.c new file mode 100644 index 000000000..ca723355a --- /dev/null +++ b/test/misc/stdarg.c @@ -0,0 +1,19 @@ +/* copied from rsync */ + +#include +#include +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"); } -- cgit v1.2.3