OpenCoverage

sm_loop.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/lib/glob/sm_loop.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* Copyright (C) 1991-2018 Free Software Foundation, Inc.-
2-
3 This file is part of GNU Bash, the Bourne Again SHell.-
4 -
5 Bash is free software: you can redistribute it and/or modify-
6 it under the terms of the GNU General Public License as published by-
7 the Free Software Foundation, either version 3 of the License, or-
8 (at your option) any later version.-
9-
10 Bash is distributed in the hope that it will be useful,-
11 but WITHOUT ANY WARRANTY; without even the implied warranty of-
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
13 GNU General Public License for more details.-
14-
15 You should have received a copy of the GNU General Public License-
16 along with Bash. If not, see <http://www.gnu.org/licenses/>.-
17*/-
18-
19struct STRUCT-
20{-
21 CHAR *pattern;-
22 CHAR *string;-
23};-
24-
25int FCT __P((CHAR *, CHAR *, int));-
26-
27static int GMATCH __P((CHAR *, CHAR *, CHAR *, CHAR *, struct STRUCT *, int));-
28static CHAR *PARSE_COLLSYM __P((CHAR *, INT *));-
29static CHAR *BRACKMATCH __P((CHAR *, U_CHAR, int));-
30static int EXTMATCH __P((INT, CHAR *, CHAR *, CHAR *, CHAR *, int));-
31-
32/*static*/ CHAR *PATSCAN __P((CHAR *, CHAR *, INT));-
33-
34int-
35FCT (pattern, string, flags)-
36 CHAR *pattern;-
37 CHAR *string;-
38 int flags;-
39{-
40 CHAR *se, *pe;-
41-
42 if (string == 0 || pattern == 0)
string == 0Description
TRUEnever evaluated
FALSEevaluated 48823644 times by 1 test
Evaluated by:
  • Self test
pattern == 0Description
TRUEnever evaluated
FALSEevaluated 48823644 times by 1 test
Evaluated by:
  • Self test
string == 0Description
TRUEnever evaluated
FALSEevaluated 9622995 times by 1 test
Evaluated by:
  • Self test
pattern == 0Description
TRUEnever evaluated
FALSEevaluated 9622995 times by 1 test
Evaluated by:
  • Self test
0-48823644
43 return FNM_NOMATCH;
never executed: return 1;
never executed: return 1;
0
44-
45 se = string + STRLEN ((XCHAR *)string);-
46 pe = pattern + STRLEN ((XCHAR *)pattern);-
47-
48 return (GMATCH (string, se, pattern, pe, (struct STRUCT *)NULL, flags));
executed 48823644 times by 1 test: return (gmatch (string, se, pattern, pe, (struct smat_struct *) ((void *)0) , flags));
Executed by:
  • Self test
executed 9622995 times by 1 test: return (gmatch_wc (string, se, pattern, pe, (struct wcsmat_struct *) ((void *)0) , flags));
Executed by:
  • Self test
9622995-48823644
49}-
50-
51/* Match STRING against the filename pattern PATTERN, returning zero if-
52 it matches, FNM_NOMATCH if not. */-
53static int-
54GMATCH (string, se, pattern, pe, ends, flags)-
55 CHAR *string, *se;-
56 CHAR *pattern, *pe;-
57 struct STRUCT *ends;-
58 int flags;-
59{-
60 CHAR *p, *n; /* pattern, string */-
61 INT c; /* current pattern character - XXX U_CHAR? */-
62 INT sc; /* current string character - XXX U_CHAR? */-
63-
64 p = pattern;-
65 n = string;-
66-
67 if (string == 0 || pattern == 0)
string == 0Description
TRUEnever evaluated
FALSEevaluated 49026933 times by 1 test
Evaluated by:
  • Self test
pattern == 0Description
TRUEnever evaluated
FALSEevaluated 49026933 times by 1 test
Evaluated by:
  • Self test
string == 0Description
TRUEnever evaluated
FALSEevaluated 9624442 times by 1 test
Evaluated by:
  • Self test
pattern == 0Description
TRUEnever evaluated
FALSEevaluated 9624442 times by 1 test
Evaluated by:
  • Self test
0-49026933
68 return FNM_NOMATCH;
never executed: return 1;
never executed: return 1;
0
69-
70#if DEBUG_MATCHING-
71fprintf(stderr, "gmatch: string = %s; se = %s\n", string, se);-
72fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);-
73#endif-
74-
75 while (p < pe)
p < peDescription
TRUEevaluated 121590254 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 28282211 times by 1 test
Evaluated by:
  • Self test
p < peDescription
TRUEevaluated 9625687 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1531062 times by 1 test
Evaluated by:
  • Self test
1531062-121590254
76 {-
77 c = *p++;-
78 c = FOLD (c);
never executed: end of block
never executed: __res = tolower ( (unsigned char)c );
executed 12 times by 1 test: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)c )];
Executed by:
  • Self test
sizeof ( (unsi...d char)c ) > 1Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
__builtin_cons...igned char)c )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEevaluated 152 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 121590102 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 140 times by 1 test
Evaluated by:
  • Self test
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 9625687 times by 1 test
Evaluated by:
  • Self test
iswupper (c)Description
TRUEnever evaluated
FALSEnever evaluated
0-121590102
79-
80 sc = n < se ? *n : '\0';
n < seDescription
TRUEevaluated 121315965 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 274289 times by 1 test
Evaluated by:
  • Self test
n < seDescription
TRUEevaluated 7309168 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2316519 times by 1 test
Evaluated by:
  • Self test
274289-121315965
81-
82#ifdef EXTENDED_GLOB-
83 /* EXTMATCH () will handle recursively calling GMATCH, so we can-
84 just return what EXTMATCH() returns. */-
85 if ((flags & FNM_EXTMATCH) && *p == L('(') &&
(flags & (1 << 5))Description
TRUEevaluated 8030821 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 113559433 times by 1 test
Evaluated by:
  • Self test
*p == '('Description
TRUEevaluated 8437 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 8022384 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 5))Description
TRUEevaluated 450 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 9625237 times by 1 test
Evaluated by:
  • Self test
*p == L'('Description
TRUEevaluated 52 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 398 times by 1 test
Evaluated by:
  • Self test
52-113559433
86 (c == L('+') || c == L('*') || c == L('?') || c == L('@') || c == L('!'))) /* ) */
c == '+'Description
TRUEevaluated 163 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 8274 times by 1 test
Evaluated by:
  • Self test
c == '*'Description
TRUEevaluated 3021 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5253 times by 1 test
Evaluated by:
  • Self test
c == '?'Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5209 times by 1 test
Evaluated by:
  • Self test
c == '@'Description
TRUEevaluated 5060 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 149 times by 1 test
Evaluated by:
  • Self test
c == '!'Description
TRUEevaluated 149 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == L'+'Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 33 times by 1 test
Evaluated by:
  • Self test
c == L'*'Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == L'?'Description
TRUEnever evaluated
FALSEnever evaluated
c == L'@'Description
TRUEnever evaluated
FALSEnever evaluated
c == L'!'Description
TRUEnever evaluated
FALSEnever evaluated
0-8274
87 {-
88 int lflags;-
89 /* If we're not matching the start of the string, we're not-
90 concerned about the special cases for matching `.' */-
91 lflags = (n == string) ? flags : (flags & ~FNM_PERIOD);
(n == string)Description
TRUEevaluated 7382 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1055 times by 1 test
Evaluated by:
  • Self test
(n == string)Description
TRUEevaluated 52 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-7382
92 return (EXTMATCH (c, n, se, p, pe, lflags));
executed 8437 times by 1 test: return (extmatch (c, n, se, p, pe, lflags));
Executed by:
  • Self test
executed 52 times by 1 test: return (extmatch_wc (c, n, se, p, pe, lflags));
Executed by:
  • Self test
52-8437
93 }-
94#endif /* EXTENDED_GLOB */-
95-
96 switch (c)-
97 {-
98 case L('?'): /* Match single character */
executed 18876 times by 1 test: case '?':
Executed by:
  • Self test
executed 1678 times by 1 test: case L'?':
Executed by:
  • Self test
1678-18876
99 if (sc == '\0')
sc == '\0'Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 18858 times by 1 test
Evaluated by:
  • Self test
sc == '\0'Description
TRUEevaluated 676 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1002 times by 1 test
Evaluated by:
  • Self test
18-18858
100 return FNM_NOMATCH;
executed 18 times by 1 test: return 1;
Executed by:
  • Self test
executed 676 times by 1 test: return 1;
Executed by:
  • Self test
18-676
101 else if ((flags & FNM_PATHNAME) && sc == L('/'))
(flags & (1 << 0))Description
TRUEevaluated 1772 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 17086 times by 1 test
Evaluated by:
  • Self test
sc == '/'Description
TRUEnever evaluated
FALSEevaluated 1772 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEevaluated 1002 times by 1 test
Evaluated by:
  • Self test
sc == L'/'Description
TRUEnever evaluated
FALSEnever evaluated
0-17086
102 /* If we are matching a pathname, `?' can never match a `/'. */-
103 return FNM_NOMATCH;
never executed: return 1;
never executed: return 1;
0
104 else if ((flags & FNM_PERIOD) && sc == L('.') &&
(flags & (1 << 2))Description
TRUEevaluated 1748 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 17110 times by 1 test
Evaluated by:
  • Self test
sc == '.'Description
TRUEnever evaluated
FALSEevaluated 1748 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 2))Description
TRUEnever evaluated
FALSEevaluated 1002 times by 1 test
Evaluated by:
  • Self test
sc == L'.'Description
TRUEnever evaluated
FALSEnever evaluated
0-17110
105 (n == string || ((flags & FNM_PATHNAME) && n[-1] == L('/'))))
n == stringDescription
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEnever evaluated
n[-1] == '/'Description
TRUEnever evaluated
FALSEnever evaluated
n == stringDescription
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEnever evaluated
n[-1] == L'/'Description
TRUEnever evaluated
FALSEnever evaluated
0
106 /* `?' cannot match a `.' if it is the first character of the-
107 string or if it is the first character following a slash and-
108 we are matching a pathname. */-
109 return FNM_NOMATCH;
never executed: return 1;
never executed: return 1;
0
110 break;
executed 18858 times by 1 test: break;
Executed by:
  • Self test
executed 1002 times by 1 test: break;
Executed by:
  • Self test
1002-18858
111-
112 case L('\\'): /* backslash escape removes special meaning */
executed 85217778 times by 1 test: case '\\':
Executed by:
  • Self test
executed 9619835 times by 1 test: case L'\\':
Executed by:
  • Self test
9619835-85217778
113 if (p == pe && sc == '\\' && (n+1 == se))
p == peDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 85217772 times by 1 test
Evaluated by:
  • Self test
sc == '\\'Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
(n+1 == se)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
p == peDescription
TRUEnever evaluated
FALSEevaluated 9619835 times by 1 test
Evaluated by:
  • Self test
sc == '\\'Description
TRUEnever evaluated
FALSEnever evaluated
(n+1 == se)Description
TRUEnever evaluated
FALSEnever evaluated
0-85217772
114 break;
executed 6 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-6
115-
116 if (p == pe)
p == peDescription
TRUEnever evaluated
FALSEevaluated 85217772 times by 1 test
Evaluated by:
  • Self test
p == peDescription
TRUEnever evaluated
FALSEevaluated 9619835 times by 1 test
Evaluated by:
  • Self test
