1#include <stdio.h>
2
3int
4main (void)
5{
6 char buf[80];
7 int i;
8 int lost = 0;
9
10 lost = (scanf (format: "%2s", buf) < 0);
11 lost |= (buf[0] != 'X' || buf[1] != 'Y' || buf[2] != '\0');
12 if (lost)
13 puts (s: "test of %2s failed.");
14 lost |= (scanf (format: " ") < 0);
15 lost |= (scanf (format: "%d", &i) < 0);
16 lost |= (i != 1234);
17 if (lost)
18 puts (s: "test of %d failed.");
19 lost |= (scanf (format: "%c", buf) < 0);
20 lost |= (buf[0] != 'L');
21 if (lost)
22 puts (s: "test of %c failed.\n");
23
24 puts (s: lost ? "Test FAILED!" : "Test succeeded.");
25 return lost;
26}
27

source code of glibc/stdio-common/bug6.c