Update.
[platform/upstream/glibc.git] / stdio-common / scanf9.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 int  main(int argc, char *argv[])  {
6   int  matches;
7   char  str[10];
8
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;
23 }