0-85217772
117 return FNM_NOMATCH;
never executed: return 1;
never executed: return 1;
0
118-
119 if ((flags & FNM_NOESCAPE) == 0)
(flags & (1 << 1)) == 0Description
TRUEevaluated 85217772 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
(flags & (1 << 1)) == 0Description
TRUEevaluated 9619835 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-85217772
120 {-
121 c = *p++;-
122 /* A trailing `\' cannot match. */-
123 if (p > pe)
p > peDescription
TRUEnever evaluated
FALSEevaluated 85217772 times by 1 test
Evaluated by:
  • Self test
p > peDescription
TRUEnever evaluated
FALSEevaluated 9619835 times by 1 test
Evaluated by:
  • Self test
0-85217772
124 return FNM_NOMATCH;
never executed: return 1;
never executed: return 1;
0
125 c = FOLD (c);
never executed: end of block
never executed: __res = tolower ( (unsigned char)c );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)c )];
sizeof ( (unsi...d char)c ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...igned char)c )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 85217772 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 9619835 times by 1 test
Evaluated by:
  • Self test
iswupper (c)Description
TRUEnever evaluated
FALSEnever evaluated
0-85217772
126 }
executed 85217772 times by 1 test: end of block
Executed by:
  • Self test
executed 9619835 times by 1 test: end of block
Executed by:
  • Self test
9619835-85217772
127 if (FOLD (sc) != (U_CHAR)c)
never executed: end of block
never executed: __res = tolower ( (unsigned char)sc );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)sc )];
((flags & (1 <...nsigned char)cDescription
TRUEevaluated 1390451 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 83827321 times by 1 test
Evaluated by:
  • Self test
((flags & (1 <...) != (wint_t)cDescription
TRUEevaluated 8090736 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1529099 times by 1 test
Evaluated by:
  • Self test
sizeof ( (unsi... char)sc ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...gned char)sc )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 85217772 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 9619835 times by 1 test
Evaluated by:
  • Self test
iswupper (sc)Description
TRUEnever evaluated
FALSEnever evaluated
0-85217772
128 return FNM_NOMATCH;
executed 1390451 times by 1 test: return 1;
Executed by:
  • Self test
executed 8090736 times by 1 test: return 1;
Executed by:
  • Self test
1390451-8090736
129 break;
executed 83827321 times by 1 test: break;
Executed by:
  • Self test
executed 1529099 times by 1 test: break;
Executed by:
  • Self test
1529099-83827321
130-
131 case L('*'): /* Match zero or more characters */
executed 4904304 times by 1 test: case '*':
Executed by:
  • Self test
executed 1139 times by 1 test: case L'*':
Executed by:
  • Self test
1139-4904304
132 /* See below for the reason for using this. It avoids backtracking-
133 back to a previous `*'. Picked up from glibc. */-
134 if (ends != NULL)
ends != ((void *)0)Description
TRUEevaluated 59159 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4845145 times by 1 test
Evaluated by:
  • Self test
ends != ((void *)0)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1129 times by 1 test
Evaluated by:
  • Self test
10-4845145
135 {-
136 ends->pattern = p - 1;-
137 ends->string = n;-
138 return (0);
executed 59159 times by 1 test: return (0);
Executed by:
  • Self test
executed 10 times by 1 test: return (0);
Executed by:
  • Self test
10-59159
139 }-
140-
141 if ((flags & FNM_PERIOD) && sc == L('.') &&
(flags & (1 << 2))Description
TRUEevaluated 24186 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4820959 times by 1 test
Evaluated by:
  • Self test
sc == '.'Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 24177 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 2))Description
TRUEnever evaluated
FALSEevaluated 1129 times by 1 test
Evaluated by:
  • Self test
sc == L'.'Description
TRUEnever evaluated
FALSEnever evaluated
0-4820959
142 (n == string || ((flags & FNM_PATHNAME) && n[-1] == L('/'))))
n == stringDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 0))Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
n[-1] == '/'Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
n == stringDescription
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEnever evaluated
n[-1] == L'/'Description
TRUEnever evaluated
FALSEnever evaluated
0-7
143 /* `*' cannot match a `.' if it is the first character of the-
144 string or if it is the first character following a slash and-
145 we are matching a pathname. */-
146 return FNM_NOMATCH;
executed 7 times by 1 test: return 1;
Executed by:
  • Self test
never executed: return 1;
0-7
147-
148 if (p == pe)
p == peDescription
TRUEevaluated 4757910 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 87228 times by 1 test
Evaluated by:
  • Self test
p == peDescription
TRUEevaluated 149 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 980 times by 1 test
Evaluated by:
  • Self test
149-4757910
149 return 0;
executed 4757910 times by 1 test: return 0;
Executed by:
  • Self test
executed 149 times by 1 test: return 0;
Executed by:
  • Self test
149-4757910
150-
151 /* Collapse multiple consecutive `*' and `?', but make sure that-
152 one character of the string is consumed for each `?'. */-
153 for (c = *p++; (c == L('?') || c == L('*')); c = *p++)
c == '?'Description
TRUEevaluated 2811 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 87222 times by 1 test
Evaluated by:
  • Self test
c == '*'Description
TRUEevaluated 407 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 86815 times by 1 test
Evaluated by:
  • Self test
c == L'?'Description
TRUEnever evaluated
FALSEevaluated 980 times by 1 test
Evaluated by:
  • Self test
c == L'*'Description
TRUEnever evaluated
FALSEevaluated 980 times by 1 test
Evaluated by:
  • Self test
0-87222
154 {-
155 if ((flags & FNM_PATHNAME) && sc == L('/'))
(flags & (1 << 0))Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3212 times by 1 test
Evaluated by:
  • Self test
sc == '/'Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEnever evaluated
sc == L'/'Description
TRUEnever evaluated
FALSEnever evaluated
0-3212
156 /* A slash does not match a wildcard under FNM_PATHNAME. */-
157 return FNM_NOMATCH;
never executed: return 1;
never executed: return 1;
0
158#ifdef EXTENDED_GLOB-
159 else if ((flags & FNM_EXTMATCH) && c == L('?') && *p == L('(')) /* ) */
(flags & (1 << 5))Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3199 times by 1 test
Evaluated by:
  • Self test
c == '?'Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 13 times by 1 test
Evaluated by:
  • Self test
*p == '('Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
(flags & (1 << 5))Description
TRUEnever evaluated
FALSEnever evaluated
c == L'?'Description
TRUEnever evaluated
FALSEnever evaluated
*p == L'('Description
TRUEnever evaluated
FALSEnever evaluated
0-3199
160 {-
161 CHAR *newn;-
162-
163 /* We can match 0 or 1 times. If we match, return success */-
164 if (EXTMATCH (c, n, se, p, pe, flags) == 0)
extmatch (c, n...e, flags) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
extmatch_wc (c...e, flags) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-5
165 return (0);
executed 1 time by 1 test: return (0);
Executed by:
  • Self test
never executed: return (0);
0-1
166-
167 /* We didn't match the extended glob pattern, but-
168 that's OK, since we can match 0 or 1 occurrences.-
169 We need to skip the glob pattern and see if we-
170 match the rest of the string. */-
171 newn = PATSCAN (p + 1, pe, 0);-
172 /* If NEWN is 0, we have an ill-formed pattern. */-
173 p = newn ? newn : pe;
newnDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
newnDescription
TRUEnever evaluated
FALSEnever evaluated
0-5
174 }
executed 5 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-5
175#endif-
176 else if (c == L('?'))
c == '?'Description
TRUEevaluated 2805 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 407 times by 1 test
Evaluated by:
  • Self test
c == L'?'Description
TRUEnever evaluated
FALSEnever evaluated
0-2805
177 {-
178 if (sc == L('\0'))
sc == '\0'Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2800 times by 1 test
Evaluated by:
  • Self test
sc == L'\0'Description
TRUEnever evaluated
FALSEnever evaluated
0-2800
179 return FNM_NOMATCH;
executed 5 times by 1 test: return 1;
Executed by:
  • Self test
never executed: return 1;
0-5
180 /* One character of the string is consumed in matching-
181 this ? wildcard, so *??? won't match if there are-
182 fewer than three characters. */-
183 n++;-
184 sc = n < se ? *n : '\0';
n < seDescription
TRUEevaluated 2721 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 79 times by 1 test
Evaluated by:
  • Self test
n < seDescription
TRUEnever evaluated
FALSEnever evaluated
0-2721
185 }
executed 2800 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-2800
186-
187#ifdef EXTENDED_GLOB-
188 /* Handle ******(patlist) */-
189 if ((flags & FNM_EXTMATCH) && c == L('*') && *p == L('(')) /*)*/
(flags & (1 << 5))Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3194 times by 1 test
Evaluated by:
  • Self test
c == '*'Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
*p == '('Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 5))Description
TRUEnever evaluated
FALSEnever evaluated
c == L'*'Description
TRUEnever evaluated
FALSEnever evaluated
*p == L'('Description
TRUEnever evaluated
FALSEnever evaluated
0-3194
190 {-
191 CHAR *newn;-
192 /* We need to check whether or not the extended glob-
193 pattern matches the remainder of the string.-
194 If it does, we match the entire pattern. */-
195 for (newn = n; newn < se; ++newn)
newn < seDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test
newn < seDescription
TRUEnever evaluated
FALSEnever evaluated
0-16
196 {-
197 if (EXTMATCH (c, newn, se, p, pe, flags) == 0)
extmatch (c, n...e, flags) == 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
extmatch_wc (c...e, flags) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-11
198 return (0);
executed 5 times by 1 test: return (0);
Executed by:
  • Self test
never executed: return (0);
0-5
199 }
executed 11 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-11
200 /* We didn't match the extended glob pattern, but-
201 that's OK, since we can match 0 or more occurrences.-
202 We need to skip the glob pattern and see if we-
203 match the rest of the string. */-
204 newn = PATSCAN (p + 1, pe, 0);-
205 /* If NEWN is 0, we have an ill-formed pattern. */-
206 p = newn ? newn : pe;
newnDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
newnDescription
TRUEnever evaluated
FALSEnever evaluated
0-3
207 }
executed 3 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-3
208#endif-
209 if (p == pe)
p == peDescription
TRUEevaluated 402 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2805 times by 1 test
Evaluated by:
  • Self test
p == peDescription
TRUEnever evaluated
FALSEnever evaluated
0-2805
210 break;
executed 402 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-402
211 }
executed 2805 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-2805
212-
213 /* The wildcards are the last element of the pattern. The name-
214 cannot match completely if we are looking for a pathname and-
215 it contains another slash, unless FNM_LEADING_DIR is set. */-
216 if (c == L('\0'))
c == '\0'Description
TRUEnever evaluated
FALSEevaluated 87217 times by 1 test
Evaluated by:
  • Self test
c == L'\0'Description
TRUEnever evaluated
FALSEevaluated 980 times by 1 test
Evaluated by:
  • Self test
