Avoid array-bounds warning for strncat on i586 (bug 20260)
[glibc.git] / posix / tst-fnmatch2.c
blobe66a01f5926851a6a04101322fc5037b8527a1a1
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 if (fnmatch ("[", "[", 0) != 0)
33 puts ("Fifth fnmatch didn't return 0");
34 return 1;
36 return 0;
39 #define TEST_FUNCTION do_test ()
40 #include "../test-skeleton.c"