1#include <fnmatch.h>
2#include <stdio.h>
3
4int
5do_test (void)
6{
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)
11 {
12 puts (s: "First fnmatch didn't return FNM_NOMATCH");
13 return 1;
14 }
15 pattern[(sizeof pattern) - 3] = '*';
16 if (fnmatch (pattern, string, 0) != 0)
17 {
18 puts (s: "Second fnmatch didn't return 0");
19 return 1;
20 }
21 if (fnmatch ("a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD) != FNM_NOMATCH)
22 {
23 puts (s: "Third fnmatch didn't return FNM_NOMATCH");
24 return 1;
25 }
26 if (fnmatch ("a*b/*", "abbb/xy", FNM_PATHNAME | FNM_PERIOD) != 0)
27 {
28 puts (s: "Fourth fnmatch didn't return 0");
29 return 1;
30 }
31 if (fnmatch ("[", "[", 0) != 0)
32 {
33 puts (s: "Fifth fnmatch didn't return 0");
34 return 1;
35 }
36 return 0;
37}
38
39#define TEST_FUNCTION do_test ()
40#include "../test-skeleton.c"
41

source code of glibc/posix/tst-fnmatch2.c