0-87217
217 {-
218 int r = (flags & FNM_PATHNAME) == 0 ? 0 : FNM_NOMATCH;
(flags & (1 << 0)) == 0Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 0)) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
219 if (flags & FNM_PATHNAME)
flags & (1 << 0)Description
TRUEnever evaluated
FALSEnever evaluated
flags & (1 << 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
220 {-
221 if (flags & FNM_LEADING_DIR)
flags & (1 << 3)Description
TRUEnever evaluated
FALSEnever evaluated
flags & (1 << 3)Description
TRUEnever evaluated
FALSEnever evaluated
0
222 r = 0;
never executed: r = 0;
never executed: r = 0;
0
223 else if (MEMCHR (n, L('/'), se - n) == NULL)
memchr((n), ('...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
wmemchr((n), (...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
224 r = 0;
never executed: r = 0;
never executed: r = 0;
0
225 }
never executed: end of block
never executed: end of block
0
226 return r;
never executed: return r;
never executed: return r;
0
227 }-
228-
229 /* If we've hit the end of the pattern and the last character of-
230 the pattern was handled by the loop above, we've succeeded.-
231 Otherwise, we need to match that last character. */-
232 if (p == pe && (c == L('?') || c == L('*')))
p == peDescription
TRUEevaluated 7686 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 79531 times by 1 test
Evaluated by:
  • Self test
c == '?'Description
TRUEevaluated 149 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7537 times by 1 test
Evaluated by:
  • Self test
c == '*'Description
TRUEevaluated 253 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7284 times by 1 test
Evaluated by:
  • Self test
p == peDescription
TRUEevaluated 694 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 286 times by 1 test
Evaluated by:
  • Self test
c == L'?'Description
TRUEnever evaluated
FALSEevaluated 694 times by 1 test
Evaluated by:
  • Self test
c == L'*'Description
TRUEnever evaluated
FALSEevaluated 694 times by 1 test
Evaluated by:
  • Self test
0-79531
233 return (0);
executed 402 times by 1 test: return (0);
Executed by:
  • Self test
never executed: return (0);
0-402
234-
235 /* If we've hit the end of the string and the rest of the pattern-
236 is something that matches the empty string, we can succeed. */-
237#if defined (EXTENDED_GLOB)-
238 if (n == se && ((flags & FNM_EXTMATCH) && (c == L('!') || c == L('?')) && *p == L('(')))
n == seDescription
TRUEevaluated 86 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 86729 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 5))Description
TRUEevaluated 66 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 20 times by 1 test
Evaluated by:
  • Self test
c == '!'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 65 times by 1 test
Evaluated by:
  • Self test
c == '?'Description
TRUEnever evaluated
FALSEevaluated 65 times by 1 test
Evaluated by:
  • Self test
*p == '('Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
n == seDescription
TRUEevaluated 76 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 904 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 5))Description
TRUEnever evaluated
FALSEevaluated 76 times by 1 test
Evaluated by:
  • Self test
c == L'!'Description
TRUEnever evaluated
FALSEnever evaluated
c == L'?'Description
TRUEnever evaluated
FALSEnever evaluated
*p == L'('Description
TRUEnever evaluated
FALSEnever evaluated
0-86729
239 {-
240 --p;-
241 if (EXTMATCH (c, n, se, p, pe, flags) == 0)
extmatch (c, n...e, flags) == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
extmatch_wc (c...e, flags) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-1
242 return (c == L('!') ? FNM_NOMATCH : 0);
never executed: return (c == '!' ? 1 : 0);
never executed: return (c == L'!' ? 1 : 0);
0
243 return (c == L('!') ? 0 : FNM_NOMATCH);
executed 1 time by 1 test: return (c == '!' ? 0 : 1);
Executed by:
  • Self test
never executed: return (c == L'!' ? 0 : 1);
0-1
244 }-
245#endif-
246-
247 /* If we stop at a slash in the pattern and we are looking for a-
248 pathname ([star]/foo), then consume enough of the string to stop-
249 at any slash and then try to match the rest of the pattern. If-
250 the string doesn't contain a slash, fail */-
251 if (c == L('/') && (flags & FNM_PATHNAME))
c == '/'Description
TRUEevaluated 55 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 86759 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEevaluated 55 times by 1 test
Evaluated by:
  • Self test
c == L'/'Description
TRUEevaluated 685 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 295 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEevaluated 685 times by 1 test
Evaluated by:
  • Self test
0-86759
252 {-
253 while (n < se && *n != L('/'))
n < seDescription
TRUEnever evaluated
FALSEnever evaluated
*n != '/'Description
TRUEnever evaluated
FALSEnever evaluated
n < seDescription
TRUEnever evaluated
FALSEnever evaluated
*n != L'/'Description
TRUEnever evaluated
FALSEnever evaluated
0
254 ++n;
never executed: ++n;
never executed: ++n;
0
255 if (n < se && *n == L('/') && (GMATCH (n+1, se, p, pe, NULL, flags) == 0))
n < seDescription
TRUEnever evaluated
FALSEnever evaluated
*n == '/'Description
TRUEnever evaluated
FALSEnever evaluated
(gmatch (n+1, ..., flags) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
n < seDescription
TRUEnever evaluated
FALSEnever evaluated
*n == L'/'Description
TRUEnever evaluated
FALSEnever evaluated
(gmatch_wc (n+..., flags) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
256 return 0;
never executed: return 0;
never executed: return 0;
0
257 return FNM_NOMATCH; /* XXX */
never executed: return 1;
never executed: return 1;
0
258 }-
259-
260 /* General case, use recursion. */-
261 {-
262 U_CHAR c1;-
263 const CHAR *endp;-
264 struct STRUCT end;-
265-
266 end.pattern = NULL;-
267 endp = MEMCHR (n, (flags & FNM_PATHNAME) ? L('/') : L('\0'), se - n);-
268 if (endp == 0)
endp == 0Description
TRUEevaluated 86814 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
endp == 0Description
TRUEevaluated 980 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-86814
269 endp = se;
executed 86814 times by 1 test: endp = se;
Executed by:
  • Self test
executed 980 times by 1 test: endp = se;
Executed by:
  • Self test
980-86814
270-
271 c1 = ((flags & FNM_NOESCAPE) == 0 && c == L('\\')) ? *p : c;
(flags & (1 << 1)) == 0Description
TRUEevaluated 86814 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == '\\'Description
TRUEevaluated 330 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 86484 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 1)) == 0Description
TRUEevaluated 980 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == L'\\'Description
TRUEevaluated 180 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 800 times by 1 test
Evaluated by:
  • Self test
0-86814
272 c1 = FOLD (c1);
never executed: end of block
never executed: __res = tolower ( (unsigned char)c1 );
executed 8 times by 1 test: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)c1 )];
Executed by:
  • Self test
sizeof ( (unsi... char)c1 ) > 1Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • Self test
__builtin_cons...gned char)c1 )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 86794 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 980 times by 1 test
Evaluated by:
  • Self test
iswupper (c1)Description
TRUEnever evaluated
FALSEnever evaluated
0-86794
273 for (--p; n < endp; ++n)
n < endpDescription
TRUEevaluated 633708 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 27520 times by 1 test
Evaluated by:
  • Self test
n < endpDescription
TRUEevaluated 5704 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 841 times by 1 test
Evaluated by:
  • Self test
841-633708
274 {-
275 /* Only call strmatch if the first character indicates a-
276 possible match. We can check the first character if-
277 we're not doing an extended glob match. */-
278 if ((flags & FNM_EXTMATCH) == 0 && c != L('[') && FOLD (*n) != c1) /*]*/
never executed: end of block
never executed: __res = tolower ( (unsigned char)*n );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)*n )];
sizeof ( (unsi... char)*n ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...gned char)*n )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 486176 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 5)) == 0Description
TRUEevaluated 630288 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3420 times by 1 test
Evaluated by:
  • Self test
c != '['Description
TRUEevaluated 486190 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 144098 times by 1 test
Evaluated by:
  • Self test
((flags & (1 <...har)*n)) != c1Description
TRUEevaluated 464082 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 22108 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 5)) == 0Description
TRUEevaluated 5704 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c != L'['Description
TRUEevaluated 5704 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
((flags & (1 <... : (*n)) != c1Description
TRUEevaluated 4637 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1067 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 5704 times by 1 test
Evaluated by:
  • Self test
iswupper (*n)Description
TRUEnever evaluated
FALSEnever evaluated
0-630288
279 continue;
executed 464082 times by 1 test: continue;
Executed by:
  • Self test
executed 4637 times by 1 test: continue;
Executed by:
  • Self test
4637-464082
280-
281 /* If we're doing an extended glob match and the pattern is not-
282 one of the extended glob patterns, we can check the first-
283 character. */-
284 if ((flags & FNM_EXTMATCH) && p[1] != L('(') && /*)*/
(flags & (1 << 5))Description
TRUEevaluated 3420 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 166206 times by 1 test
Evaluated by:
  • Self test
p[1] != '('Description
TRUEevaluated 1012 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2408 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 5))Description
TRUEnever evaluated
FALSEevaluated 1067 times by 1 test
Evaluated by:
  • Self test
p[1] != L'('Description
TRUEnever evaluated
FALSEnever evaluated
0-166206
285 STRCHR (L("?*+@!"), *p) == 0 && c != L('[') && FOLD (*n) != c1) /*]*/
never executed: end of block
never executed: __res = tolower ( (unsigned char)*n );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)*n )];
sizeof ( (unsi... char)*n ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...gned char)*n )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 1012 times by 1 test
Evaluated by:
  • Self test
(__extension__... (*p) ))) == 0Description
TRUEevaluated 1012 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
__builtin_constant_p ( (*p) )Description
TRUEnever evaluated
FALSEevaluated 1012 times by 1 test
Evaluated by:
  • Self test
!__builtin_con... ( ("?*+@!") )Description
TRUEnever evaluated
FALSEnever evaluated
( (*p) ) == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
c != '['Description
TRUEevaluated 1012 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
((flags & (1 <...har)*n)) != c1Description
TRUEevaluated 904 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
wcschr((L"?*+@!"), (*p)) == 0Description
TRUEnever evaluated
FALSEnever evaluated
c != L'['Description
TRUEnever evaluated
FALSEnever evaluated
((flags & (1 <... : (*n)) != c1Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEnever evaluated
iswupper (*n)Description
TRUEnever evaluated
FALSEnever evaluated
0-1012
286 continue;
executed 904 times by 1 test: continue;
Executed by:
  • Self test
never executed: continue;
0-904
287-
288 /* Otherwise, we just recurse. */-
289 if (GMATCH (n, se, p, pe, &end, flags & ~FNM_PERIOD) == 0)
gmatch (n, se,...(1 << 2)) == 0Description
TRUEevaluated 59294 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 109428 times by 1 test
Evaluated by:
  • Self test
gmatch_wc (n, ...(1 << 2)) == 0Description
TRUEevaluated 139 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 928 times by 1 test
Evaluated by:
  • Self test
139-109428
290 {-
291 if (end.pattern == NULL)
end.pattern == ((void *)0)Description
TRUEevaluated 135 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 59159 times by 1 test
Evaluated by:
  • Self test
end.pattern == ((void *)0)Description
TRUEevaluated 129 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 10 times by 1 test
Evaluated by:
  • Self test
10-59159
292 return (0);
executed 135 times by 1 test: return (0);
Executed by:
  • Self test
executed 129 times by 1 test: return (0);
Executed by:
  • Self test
129-135
293 break;
executed 59159 times by 1 test: break;
Executed by:
  • Self test
executed 10 times by 1 test: break;
Executed by:
  • Self test
10-59159
294 }-
295 }
executed 109428 times by 1 test: end of block
Executed by:
  • Self test
executed 928 times by 1 test: end of block
Executed by:
  • Self test
928-109428
296 /* This is a clever idea from glibc, used to avoid backtracking-
297 to a `*' that appears earlier in the pattern. We get away-
298 without saving se and pe because they are always the same,-
299 even in the recursive calls to gmatch */ -
300 if (end.pattern != NULL)
end.pattern != ((void *)0)Description
TRUEevaluated 59159 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 27520 times by 1 test
Evaluated by:
  • Self test
end.pattern != ((void *)0)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 841 times by 1 test
Evaluated by:
  • Self test
10-59159
301 {-
302 p = end.pattern;-
303 n = end.string;-
304 continue;
executed 59159 times by 1 test: continue;
Executed by:
  • Self test
executed 10 times by 1 test: continue;
Executed by:
  • Self test
10-59159
305 }-
306-
307 return FNM_NOMATCH;
executed 27520 times by 1 test: return 1;
Executed by:
  • Self test
executed 841 times by 1 test: return 1;
Executed by:
  • Self test
841-27520
308 }-
309-
310 case L('['):
executed 280515 times by 1 test: case '[':
Executed by:
  • Self test
