]>
Commit | Line | Data |
---|---|---|
a66067be RM |
1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
3 | #include <string.h> | |
4 | ||
1a511d31 AJ |
5 | int |
6 | main (void) | |
7 | { | |
8 | int matches; | |
9 | char str[10]; | |
a66067be RM |
10 | |
11 | str[0] = '\0'; | |
12 | matches = -9; | |
1a511d31 AJ |
13 | matches = sscanf ("x ]", "%[^] ]", str); |
14 | printf ("Matches = %d, string str = \"%s\".\n", matches, str); | |
15 | printf ("str should be \"x\".\n"); | |
16 | ||
17 | if (strcmp (str, "x")) | |
18 | abort (); | |
19 | ||
a66067be RM |
20 | str[0] = '\0'; |
21 | matches = -9; | |
1a511d31 AJ |
22 | matches = sscanf (" ] x", "%[] ]", str); |
23 | printf ("Matches = %d, string str = \"%s\".\n", matches, str); | |
24 | printf ("str should be \" ] \".\n"); | |
25 | ||
26 | if (strcmp (str, " ] ")) | |
27 | abort (); | |
28 | ||
a66067be RM |
29 | return 0; |
30 | } |