Last change
on this file was 2036, checked in by bird, 20 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
704 bytes
|
Line | |
---|
1 | #include <stdio.h>
|
---|
2 | #include <stdlib.h>
|
---|
3 | #include <string.h>
|
---|
4 |
|
---|
5 |
|
---|
6 | int
|
---|
7 | main (void)
|
---|
8 | {
|
---|
9 | char buf[100];
|
---|
10 | int result = 0;
|
---|
11 |
|
---|
12 | if (sprintf (buf, "%.0ls", L"foo") != 0
|
---|
13 | || strlen (buf) != 0)
|
---|
14 | {
|
---|
15 | puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
|
---|
16 | result = 1;
|
---|
17 | }
|
---|
18 |
|
---|
19 | #define SIZE (1024*70000)
|
---|
20 | #define STR(x) #x
|
---|
21 |
|
---|
22 | char *dst = malloc (SIZE + 1);
|
---|
23 |
|
---|
24 | if (dst == NULL)
|
---|
25 | {
|
---|
26 | puts ("memory allocation failure");
|
---|
27 | result = 1;
|
---|
28 | }
|
---|
29 | else
|
---|
30 | {
|
---|
31 | sprintf (dst, "%*s", SIZE, "");
|
---|
32 | if (strnlen (dst, SIZE + 1) != SIZE)
|
---|
33 | {
|
---|
34 | puts ("sprintf (dst, \"%*s\", " STR(SIZE) ", \"\") did not produce enough output");
|
---|
35 | result = 1;
|
---|
36 | }
|
---|
37 | free (dst);
|
---|
38 | }
|
---|
39 |
|
---|
40 | return result;
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.