executed 144 times by 1 test: case L'[':
Executed by:
  • Self test
144-280515
311 {-
312 if (sc == L('\0') || n == se)
sc == '\0'Description
TRUEevaluated 191 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 280324 times by 1 test
Evaluated by:
  • Self test
n == seDescription
TRUEnever evaluated
FALSEevaluated 280324 times by 1 test
Evaluated by:
  • Self test
sc == L'\0'Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
n == seDescription
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
0-280324
313 return FNM_NOMATCH;
executed 191 times by 1 test: return 1;
Executed by:
  • Self test
never executed: return 1;
0-191
314-
315 /* A character class cannot match a `.' if it is the first-
316 character of the string or if it is the first character-
317 following a slash and we are matching a pathname. */-
318 if ((flags & FNM_PERIOD) && sc == L('.') &&
(flags & (1 << 2))Description
TRUEevaluated 36812 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 243512 times by 1 test
Evaluated by:
  • Self test
sc == '.'Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 36770 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 2))Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
sc == L'.'Description
TRUEnever evaluated
FALSEnever evaluated
0-243512
319 (n == string || ((flags & FNM_PATHNAME) && n[-1] == L('/'))))
n == stringDescription
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 0))Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
n[-1] == '/'Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • Self test
n == stringDescription
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEnever evaluated
n[-1] == L'/'Description
TRUEnever evaluated
FALSEnever evaluated
0-42
320 return (FNM_NOMATCH);
never executed: return (1);
never executed: return (1);
0
321-
322 p = BRACKMATCH (p, sc, flags);-
323 if (p == 0)
p == 0Description
TRUEevaluated 103457 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 176867 times by 1 test
Evaluated by:
  • Self test
p == 0Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 76 times by 1 test
Evaluated by:
  • Self test
68-176867
324 return FNM_NOMATCH;
executed 103457 times by 1 test: return 1;
Executed by:
  • Self test
executed 68 times by 1 test: return 1;
Executed by:
  • Self test
68-103457
325 }-
326 break;
executed 176867 times by 1 test: break;
Executed by:
  • Self test
executed 76 times by 1 test: break;
Executed by:
  • Self test
76-176867
327-
328 default:
executed 31160344 times by 1 test: default:
Executed by:
  • Self test
executed 2839 times by 1 test: default:
Executed by:
  • Self test
2839-31160344
329 if ((U_CHAR)c != FOLD (sc))
never executed: end of block
never executed: __res = tolower ( (unsigned char)sc );
executed 1 time by 1 test: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)sc )];
Executed by:
  • Self test
(unsigned char...gned char)sc))Description
TRUEevaluated 14397023 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16763321 times by 1 test
Evaluated by:
  • Self test
(wint_t)c != (...r (sc) : (sc))Description
TRUEevaluated 719 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2120 times by 1 test
Evaluated by:
  • Self test
sizeof ( (unsi... char)sc ) > 1Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
__builtin_cons...gned char)sc )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 31160312 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 31 times by 1 test
Evaluated by:
  • Self test
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 2839 times by 1 test
Evaluated by:
  • Self test
iswupper (sc)Description
TRUEnever evaluated
FALSEnever evaluated
0-31160312
330 return (FNM_NOMATCH);
executed 14397023 times by 1 test: return (1);
Executed by:
  • Self test
executed 719 times by 1 test: return (1);
Executed by:
  • Self test
719-14397023
331 }
executed 16763321 times by 1 test: end of block
Executed by:
  • Self test
executed 2120 times by 1 test: end of block
Executed by:
  • Self test
2120-16763321
332-
333 ++n;-
334 }
executed 100786373 times by 1 test: end of block
Executed by:
  • Self test
executed 1532297 times by 1 test: end of block
Executed by:
  • Self test
1532297-100786373
335-
336 if (n == se)
n == seDescription
TRUEevaluated 23050972 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5231239 times by 1 test
Evaluated by:
  • Self test
n == seDescription
TRUEevaluated 863901 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 667161 times by 1 test
Evaluated by:
  • Self test
667161-23050972
337 return (0);
executed 23050972 times by 1 test: return (0);
Executed by:
  • Self test
executed 863901 times by 1 test: return (0);
Executed by:
  • Self test
863901-23050972
338-
339 if ((flags & FNM_LEADING_DIR) && *n == L('/'))
(flags & (1 << 3))Description
TRUEnever evaluated
FALSEevaluated 5231239 times by 1 test
Evaluated by:
  • Self test
*n == '/'Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 3))Description
TRUEnever evaluated
FALSEevaluated 667161 times by 1 test
Evaluated by:
  • Self test
*n == L'/'Description
TRUEnever evaluated
FALSEnever evaluated
0-5231239
340 /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */-
341 return 0;
never executed: return 0;
never executed: return 0;
0
342 -
343 return (FNM_NOMATCH);
executed 5231239 times by 1 test: return (1);
Executed by:
  • Self test
executed 667161 times by 1 test: return (1);
Executed by:
  • Self test
667161-5231239
344}-
345-
346/* Parse a bracket expression collating symbol ([.sym.]) starting at P, find-
347 the value of the symbol, and move P past the collating symbol expression.-
348 The value is returned in *VP, if VP is not null. */-
349static CHAR *-
350PARSE_COLLSYM (p, vp)-
351 CHAR *p;-
352 INT *vp;-
353{-
354 register int pc;-
355 INT val;-
356-
357 p++; /* move past the `.' */-
358 -
359 for (pc = 0; p[pc]; pc++)
p[pc]Description
TRUEevaluated 87 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
p[pc]Description
TRUEnever evaluated
FALSEnever evaluated
0-87
360 if (p[pc] == L('.') && p[pc+1] == L(']'))
p[pc] == '.'Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 62 times by 1 test
Evaluated by:
  • Self test
p[pc+1] == ']'Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
p[pc] == L'.'Description
TRUEnever evaluated
FALSEnever evaluated
p[pc+1] == L']'Description
TRUEnever evaluated
FALSEnever evaluated
0-62
361 break;
executed 25 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-25
362 if (p[pc] == 0)
p[pc] == 0Description
TRUEnever evaluated
FALSEevaluated 25 times by 1 test
Evaluated by:
  • Self test
p[pc] == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-25
363 {-
364 if (vp)
vpDescription
TRUEnever evaluated
FALSEnever evaluated
vpDescription
TRUEnever evaluated
FALSEnever evaluated
0
365 *vp = INVALID;
never executed: *vp = -1;
never executed: *vp = (0xffffffffu) ;
0
366 return (p + pc);
never executed: return (p + pc);
never executed: return (p + pc);
0
367 }-
368 val = COLLSYM (p, pc);-
369 if (vp)
vpDescription
TRUEevaluated 25 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
vpDescription
TRUEnever evaluated
FALSEnever evaluated
0-25
370 *vp = val;
executed 25 times by 1 test: *vp = val;
Executed by:
  • Self test
never executed: *vp = val;
0-25
371 return (p + pc + 2);
executed 25 times by 1 test: return (p + pc + 2);
Executed by:
  • Self test
never executed: return (p + pc + 2);
0-25
372}-
373-
374/* Use prototype definition here because of type promotion. */-
375static CHAR *-
376#if defined (PROTOTYPES)-
377BRACKMATCH (CHAR *p, U_CHAR test, int flags)-
378#else-
379BRACKMATCH (p, test, flags)-
380 CHAR *p;-
381 U_CHAR test;-
382 int flags;-
383#endif-
384{-
385 register CHAR cstart, cend, c;-
386 register int not; /* Nonzero if the sense of the character class is inverted. */-
387 int brcnt, brchr, forcecoll;-
388 INT pc;-
389 CHAR *savep;-
390 U_CHAR orig_test;-
391-
392 orig_test = test;-
393 test = FOLD (orig_test);
never executed: end of block
never executed: __res = tolower ( (unsigned char)orig_test );
executed 1 time by 1 test: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)orig_test )];
Executed by:
  • Self test
sizeof ( (unsi...rig_test ) > 1Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
__builtin_cons...ar)orig_test )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 280276 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 47 times by 1 test
Evaluated by:
  • Self test
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
iswupper (orig_test)Description
TRUEnever evaluated
FALSEnever evaluated
0-280276
394-
395 savep = p;-
396-
397 /* POSIX.2 3.13.1 says that an exclamation mark (`!') shall replace the-
398 circumflex (`^') in its role in a `nonmatching list'. A bracket-
399 expression starting with an unquoted circumflex character produces-
400 unspecified results. This implementation treats the two identically. */-
401 if (not = (*p == L('!') || *p == L('^')))
*p == '!'Description
TRUEevaluated 28638 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 251686 times by 1 test
Evaluated by:
  • Self test
*p == '^'Description
TRUEevaluated 116838 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 134848 times by 1 test
Evaluated by:
  • Self test
*p == L'!'Description
TRUEevaluated 144 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
*p == L'^'Description
TRUEnever evaluated
FALSEnever evaluated
0-251686
402 ++p;
executed 145476 times by 1 test: ++p;
Executed by:
  • Self test
executed 144 times by 1 test: ++p;
Executed by:
  • Self test
144-145476
403-
404 c = *p++;-
405 for (;;)-
406 {-
407 /* Initialize cstart and cend in case `-' is the last-
408 character of the pattern. */-
409 cstart = cend = c;-
410 forcecoll = 0;-
411-
412 /* POSIX.2 equivalence class: [=c=]. See POSIX.2 2.8.3.2. Find-
413 the end of the equivalence class, move the pattern pointer past-
414 it, and check for equivalence. XXX - this handles only-
415 single-character equivalence classes, which is wrong, or at-
416 least incomplete. */-
417 if (c == L('[') && *p == L('=') && p[2] == L('=') && p[3] == L(']'))
c == '['Description
TRUEevaluated 97129 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 273825 times by 1 test
Evaluated by:
  • Self test
*p == '='Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 97126 times by 1 test
Evaluated by:
  • Self test
p[2] == '='Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
p[3] == ']'Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == L'['Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
*p == L'='Description
TRUEnever evaluated
FALSEnever evaluated
p[2] == L'='Description
TRUEnever evaluated
FALSEnever evaluated
p[3] == L']'Description
TRUEnever evaluated
FALSEnever evaluated
0-273825
418 {-
419 pc = FOLD (p[1]);
never executed: end of block
never executed: __res = tolower ( (unsigned char)p[1] );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)p[1] )];
sizeof ( (unsi...har)p[1] ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...ed char)p[1] )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEnever evaluated
iswupper (p[1])Description
TRUEnever evaluated
FALSEnever evaluated
0-3
420 p += 4;-
421 if (COLLEQUIV (test, pc))
collequiv((test), (pc))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
collequiv_wc((test), (pc))Description
TRUEnever evaluated
FALSEnever evaluated
0-2
422 {-
423/*[*/ /* Move past the closing `]', since the first thing we do at-
424 the `matched:' label is back p up one. */-
425 p++;-
426 goto matched;
executed 1 time by 1 test: goto matched;
Executed by:
  • Self test
never executed: goto matched;
0-1
427 }-
428 else-
429 {-
430 c = *p++;-
431 if (c == L('\0'))
c == '\0'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
c == L'\0'Description
TRUEnever evaluated
FALSEnever evaluated
0-1
432 return ((test == L('[')) ? savep : (CHAR *)0); /*]*/
executed 1 time by 1 test: return ((test == '[') ? savep : (unsigned char *)0);
Executed by:
  • Self test
never executed: return ((test == L'[') ? savep : (wchar_t *)0);
0-1
433 c = FOLD (c);
never executed: end of block
never executed: __res = tolower ( (unsigned char)c );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)c )];
sizeof ( (unsi...d char)c ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...igned char)c )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEnever evaluated
iswupper (c)Description
TRUEnever evaluated
FALSEnever evaluated
0-1
434 continue;
executed 1 time by 1 test: continue;
Executed by:
  • Self test
