12 if (sprintf (buf
, "%.0ls", L
"foo") != 0
15 puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
19 #define SIZE (1024*70000)
22 char *dst
= malloc (SIZE
+ 1);
26 puts ("memory allocation failure");
31 sprintf (dst
, "%*s", SIZE
, "");
32 if (strnlen (dst
, SIZE
+ 1) != SIZE
)
34 puts ("sprintf (dst, \"%*s\", " STR(SIZE
) ", \"\") did not produce enough output");
40 if (sprintf (buf
, "%1$d%3$.*2$s%4$d", 7, 67108863, "x", 8) != 3
41 || strcmp (buf
, "7x8") != 0)
43 printf ("sprintf (buf, \"%%1$d%%3$.*2$s%%4$d\", 7, 67108863, \"x\", 8) produced `%s' output", buf
);
47 if (sprintf (buf
, "%67108863.16\"%d", 7) != 14
48 || strcmp (buf
, "%67108863.16\"7") != 0)
50 printf ("sprintf (buf, \"%%67108863.16\\\"%%d\", 7) produced `%s' output", buf
);
54 if (sprintf (buf
, "%*\"%d", 0x3ffffff, 7) != 11
55 || strcmp (buf
, "%67108863\"7") != 0)
57 printf ("sprintf (buf, \"%%*\\\"%%d\", 0x3ffffff, 7) produced `%s' output", buf
);