No need to use __THROW in this header.
[glibc.git] / stdio-common / tst-sprintf.c
blobc61d3b50e4f78baf32fc787bafefc49a05e6677a
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
6 int
7 main (void)
9 char buf[100];
10 int result = 0;
12 if (sprintf (buf, "%.0ls", L"foo") != 0
13 || strlen (buf) != 0)
15 puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
16 result = 1;
19 #define SIZE (1024*70000)
20 #define STR(x) #x
22 char *dst = malloc (SIZE + 1);
24 if (dst == NULL)
26 puts ("memory allocation failure");
27 result = 1;
29 else
31 sprintf (dst, "%*s", SIZE, "");
32 if (strnlen (dst, SIZE + 1) != SIZE)
34 puts ("sprintf (dst, \"%*s\", " STR(SIZE) ", \"\") did not produce enough output");
35 result = 1;
37 free (dst);
40 return result;