never executed: continue;
0-1
435 }-
436 }-
437-
438 /* POSIX.2 character class expression. See POSIX.2 2.8.3.2. */-
439 if (c == L('[') && *p == L(':'))
c == '['Description
TRUEevaluated 97126 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 273825 times by 1 test
Evaluated by:
  • Self test
*p == ':'Description
TRUEevaluated 79317 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 17809 times by 1 test
Evaluated by:
  • Self test
c == L'['Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
*p == L':'Description
TRUEnever evaluated
FALSEnever evaluated
0-273825
440 {-
441 CHAR *close, *ccname;-
442-
443 pc = 0; /* make sure invalid char classes don't match. */-
444 /* Find end of character class name */-
445 for (close = p + 1; *close != '\0'; close++)
*close != '\0'Description
TRUEevaluated 475915 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
*close != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
0-475915
446 if (*close == L(':') && *(close+1) == L(']'))
*close == ':'Description
TRUEevaluated 79303 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 396612 times by 1 test
Evaluated by:
  • Self test
*(close+1) == ']'Description
TRUEevaluated 79303 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
*close == L':'Description
TRUEnever evaluated
FALSEnever evaluated
*(close+1) == L']'Description
TRUEnever evaluated
FALSEnever evaluated
0-396612
447 break;
executed 79303 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-79303
448-
449 if (*close != L('\0'))
*close != '\0'Description
TRUEevaluated 79303 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
*close != L'\0'Description
TRUEnever evaluated
FALSEnever evaluated
0-79303
450 {-
451 ccname = (CHAR *)malloc ((close - p) * sizeof (CHAR));-
452 if (ccname == 0)
ccname == 0Description
TRUEnever evaluated
FALSEevaluated 79303 times by 1 test
Evaluated by:
  • Self test
ccname == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-79303
453 pc = 0;
never executed: pc = 0;
never executed: pc = 0;
0
454 else-
455 {-
456 bcopy (p + 1, ccname, (close - p - 1) * sizeof (CHAR));-
457 *(ccname + (close - p - 1)) = L('\0');-
458 pc = IS_CCLASS (orig_test, (XCHAR *)ccname);-
459 }
executed 79303 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-79303
460 if (pc == -1)
pc == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 79302 times by 1 test
Evaluated by:
  • Self test
pc == -1Description
TRUEnever evaluated
FALSEnever evaluated
0-79302
461 pc = 0;
executed 1 time by 1 test: pc = 0;
Executed by:
  • Self test
never executed: pc = 0;
0-1
462 else-
463 p = close + 2; /* move past the closing `]' */
executed 79302 times by 1 test: p = close + 2;
Executed by:
  • Self test
never executed: p = close + 2;
0-79302
464-
465 free (ccname);-
466 }
executed 79303 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-79303
467 -
468 if (pc)
pcDescription
TRUEevaluated 71222 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 8095 times by 1 test
Evaluated by:
  • Self test
pcDescription
TRUEnever evaluated
FALSEnever evaluated
0-71222
469 {-
470/*[*/ /* Move past the closing `]', since the first thing we do at-
471 the `matched:' label is back p up one. */-
472 p++;-
473 goto matched;
executed 71222 times by 1 test: goto matched;
Executed by:
  • Self test
never executed: goto matched;
0-71222
474 }-
475 else-
476 {-
477 /* continue the loop here, since this expression can't be-
478 the first part of a range expression. */-
479 c = *p++;-
480 if (c == L('\0'))
c == '\0'Description
TRUEnever evaluated
FALSEevaluated 8095 times by 1 test
Evaluated by:
  • Self test
c == L'\0'Description
TRUEnever evaluated
FALSEnever evaluated
0-8095
481 return ((test == L('[')) ? savep : (CHAR *)0);
never executed: return ((test == '[') ? savep : (unsigned char *)0);
never executed: return ((test == L'[') ? savep : (wchar_t *)0);
0
482 else if (c == L(']'))
c == ']'Description
TRUEevaluated 4067 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4028 times by 1 test
Evaluated by:
  • Self test
c == L']'Description
TRUEnever evaluated
FALSEnever evaluated
0-4067
483 break;
executed 4067 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-4067
484 c = FOLD (c);
never executed: end of block
never executed: __res = tolower ( (unsigned char)c );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)c )];
sizeof ( (unsi...d char)c ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...igned char)c )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 4028 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEnever evaluated
iswupper (c)Description
TRUEnever evaluated
FALSEnever evaluated
0-4028
485 continue;
executed 4028 times by 1 test: continue;
Executed by:
  • Self test
never executed: continue;
0-4028
486 }-
487 }-
488 -
489 /* POSIX.2 collating symbols. See POSIX.2 2.8.3.2. Find the end of-
490 the symbol name, make sure it is terminated by `.]', translate-
491 the name to a character using the external table, and do the-
492 comparison. */-
493 if (c == L('[') && *p == L('.'))
c == '['Description
TRUEevaluated 17809 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 273825 times by 1 test
Evaluated by:
  • Self test
*p == '.'Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 17790 times by 1 test
Evaluated by:
  • Self test
c == L'['Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
*p == L'.'Description
TRUEnever evaluated
FALSEnever evaluated
0-273825
494 {-
495 p = PARSE_COLLSYM (p, &pc);-
496 /* An invalid collating symbol cannot be the first point of a-
497 range. If it is, we set cstart to one greater than `test',-
498 so any comparisons later will fail. */-
499 cstart = (pc == INVALID) ? test + 1 : pc;
(pc == -1)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 13 times by 1 test
Evaluated by:
  • Self test
(pc == (0xffffffffu) )Description
TRUEnever evaluated
FALSEnever evaluated
0-13
500 forcecoll = 1;-
501 }
executed 19 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-19
502-
503 if (!(flags & FNM_NOESCAPE) && c == L('\\'))
!(flags & (1 << 1))Description
TRUEevaluated 291634 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == '\\'Description
TRUEevaluated 343 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 291291 times by 1 test
Evaluated by:
  • Self test
!(flags & (1 << 1))Description
TRUEevaluated 144 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == L'\\'Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
0-291634
504 {-
505 if (*p == '\0')
*p == '\0'Description
TRUEnever evaluated
FALSEevaluated 343 times by 1 test
Evaluated by:
  • Self test
*p == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
0-343
506 return (CHAR *)0;
never executed: return (unsigned char *)0;
never executed: return (wchar_t *)0;
0
507 cstart = cend = *p++;-
508 }
executed 343 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-343
509-
510 cstart = cend = FOLD (cstart);
never executed: end of block
never executed: __res = tolower ( (unsigned char)cstart );
executed 14 times by 1 test: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)cstart )];
Executed by:
  • Self test
sizeof ( (unsi...r)cstart ) > 1Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
__builtin_cons... char)cstart )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 291566 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 54 times by 1 test
Evaluated by:
  • Self test
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
iswupper (cstart)Description
TRUEnever evaluated
FALSEnever evaluated
0-291566
511-
512 /* POSIX.2 2.8.3.1.2 says: `An expression containing a `[' that-
513 is not preceded by a backslash and is not part of a bracket-
514 expression produces undefined results.' This implementation-
515 treats the `[' as just a character to be matched if there is-
516 not a closing `]'. */-
517 if (c == L('\0'))
c == '\0'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 291632 times by 1 test
Evaluated by:
  • Self test
c == L'\0'Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
0-291632
518 return ((test == L('[')) ? savep : (CHAR *)0);
executed 2 times by 1 test: return ((test == '[') ? savep : (unsigned char *)0);
Executed by:
  • Self test
never executed: return ((test == L'[') ? savep : (wchar_t *)0);
0-2
519-
520 c = *p++;-
521 c = FOLD (c);
never executed: end of block
never executed: __res = tolower ( (unsigned char)c );
executed 28 times by 1 test: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)c )];
Executed by:
  • Self test
sizeof ( (unsi...d char)c ) > 1Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test
__builtin_cons...igned char)c )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 291564 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 40 times by 1 test
Evaluated by:
  • Self test
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
iswupper (c)Description
TRUEnever evaluated
FALSEnever evaluated
0-291564
522-
523 if (c == L('\0'))
c == '\0'Description
TRUEevaluated 513 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 291119 times by 1 test
Evaluated by:
  • Self test
c == L'\0'Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
0-291119
524 return ((test == L('[')) ? savep : (CHAR *)0);
executed 513 times by 1 test: return ((test == '[') ? savep : (unsigned char *)0);
Executed by:
  • Self test
never executed: return ((test == L'[') ? savep : (wchar_t *)0);
0-513
525-
526 if ((flags & FNM_PATHNAME) && c == L('/'))
(flags & (1 << 0))Description
TRUEevaluated 69307 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 221812 times by 1 test
Evaluated by:
  • Self test
c == '/'Description
TRUEnever evaluated
FALSEevaluated 69307 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 0))Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
c == L'/'Description
TRUEnever evaluated
FALSEnever evaluated
0-221812
527 /* [/] can never match when matching a pathname. */-
528 return (CHAR *)0;
never executed: return (unsigned char *)0;
never executed: return (wchar_t *)0;
0
529-
530 /* This introduces a range, unless the `-' is the last-
531 character of the class. Find the end of the range-
532 and move past it. */-
533 if (c == L('-') && *p != L(']'))
c == '-'Description
TRUEevaluated 38281 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 252838 times by 1 test
Evaluated by:
  • Self test
*p != ']'Description
TRUEevaluated 38274 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7 times by 1 test
Evaluated by:
  • Self test
c == L'-'Description
TRUEnever evaluated
FALSEevaluated 144 times by 1 test
Evaluated by:
  • Self test
