diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-10-24 20:22:12 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-10-24 20:22:12 +0200 |
commit | 7988979a722b4cdf287b2093956a76a3f19b9897 (patch) | |
tree | d35e251d0472ceca55a2eef61cff261c8ee68fab /test/misc/stdarg.c |
add uClibc-ng test directory
Diffstat (limited to 'test/misc/stdarg.c')
-rw-r--r-- | test/misc/stdarg.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/misc/stdarg.c b/test/misc/stdarg.c new file mode 100644 index 0000000..1566e0c --- /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> +static 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"); } |