.
[glibc/history.git] / posix / tst-fnmatch2.c
blob28a0871c1c6d8cafefb8953ade247580baf32710
1 #include <fnmatch.h>
2 #include <stdio.h>
4 int
5 do_test (void)
7 char pattern[] = "a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*";
8 const char *string = "aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmm"
9 "nnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyy";
10 if (fnmatch (pattern, string, 0) != FNM_NOMATCH)
12 puts ("First fnmatch didn't return FNM_NOMATCH");
13 return 1;
15 pattern[(sizeof pattern) - 3] = '*';
16 if (fnmatch (pattern, string, 0) != 0)
18 puts ("Second fnmatch didn't return 0");
19 return 1;
21 if (fnmatch ("a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD) != FNM_NOMATCH)
23 puts ("Third fnmatch didn't return FNM_NOMATCH");
24 return 1;
26 if (fnmatch ("a*b/*", "abbb/xy", FNM_PATHNAME | FNM_PERIOD) != 0)
28 puts ("Fourth fnmatch didn't return 0");
29 return 1;
31 return 0;
34 #define TEST_FUNCTION do_test ()
35 #include "../test-skeleton.c"