*p != L']'Description
TRUEnever evaluated
FALSEnever evaluated
0-252838
534 {-
535 cend = *p++;-
536 if (!(flags & FNM_NOESCAPE) && cend == L('\\'))
!(flags & (1 << 1))Description
TRUEevaluated 38274 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
cend == '\\'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 38273 times by 1 test
Evaluated by:
  • Self test
!(flags & (1 << 1))Description
TRUEnever evaluated
FALSEnever evaluated
cend == L'\\'Description
TRUEnever evaluated
FALSEnever evaluated
0-38274
537 cend = *p++;
executed 1 time by 1 test: cend = *p++;
Executed by:
  • Self test
never executed: cend = *p++;
0-1
538 if (cend == L('\0'))
cend == '\0'Description
TRUEnever evaluated
FALSEevaluated 38274 times by 1 test
Evaluated by:
  • Self test
cend == L'\0'Description
TRUEnever evaluated
FALSEnever evaluated
0-38274
539 return (CHAR *)0;
never executed: return (unsigned char *)0;
never executed: return (wchar_t *)0;
0
540 if (cend == L('[') && *p == L('.'))
cend == '['Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 38268 times by 1 test
Evaluated by:
  • Self test
*p == '.'Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
cend == L'['Description
TRUEnever evaluated
FALSEnever evaluated
*p == L'.'Description
TRUEnever evaluated
FALSEnever evaluated
0-38268
541 {-
542 p = PARSE_COLLSYM (p, &pc);-
543 /* An invalid collating symbol cannot be the second part of a-
544 range expression. If we get one, we set cend to one fewer-
545 than the test character to make sure the range test fails. */-
546 cend = (pc == INVALID) ? test - 1 : pc;
(pc == -1)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
(pc == (0xffffffffu) )Description
TRUEnever evaluated
FALSEnever evaluated
0-5
547 forcecoll = 1;-
548 }
executed 6 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-6
549 cend = FOLD (cend);
never executed: end of block
never executed: __res = tolower ( (unsigned char)cend );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)cend )];
sizeof ( (unsi...har)cend ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...ed char)cend )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 38274 times by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEnever evaluated
iswupper (cend)Description
TRUEnever evaluated
FALSEnever evaluated
0-38274
550-
551 c = *p++;-
552-
553 /* POSIX.2 2.8.3.2: ``The ending range point shall collate-
554 equal to or higher than the starting range point; otherwise-
555 the expression shall be treated as invalid.'' Note that this-
556 applies to only the range expression; the rest of the bracket-
557 expression is still checked for matches. */-
558 if (RANGECMP (cstart, cend, forcecoll) > 0)
rangecmp((csta...orcecoll)) > 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 38272 times by 1 test
Evaluated by:
  • Self test
rangecmp_wc((c...orcecoll)) > 0Description
TRUEnever evaluated
FALSEnever evaluated
0-38272
559 {-
560 if (c == L(']'))
c == ']'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
c == L']'Description
TRUEnever evaluated
FALSEnever evaluated
0-1
561 break;
executed 1 time by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-1
562 c = FOLD (c);
never executed: end of block
never executed: __res = tolower ( (unsigned char)c );
never executed: __res = (*__ctype_tolower_loc ())[(int) ( (unsigned char)c )];
sizeof ( (unsi...d char)c ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...igned char)c )Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
((*__ctype_b_l...int) _ISupper)Description
TRUEnever evaluated
FALSEnever evaluated
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 4))Description
TRUEnever evaluated
FALSEnever evaluated
iswupper (c)Description
TRUEnever evaluated
FALSEnever evaluated
0-1
563 continue;
executed 1 time by 1 test: continue;
Executed by:
  • Self test
never executed: continue;
0-1
564 }-
565 }
executed 38272 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-38272
566-
567 if (RANGECMP (test, cstart, forcecoll) >= 0 && RANGECMP (test, cend, forcecoll) <= 0)
rangecmp((test...rcecoll)) >= 0Description
TRUEevaluated 225541 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 65576 times by 1 test
Evaluated by:
  • Self test
rangecmp((test...rcecoll)) <= 0Description
TRUEevaluated 41569 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 183972 times by 1 test
Evaluated by:
  • Self test
rangecmp_wc((t...rcecoll)) >= 0Description
TRUEevaluated 144 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
rangecmp_wc((t...rcecoll)) <= 0Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 76 times by 1 test
Evaluated by:
  • Self test
0-225541
568 goto matched;
executed 41569 times by 1 test: goto matched;
Executed by:
  • Self test
executed 68 times by 1 test: goto matched;
Executed by:
  • Self test
68-41569
569-
570 if (c == L(']'))
c == ']'Description
TRUEevaluated 162948 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 86600 times by 1 test
Evaluated by:
  • Self test
c == L']'Description
TRUEevaluated 76 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-162948
571 break;
executed 162948 times by 1 test: break;
Executed by:
  • Self test
executed 76 times by 1 test: break;
Executed by:
  • Self test
76-162948
572 }
executed 86600 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-86600
573 /* No match. */-
574 return (!not ? (CHAR *)0 : p);
executed 167016 times by 1 test: return (!not ? (unsigned char *)0 : p);
Executed by:
  • Self test
executed 76 times by 1 test: return (!not ? (wchar_t *)0 : p);
Executed by:
  • Self test
76-167016
575-
576matched:-
577 /* Skip the rest of the [...] that already matched. */-
578 c = *--p;-
579 brcnt = 1;-
580 brchr = 0;-
581 while (brcnt > 0)
brcnt > 0Description
TRUEevaluated 303898 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 112665 times by 1 test
Evaluated by:
  • Self test
brcnt > 0Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 68 times by 1 test
Evaluated by:
  • Self test
