diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-01-14 00:15:52 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-01-14 00:15:52 +0000 |
commit | 380ba23e2dabeb2280ebf353cba27867ef027fbe (patch) | |
tree | 3931a0851954dbbef65bbf0b642ebea31d0f2d55 /test | |
parent | d874cc673a85fe328b37d59e84d7f7716417a7e5 (diff) |
simple stdarg test
Diffstat (limited to 'test')
-rw-r--r-- | test/misc/stdarg.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 <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"); } |