]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/test/misc/stdarg.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / test / misc / stdarg.c
1 /* copied from rsync */
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <sys/types.h>
7 #include <stdarg.h>
8 static int foo(const char *format, ...)
9 {
10         va_list ap;
11         size_t len;
12         char buf[5];
13
14         va_start(ap, format);
15         len = vsnprintf(0, 0, format, ap);
16         va_end(ap);
17         if (len != 5) return(1);
18
19         if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) return(1);
20
21         return(0);
22 }
23 int main(void) { return foo("hello"); }