68-303898
582 {-
583 int oc;-
584-
585 /* A `[' without a matching `]' is just another character to match. */-
586 if (c == L('\0'))
c == '\0'Description
TRUEevaluated 127 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 303771 times by 1 test
Evaluated by:
  • Self test
c == L'\0'Description
TRUEnever evaluated
FALSEevaluated 68 times by 1 test
Evaluated by:
  • Self test
0-303771
587 return ((test == L('[')) ? savep : (CHAR *)0);
executed 127 times by 1 test: return ((test == '[') ? savep : (unsigned char *)0);
Executed by:
  • Self test
never executed: return ((test == L'[') ? savep : (wchar_t *)0);
0-127
588-
589 oc = c;-
590 c = *p++;-
591 if (c == L('[') && (*p == L('=') || *p == L(':') || *p == L('.')))
c == '['Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 303767 times by 1 test
Evaluated by:
  • Self test
*p == '='Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test
*p == ':'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test
*p == '.'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
c == L'['Description
TRUEnever evaluated
FALSEevaluated 68 times by 1 test
Evaluated by:
  • Self test
*p == L'='Description
TRUEnever evaluated
FALSEnever evaluated
*p == L':'Description
TRUEnever evaluated
FALSEnever evaluated
*p == L'.'Description
TRUEnever evaluated
FALSEnever evaluated
0-303767
592 {-
593 brcnt++;-
594 brchr = *p;-
595 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-2
596 /* we only want to check brchr if we set it above */-
597 else if (c == L(']') && brcnt > 1 && brchr != 0 && oc == brchr)
c == ']'Description
TRUEevaluated 112667 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 191102 times by 1 test
Evaluated by:
  • Self test
brcnt > 1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 112665 times by 1 test
Evaluated by:
  • Self test
brchr != 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
oc == brchrDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == L']'Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
brcnt > 1Description
TRUEnever evaluated
FALSEevaluated 68 times by 1 test
Evaluated by:
  • Self test
brchr != 0Description
TRUEnever evaluated
FALSEnever evaluated
oc == brchrDescription
TRUEnever evaluated
FALSEnever evaluated
0-191102
598 brcnt--;
executed 2 times by 1 test: brcnt--;
Executed by:
  • Self test
never executed: brcnt--;
0-2
599 else if (c == L(']') && brcnt == 1)
c == ']'Description
TRUEevaluated 112665 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 191102 times by 1 test
Evaluated by:
  • Self test
brcnt == 1Description
TRUEevaluated 112665 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == L']'Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
brcnt == 1Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-191102
600 brcnt--;
executed 112665 times by 1 test: brcnt--;
Executed by:
  • Self test
executed 68 times by 1 test: brcnt--;
Executed by:
  • Self test
68-112665
601 else if (!(flags & FNM_NOESCAPE) && c == L('\\'))
!(flags & (1 << 1))Description
TRUEevaluated 191102 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == '\\'Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 191091 times by 1 test
Evaluated by:
  • Self test
!(flags & (1 << 1))Description
TRUEnever evaluated
FALSEnever evaluated
c == L'\\'Description
TRUEnever evaluated
FALSEnever evaluated
0-191102
602 {-
603 if (*p == '\0')
*p == '\0'Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
*p == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
0-11
604 return (CHAR *)0;
never executed: return (unsigned char *)0;
never executed: return (wchar_t *)0;
0
605 /* XXX 1003.2d11 is unclear if this is right. */-
606 ++p;-
607 }
executed 11 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-11
608 }
executed 303771 times by 1 test: end of block
Executed by:
  • Self test
executed 68 times by 1 test: end of block
Executed by:
  • Self test
68-303771
609 return (not ? (CHAR *)0 : p);
executed 112665 times by 1 test: return (not ? (unsigned char *)0 : p);
Executed by:
  • Self test
executed 68 times by 1 test: return (not ? (wchar_t *)0 : p);
Executed by:
  • Self test
68-112665
610}-
611-
612#if defined (EXTENDED_GLOB)-
613/* ksh-like extended pattern matching:-
614-
615 [?*+@!](pat-list)-
616-
617 where pat-list is a list of one or patterns separated by `|'. Operation-
618 is as follows:-
619-
620 ?(patlist) match zero or one of the given patterns-
621 *(patlist) match zero or more of the given patterns-
622 +(patlist) match one or more of the given patterns-
623 @(patlist) match exactly one of the given patterns-
624 !(patlist) match anything except one of the given patterns-
625*/-
626-
627/* Scan a pattern starting at STRING and ending at END, keeping track of-
628 embedded () and []. If DELIM is 0, we scan until a matching `)'-
629 because we're scanning a `patlist'. Otherwise, we scan until we see-
630 DELIM. In all cases, we never scan past END. The return value is the-
631 first character after the matching DELIM or NULL if the pattern is-
632 empty or invalid. */-
633/*static*/ CHAR *-
634PATSCAN (string, end, delim)-
635 CHAR *string, *end;-
636 INT delim;-
637{-
638 int pnest, bnest, skip;-
639 INT cchar;-
640 CHAR *s, c, *bfirst;-
641-
642 pnest = bnest = skip = 0;-
643 cchar = 0;-
644 bfirst = NULL;-
645-
646 if (string == end)
string == endDescription
TRUEevaluated 69 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 23102 times by 1 test
Evaluated by:
  • Self test
string == endDescription
TRUEnever evaluated
FALSEevaluated 152 times by 1 test
Evaluated by:
  • Self test
0-23102
647 return (NULL);
executed 69 times by 1 test: return ( ((void *)0) );
Executed by:
  • Self test
never executed: return ( ((void *)0) );
0-69
648-
649 for (s = string; c = *s; s++)
c = *sDescription
TRUEevaluated 383270 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 10 times by 1 test
Evaluated by:
  • Self test
c = *sDescription
TRUEevaluated 482 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-383270
650 {-
651 if (s >= end)
s >= endDescription
TRUEevaluated 2291 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 380979 times by 1 test
Evaluated by:
  • Self test
s >= endDescription
TRUEnever evaluated
FALSEevaluated 482 times by 1 test
Evaluated by:
  • Self test
0-380979
652 return (s);
executed 2291 times by 1 test: return (s);
Executed by:
  • Self test
never executed: return (s);
0-2291
653 if (skip)
skipDescription
TRUEnever evaluated
FALSEevaluated 380979 times by 1 test
Evaluated by:
  • Self test
skipDescription
TRUEnever evaluated
FALSEevaluated 482 times by 1 test
Evaluated by:
  • Self test
0-380979
654 {-
655 skip = 0;-
656 continue;
never executed: continue;
never executed: continue;
0
657 }-
658 switch (c)-
659 {-
660 case L('\\'):
never executed: case '\\':
never executed: case L'\\':
0
661 skip = 1;-
662 break;
never executed: break;
never executed: break;
0
663-
664 case L('\0'):
never executed: case '\0':
never executed: case L'\0':
0
665 return ((CHAR *)NULL);
never executed: return ((unsigned char *) ((void *)0) );
never executed: return ((wchar_t *) ((void *)0) );
0
666-
667 /* `[' is not special inside a bracket expression, but it may-
668 introduce one of the special POSIX bracket expressions-
669 ([.SYM.], [=c=], [: ... :]) that needs special handling. */-
670 case L('['):
executed 600 times by 1 test: case '[':
Executed by:
  • Self test
never executed: case L'[':
0-600
671 if (bnest == 0)
bnest == 0Description
TRUEevaluated 417 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 183 times by 1 test
Evaluated by:
  • Self test
bnest == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-417
672 {-
673 bfirst = s + 1;-
674 if (*bfirst == L('!') || *bfirst == L('^'))
*bfirst == '!'Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 400 times by 1 test
Evaluated by:
  • Self test
*bfirst == '^'Description
TRUEevaluated 84 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 316 times by 1 test
Evaluated by:
  • Self test
*bfirst == L'!'Description
TRUEnever evaluated
FALSEnever evaluated
*bfirst == L'^'Description
TRUEnever evaluated
FALSEnever evaluated
0-400
675 bfirst++;
executed 101 times by 1 test: bfirst++;
Executed by:
  • Self test
never executed: bfirst++;
0-101
676 bnest++;-
677 }
executed 417 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-417
678 else if (s[1] == L(':') || s[1] == L('.') || s[1] == L('='))
s[1] == ':'Description
TRUEevaluated 183 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
s[1] == '.'Description
TRUEnever evaluated
FALSEnever evaluated
s[1] == '='Description
TRUEnever evaluated
FALSEnever evaluated
s[1] == L':'Description
TRUEnever evaluated
FALSEnever evaluated
s[1] == L'.'Description
TRUEnever evaluated
FALSEnever evaluated
s[1] == L'='Description
TRUEnever evaluated
FALSEnever evaluated
0-183
679 cchar = s[1];
executed 183 times by 1 test: cchar = s[1];
Executed by:
  • Self test
never executed: cchar = s[1];
0-183
680 break;
executed 600 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-600
681-
682 /* `]' is not special if it's the first char (after a leading `!'-
683 or `^') in a bracket expression or if it's part of one of the-
684 special POSIX bracket expressions ([.SYM.], [=c=], [: ... :]) */-
685 case L(']'):
executed 565 times by 1 test: case ']':
Executed by:
  • Self test
never executed: case L']':
0-565
686 if (bnest)
bnestDescription
TRUEevaluated 565 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
bnestDescription
TRUEnever evaluated
FALSEnever evaluated
0-565
687 {-
688 if (cchar && s[-1] == cchar)
ccharDescription
TRUEevaluated 183 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 382 times by 1 test
Evaluated by:
  • Self test
s[-1] == ccharDescription
TRUEevaluated 183 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
ccharDescription
TRUEnever evaluated
FALSEnever evaluated
s[-1] == ccharDescription
TRUEnever evaluated
FALSEnever evaluated
0-382
689 cchar = 0;
executed 183 times by 1 test: cchar = 0;
Executed by:
  • Self test
never executed: cchar = 0;
0-183
690 else if (s != bfirst)
s != bfirstDescription
TRUEevaluated 382 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
s != bfirstDescription
TRUEnever evaluated
FALSEnever evaluated
0-382
691 {-
692 bnest--;-
693 bfirst = 0;-
694 }
executed 382 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-382
695 }
executed 565 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-565
696 break;
executed 565 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-565
697-
698 case L('('):
executed 16435 times by 1 test: case '(':
Executed by:
  • Self test
never executed: case L'(':
0-16435
699 if (bnest == 0)
bnest == 0Description
TRUEevaluated 16435 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
bnest == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-16435
700 pnest++;
executed 16435 times by 1 test: pnest++;
Executed by:
  • Self test
never executed: pnest++;
0-16435
701 break;
executed 16435 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-16435
702-
703 case L(')'):
executed 33901 times by 1 test: case ')':
Executed by:
  • Self test
executed 100 times by 1 test: case L')':
Executed by:
  • Self test
100-33901
704 if (bnest == 0 && pnest-- <= 0)
bnest == 0Description
TRUEevaluated 33866 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 35 times by 1 test
Evaluated by:
  • Self test
pnest-- <= 0Description
TRUEevaluated 17431 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16435 times by 1 test
Evaluated by:
  • Self test
bnest == 0Description
TRUEevaluated 100 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
pnest-- <= 0Description
TRUEevaluated 100 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-33866
705 return ++s;
executed 17431 times by 1 test: return ++s;
Executed by:
  • Self test
executed 100 times by 1 test: return ++s;
Executed by:
  • Self test
100-17431
706 break;
executed 16470 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-16470
707-
708 case L('|'):
executed 52602 times by 1 test: case '|':
Executed by:
  • Self test
executed 104 times by 1 test: case L'|':
Executed by:
  • Self test
104-52602
709 if (bnest == 0 && pnest == 0 && delim == L('|'))
bnest == 0Description
TRUEevaluated 52602 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
pnest == 0Description
TRUEevaluated 6673 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 45929 times by 1 test
Evaluated by:
  • Self test
delim == '|'Description
TRUEevaluated 3370 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3303 times by 1 test
Evaluated by:
  • Self test
bnest == 0Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
pnest == 0Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
delim == L'|'Description
TRUEevaluated 52 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 52 times by 1 test
Evaluated by:
  • Self test
0-52602
710 return ++s;
executed 3370 times by 1 test: return ++s;
Executed by:
  • Self test
executed 52 times by 1 test: return ++s;
Executed by:
  • Self test
52-3370
711 break;
executed 49232 times by 1 test: break;
Executed by:
  • Self test
executed 52 times by 1 test: break;
Executed by:
  • Self test
52-49232
712 }-
713 }
executed 360178 times by 1 test: end of block
Executed by:
  • Self test
executed 330 times by 1 test: end of block
Executed by:
  • Self test
330-360178
714-
715 return (NULL);
executed 10 times by 1 test: return ( ((void *)0) );
Executed by:
  • Self test
never executed: return ( ((void *)0) );
0-10
716}-
717-
718/* Return 0 if dequoted pattern matches S in the current locale. */-
719static int-
720STRCOMPARE (p, pe, s, se)-
721 CHAR *p, *pe, *s, *se;-
722{-
723 int ret;-
724 CHAR c1, c2;-
725 int l1, l2;-
726-
727 l1 = pe - p;-
728 l2 = se - s;-
729-
730 if (l1 != l2)
l1 != l2Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
l1 != l2Description
TRUEnever evaluated
FALSEnever evaluated
0-9
731 return (FNM_NOMATCH); /* unequal lengths, can't be identical */
executed 9 times by 1 test: return (1);
Executed by:
  • Self test
never executed: return (1);
0-9
732 -
733 c1 = *pe;-
734 c2 = *se;-
735-
736 if (c1 != 0)
c1 != 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
c1 != 0Description
TRUEnever evaluated
FALSEnever evaluated
0-1
737 *pe = '\0';
never executed: *pe = '\0';
never executed: *pe = '\0';
0
738 if (c2 != 0)
c2 != 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
c2 != 0Description
TRUEnever evaluated
FALSEnever evaluated
0-1
739 *se = '\0';
never executed: *se = '\0';
never executed: *se = '\0';
0
740 -
741#if HAVE_MULTIBYTE || defined (HAVE_STRCOLL)-
742 ret = STRCOLL ((XCHAR *)p, (XCHAR *)s);-
743#else-
744 ret = STRCMP ((XCHAR *)p, (XCHAR *)s);-
745#endif-
746-
747 if (c1 != 0)
c1 != 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
c1 != 0Description
TRUEnever evaluated
FALSEnever evaluated
0-1
748 *pe = c1;
never executed: *pe = c1;
never executed: *pe = c1;
0
749 if (c2 != 0)
c2 != 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
c2 != 0Description
TRUEnever evaluated
FALSEnever evaluated
0-1
750 *se = c2;
never executed: *se = c2;
never executed: *se = c2;
0
751-
752 return (ret == 0 ? ret : FNM_NOMATCH);
executed 1 time by 1 test: return (ret == 0 ? ret : 1);
Executed by:
  • Self test
never executed: return (ret == 0 ? ret : 1);
0-1
753}-
754-
755/* Match a ksh extended pattern specifier. Return FNM_NOMATCH on failure or-
756 0 on success. This is handed the entire rest of the pattern and string-
757 the first time an extended pattern specifier is encountered, so it calls-
758 gmatch recursively. */-
759static int-
760EXTMATCH (xc, s, se, p, pe, flags)-
761 INT xc; /* select which operation */-
762 CHAR *s, *se;-
763 CHAR *p, *pe;-
764 int flags;-
765{-
766 CHAR *prest; /* pointer to rest of pattern */-
767 CHAR *psub; /* pointer to sub-pattern */-
768 CHAR *pnext; /* pointer to next sub-pattern */-
769 CHAR *srest; /* pointer to rest of string */-
770 int m1, m2, xflags; /* xflags = flags passed to recursive matches */-
771-
772#if DEBUG_MATCHING-
773fprintf(stderr, "extmatch: xc = %c\n", xc);-
774fprintf(stderr, "extmatch: s = %s; se = %s\n", s, se);-
775fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);-
776fprintf(stderr, "extmatch: flags = %d\n", flags);-
777#endif-
778-
779 prest = PATSCAN (p + (*p == L('(')), pe, 0); /* ) */-
780 if (prest == 0)
prest == 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 8450 times by 1 test
Evaluated by:
  • Self test
prest == 0Description
TRUEnever evaluated
FALSEevaluated 52 times by 1 test
Evaluated by:
  • Self test
0-8450
781 /* If PREST is 0, we failed to scan a valid pattern. In this-
782 case, we just want to compare the two as strings. */-
783 return (STRCOMPARE (p - 1, pe, s, se));
executed 10 times by 1 test: return (strcompare (p - 1, pe, s, se));
Executed by:
  • Self test
