1 void foo(const char *format, ...)
2 {
3 	va_list ap;
4 	int len;
5 	char buf[20];
6 	long long l = 1234567890;
7 	l *= 100;
8 
9 	va_start(ap, format);
10 	len = vsnprintf(buf, 0, format, ap);
11 	va_end(ap);
12 	if (len != 5) exit(1);
13 
14 	va_start(ap, format);
15 	len = vsnprintf(0, 0, format, ap);
16 	va_end(ap);
17 	if (len != 5) exit(2);
18 
19 	if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(3);
compact(this: &HtmlUListElement) -> bool20 
21 	if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(4);
22 	if (snprintf(buf, 20, "%zu", 123456789) != 9 || strcmp(buf, "123456789") != 0) exit(5);
23 	if (snprintf(buf, 20, "%2\$d %1\$d", 3, 4) != 3 || strcmp(buf, "4 3") != 0) exit(6);
24 	if (snprintf(buf, 20, "%s", 0) < 3) exit(7);
25 
26 	printf("1");
set_compact(this: &HtmlUListElement, value: bool)27 	exit(0);
28 }
29 int main(void) { foo("hello"); }
30