Update to 2.1.x development version
[glibc/history.git] / stdio-common / scanf9.c
blob52bff08e18feabe515ee62d40ae8494fecd8cbd2
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
5 int main(int argc, char *argv[]) {
6 int matches;
7 char str[10];
9 str[0] = '\0';
10 matches = -9;
11 matches = sscanf("x ]", "%[^] ]", str);
12 printf("Matches = %d, string str = \"%s\".\n", matches, str);
13 printf("str should be \"x\".\n");
14 if (strcmp (str, "x")) abort ();
15 str[0] = '\0';
16 matches = -9;
17 matches = sscanf(" ] x", "%[] ]", str);
18 printf("Matches = %d, string str = \"%s\".\n", matches, str);
19 printf("str should be \" ] \".\n");
20 if (strcmp (str, " ] ")) abort ();
21 exit(0);
22 return 0;