]> git.ipfire.org Git - thirdparty/glibc.git/blame - stdio-common/bug1.c
Update.
[thirdparty/glibc.git] / stdio-common / bug1.c
CommitLineData
28f540f4
RM
1#include <stdio.h>
2#include <string.h>
3
4int
ebbad4cc 5main (void)
28f540f4
RM
6{
7 char *bp;
8 size_t size;
9 FILE *stream;
10 int lose = 0;
11
12 stream = open_memstream (&bp, &size);
13 fprintf (stream, "hello");
14 fflush (stream);
15 printf ("buf = %s, size = %d\n", bp, size);
16 lose |= size != 5;
17 lose |= strncmp (bp, "hello", size);
18 fprintf (stream, ", world");
19 fclose (stream);
20 printf ("buf = %s, size = %d\n", bp, size);
21 lose |= size != 12;
22 lose |= strncmp (bp, "hello, world", 12);
23
24 puts (lose ? "Test FAILED!" : "Test succeeded.");
25
26 return lose;
27}