never executed: return (wscompare (p - 1, pe, s, se));
0-10
784-
785 switch (xc)-
786 {-
787 case L('+'): /* match one or more occurrences */
executed 160 times by 1 test: case '+':
Executed by:
  • Self test
executed 19 times by 1 test: case L'+':
Executed by:
  • Self test
19-160
788 case L('*'): /* match zero or more occurrences */
executed 3034 times by 1 test: case '*':
Executed by:
  • Self test
executed 33 times by 1 test: case L'*':
Executed by:
  • Self test
33-3034
789 /* If we can get away with no matches, don't even bother. Just-
790 call GMATCH on the rest of the pattern and return success if-
791 it succeeds. */-
792 if (xc == L('*') && (GMATCH (s, se, prest, pe, NULL, flags) == 0))
xc == '*'Description
TRUEevaluated 3034 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 160 times by 1 test
Evaluated by:
  • Self test
(gmatch (s, se..., flags) == 0)Description
TRUEevaluated 186 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2848 times by 1 test
Evaluated by:
  • Self test
xc == L'*'Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 19 times by 1 test
Evaluated by:
  • Self test
(gmatch_wc (s,..., flags) == 0)Description
TRUEnever evaluated
FALSEevaluated 33 times by 1 test
Evaluated by:
  • Self test
0-3034
793 return 0;
executed 186 times by 1 test: return 0;
Executed by:
  • Self test
never executed: return 0;
0-186
794-
795 /* OK, we have to do this the hard way. First, we make sure one of-
796 the subpatterns matches, then we try to match the rest of the-
797 string. */-
798 for (psub = p + 1; ; psub = pnext)-
799 {-
800 pnext = PATSCAN (psub, pe, L('|'));-
801 for (srest = s; srest <= se; srest++)
srest <= seDescription
TRUEevaluated 17751 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2592 times by 1 test
Evaluated by:
  • Self test
srest <= seDescription
TRUEevaluated 290 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 90 times by 1 test
Evaluated by:
  • Self test
90-17751
802 {-
803 /* Match this substring (S -> SREST) against this-
804 subpattern (psub -> pnext - 1) */-
805 m1 = GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0;-
806 /* OK, we matched a subpattern, so make sure the rest of the-
807 string matches the rest of the pattern. Also handle-
808 multiple matches of the pattern. */-
809 if (m1)
m1Description
TRUEevaluated 1805 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 15946 times by 1 test
Evaluated by:
  • Self test
m1Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 258 times by 1 test
Evaluated by:
  • Self test
32-15946
810 {-
811 /* if srest > s, we are not at start of string */-
812 xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
(srest > s)Description
TRUEevaluated 1749 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
(srest > s)Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-1749
813 m2 = (GMATCH (srest, se, prest, pe, NULL, xflags) == 0) ||
(gmatch (srest... xflags) == 0)Description
TRUEevaluated 239 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1566 times by 1 test
Evaluated by:
  • Self test
(gmatch_wc (sr... xflags) == 0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 25 times by 1 test
Evaluated by:
  • Self test
7-1566
814 (s != srest && GMATCH (srest, se, p - 1, pe, NULL, xflags) == 0);
s != srestDescription
TRUEevaluated 1510 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
gmatch (srest,..., xflags) == 0Description
TRUEevaluated 270 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1240 times by 1 test
Evaluated by:
  • Self test
s != srestDescription
TRUEevaluated 25 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
gmatch_wc (sre..., xflags) == 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 22 times by 1 test
Evaluated by:
  • Self test
0-1510
815 }
executed 1805 times by 1 test: end of block
Executed by:
  • Self test
executed 32 times by 1 test: end of block
Executed by:
  • Self test
32-1805
816 if (m1 && m2)
m1Description
TRUEevaluated 1805 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 15946 times by 1 test
Evaluated by:
  • Self test
m2Description
TRUEevaluated 509 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1296 times by 1 test
Evaluated by:
  • Self test
m1Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 258 times by 1 test
Evaluated by:
  • Self test
m2Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 22 times by 1 test
Evaluated by:
  • Self test
10-15946
817 return (0);
executed 509 times by 1 test: return (0);
Executed by:
  • Self test
executed 10 times by 1 test: return (0);
Executed by:
  • Self test
10-509
818 }
executed 17242 times by 1 test: end of block
Executed by:
  • Self test
executed 280 times by 1 test: end of block
Executed by:
  • Self test
280-17242
819 if (pnext == prest)
pnext == prestDescription
TRUEevaluated 2499 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 93 times by 1 test
Evaluated by:
  • Self test
pnext == prestDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test
42-2499
820 break;
executed 2499 times by 1 test: break;
Executed by:
  • Self test
executed 42 times by 1 test: break;
Executed by:
  • Self test
42-2499
821 }
executed 93 times by 1 test: end of block
Executed by:
  • Self test
executed 48 times by 1 test: end of block
Executed by:
  • Self test
48-93
822 return (FNM_NOMATCH);
executed 2499 times by 1 test: return (1);
Executed by:
  • Self test
executed 42 times by 1 test: return (1);
Executed by:
  • Self test
42-2499
823-
824 case L('?'): /* match zero or one of the patterns */
executed 50 times by 1 test: case '?':
Executed by:
  • Self test
never executed: case L'?':
0-50
825 case L('@'): /* match one (or more) of the patterns */
executed 5060 times by 1 test: case '@':
Executed by:
  • Self test
never executed: case L'@':
0-5060
826 /* If we can get away with no matches, don't even bother. Just-
827 call gmatch on the rest of the pattern and return success if-
828 it succeeds. */-
829 if (xc == L('?') && (GMATCH (s, se, prest, pe, NULL, flags) == 0))
xc == '?'Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5060 times by 1 test
Evaluated by:
  • Self test
(gmatch (s, se..., flags) == 0)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 45 times by 1 test
Evaluated by:
  • Self test
xc == L'?'Description
TRUEnever evaluated
FALSEnever evaluated
(gmatch_wc (s,..., flags) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0-5060
830 return 0;
executed 5 times by 1 test: return 0;
Executed by:
  • Self test
never executed: return 0;
0-5
831-
832 /* OK, we have to do this the hard way. First, we see if one of-
833 the subpatterns matches, then, if it does, we try to match the-
834 rest of the string. */-
835 for (psub = p + 1; ; psub = pnext)-
836 {-
837 pnext = PATSCAN (psub, pe, L('|'));-
838 srest = (prest == pe) ? se : s;
(prest == pe)Description
TRUEevaluated 7886 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 197 times by 1 test
Evaluated by:
  • Self test
(prest == pe)Description
TRUEnever evaluated
FALSEnever evaluated
0-7886
839 for ( ; srest <= se; srest++)
srest <= seDescription
TRUEevaluated 8805 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7955 times by 1 test
Evaluated by:
  • Self test
srest <= seDescription
TRUEnever evaluated
FALSEnever evaluated
0-8805
840 {-
841 /* if srest > s, we are not at start of string */-
842 xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
(srest > s)Description
TRUEevaluated 8467 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 338 times by 1 test
Evaluated by:
  • Self test
(srest > s)Description
TRUEnever evaluated
FALSEnever evaluated
0-8467
843 if (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0 &&
gmatch (s, sre... , flags) == 0Description
TRUEevaluated 136 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 8669 times by 1 test
Evaluated by:
  • Self test
gmatch_wc (s, ... , flags) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-8669
844 GMATCH (srest, se, prest, pe, NULL, xflags) == 0)
gmatch (srest,..., xflags) == 0Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 8 times by 1 test
Evaluated by:
  • Self test
gmatch_wc (sre..., xflags) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-128
845 return (0);
executed 128 times by 1 test: return (0);
Executed by:
  • Self test
never executed: return (0);
0-128
846 }
executed 8677 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-8677
847 if (pnext == prest)
pnext == prestDescription
TRUEevaluated 4977 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2978 times by 1 test
Evaluated by:
  • Self test
pnext == prestDescription
TRUEnever evaluated
FALSEnever evaluated
0-4977
848 break;
executed 4977 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-4977
849 }
executed 2978 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-2978
850 return (FNM_NOMATCH);
executed 4977 times by 1 test: return (1);
Executed by:
  • Self test
never executed: return (1);
0-4977
851-
852 case '!': /* match anything *except* one of the patterns */
executed 146 times by 1 test: case '!':
Executed by:
  • Self test
never executed: case '!':
0-146
853 for (srest = s; srest <= se; srest++)
srest <= seDescription
TRUEevaluated 716 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 24 times by 1 test
Evaluated by:
  • Self test
srest <= seDescription
TRUEnever evaluated
FALSEnever evaluated
0-716
854 {-
855 m1 = 0;-
856 for (psub = p + 1; ; psub = pnext)-
857 {-
858 pnext = PATSCAN (psub, pe, L('|'));-
859 /* If one of the patterns matches, just bail immediately. */-
860 if (m1 = (GMATCH (s, srest, psub, pnext - 1, NULL, flags) == 0))
m1 = (gmatch (..., flags) == 0)Description
TRUEevaluated 61 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 760 times by 1 test
Evaluated by:
  • Self test
m1 = (gmatch_w..., flags) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0-760
861 break;
executed 61 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-61
862 if (pnext == prest)
pnext == prestDescription
TRUEevaluated 655 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 105 times by 1 test
Evaluated by:
  • Self test
pnext == prestDescription
TRUEnever evaluated
FALSEnever evaluated
0-655
863 break;
executed 655 times by 1 test: break;
Executed by:
  • Self test
never executed: break;
0-655
864 }
executed 105 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-105
865-
866 /* If nothing matched, but the string starts with a period and we-
867 need to match periods explicitly, don't return this as a match,-
868 even for negation. Might need to do this only if srest == s. */-
869 if (m1 == 0 && *s == '.' && (flags & FNM_PERIOD))
m1 == 0Description
TRUEevaluated 655 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 61 times by 1 test
Evaluated by:
  • Self test
*s == '.'Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 644 times by 1 test
Evaluated by:
  • Self test
(flags & (1 << 2))Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
m1 == 0Description
TRUEnever evaluated
FALSEnever evaluated
*s == '.'Description
TRUEnever evaluated
FALSEnever evaluated
(flags & (1 << 2))Description
TRUEnever evaluated
FALSEnever evaluated
0-655
870 return (FNM_NOMATCH);
never executed: return (1);
never executed: return (1);
0
871-
872 /* if srest > s, we are not at start of string */-
873 xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
(srest > s)Description
TRUEevaluated 570 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 146 times by 1 test
Evaluated by:
  • Self test
(srest > s)Description
TRUEnever evaluated
FALSEnever evaluated
0-570
874 if (m1 == 0 && GMATCH (srest, se, prest, pe, NULL, xflags) == 0)
m1 == 0Description
TRUEevaluated 655 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 61 times by 1 test
Evaluated by:
  • Self test
gmatch (srest,..., xflags) == 0Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 533 times by 1 test
Evaluated by:
  • Self test
m1 == 0Description
TRUEnever evaluated
FALSEnever evaluated
gmatch_wc (sre..., xflags) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-655
875 return (0);
executed 122 times by 1 test: return (0);
Executed by:
  • Self test
never executed: return (0);
0-122
876 }
executed 594 times by 1 test: end of block
Executed by:
  • Self test
never executed: end of block
0-594
877 return (FNM_NOMATCH);
executed 24 times by 1 test: return (1);
Executed by:
  • Self test
never executed: return (1);
0-24
878 }-
879-
880 return (FNM_NOMATCH);
never executed: return (1);
never executed: return (1);
0
881}-
882#endif /* EXTENDED_GLOB */-
883-
884#undef IS_CCLASS-
885#undef FOLD-
886#undef CHAR-
887#undef U_CHAR-
888#undef XCHAR-
889#undef INT-
890#undef INVALID-
891#undef FCT-
892#undef GMATCH-
893#undef COLLSYM-
894#undef PARSE_COLLSYM-
895#undef PATSCAN-
896#undef STRCOMPARE-
897#undef EXTMATCH-
898#undef STRUCT-
899#undef BRACKMATCH-
900#undef STRCHR-
901#undef STRCOLL-
902#undef STRLEN-
903#undef STRCMP-
904#undef MEMCHR-
905#undef COLLEQUIV-
906#undef RANGECMP-
907#undef L-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2