| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/lib/glob/glob.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||||||||||||||
| 19 | struct globval | - | ||||||||||||||||||||||||||||||||||||
| 20 | { | - | ||||||||||||||||||||||||||||||||||||
| 21 | struct globval *next; | - | ||||||||||||||||||||||||||||||||||||
| 22 | char *name; | - | ||||||||||||||||||||||||||||||||||||
| 23 | }; | - | ||||||||||||||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||||||||||||||
| 25 | extern void throw_to_top_level (void); | - | ||||||||||||||||||||||||||||||||||||
| 26 | extern int sh_eaccess (const char *, int); | - | ||||||||||||||||||||||||||||||||||||
| 27 | extern char *sh_makepath (const char *, const char *, int); | - | ||||||||||||||||||||||||||||||||||||
| 28 | extern int signal_is_pending (int); | - | ||||||||||||||||||||||||||||||||||||
| 29 | extern void run_pending_traps (void); | - | ||||||||||||||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||||||||||||||
| 31 | extern int extended_glob; | - | ||||||||||||||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||||||||||||||
| 35 | int noglob_dot_filenames = 1; | - | ||||||||||||||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||||||||||||||
| 39 | int glob_ignore_case = 0; | - | ||||||||||||||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||||||||||||||
| 42 | char *glob_error_return; | - | ||||||||||||||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||||||||||||||
| 44 | static struct globval finddirs_error_return; | - | ||||||||||||||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||||||||||||||
| 47 | static int skipname (char *, char *, int); | - | ||||||||||||||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||||||||||||||
| 49 | static int mbskipname (char *, char *, int); | - | ||||||||||||||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||||||||||||||
| 52 | static void udequote_pathname (char *); | - | ||||||||||||||||||||||||||||||||||||
| 53 | static void wdequote_pathname (char *); | - | ||||||||||||||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||||||||||||||
| 57 | static void dequote_pathname (char *); | - | ||||||||||||||||||||||||||||||||||||
| 58 | static int glob_testdir (char *, int); | - | ||||||||||||||||||||||||||||||||||||
| 59 | static char **glob_dir_to_array (char *, char **, int); | - | ||||||||||||||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||||||||||||||
| 62 | extern char *glob_patscan (char *, char *, int); | - | ||||||||||||||||||||||||||||||||||||
| 63 | extern wchar_t *glob_patscan_wc (wchar_t *, wchar_t *, int); | - | ||||||||||||||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||||||||||||||
| 66 | extern int wextglob_pattern_p (wchar_t *); | - | ||||||||||||||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||||||||||||||
| 68 | extern char *glob_dirscan (char *, int); | - | ||||||||||||||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||||||||||||||
| 81 | int | - | ||||||||||||||||||||||||||||||||||||
| 82 | glob_pattern_p (pattern) | - | ||||||||||||||||||||||||||||||||||||
| 83 | const char *pattern; | - | ||||||||||||||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||||||||||||||
| 86 | size_t n; | - | ||||||||||||||||||||||||||||||||||||
| 87 | wchar_t *wpattern; | - | ||||||||||||||||||||||||||||||||||||
| 88 | int r; | - | ||||||||||||||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||||||||||||||
| 90 | if ( | - | ||||||||||||||||||||||||||||||||||||
| 91 | (
| 1095-1185 | ||||||||||||||||||||||||||||||||||||
| 92 | == 1
| 1095-1185 | ||||||||||||||||||||||||||||||||||||
| 93 | return executed 1185 times by 1 test: (internal_glob_pattern_p ((unsigned char *)pattern));return (internal_glob_pattern_p ((unsigned char *)pattern));Executed by:
executed 1185 times by 1 test: return (internal_glob_pattern_p ((unsigned char *)pattern));Executed by:
| 1185 | ||||||||||||||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||||||||||||||
| 96 | n = xdupmbstowcs (&wpattern, | - | ||||||||||||||||||||||||||||||||||||
| 97 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 98 | , pattern); | - | ||||||||||||||||||||||||||||||||||||
| 99 | if (n == (size_t)-1
| 0-1095 | ||||||||||||||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||||||||||||||
| 101 | return never executed: (internal_glob_pattern_p ((unsigned char *)pattern));return (internal_glob_pattern_p ((unsigned char *)pattern));never executed: return (internal_glob_pattern_p ((unsigned char *)pattern)); | 0 | ||||||||||||||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||||||||||||||
| 103 | r = internal_glob_wpattern_p (wpattern); | - | ||||||||||||||||||||||||||||||||||||
| 104 | sh_xfree((wpattern), "glob.c", 172); | - | ||||||||||||||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||||||||||||||
| 106 | return executed 1095 times by 1 test: r;return r;Executed by:
executed 1095 times by 1 test: return r;Executed by:
| 1095 | ||||||||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||||||||||||||
| 110 | } | - | ||||||||||||||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||||||||||||||
| 116 | static int | - | ||||||||||||||||||||||||||||||||||||
| 117 | extglob_skipname (pat, dname, flags) | - | ||||||||||||||||||||||||||||||||||||
| 118 | char *pat, *dname; | - | ||||||||||||||||||||||||||||||||||||
| 119 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 120 | { | - | ||||||||||||||||||||||||||||||||||||
| 121 | char *pp, *pe, *t, *se; | - | ||||||||||||||||||||||||||||||||||||
| 122 | int n, r, negate, wild; | - | ||||||||||||||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||||||||||||||
| 124 | negate = *pat == '!'; | - | ||||||||||||||||||||||||||||||||||||
| 125 | wild = *
| 16-2306 | ||||||||||||||||||||||||||||||||||||
| 126 | pp = pat + 2; | - | ||||||||||||||||||||||||||||||||||||
| 127 | se = pp + strlen (pp) - 1; | - | ||||||||||||||||||||||||||||||||||||
| 128 | pe = glob_patscan (pp, se, 0); | - | ||||||||||||||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||||||||||||||
| 130 | if (pe == 0
| 0-2352 | ||||||||||||||||||||||||||||||||||||
| 131 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||||||||||||||
| 135 | if (pe == se
| 38-2314 | ||||||||||||||||||||||||||||||||||||
| 136 | (__extension__ (__builtin_constant_p (
| 0-2256 | ||||||||||||||||||||||||||||||||||||
| 137 | '|'
| 0-2256 | ||||||||||||||||||||||||||||||||||||
| 138 | )
| 0-2256 | ||||||||||||||||||||||||||||||||||||
| 139 | pp
| 0-2256 | ||||||||||||||||||||||||||||||||||||
| 140 | )
| 0-2256 | ||||||||||||||||||||||||||||||||||||
| 141 | '|'
| 0-2256 | ||||||||||||||||||||||||||||||||||||
| 142 | ) == '\0'
| 0-2256 | ||||||||||||||||||||||||||||||||||||
| 143 | pp
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 144 | ,
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 145 | '|'
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 146 | ) : __builtin_strchr (
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 147 | pp
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 148 | ,
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 149 | '|'
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 150 | )))
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 151 | ) == 0
| 144-2112 | ||||||||||||||||||||||||||||||||||||
| 152 | { | - | ||||||||||||||||||||||||||||||||||||
| 153 | *pe = '\0'; | - | ||||||||||||||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||||||||||||||
| 155 | r = mbskipname (pp, dname, flags); | - | ||||||||||||||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||||||||||||||
| 159 | *pe = ')'; | - | ||||||||||||||||||||||||||||||||||||
| 160 | if (wild
| 0-2090 | ||||||||||||||||||||||||||||||||||||
| 161 | return never executed: (skipname (pe+1, dname, flags));return (skipname (pe+1, dname, flags));never executed: return (skipname (pe+1, dname, flags)); | 0 | ||||||||||||||||||||||||||||||||||||
| 162 | return executed 2112 times by 1 test: r;return r;Executed by:
executed 2112 times by 1 test: return r;Executed by:
| 2112 | ||||||||||||||||||||||||||||||||||||
| 163 | } | - | ||||||||||||||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||||||||||||||
| 166 | while (t = glob_patscan (pp, pe, '|')
| 69-275 | ||||||||||||||||||||||||||||||||||||
| 167 | { | - | ||||||||||||||||||||||||||||||||||||
| 168 | n = t[-1]; | - | ||||||||||||||||||||||||||||||||||||
| 169 | if (extglob_pattern_p (pp)
| 0-211 | ||||||||||||||||||||||||||||||||||||
| 170 | t[-1] = n; executed 64 times by 1 test: t[-1] = n;Executed by:
| 64 | ||||||||||||||||||||||||||||||||||||
| 171 | else | - | ||||||||||||||||||||||||||||||||||||
| 172 | t[-1] = '\0'; executed 211 times by 1 test: t[-1] = '\0';Executed by:
| 211 | ||||||||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||||||||
| 174 | r = mbskipname (pp, dname, flags); | - | ||||||||||||||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||||||||||||||
| 178 | t[-1] = n; | - | ||||||||||||||||||||||||||||||||||||
| 179 | if (r == 0
| 104-171 | ||||||||||||||||||||||||||||||||||||
| 180 | return executed 171 times by 1 test: r;return r;Executed by:
executed 171 times by 1 test: return r;Executed by:
| 171 | ||||||||||||||||||||||||||||||||||||
| 181 | pp = t; | - | ||||||||||||||||||||||||||||||||||||
| 182 | } executed 104 times by 1 test: end of blockExecuted by:
| 104 | ||||||||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||||||||||||||
| 185 | if (pp == se
| 23-46 | ||||||||||||||||||||||||||||||||||||
| 186 | return executed 46 times by 1 test: r;return r;Executed by:
executed 46 times by 1 test: return r;Executed by:
| 46 | ||||||||||||||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||||||||||||||
| 189 | if (wild
| 0-14 | ||||||||||||||||||||||||||||||||||||
| 190 | return executed 14 times by 1 test: (skipname (pe, dname, flags));return (skipname (pe, dname, flags));Executed by:
executed 14 times by 1 test: return (skipname (pe, dname, flags));Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||
| 191 | return executed 9 times by 1 test: 1;return 1;Executed by:
executed 9 times by 1 test: return 1;Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||
| 192 | } | - | ||||||||||||||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||||||||||||||
| 197 | static int | - | ||||||||||||||||||||||||||||||||||||
| 198 | skipname (pat, dname, flags) | - | ||||||||||||||||||||||||||||||||||||
| 199 | char *pat; | - | ||||||||||||||||||||||||||||||||||||
| 200 | char *dname; | - | ||||||||||||||||||||||||||||||||||||
| 201 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 202 | { | - | ||||||||||||||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||||||||||||||
| 204 | if (extglob_pattern_p (pat)
| 2352-983727 | ||||||||||||||||||||||||||||||||||||
| 205 | return executed 2352 times by 1 test: (extglob_skipname (pat, dname, flags));return (extglob_skipname (pat, dname, flags));Executed by:
executed 2352 times by 1 test: return (extglob_skipname (pat, dname, flags));Executed by:
| 2352 | ||||||||||||||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||||||||||||||
| 210 | if (noglob_dot_filenames == 0
| 0-983563 | ||||||||||||||||||||||||||||||||||||
| 211 | (pat[0] != '\\'
| 0-164 | ||||||||||||||||||||||||||||||||||||
| 212 | (dname[0] == '.'
| 34-130 | ||||||||||||||||||||||||||||||||||||
| 213 | (dname[1] == '\0'
| 0-26 | ||||||||||||||||||||||||||||||||||||
| 214 | return executed 16 times by 1 test: 1;return 1;Executed by:
executed 16 times by 1 test: return 1;Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||||||||||||||
| 217 | else if (noglob_dot_filenames
| 26-983563 | ||||||||||||||||||||||||||||||||||||
| 218 | (pat[0] != '\\'
| 0-3120 | ||||||||||||||||||||||||||||||||||||
| 219 | return executed 3138 times by 1 test: 1;return 1;Executed by:
executed 3138 times by 1 test: return 1;Executed by:
| 3138 | ||||||||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||||||||
| 221 | return executed 980573 times by 1 test: 0;return 0;Executed by:
executed 980573 times by 1 test: return 0;Executed by:
| 980573 | ||||||||||||||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||||||||||||||
| 226 | static int | - | ||||||||||||||||||||||||||||||||||||
| 227 | wskipname (pat, dname, flags) | - | ||||||||||||||||||||||||||||||||||||
| 228 | wchar_t *pat, *dname; | - | ||||||||||||||||||||||||||||||||||||
| 229 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 230 | { | - | ||||||||||||||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||||||||||||||
| 233 | if (noglob_dot_filenames == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 234 | (pat[0] != L'\\'
| 0 | ||||||||||||||||||||||||||||||||||||
| 235 | (dname[0] == L'.'
| 0 | ||||||||||||||||||||||||||||||||||||
| 236 | (dname[1] == L'\0'
| 0 | ||||||||||||||||||||||||||||||||||||
| 237 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||||||||||||||
| 241 | else if (noglob_dot_filenames
| 0 | ||||||||||||||||||||||||||||||||||||
| 242 | pat[0] != L'.'
| 0 | ||||||||||||||||||||||||||||||||||||
| 243 | (pat[0] != L'\\'
| 0 | ||||||||||||||||||||||||||||||||||||
| 244 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||||||||||||||
| 246 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 247 | } | - | ||||||||||||||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||||||||||||||
| 249 | static int | - | ||||||||||||||||||||||||||||||||||||
| 250 | wextglob_skipname (pat, dname, flags) | - | ||||||||||||||||||||||||||||||||||||
| 251 | wchar_t *pat, *dname; | - | ||||||||||||||||||||||||||||||||||||
| 252 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 253 | { | - | ||||||||||||||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||||||||||||||
| 255 | wchar_t *pp, *pe, *t, n, *se; | - | ||||||||||||||||||||||||||||||||||||
| 256 | int r, negate, wild; | - | ||||||||||||||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||||||||||||||
| 258 | negate = *pat == L'!'; | - | ||||||||||||||||||||||||||||||||||||
| 259 | wild = *
| 0 | ||||||||||||||||||||||||||||||||||||
| 260 | pp = pat + 2; | - | ||||||||||||||||||||||||||||||||||||
| 261 | se = pp + wcslen (pp) - 1; | - | ||||||||||||||||||||||||||||||||||||
| 262 | pe = glob_patscan_wc (pp, se, 0); | - | ||||||||||||||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||||||||||||||
| 264 | if (pe == se
| 0 | ||||||||||||||||||||||||||||||||||||
| 265 | { | - | ||||||||||||||||||||||||||||||||||||
| 266 | *pe = L'\0'; | - | ||||||||||||||||||||||||||||||||||||
| 267 | r = wskipname (pp, dname, flags); | - | ||||||||||||||||||||||||||||||||||||
| 268 | *pe = L')'; | - | ||||||||||||||||||||||||||||||||||||
| 269 | if (wild
| 0 | ||||||||||||||||||||||||||||||||||||
| 270 | return never executed: (wskipname (pe+1, dname, flags));return (wskipname (pe+1, dname, flags));never executed: return (wskipname (pe+1, dname, flags)); | 0 | ||||||||||||||||||||||||||||||||||||
| 271 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||||||||||||||||||||||||||
| 272 | } | - | ||||||||||||||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||||||||||||||
| 275 | while (t = glob_patscan_wc (pp, pe, '|')
| 0 | ||||||||||||||||||||||||||||||||||||
| 276 | { | - | ||||||||||||||||||||||||||||||||||||
| 277 | n = t[-1]; | - | ||||||||||||||||||||||||||||||||||||
| 278 | if (wextglob_pattern_p (pp)
| 0 | ||||||||||||||||||||||||||||||||||||
| 279 | t[-1] = n; never executed: t[-1] = n; | 0 | ||||||||||||||||||||||||||||||||||||
| 280 | else | - | ||||||||||||||||||||||||||||||||||||
| 281 | t[-1] = L'\0'; never executed: t[-1] = L'\0'; | 0 | ||||||||||||||||||||||||||||||||||||
| 282 | r = wskipname (pp, dname, flags); | - | ||||||||||||||||||||||||||||||||||||
| 283 | t[-1] = n; | - | ||||||||||||||||||||||||||||||||||||
| 284 | if (r == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 285 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 286 | pp = t; | - | ||||||||||||||||||||||||||||||||||||
| 287 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||||||||
| 289 | if (pp == pe
| 0 | ||||||||||||||||||||||||||||||||||||
| 290 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||||||||||||||
| 293 | if (wild
| 0 | ||||||||||||||||||||||||||||||||||||
| 294 | return never executed: (wskipname (pe, dname, flags));return (wskipname (pe, dname, flags));never executed: return (wskipname (pe, dname, flags)); | 0 | ||||||||||||||||||||||||||||||||||||
| 295 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||||||||||||||
| 299 | } | - | ||||||||||||||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||||||||||||||
| 303 | static int | - | ||||||||||||||||||||||||||||||||||||
| 304 | mbskipname (pat, dname, flags) | - | ||||||||||||||||||||||||||||||||||||
| 305 | char *pat, *dname; | - | ||||||||||||||||||||||||||||||||||||
| 306 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 307 | { | - | ||||||||||||||||||||||||||||||||||||
| 308 | int ret, ext; | - | ||||||||||||||||||||||||||||||||||||
| 309 | wchar_t *pat_wc, *dn_wc; | - | ||||||||||||||||||||||||||||||||||||
| 310 | size_t pat_n, dn_n; | - | ||||||||||||||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||||||||||||||
| 312 | if (mbsmbchar (dname) == 0
| 0-487247 | ||||||||||||||||||||||||||||||||||||
| 313 | return executed 487247 times by 1 test: (skipname (pat, dname, flags));return (skipname (pat, dname, flags));Executed by:
executed 487247 times by 1 test: return (skipname (pat, dname, flags));Executed by:
| 487247 | ||||||||||||||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||||||||||||||
| 315 | ext = 0; | - | ||||||||||||||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||||||||||||||
| 317 | ext = extglob_pattern_p (pat); | - | ||||||||||||||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||||||||||||||
| 320 | pat_wc = dn_wc = (wchar_t *) | - | ||||||||||||||||||||||||||||||||||||
| 321 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 322 | ; | - | ||||||||||||||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||||||||||||||
| 324 | pat_n = xdupmbstowcs (&pat_wc, | - | ||||||||||||||||||||||||||||||||||||
| 325 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 326 | , pat); | - | ||||||||||||||||||||||||||||||||||||
| 327 | if (pat_n != (size_t)-1
| 0 | ||||||||||||||||||||||||||||||||||||
| 328 | dn_n = xdupmbstowcs (&dn_wc, never executed: dn_n = xdupmbstowcs (&dn_wc, ((void *)0) , dname); | 0 | ||||||||||||||||||||||||||||||||||||
| 329 | ((void *)0) never executed: dn_n = xdupmbstowcs (&dn_wc, ((void *)0) , dname); | 0 | ||||||||||||||||||||||||||||||||||||
| 330 | , dname); never executed: dn_n = xdupmbstowcs (&dn_wc, ((void *)0) , dname); | 0 | ||||||||||||||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||||||||||||||
| 332 | ret = 0; | - | ||||||||||||||||||||||||||||||||||||
| 333 | if (pat_n != (size_t)-1
| 0 | ||||||||||||||||||||||||||||||||||||
| 334 | ret = ext
never executed: ret = ext ? wextglob_skipname (pat_wc, dn_wc, flags) : wskipname (pat_wc, dn_wc, flags); | 0 | ||||||||||||||||||||||||||||||||||||
| 335 | else | - | ||||||||||||||||||||||||||||||||||||
| 336 | ret = skipname (pat, dname, flags); never executed: ret = skipname (pat, dname, flags); | 0 | ||||||||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||||||||
| 338 | do { if (pat_wc
never executed: } while (0);sh_xfree((pat_wc), "glob.c", 384); | 0 | ||||||||||||||||||||||||||||||||||||
| 339 | do { if (dn_wc
never executed: } while (0);sh_xfree((dn_wc), "glob.c", 385); | 0 | ||||||||||||||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||||||||||||||
| 341 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||
| 342 | } | - | ||||||||||||||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||||||||||||||
| 346 | static void | - | ||||||||||||||||||||||||||||||||||||
| 347 | udequote_pathname (pathname) | - | ||||||||||||||||||||||||||||||||||||
| 348 | char *pathname; | - | ||||||||||||||||||||||||||||||||||||
| 349 | { | - | ||||||||||||||||||||||||||||||||||||
| 350 | register int i, j; | - | ||||||||||||||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||||||||||||||
| 352 | for (i = j = 0; pathname
| 0-423 | ||||||||||||||||||||||||||||||||||||
| 353 | { | - | ||||||||||||||||||||||||||||||||||||
| 354 | if (pathname[i] == '\\'
| 0-228 | ||||||||||||||||||||||||||||||||||||
| 355 | i++; never executed: i++; | 0 | ||||||||||||||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||||||||||||||
| 357 | pathname[j++] = pathname[i++]; | - | ||||||||||||||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||||||||||||||
| 359 | if (pathname[i - 1] == 0
| 0-228 | ||||||||||||||||||||||||||||||||||||
| 360 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 361 | } executed 228 times by 1 test: end of blockExecuted by:
| 228 | ||||||||||||||||||||||||||||||||||||
| 362 | if (pathname
| 0-195 | ||||||||||||||||||||||||||||||||||||
| 363 | pathname[j] = '\0'; executed 195 times by 1 test: pathname[j] = '\0';Executed by:
| 195 | ||||||||||||||||||||||||||||||||||||
| 364 | } executed 195 times by 1 test: end of blockExecuted by:
| 195 | ||||||||||||||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||||||||||||||
| 366 | - | |||||||||||||||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||||||||||||||
| 368 | static void | - | ||||||||||||||||||||||||||||||||||||
| 369 | wdequote_pathname (pathname) | - | ||||||||||||||||||||||||||||||||||||
| 370 | char *pathname; | - | ||||||||||||||||||||||||||||||||||||
| 371 | { | - | ||||||||||||||||||||||||||||||||||||
| 372 | mbstate_t ps; | - | ||||||||||||||||||||||||||||||||||||
| 373 | size_t len, n; | - | ||||||||||||||||||||||||||||||||||||
| 374 | wchar_t *wpathname; | - | ||||||||||||||||||||||||||||||||||||
| 375 | int i, j; | - | ||||||||||||||||||||||||||||||||||||
| 376 | wchar_t *orig_wpathname; | - | ||||||||||||||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||||||||||||||
| 378 | len = strlen (pathname); | - | ||||||||||||||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||||||||||||||
| 380 | n = xdupmbstowcs (&wpathname, | - | ||||||||||||||||||||||||||||||||||||
| 381 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 382 | , pathname); | - | ||||||||||||||||||||||||||||||||||||
| 383 | if (n == (size_t) -1
| 0-103 | ||||||||||||||||||||||||||||||||||||
| 384 | { | - | ||||||||||||||||||||||||||||||||||||
| 385 | - | |||||||||||||||||||||||||||||||||||||
| 386 | udequote_pathname (pathname); | - | ||||||||||||||||||||||||||||||||||||
| 387 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 388 | } | - | ||||||||||||||||||||||||||||||||||||
| 389 | orig_wpathname = wpathname; | - | ||||||||||||||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||||||||||||||
| 391 | for (i = j = 0; wpathname
| 0-382 | ||||||||||||||||||||||||||||||||||||
| 392 | { | - | ||||||||||||||||||||||||||||||||||||
| 393 | if (wpathname[i] == L'\\'
| 1-278 | ||||||||||||||||||||||||||||||||||||
| 394 | i++; executed 1 time by 1 test: i++;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 395 | - | |||||||||||||||||||||||||||||||||||||
| 396 | wpathname[j++] = wpathname[i++]; | - | ||||||||||||||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||||||||||||||
| 398 | if (wpathname[i - 1] == L'\0'
| 0-279 | ||||||||||||||||||||||||||||||||||||
| 399 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 400 | } executed 279 times by 1 test: end of blockExecuted by:
| 279 | ||||||||||||||||||||||||||||||||||||
| 401 | if (wpathname
| 0-103 | ||||||||||||||||||||||||||||||||||||
| 402 | wpathname[j] = L'\0'; executed 103 times by 1 test: wpathname[j] = L'\0';Executed by:
| 103 | ||||||||||||||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||||||||||||||
| 405 | memset (&ps, '\0', sizeof(mbstate_t)); | - | ||||||||||||||||||||||||||||||||||||
| 406 | n = wcsrtombs(pathname, (const wchar_t **)&wpathname, len, &ps); | - | ||||||||||||||||||||||||||||||||||||
| 407 | pathname[len] = '\0'; | - | ||||||||||||||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||||||||||||||
| 410 | sh_xfree((orig_wpathname), "glob.c", 454); | - | ||||||||||||||||||||||||||||||||||||
| 411 | } executed 103 times by 1 test: end of blockExecuted by:
| 103 | ||||||||||||||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||||||||||||||
| 413 | static void | - | ||||||||||||||||||||||||||||||||||||
| 414 | dequote_pathname (pathname) | - | ||||||||||||||||||||||||||||||||||||
| 415 | char *pathname; | - | ||||||||||||||||||||||||||||||||||||
| 416 | { | - | ||||||||||||||||||||||||||||||||||||
| 417 | if ( | - | ||||||||||||||||||||||||||||||||||||
| 418 | (
| 103-195 | ||||||||||||||||||||||||||||||||||||
| 419 | > 1
| 103-195 | ||||||||||||||||||||||||||||||||||||
| 420 | wdequote_pathname (pathname); executed 103 times by 1 test: wdequote_pathname (pathname);Executed by:
| 103 | ||||||||||||||||||||||||||||||||||||
| 421 | else | - | ||||||||||||||||||||||||||||||||||||
| 422 | udequote_pathname (pathname); executed 195 times by 1 test: udequote_pathname (pathname);Executed by:
| 195 | ||||||||||||||||||||||||||||||||||||
| 423 | } | - | ||||||||||||||||||||||||||||||||||||
| 424 | static int | - | ||||||||||||||||||||||||||||||||||||
| 425 | glob_testdir (dir, flags) | - | ||||||||||||||||||||||||||||||||||||
| 426 | char *dir; | - | ||||||||||||||||||||||||||||||||||||
| 427 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 428 | { | - | ||||||||||||||||||||||||||||||||||||
| 429 | struct stat finfo; | - | ||||||||||||||||||||||||||||||||||||
| 430 | int r; | - | ||||||||||||||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||||||||||||||
| 434 | r = (
| 197-817 | ||||||||||||||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||||||||||||||
| 438 | if (r < 0
| 0-1014 | ||||||||||||||||||||||||||||||||||||
| 439 | return never executed: (-1);return (-1);never executed: return (-1); | 0 | ||||||||||||||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||||||||||||||
| 441 | if ( | - | ||||||||||||||||||||||||||||||||||||
| 442 | ((((
| 166-848 | ||||||||||||||||||||||||||||||||||||
| 443 | finfo.st_mode
| 166-848 | ||||||||||||||||||||||||||||||||||||
| 444 | )) & 0170000) == (0040000))
| 166-848 | ||||||||||||||||||||||||||||||||||||
| 445 | == 0
| 166-848 | ||||||||||||||||||||||||||||||||||||
| 446 | return executed 166 times by 1 test: (-1);return (-1);Executed by:
executed 166 times by 1 test: return (-1);Executed by:
| 166 | ||||||||||||||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||||||||||||||
| 448 | return executed 848 times by 1 test: (0);return (0);Executed by:
executed 848 times by 1 test: return (0);Executed by:
| 848 | ||||||||||||||||||||||||||||||||||||
| 449 | } | - | ||||||||||||||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||||||||||||||
| 457 | static struct globval * | - | ||||||||||||||||||||||||||||||||||||
| 458 | finddirs (pat, sdir, flags, ep, np) | - | ||||||||||||||||||||||||||||||||||||
| 459 | char *pat; | - | ||||||||||||||||||||||||||||||||||||
| 460 | char *sdir; | - | ||||||||||||||||||||||||||||||||||||
| 461 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 462 | struct globval **ep; | - | ||||||||||||||||||||||||||||||||||||
| 463 | int *np; | - | ||||||||||||||||||||||||||||||||||||
| 464 | { | - | ||||||||||||||||||||||||||||||||||||
| 465 | char **r, *n; | - | ||||||||||||||||||||||||||||||||||||
| 466 | int ndirs; | - | ||||||||||||||||||||||||||||||||||||
| 467 | struct globval *ret, *e, *g; | - | ||||||||||||||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||||||||||||||
| 470 | e = ret = 0; | - | ||||||||||||||||||||||||||||||||||||
| 471 | r = glob_vector (pat, sdir, flags); | - | ||||||||||||||||||||||||||||||||||||
| 472 | if (r == 0
| 0-654 | ||||||||||||||||||||||||||||||||||||
| 473 | { | - | ||||||||||||||||||||||||||||||||||||
| 474 | if (np
| 0-365 | ||||||||||||||||||||||||||||||||||||
| 475 | * executed 365 times by 1 test: np = 0;*np = 0;Executed by:
executed 365 times by 1 test: *np = 0;Executed by:
| 365 | ||||||||||||||||||||||||||||||||||||
| 476 | if (ep
| 0-365 | ||||||||||||||||||||||||||||||||||||
| 477 | * executed 365 times by 1 test: ep = 0;*ep = 0;Executed by:
executed 365 times by 1 test: *ep = 0;Executed by:
| 365 | ||||||||||||||||||||||||||||||||||||
| 478 | if (r
| 0-365 | ||||||||||||||||||||||||||||||||||||
| 479 | sh_xfree((r), "glob.c", 532); executed 365 times by 1 test: sh_xfree((r), "glob.c", 532);Executed by:
| 365 | ||||||||||||||||||||||||||||||||||||
| 480 | return executed 365 times by 1 test: (struct globval *)0;return (struct globval *)0;Executed by:
executed 365 times by 1 test: return (struct globval *)0;Executed by:
| 365 | ||||||||||||||||||||||||||||||||||||
| 481 | } | - | ||||||||||||||||||||||||||||||||||||
| 482 | for (ndirs = 0; r[ndirs] != 0
| 289-1308 | ||||||||||||||||||||||||||||||||||||
| 483 | { | - | ||||||||||||||||||||||||||||||||||||
| 484 | g = (struct globval *) malloc (sizeof (struct globval)); | - | ||||||||||||||||||||||||||||||||||||
| 485 | if (g == 0
| 0-1308 | ||||||||||||||||||||||||||||||||||||
| 486 | { | - | ||||||||||||||||||||||||||||||||||||
| 487 | while (ret
| 0 | ||||||||||||||||||||||||||||||||||||
| 488 | { | - | ||||||||||||||||||||||||||||||||||||
| 489 | g = ret->next; | - | ||||||||||||||||||||||||||||||||||||
| 490 | sh_xfree((ret), "glob.c", 543); | - | ||||||||||||||||||||||||||||||||||||
| 491 | ret = g; | - | ||||||||||||||||||||||||||||||||||||
| 492 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||||||||||||||
| 494 | sh_xfree((r), "glob.c", 547); | - | ||||||||||||||||||||||||||||||||||||
| 495 | if (np
| 0 | ||||||||||||||||||||||||||||||||||||
| 496 | * never executed: np = 0;*np = 0;never executed: *np = 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 497 | if (ep
| 0 | ||||||||||||||||||||||||||||||||||||
| 498 | * never executed: ep = 0;*ep = 0;never executed: *ep = 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 499 | return never executed: (&finddirs_error_return);return (&finddirs_error_return);never executed: return (&finddirs_error_return); | 0 | ||||||||||||||||||||||||||||||||||||
| 500 | } | - | ||||||||||||||||||||||||||||||||||||
| 501 | if (e == 0
| 289-1019 | ||||||||||||||||||||||||||||||||||||
| 502 | e = g; executed 289 times by 1 test: e = g;Executed by:
| 289 | ||||||||||||||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||||||||||||||
| 504 | g->next = ret; | - | ||||||||||||||||||||||||||||||||||||
| 505 | ret = g; | - | ||||||||||||||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||||||||||||||
| 507 | g->name = r[ndirs]; | - | ||||||||||||||||||||||||||||||||||||
| 508 | } executed 1308 times by 1 test: end of blockExecuted by:
| 1308 | ||||||||||||||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||||||||||||||
| 510 | sh_xfree((r), "glob.c", 563); | - | ||||||||||||||||||||||||||||||||||||
| 511 | if (ep
| 0-289 | ||||||||||||||||||||||||||||||||||||
| 512 | * executed 289 times by 1 test: ep = e;*ep = e;Executed by:
executed 289 times by 1 test: *ep = e;Executed by:
| 289 | ||||||||||||||||||||||||||||||||||||
| 513 | if (np
| 0-289 | ||||||||||||||||||||||||||||||||||||
| 514 | * executed 289 times by 1 test: np = ndirs;*np = ndirs;Executed by:
executed 289 times by 1 test: *np = ndirs;Executed by:
| 289 | ||||||||||||||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||||||||||||||
| 516 | return executed 289 times by 1 test: ret;return ret;Executed by:
executed 289 times by 1 test: return ret;Executed by:
| 289 | ||||||||||||||||||||||||||||||||||||
| 517 | } | - | ||||||||||||||||||||||||||||||||||||
| 518 | char ** | - | ||||||||||||||||||||||||||||||||||||
| 519 | glob_vector (pat, dir, flags) | - | ||||||||||||||||||||||||||||||||||||
| 520 | char *pat; | - | ||||||||||||||||||||||||||||||||||||
| 521 | char *dir; | - | ||||||||||||||||||||||||||||||||||||
| 522 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 523 | { | - | ||||||||||||||||||||||||||||||||||||
| 524 | DIR *d; | - | ||||||||||||||||||||||||||||||||||||
| 525 | register struct dirent *dp; | - | ||||||||||||||||||||||||||||||||||||
| 526 | struct globval *lastlink, *e, *dirlist; | - | ||||||||||||||||||||||||||||||||||||
| 527 | register struct globval *nextlink; | - | ||||||||||||||||||||||||||||||||||||
| 528 | register char *nextname, *npat, *subdir; | - | ||||||||||||||||||||||||||||||||||||
| 529 | unsigned int count; | - | ||||||||||||||||||||||||||||||||||||
| 530 | int lose, skip, ndirs, isdir, sdlen, add_current, patlen; | - | ||||||||||||||||||||||||||||||||||||
| 531 | register char **name_vector; | - | ||||||||||||||||||||||||||||||||||||
| 532 | register unsigned int i; | - | ||||||||||||||||||||||||||||||||||||
| 533 | int mflags; | - | ||||||||||||||||||||||||||||||||||||
| 534 | int pflags; | - | ||||||||||||||||||||||||||||||||||||
| 535 | int nalloca; | - | ||||||||||||||||||||||||||||||||||||
| 536 | struct globval *firstmalloc, *tmplink; | - | ||||||||||||||||||||||||||||||||||||
| 537 | char *convfn; | - | ||||||||||||||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||||||||||||||
| 539 | lastlink = 0; | - | ||||||||||||||||||||||||||||||||||||
| 540 | count = lose = skip = add_current = 0; | - | ||||||||||||||||||||||||||||||||||||
| 541 | - | |||||||||||||||||||||||||||||||||||||
| 542 | firstmalloc = 0; | - | ||||||||||||||||||||||||||||||||||||
| 543 | nalloca = 0; | - | ||||||||||||||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||||||||||||||
| 547 | if (pat == 0
| 0-1896 | ||||||||||||||||||||||||||||||||||||
| 548 | { | - | ||||||||||||||||||||||||||||||||||||
| 549 | if (glob_testdir (dir, 0) < 0
| 3 | ||||||||||||||||||||||||||||||||||||
| 550 | return executed 3 times by 1 test: ((char **) &glob_error_return);return ((char **) &glob_error_return);Executed by:
executed 3 times by 1 test: return ((char **) &glob_error_return);Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||||||||||||||
| 552 | nextlink = (struct globval *)__builtin_alloca (sizeof (struct globval)); | - | ||||||||||||||||||||||||||||||||||||
| 553 | if (nextlink ==
| 0-3 | ||||||||||||||||||||||||||||||||||||
| 554 | ((void *)0)
| 0-3 | ||||||||||||||||||||||||||||||||||||
| 555 | ) | - | ||||||||||||||||||||||||||||||||||||
| 556 | return never executed: ((char **) return ((char **) ((void *)0) );never executed: return ((char **) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 557 | ((void *)0) never executed: return ((char **) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 558 | ); never executed: return ((char **) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||||||||||||||
| 560 | nextlink->next = (struct globval *)0; | - | ||||||||||||||||||||||||||||||||||||
| 561 | nextname = (char *) malloc (1); | - | ||||||||||||||||||||||||||||||||||||
| 562 | if (nextname == 0
| 0-3 | ||||||||||||||||||||||||||||||||||||
| 563 | lose = 1; never executed: lose = 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 564 | else | - | ||||||||||||||||||||||||||||||||||||
| 565 | { | - | ||||||||||||||||||||||||||||||||||||
| 566 | lastlink = nextlink; | - | ||||||||||||||||||||||||||||||||||||
| 567 | nextlink->name = nextname; | - | ||||||||||||||||||||||||||||||||||||
| 568 | nextname[0] = '\0'; | - | ||||||||||||||||||||||||||||||||||||
| 569 | count = 1; | - | ||||||||||||||||||||||||||||||||||||
| 570 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||||||||||||||
| 572 | skip = 1; | - | ||||||||||||||||||||||||||||||||||||
| 573 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||||||||||||||
| 575 | patlen = (pat
| 0-1893 | ||||||||||||||||||||||||||||||||||||
| 576 | - | |||||||||||||||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||||||||||||||
| 579 | - | |||||||||||||||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||||||||||||||
| 581 | if (skip == 0
| 3-1890 | ||||||||||||||||||||||||||||||||||||
| 582 | { | - | ||||||||||||||||||||||||||||||||||||
| 583 | int dirlen; | - | ||||||||||||||||||||||||||||||||||||
| 584 | struct stat finfo; | - | ||||||||||||||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||||||||||||||
| 586 | if (glob_testdir (dir, 0) < 0
| 0-191 | ||||||||||||||||||||||||||||||||||||
| 587 | return never executed: ((char **) &glob_error_return);return ((char **) &glob_error_return);never executed: return ((char **) &glob_error_return); | 0 | ||||||||||||||||||||||||||||||||||||
| 588 | - | |||||||||||||||||||||||||||||||||||||
| 589 | dirlen = strlen (dir); | - | ||||||||||||||||||||||||||||||||||||
| 590 | nextname = (char *)malloc (dirlen + patlen + 2); | - | ||||||||||||||||||||||||||||||||||||
| 591 | npat = (char *)malloc (patlen + 1); | - | ||||||||||||||||||||||||||||||||||||
| 592 | if (nextname == 0
| 0-191 | ||||||||||||||||||||||||||||||||||||
| 593 | { | - | ||||||||||||||||||||||||||||||||||||
| 594 | do { if (nextname
never executed: } while (0);sh_xfree((nextname), "glob.c", 660); | 0 | ||||||||||||||||||||||||||||||||||||
| 595 | do { if (npat
never executed: } while (0);sh_xfree((npat), "glob.c", 661); | 0 | ||||||||||||||||||||||||||||||||||||
| 596 | lose = 1; | - | ||||||||||||||||||||||||||||||||||||
| 597 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 598 | else | - | ||||||||||||||||||||||||||||||||||||
| 599 | { | - | ||||||||||||||||||||||||||||||||||||
| 600 | strcpy (npat, pat); | - | ||||||||||||||||||||||||||||||||||||
| 601 | dequote_pathname (npat); | - | ||||||||||||||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||||||||||||||
| 603 | strcpy (nextname, dir); | - | ||||||||||||||||||||||||||||||||||||
| 604 | nextname[dirlen++] = '/'; | - | ||||||||||||||||||||||||||||||||||||
| 605 | strcpy (nextname + dirlen, npat); | - | ||||||||||||||||||||||||||||||||||||
| 606 | - | |||||||||||||||||||||||||||||||||||||
| 607 | if ((
| 95-96 | ||||||||||||||||||||||||||||||||||||
| 608 | { | - | ||||||||||||||||||||||||||||||||||||
| 609 | sh_xfree((nextname), "glob.c", 675); | - | ||||||||||||||||||||||||||||||||||||
| 610 | nextlink = (struct globval *)__builtin_alloca (sizeof (struct globval)); | - | ||||||||||||||||||||||||||||||||||||
| 611 | if (nextlink
| 0-95 | ||||||||||||||||||||||||||||||||||||
| 612 | { | - | ||||||||||||||||||||||||||||||||||||
| 613 | nextlink->next = (struct globval *)0; | - | ||||||||||||||||||||||||||||||||||||
| 614 | lastlink = nextlink; | - | ||||||||||||||||||||||||||||||||||||
| 615 | nextlink->name = npat; | - | ||||||||||||||||||||||||||||||||||||
| 616 | count = 1; | - | ||||||||||||||||||||||||||||||||||||
| 617 | } executed 95 times by 1 test: end of blockExecuted by:
| 95 | ||||||||||||||||||||||||||||||||||||
| 618 | else | - | ||||||||||||||||||||||||||||||||||||
| 619 | { | - | ||||||||||||||||||||||||||||||||||||
| 620 | sh_xfree((npat), "glob.c", 686); | - | ||||||||||||||||||||||||||||||||||||
| 621 | lose = 1; | - | ||||||||||||||||||||||||||||||||||||
| 622 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 623 | } | - | ||||||||||||||||||||||||||||||||||||
| 624 | else | - | ||||||||||||||||||||||||||||||||||||
| 625 | { | - | ||||||||||||||||||||||||||||||||||||
| 626 | sh_xfree((nextname), "glob.c", 692); | - | ||||||||||||||||||||||||||||||||||||
| 627 | sh_xfree((npat), "glob.c", 693); | - | ||||||||||||||||||||||||||||||||||||
| 628 | } executed 96 times by 1 test: end of blockExecuted by:
| 96 | ||||||||||||||||||||||||||||||||||||
| 629 | } | - | ||||||||||||||||||||||||||||||||||||
| 630 | - | |||||||||||||||||||||||||||||||||||||
| 631 | skip = 1; | - | ||||||||||||||||||||||||||||||||||||
| 632 | } executed 191 times by 1 test: end of blockExecuted by:
| 191 | ||||||||||||||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||||||||||||||
| 634 | if (skip == 0
| 194-1699 | ||||||||||||||||||||||||||||||||||||
| 635 | { | - | ||||||||||||||||||||||||||||||||||||
| 636 | d = opendir (dir); | - | ||||||||||||||||||||||||||||||||||||
| 637 | if (d ==
| 167-1532 | ||||||||||||||||||||||||||||||||||||
| 638 | ((void *)0)
| 167-1532 | ||||||||||||||||||||||||||||||||||||
| 639 | ) | - | ||||||||||||||||||||||||||||||||||||
| 640 | return executed 167 times by 1 test: ((char **) &glob_error_return);return ((char **) &glob_error_return);Executed by:
executed 167 times by 1 test: return ((char **) &glob_error_return);Executed by:
| 167 | ||||||||||||||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||||||||||||||
| 643 | - | |||||||||||||||||||||||||||||||||||||
| 644 | mflags = (noglob_dot_filenames
| 6-1526 | ||||||||||||||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||||||||||||||
| 646 | - | |||||||||||||||||||||||||||||||||||||
| 647 | if (glob_ignore_case
| 2-1530 | ||||||||||||||||||||||||||||||||||||
| 648 | mflags |= (1 << 4); executed 2 times by 1 test: mflags |= (1 << 4);Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
| 649 | - | |||||||||||||||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||||||||||||||
| 651 | if (extended_glob
| 66-1466 | ||||||||||||||||||||||||||||||||||||
| 652 | mflags |= (1 << 5); executed 66 times by 1 test: mflags |= (1 << 5);Executed by:
| 66 | ||||||||||||||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||||||||||||||
| 654 | add_current = ((flags & (0x010|0x200)) == (0x010|0x200)); | - | ||||||||||||||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||||||||||||||
| 657 | - | |||||||||||||||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||||||||||||||
| 659 | - | |||||||||||||||||||||||||||||||||||||
| 660 | while (1) | - | ||||||||||||||||||||||||||||||||||||
| 661 | { | - | ||||||||||||||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||||||||||||||
| 663 | if (interrupt_state
| 0-501789 | ||||||||||||||||||||||||||||||||||||
| 664 | { | - | ||||||||||||||||||||||||||||||||||||
| 665 | lose = 1; | - | ||||||||||||||||||||||||||||||||||||
| 666 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 667 | } | - | ||||||||||||||||||||||||||||||||||||
| 668 | else if (signal_is_pending (
| 0-501789 | ||||||||||||||||||||||||||||||||||||
| 669 | 2
| 0-501789 | ||||||||||||||||||||||||||||||||||||
| 670 | )
| 0-501789 | ||||||||||||||||||||||||||||||||||||
| 671 | { | - | ||||||||||||||||||||||||||||||||||||
| 672 | lose = 1; | - | ||||||||||||||||||||||||||||||||||||
| 673 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 674 | } | - | ||||||||||||||||||||||||||||||||||||
| 675 | - | |||||||||||||||||||||||||||||||||||||
| 676 | dp = readdir (d); | - | ||||||||||||||||||||||||||||||||||||
| 677 | if (dp ==
| 1532-500257 | ||||||||||||||||||||||||||||||||||||
| 678 | ((void *)0)
| 1532-500257 | ||||||||||||||||||||||||||||||||||||
| 679 | ) | - | ||||||||||||||||||||||||||||||||||||
| 680 | break; executed 1532 times by 1 test: break;Executed by:
| 1532 | ||||||||||||||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||||||||||||||
| 683 | if ((
| 0-500257 | ||||||||||||||||||||||||||||||||||||
| 684 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||||||||||||||
| 686 | - | |||||||||||||||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||||||||||||||
| 689 | - | |||||||||||||||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||||||||||||||
| 692 | if ( | - | ||||||||||||||||||||||||||||||||||||
| 693 | (
| 15397-484860 | ||||||||||||||||||||||||||||||||||||
| 694 | > 1
| 1439-484860 | ||||||||||||||||||||||||||||||||||||
| 695 | continue; executed 1439 times by 1 test: continue;Executed by:
| 1439 | ||||||||||||||||||||||||||||||||||||
| 696 | else | - | ||||||||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||||||||
| 698 | if (skipname (pat, dp->d_name, flags)
| 1666-497152 | ||||||||||||||||||||||||||||||||||||
| 699 | continue; executed 1666 times by 1 test: continue;Executed by:
| 1666 | ||||||||||||||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||||||||||||||
| 702 | if (flags & (0x008|0x010)
| 817-496335 | ||||||||||||||||||||||||||||||||||||
| 703 | { | - | ||||||||||||||||||||||||||||||||||||
| 704 | pflags = (
| 0-817 | ||||||||||||||||||||||||||||||||||||
| 705 | if (flags & 0x100
| 238-579 | ||||||||||||||||||||||||||||||||||||
| 706 | pflags |= 0x08; executed 579 times by 1 test: pflags |= 0x08;Executed by:
| 579 | ||||||||||||||||||||||||||||||||||||
| 707 | subdir = sh_makepath (dir, dp->d_name, pflags); | - | ||||||||||||||||||||||||||||||||||||
| 708 | isdir = glob_testdir (subdir, flags); | - | ||||||||||||||||||||||||||||||||||||
| 709 | if (isdir < 0
| 0-654 | ||||||||||||||||||||||||||||||||||||
| 710 | { | - | ||||||||||||||||||||||||||||||||||||
| 711 | sh_xfree((subdir), "glob.c", 777); | - | ||||||||||||||||||||||||||||||||||||
| 712 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
| 713 | } | - | ||||||||||||||||||||||||||||||||||||
| 714 | } executed 817 times by 1 test: end of blockExecuted by:
| 817 | ||||||||||||||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||||||||||||||
| 716 | if (flags & 0x010
| 817-496335 | ||||||||||||||||||||||||||||||||||||
| 717 | { | - | ||||||||||||||||||||||||||||||||||||
| 718 | if (isdir == 0
| 163-654 | ||||||||||||||||||||||||||||||||||||
| 719 | { | - | ||||||||||||||||||||||||||||||||||||
| 720 | dirlist = finddirs (pat, subdir, (flags & ~0x200), &e, &ndirs); | - | ||||||||||||||||||||||||||||||||||||
| 721 | if (dirlist == &finddirs_error_return
| 0-654 | ||||||||||||||||||||||||||||||||||||
| 722 | { | - | ||||||||||||||||||||||||||||||||||||
| 723 | sh_xfree((subdir), "glob.c", 789); | - | ||||||||||||||||||||||||||||||||||||
| 724 | lose = 1; | - | ||||||||||||||||||||||||||||||||||||
| 725 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 726 | } | - | ||||||||||||||||||||||||||||||||||||
| 727 | if (ndirs
| 289-365 | ||||||||||||||||||||||||||||||||||||
| 728 | { | - | ||||||||||||||||||||||||||||||||||||
| 729 | if (firstmalloc == 0
| 144-145 | ||||||||||||||||||||||||||||||||||||
| 730 | firstmalloc = e; executed 144 times by 1 test: firstmalloc = e;Executed by:
| 144 | ||||||||||||||||||||||||||||||||||||
| 731 | e->next = lastlink; | - | ||||||||||||||||||||||||||||||||||||
| 732 | lastlink = dirlist; | - | ||||||||||||||||||||||||||||||||||||
| 733 | count += ndirs; | - | ||||||||||||||||||||||||||||||||||||
| 734 | } executed 289 times by 1 test: end of blockExecuted by:
| 289 | ||||||||||||||||||||||||||||||||||||
| 735 | } executed 654 times by 1 test: end of blockExecuted by:
| 654 | ||||||||||||||||||||||||||||||||||||
| 736 | - | |||||||||||||||||||||||||||||||||||||
| 737 | nextlink = (struct globval *) malloc (sizeof (struct globval)); | - | ||||||||||||||||||||||||||||||||||||
| 738 | if (firstmalloc == 0
| 203-614 | ||||||||||||||||||||||||||||||||||||
| 739 | firstmalloc = nextlink; executed 203 times by 1 test: firstmalloc = nextlink;Executed by:
| 203 | ||||||||||||||||||||||||||||||||||||
| 740 | sdlen = strlen (subdir); | - | ||||||||||||||||||||||||||||||||||||
| 741 | nextname = (char *) malloc (sdlen + 1); | - | ||||||||||||||||||||||||||||||||||||
| 742 | if (nextlink == 0
| 0-817 | ||||||||||||||||||||||||||||||||||||
| 743 | { | - | ||||||||||||||||||||||||||||||||||||
| 744 | do { if (nextlink
never executed: } while (0);sh_xfree((nextlink), "glob.c", 810); | 0 | ||||||||||||||||||||||||||||||||||||
| 745 | do { if (nextname
never executed: } while (0);sh_xfree((nextname), "glob.c", 811); | 0 | ||||||||||||||||||||||||||||||||||||
| 746 | sh_xfree((subdir), "glob.c", 812); | - | ||||||||||||||||||||||||||||||||||||
| 747 | lose = 1; | - | ||||||||||||||||||||||||||||||||||||
| 748 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 749 | } | - | ||||||||||||||||||||||||||||||||||||
| 750 | nextlink->next = lastlink; | - | ||||||||||||||||||||||||||||||||||||
| 751 | lastlink = nextlink; | - | ||||||||||||||||||||||||||||||||||||
| 752 | nextlink->name = nextname; | - | ||||||||||||||||||||||||||||||||||||
| 753 | bcopy (subdir, nextname, sdlen + 1); | - | ||||||||||||||||||||||||||||||||||||
| 754 | sh_xfree((subdir), "glob.c", 820); | - | ||||||||||||||||||||||||||||||||||||
| 755 | ++count; | - | ||||||||||||||||||||||||||||||||||||
| 756 | continue; executed 817 times by 1 test: continue;Executed by:
| 817 | ||||||||||||||||||||||||||||||||||||
| 757 | } | - | ||||||||||||||||||||||||||||||||||||
| 758 | else if (flags & 0x008
| 0-496335 | ||||||||||||||||||||||||||||||||||||
| 759 | sh_xfree((subdir), "glob.c", 825); never executed: sh_xfree((subdir), "glob.c", 825); | 0 | ||||||||||||||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||||||||||||||
| 761 | convfn = fnx_fromfs (dp->d_name, (strlen ((dp)->d_name))); | - | ||||||||||||||||||||||||||||||||||||
| 762 | if (strmatch (pat, convfn, mflags) != 1
| 986-495349 | ||||||||||||||||||||||||||||||||||||
| 763 | { | - | ||||||||||||||||||||||||||||||||||||
| 764 | if (nalloca < 100000
| 0-986 | ||||||||||||||||||||||||||||||||||||
| 765 | { | - | ||||||||||||||||||||||||||||||||||||
| 766 | nextlink = (struct globval *) __builtin_alloca (sizeof (struct globval)); | - | ||||||||||||||||||||||||||||||||||||
| 767 | nalloca += sizeof (struct globval); | - | ||||||||||||||||||||||||||||||||||||
| 768 | } executed 986 times by 1 test: end of blockExecuted by:
| 986 | ||||||||||||||||||||||||||||||||||||
| 769 | else | - | ||||||||||||||||||||||||||||||||||||
| 770 | { | - | ||||||||||||||||||||||||||||||||||||
| 771 | nextlink = (struct globval *) malloc (sizeof (struct globval)); | - | ||||||||||||||||||||||||||||||||||||
| 772 | if (firstmalloc == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 773 | firstmalloc = nextlink; never executed: firstmalloc = nextlink; | 0 | ||||||||||||||||||||||||||||||||||||
| 774 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 775 | - | |||||||||||||||||||||||||||||||||||||
| 776 | nextname = (char *) malloc ((strlen ((dp)->d_name)) + 1); | - | ||||||||||||||||||||||||||||||||||||
| 777 | if (nextlink == 0
| 0-986 | ||||||||||||||||||||||||||||||||||||
| 778 | { | - | ||||||||||||||||||||||||||||||||||||
| 779 | do { if (nextlink
never executed: } while (0);sh_xfree((nextlink), "glob.c", 845); | 0 | ||||||||||||||||||||||||||||||||||||
| 780 | do { if (nextname
never executed: } while (0);sh_xfree((nextname), "glob.c", 846); | 0 | ||||||||||||||||||||||||||||||||||||
| 781 | lose = 1; | - | ||||||||||||||||||||||||||||||||||||
| 782 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 783 | } | - | ||||||||||||||||||||||||||||||||||||
| 784 | nextlink->next = lastlink; | - | ||||||||||||||||||||||||||||||||||||
| 785 | lastlink = nextlink; | - | ||||||||||||||||||||||||||||||||||||
| 786 | nextlink->name = nextname; | - | ||||||||||||||||||||||||||||||||||||
| 787 | bcopy (dp->d_name, nextname, (strlen ((dp)->d_name)) + 1); | - | ||||||||||||||||||||||||||||||||||||
| 788 | ++count; | - | ||||||||||||||||||||||||||||||||||||
| 789 | } executed 986 times by 1 test: end of blockExecuted by:
| 986 | ||||||||||||||||||||||||||||||||||||
| 790 | } executed 496335 times by 1 test: end of blockExecuted by:
| 496335 | ||||||||||||||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||||||||||||||
| 792 | (void) closedir (d); | - | ||||||||||||||||||||||||||||||||||||
| 793 | } executed 1532 times by 1 test: end of blockExecuted by:
| 1532 | ||||||||||||||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||||||||||||||
| 795 | - | |||||||||||||||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||||||||||||||
| 798 | if (add_current
| 81-1645 | ||||||||||||||||||||||||||||||||||||
| 799 | { | - | ||||||||||||||||||||||||||||||||||||
| 800 | sdlen = strlen (dir); | - | ||||||||||||||||||||||||||||||||||||
| 801 | nextname = (char *)malloc (sdlen + 1); | - | ||||||||||||||||||||||||||||||||||||
| 802 | nextlink = (struct globval *) malloc (sizeof (struct globval)); | - | ||||||||||||||||||||||||||||||||||||
| 803 | if (nextlink == 0
| 0-81 | ||||||||||||||||||||||||||||||||||||
| 804 | { | - | ||||||||||||||||||||||||||||||||||||
| 805 | do { if (nextlink
never executed: } while (0);sh_xfree((nextlink), "glob.c", 871); | 0 | ||||||||||||||||||||||||||||||||||||
| 806 | do { if (nextname
never executed: } while (0);sh_xfree((nextname), "glob.c", 872); | 0 | ||||||||||||||||||||||||||||||||||||
| 807 | lose = 1; | - | ||||||||||||||||||||||||||||||||||||
| 808 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 809 | else | - | ||||||||||||||||||||||||||||||||||||
| 810 | { | - | ||||||||||||||||||||||||||||||||||||
| 811 | nextlink->name = nextname; | - | ||||||||||||||||||||||||||||||||||||
| 812 | nextlink->next = lastlink; | - | ||||||||||||||||||||||||||||||||||||
| 813 | lastlink = nextlink; | - | ||||||||||||||||||||||||||||||||||||
| 814 | if (flags & 0x100
| 15-66 | ||||||||||||||||||||||||||||||||||||
| 815 | nextname[0] = '\0'; executed 15 times by 1 test: nextname[0] = '\0';Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||
| 816 | else | - | ||||||||||||||||||||||||||||||||||||
| 817 | bcopy (dir, nextname, sdlen + 1); executed 66 times by 1 test: bcopy (dir, nextname, sdlen + 1);Executed by:
| 66 | ||||||||||||||||||||||||||||||||||||
| 818 | ++count; | - | ||||||||||||||||||||||||||||||||||||
| 819 | } executed 81 times by 1 test: end of blockExecuted by:
| 81 | ||||||||||||||||||||||||||||||||||||
| 820 | } | - | ||||||||||||||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||||||||||||||
| 822 | if (lose == 0
| 0-1726 | ||||||||||||||||||||||||||||||||||||
| 823 | { | - | ||||||||||||||||||||||||||||||||||||
| 824 | name_vector = (char **) malloc ((count + 1) * sizeof (char *)); | - | ||||||||||||||||||||||||||||||||||||
| 825 | lose |= name_vector == | - | ||||||||||||||||||||||||||||||||||||
| 826 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 827 | ; | - | ||||||||||||||||||||||||||||||||||||
| 828 | } executed 1726 times by 1 test: end of blockExecuted by:
| 1726 | ||||||||||||||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||||||||||||||
| 831 | if (lose
| 0-1726 | ||||||||||||||||||||||||||||||||||||
| 832 | { | - | ||||||||||||||||||||||||||||||||||||
| 833 | tmplink = 0; | - | ||||||||||||||||||||||||||||||||||||
| 834 | - | |||||||||||||||||||||||||||||||||||||
| 835 | - | |||||||||||||||||||||||||||||||||||||
| 836 | while (lastlink
| 0 | ||||||||||||||||||||||||||||||||||||
| 837 | { | - | ||||||||||||||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||||||||||||||
| 839 | - | |||||||||||||||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||||||||||||||
| 841 | if (firstmalloc
| 0 | ||||||||||||||||||||||||||||||||||||
| 842 | { | - | ||||||||||||||||||||||||||||||||||||
| 843 | if (lastlink == firstmalloc
| 0 | ||||||||||||||||||||||||||||||||||||
| 844 | firstmalloc = 0; never executed: firstmalloc = 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 845 | tmplink = lastlink; | - | ||||||||||||||||||||||||||||||||||||
| 846 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 847 | else | - | ||||||||||||||||||||||||||||||||||||
| 848 | tmplink = 0; never executed: tmplink = 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 849 | sh_xfree((lastlink->name), "glob.c", 913); | - | ||||||||||||||||||||||||||||||||||||
| 850 | lastlink = lastlink->next; | - | ||||||||||||||||||||||||||||||||||||
| 851 | do { if (tmplink
never executed: } while (0);sh_xfree((tmplink), "glob.c", 915); | 0 | ||||||||||||||||||||||||||||||||||||
| 852 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 853 | - | |||||||||||||||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||||||||||||||
| 856 | return never executed: ((char **)return ((char **) ((void *)0) );never executed: return ((char **) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 857 | ((void *)0) never executed: return ((char **) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 858 | ); never executed: return ((char **) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 859 | } | - | ||||||||||||||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||||||||
| 862 | for (tmplink = lastlink, i = 0; i < count
| 1726-3290 | ||||||||||||||||||||||||||||||||||||
| 863 | { | - | ||||||||||||||||||||||||||||||||||||
| 864 | name_vector[i] = tmplink->name; | - | ||||||||||||||||||||||||||||||||||||
| 865 | tmplink = tmplink->next; | - | ||||||||||||||||||||||||||||||||||||
| 866 | } executed 3290 times by 1 test: end of blockExecuted by:
| 3290 | ||||||||||||||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||||||||||||||
| 868 | name_vector[count] = | - | ||||||||||||||||||||||||||||||||||||
| 869 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 870 | ; | - | ||||||||||||||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||||||||||||||
| 873 | if (firstmalloc
| 347-1379 | ||||||||||||||||||||||||||||||||||||
| 874 | { | - | ||||||||||||||||||||||||||||||||||||
| 875 | tmplink = 0; | - | ||||||||||||||||||||||||||||||||||||
| 876 | while (lastlink
| 347-2174 | ||||||||||||||||||||||||||||||||||||
| 877 | { | - | ||||||||||||||||||||||||||||||||||||
| 878 | tmplink = lastlink; | - | ||||||||||||||||||||||||||||||||||||
| 879 | if (lastlink == firstmalloc
| 347-1827 | ||||||||||||||||||||||||||||||||||||
| 880 | lastlink = firstmalloc = 0; executed 347 times by 1 test: lastlink = firstmalloc = 0;Executed by:
| 347 | ||||||||||||||||||||||||||||||||||||
| 881 | else | - | ||||||||||||||||||||||||||||||||||||
| 882 | lastlink = lastlink->next; executed 1827 times by 1 test: lastlink = lastlink->next;Executed by:
| 1827 | ||||||||||||||||||||||||||||||||||||
| 883 | sh_xfree((tmplink), "glob.c", 943); | - | ||||||||||||||||||||||||||||||||||||
| 884 | } executed 2174 times by 1 test: end of blockExecuted by:
| 2174 | ||||||||||||||||||||||||||||||||||||
| 885 | } executed 347 times by 1 test: end of blockExecuted by:
| 347 | ||||||||||||||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||||||||||||||
| 887 | return executed 1726 times by 1 test: (name_vector);return (name_vector);Executed by:
executed 1726 times by 1 test: return (name_vector);Executed by:
| 1726 | ||||||||||||||||||||||||||||||||||||
| 888 | } | - | ||||||||||||||||||||||||||||||||||||
| 889 | - | |||||||||||||||||||||||||||||||||||||
| 890 | - | |||||||||||||||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||||||||||||||
| 893 | - | |||||||||||||||||||||||||||||||||||||
| 894 | static char ** | - | ||||||||||||||||||||||||||||||||||||
| 895 | glob_dir_to_array (dir, array, flags) | - | ||||||||||||||||||||||||||||||||||||
| 896 | char *dir, **array; | - | ||||||||||||||||||||||||||||||||||||
| 897 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 898 | { | - | ||||||||||||||||||||||||||||||||||||
| 899 | register unsigned int i, l; | - | ||||||||||||||||||||||||||||||||||||
| 900 | int add_slash; | - | ||||||||||||||||||||||||||||||||||||
| 901 | char **result, *new; | - | ||||||||||||||||||||||||||||||||||||
| 902 | struct stat sb; | - | ||||||||||||||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||||||||||||||
| 904 | l = strlen (dir); | - | ||||||||||||||||||||||||||||||||||||
| 905 | if (l == 0
| 293-716 | ||||||||||||||||||||||||||||||||||||
| 906 | { | - | ||||||||||||||||||||||||||||||||||||
| 907 | if (flags & 0x001
| 0-716 | ||||||||||||||||||||||||||||||||||||
| 908 | for (i = 0; array[i]
| 0 | ||||||||||||||||||||||||||||||||||||
| 909 | { | - | ||||||||||||||||||||||||||||||||||||
| 910 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||
| 911 | ((((
| 0 | ||||||||||||||||||||||||||||||||||||
| 912 | sb.st_mode
| 0 | ||||||||||||||||||||||||||||||||||||
| 913 | )) & 0170000) == (0040000))
| 0 | ||||||||||||||||||||||||||||||||||||
| 914 | ) | - | ||||||||||||||||||||||||||||||||||||
| 915 | { | - | ||||||||||||||||||||||||||||||||||||
| 916 | l = strlen (array[i]); | - | ||||||||||||||||||||||||||||||||||||
| 917 | new = (char *)realloc (array[i], l + 2); | - | ||||||||||||||||||||||||||||||||||||
| 918 | if (new
| 0 | ||||||||||||||||||||||||||||||||||||
| 919 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 920 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 921 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||
| 922 | new[l] = '/'; | - | ||||||||||||||||||||||||||||||||||||
| 923 | new[l+1] = '\0'; | - | ||||||||||||||||||||||||||||||||||||
| 924 | array[i] = new; | - | ||||||||||||||||||||||||||||||||||||
| 925 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 926 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 927 | return executed 716 times by 1 test: (array);return (array);Executed by:
executed 716 times by 1 test: return (array);Executed by:
| 716 | ||||||||||||||||||||||||||||||||||||
| 928 | } | - | ||||||||||||||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||||||||||||||
| 930 | add_slash = dir[l - 1] != '/'; | - | ||||||||||||||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||||||||||||||
| 932 | i = 0; | - | ||||||||||||||||||||||||||||||||||||
| 933 | while (array[i] !=
| 221-293 | ||||||||||||||||||||||||||||||||||||
| 934 | ((void *)0)
| 221-293 | ||||||||||||||||||||||||||||||||||||
| 935 | ) | - | ||||||||||||||||||||||||||||||||||||
| 936 | ++ executed 221 times by 1 test: i;++i;Executed by:
executed 221 times by 1 test: ++i;Executed by:
| 221 | ||||||||||||||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||||||||||||||
| 938 | result = (char **) malloc ((i + 1) * sizeof (char *)); | - | ||||||||||||||||||||||||||||||||||||
| 939 | if (result ==
| 0-293 | ||||||||||||||||||||||||||||||||||||
| 940 | ((void *)0)
| 0-293 | ||||||||||||||||||||||||||||||||||||
| 941 | ) | - | ||||||||||||||||||||||||||||||||||||
| 942 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 943 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 944 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||||||||||||||
| 946 | for (i = 0; array[i] !=
| 221-293 | ||||||||||||||||||||||||||||||||||||
| 947 | ((void *)0)
| 221-293 | ||||||||||||||||||||||||||||||||||||
| 948 | ; i++) | - | ||||||||||||||||||||||||||||||||||||
| 949 | { | - | ||||||||||||||||||||||||||||||||||||
| 950 | - | |||||||||||||||||||||||||||||||||||||
| 951 | result[i] = (char *) malloc (l + strlen (array[i]) + 3); | - | ||||||||||||||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||||||||||||||
| 953 | if (result[i] ==
| 0-221 | ||||||||||||||||||||||||||||||||||||
| 954 | ((void *)0)
| 0-221 | ||||||||||||||||||||||||||||||||||||
| 955 | ) | - | ||||||||||||||||||||||||||||||||||||
| 956 | { | - | ||||||||||||||||||||||||||||||||||||
| 957 | int ind; | - | ||||||||||||||||||||||||||||||||||||
| 958 | for (ind = 0; ind < i
| 0 | ||||||||||||||||||||||||||||||||||||
| 959 | sh_xfree((result[ind]), "glob.c", 1003); never executed: sh_xfree((result[ind]), "glob.c", 1003); | 0 | ||||||||||||||||||||||||||||||||||||
| 960 | sh_xfree((result), "glob.c", 1004); | - | ||||||||||||||||||||||||||||||||||||
| 961 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 962 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 963 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 964 | } | - | ||||||||||||||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||||||||||||||
| 966 | strcpy (result[i], dir); | - | ||||||||||||||||||||||||||||||||||||
| 967 | if (add_slash
| 73-148 | ||||||||||||||||||||||||||||||||||||
| 968 | result[i][l] = '/'; executed 148 times by 1 test: result[i][l] = '/';Executed by:
| 148 | ||||||||||||||||||||||||||||||||||||
| 969 | strcpy (result[i] + l + add_slash, array[i]); | - | ||||||||||||||||||||||||||||||||||||
| 970 | if (flags & 0x001
| 0-221 | ||||||||||||||||||||||||||||||||||||
| 971 | { | - | ||||||||||||||||||||||||||||||||||||
| 972 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||
| 973 | ((((
| 0 | ||||||||||||||||||||||||||||||||||||
| 974 | sb.st_mode
| 0 | ||||||||||||||||||||||||||||||||||||
| 975 | )) & 0170000) == (0040000))
| 0 | ||||||||||||||||||||||||||||||||||||
| 976 | ) | - | ||||||||||||||||||||||||||||||||||||
| 977 | { | - | ||||||||||||||||||||||||||||||||||||
| 978 | size_t rlen; | - | ||||||||||||||||||||||||||||||||||||
| 979 | rlen = strlen (result[i]); | - | ||||||||||||||||||||||||||||||||||||
| 980 | result[i][rlen] = '/'; | - | ||||||||||||||||||||||||||||||||||||
| 981 | result[i][rlen+1] = '\0'; | - | ||||||||||||||||||||||||||||||||||||
| 982 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 983 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 984 | } executed 221 times by 1 test: end of blockExecuted by:
| 221 | ||||||||||||||||||||||||||||||||||||
| 985 | result[i] = | - | ||||||||||||||||||||||||||||||||||||
| 986 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 987 | ; | - | ||||||||||||||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||||||||||||||
| 990 | for (i = 0; array[i] !=
| 221-293 | ||||||||||||||||||||||||||||||||||||
| 991 | ((void *)0)
| 221-293 | ||||||||||||||||||||||||||||||||||||
| 992 | ; i++) | - | ||||||||||||||||||||||||||||||||||||
| 993 | sh_xfree((array[i]), "glob.c", 1027); executed 221 times by 1 test: sh_xfree((array[i]), "glob.c", 1027);Executed by:
| 221 | ||||||||||||||||||||||||||||||||||||
| 994 | sh_xfree(((char *) array), "glob.c", 1028); | - | ||||||||||||||||||||||||||||||||||||
| 995 | - | |||||||||||||||||||||||||||||||||||||
| 996 | return executed 293 times by 1 test: (result);return (result);Executed by:
executed 293 times by 1 test: return (result);Executed by:
| 293 | ||||||||||||||||||||||||||||||||||||
| 997 | } | - | ||||||||||||||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||||||||||||||
| 1003 | - | |||||||||||||||||||||||||||||||||||||
| 1004 | char ** | - | ||||||||||||||||||||||||||||||||||||
| 1005 | glob_filename (pathname, flags) | - | ||||||||||||||||||||||||||||||||||||
| 1006 | char *pathname; | - | ||||||||||||||||||||||||||||||||||||
| 1007 | int flags; | - | ||||||||||||||||||||||||||||||||||||
| 1008 | { | - | ||||||||||||||||||||||||||||||||||||
| 1009 | char **result, **new_result; | - | ||||||||||||||||||||||||||||||||||||
| 1010 | unsigned int result_size; | - | ||||||||||||||||||||||||||||||||||||
| 1011 | char *directory_name, *filename, *dname, *fn; | - | ||||||||||||||||||||||||||||||||||||
| 1012 | unsigned int directory_len; | - | ||||||||||||||||||||||||||||||||||||
| 1013 | int free_dirname; | - | ||||||||||||||||||||||||||||||||||||
| 1014 | int dflags; | - | ||||||||||||||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||||||||||||||
| 1016 | result = (char **) malloc (sizeof (char *)); | - | ||||||||||||||||||||||||||||||||||||
| 1017 | result_size = 1; | - | ||||||||||||||||||||||||||||||||||||
| 1018 | if (result ==
| 0-952 | ||||||||||||||||||||||||||||||||||||
| 1019 | ((void *)0)
| 0-952 | ||||||||||||||||||||||||||||||||||||
| 1020 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1021 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1022 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1023 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||||||||||||||
| 1025 | result[0] = | - | ||||||||||||||||||||||||||||||||||||
| 1026 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 1027 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1028 | - | |||||||||||||||||||||||||||||||||||||
| 1029 | directory_name = | - | ||||||||||||||||||||||||||||||||||||
| 1030 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 1031 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1032 | - | |||||||||||||||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||||||||||||||
| 1034 | filename = strrchr (pathname, '/'); | - | ||||||||||||||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||||||||||||||
| 1036 | if (filename
| 2-698 | ||||||||||||||||||||||||||||||||||||
| 1037 | { | - | ||||||||||||||||||||||||||||||||||||
| 1038 | fn = glob_dirscan (pathname, '/'); | - | ||||||||||||||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||||||||||||||
| 1041 | - | |||||||||||||||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||||||||||||||
| 1043 | filename = fn; | - | ||||||||||||||||||||||||||||||||||||
| 1044 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||||||||
| 1045 | - | |||||||||||||||||||||||||||||||||||||
| 1046 | - | |||||||||||||||||||||||||||||||||||||
| 1047 | if (filename ==
| 254-698 | ||||||||||||||||||||||||||||||||||||
| 1048 | ((void *)0)
| 254-698 | ||||||||||||||||||||||||||||||||||||
| 1049 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1050 | { | - | ||||||||||||||||||||||||||||||||||||
| 1051 | filename = pathname; | - | ||||||||||||||||||||||||||||||||||||
| 1052 | directory_name = ""; | - | ||||||||||||||||||||||||||||||||||||
| 1053 | directory_len = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1054 | free_dirname = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1055 | } executed 698 times by 1 test: end of blockExecuted by:
| 698 | ||||||||||||||||||||||||||||||||||||
| 1056 | else | - | ||||||||||||||||||||||||||||||||||||
| 1057 | { | - | ||||||||||||||||||||||||||||||||||||
| 1058 | directory_len = (filename - pathname) + 1; | - | ||||||||||||||||||||||||||||||||||||
| 1059 | directory_name = (char *) malloc (directory_len + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1060 | - | |||||||||||||||||||||||||||||||||||||
| 1061 | if (directory_name == 0
| 0-254 | ||||||||||||||||||||||||||||||||||||
| 1062 | { | - | ||||||||||||||||||||||||||||||||||||
| 1063 | sh_xfree((result), "glob.c", 1087); | - | ||||||||||||||||||||||||||||||||||||
| 1064 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1065 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1066 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1067 | } | - | ||||||||||||||||||||||||||||||||||||
| 1068 | - | |||||||||||||||||||||||||||||||||||||
| 1069 | bcopy (pathname, directory_name, directory_len); | - | ||||||||||||||||||||||||||||||||||||
| 1070 | directory_name[directory_len] = '\0'; | - | ||||||||||||||||||||||||||||||||||||
| 1071 | ++filename; | - | ||||||||||||||||||||||||||||||||||||
| 1072 | free_dirname = 1; | - | ||||||||||||||||||||||||||||||||||||
| 1073 | } executed 254 times by 1 test: end of blockExecuted by:
| 254 | ||||||||||||||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||||||||||||||
| 1075 | - | |||||||||||||||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||||||||||||||
| 1077 | if (directory_len > 0
| 107-698 | ||||||||||||||||||||||||||||||||||||
| 1078 | { | - | ||||||||||||||||||||||||||||||||||||
| 1079 | char **directories, *d, *p; | - | ||||||||||||||||||||||||||||||||||||
| 1080 | register unsigned int i; | - | ||||||||||||||||||||||||||||||||||||
| 1081 | int all_starstar, last_starstar; | - | ||||||||||||||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||||||||||||||
| 1083 | all_starstar = last_starstar = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1084 | d = directory_name; | - | ||||||||||||||||||||||||||||||||||||
| 1085 | dflags = flags & ~0x001; | - | ||||||||||||||||||||||||||||||||||||
| 1086 | - | |||||||||||||||||||||||||||||||||||||
| 1087 | - | |||||||||||||||||||||||||||||||||||||
| 1088 | if ((
| 0-122 | ||||||||||||||||||||||||||||||||||||
| 1089 | { | - | ||||||||||||||||||||||||||||||||||||
| 1090 | p = d; | - | ||||||||||||||||||||||||||||||||||||
| 1091 | while (d[0] == '*'
| 0-28 | ||||||||||||||||||||||||||||||||||||
| 1092 | { | - | ||||||||||||||||||||||||||||||||||||
| 1093 | p = d; | - | ||||||||||||||||||||||||||||||||||||
| 1094 | if (d[2]
| 0-28 | ||||||||||||||||||||||||||||||||||||
| 1095 | { | - | ||||||||||||||||||||||||||||||||||||
| 1096 | d += 3; | - | ||||||||||||||||||||||||||||||||||||
| 1097 | while (*
| 0-28 | ||||||||||||||||||||||||||||||||||||
| 1098 | d++; never executed: d++; | 0 | ||||||||||||||||||||||||||||||||||||
| 1099 | if (*
| 13-15 | ||||||||||||||||||||||||||||||||||||
| 1100 | break; executed 15 times by 1 test: break;Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||
| 1101 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||||||||||||||||||||
| 1102 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||||||||||||||||||||
| 1103 | if (*
| 6-15 | ||||||||||||||||||||||||||||||||||||
| 1104 | all_starstar = 1; executed 15 times by 1 test: all_starstar = 1;Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||
| 1105 | d = p; | - | ||||||||||||||||||||||||||||||||||||
| 1106 | dflags |= 0x010|0x200; | - | ||||||||||||||||||||||||||||||||||||
| 1107 | directory_len = strlen (d); | - | ||||||||||||||||||||||||||||||||||||
| 1108 | } executed 21 times by 1 test: end of blockExecuted by:
| 21 | ||||||||||||||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||||||||||||||
| 1110 | - | |||||||||||||||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||||||||||||||
| 1112 | - | |||||||||||||||||||||||||||||||||||||
| 1113 | - | |||||||||||||||||||||||||||||||||||||
| 1114 | if ((
| 10-122 | ||||||||||||||||||||||||||||||||||||
| 1115 | { | - | ||||||||||||||||||||||||||||||||||||
| 1116 | int dl, prev; | - | ||||||||||||||||||||||||||||||||||||
| 1117 | prev = dl = directory_len; | - | ||||||||||||||||||||||||||||||||||||
| 1118 | while (dl >= 4
| 0-17 | ||||||||||||||||||||||||||||||||||||
| 1119 | d[dl - 2] == '*'
| 5-12 | ||||||||||||||||||||||||||||||||||||
| 1120 | d[dl - 3] == '*'
| 2-10 | ||||||||||||||||||||||||||||||||||||
| 1121 | d[dl - 4] == '/'
| 0-10 | ||||||||||||||||||||||||||||||||||||
| 1122 | prev = dl, dl -= 3; executed 10 times by 1 test: prev = dl, dl -= 3;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 1123 | if (dl != directory_len
| 4-6 | ||||||||||||||||||||||||||||||||||||
| 1124 | last_starstar = 1; executed 6 times by 1 test: last_starstar = 1;Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
| 1125 | directory_len = prev; | - | ||||||||||||||||||||||||||||||||||||
| 1126 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||||||||||||||
| 1128 | - | |||||||||||||||||||||||||||||||||||||
| 1129 | - | |||||||||||||||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||||||||||||||
| 1131 | if (last_starstar
| 0-141 | ||||||||||||||||||||||||||||||||||||
| 1132 | filename[0] == '*'
| 0-6 | ||||||||||||||||||||||||||||||||||||
| 1133 | { | - | ||||||||||||||||||||||||||||||||||||
| 1134 | directory_len -= 3; | - | ||||||||||||||||||||||||||||||||||||
| 1135 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||||||||||||||
| 1137 | if (d[directory_len - 1] == '/'
| 0-147 | ||||||||||||||||||||||||||||||||||||
| 1138 | d[directory_len - 1] = '\0'; executed 147 times by 1 test: d[directory_len - 1] = '\0';Executed by:
| 147 | ||||||||||||||||||||||||||||||||||||
| 1139 | - | |||||||||||||||||||||||||||||||||||||
| 1140 | directories = glob_filename (d, dflags); | - | ||||||||||||||||||||||||||||||||||||
| 1141 | - | |||||||||||||||||||||||||||||||||||||
| 1142 | if (free_dirname
| 0-147 | ||||||||||||||||||||||||||||||||||||
| 1143 | { | - | ||||||||||||||||||||||||||||||||||||
| 1144 | sh_xfree((directory_name), "glob.c", 1166); | - | ||||||||||||||||||||||||||||||||||||
| 1145 | directory_name = | - | ||||||||||||||||||||||||||||||||||||
| 1146 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 1147 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1148 | } executed 147 times by 1 test: end of blockExecuted by:
| 147 | ||||||||||||||||||||||||||||||||||||
| 1149 | - | |||||||||||||||||||||||||||||||||||||
| 1150 | if (directories ==
| 0-147 | ||||||||||||||||||||||||||||||||||||
| 1151 | ((void *)0)
| 0-147 | ||||||||||||||||||||||||||||||||||||
| 1152 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1153 | goto never executed: memory_error;goto memory_error;never executed: goto memory_error; | 0 | ||||||||||||||||||||||||||||||||||||
| 1154 | else if (directories == (char **)&glob_error_return
| 35-112 | ||||||||||||||||||||||||||||||||||||
| 1155 | { | - | ||||||||||||||||||||||||||||||||||||
| 1156 | sh_xfree(((char *) result), "glob.c", 1174); | - | ||||||||||||||||||||||||||||||||||||
| 1157 | return executed 112 times by 1 test: ((char **) &glob_error_return);return ((char **) &glob_error_return);Executed by:
executed 112 times by 1 test: return ((char **) &glob_error_return);Executed by:
| 112 | ||||||||||||||||||||||||||||||||||||
| 1158 | } | - | ||||||||||||||||||||||||||||||||||||
| 1159 | else if (*
| 1-34 | ||||||||||||||||||||||||||||||||||||
| 1160 | ((void *)0)
| 1-34 | ||||||||||||||||||||||||||||||||||||
| 1161 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1162 | { | - | ||||||||||||||||||||||||||||||||||||
| 1163 | sh_xfree(((char *) directories), "glob.c", 1179); | - | ||||||||||||||||||||||||||||||||||||
| 1164 | sh_xfree(((char *) result), "glob.c", 1180); | - | ||||||||||||||||||||||||||||||||||||
| 1165 | return executed 1 time by 1 test: ((char **) &glob_error_return);return ((char **) &glob_error_return);Executed by:
executed 1 time by 1 test: return ((char **) &glob_error_return);Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 1166 | } | - | ||||||||||||||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||||||||||||||
| 1168 | - | |||||||||||||||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||||||||||||||
| 1170 | if (all_starstar
| 0-19 | ||||||||||||||||||||||||||||||||||||
| 1171 | { | - | ||||||||||||||||||||||||||||||||||||
| 1172 | sh_xfree(((char *) directories), "glob.c", 1188); | - | ||||||||||||||||||||||||||||||||||||
| 1173 | sh_xfree((directory_name), "glob.c", 1189); | - | ||||||||||||||||||||||||||||||||||||
| 1174 | directory_name = | - | ||||||||||||||||||||||||||||||||||||
| 1175 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 1176 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1177 | directory_len = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1178 | goto executed 5 times by 1 test: only_filename;goto only_filename;Executed by:
executed 5 times by 1 test: goto only_filename;Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||
| 1179 | } | - | ||||||||||||||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||||||||||||||
| 1181 | - | |||||||||||||||||||||||||||||||||||||
| 1182 | - | |||||||||||||||||||||||||||||||||||||
| 1183 | - | |||||||||||||||||||||||||||||||||||||
| 1184 | for (i = 0; directories[i] !=
| 29-432 | ||||||||||||||||||||||||||||||||||||
| 1185 | ((void *)0)
| 29-432 | ||||||||||||||||||||||||||||||||||||
| 1186 | ; ++i) | - | ||||||||||||||||||||||||||||||||||||
| 1187 | { | - | ||||||||||||||||||||||||||||||||||||
| 1188 | char **temp_results; | - | ||||||||||||||||||||||||||||||||||||
| 1189 | int shouldbreak; | - | ||||||||||||||||||||||||||||||||||||
| 1190 | - | |||||||||||||||||||||||||||||||||||||
| 1191 | shouldbreak = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1192 | - | |||||||||||||||||||||||||||||||||||||
| 1193 | - | |||||||||||||||||||||||||||||||||||||
| 1194 | - | |||||||||||||||||||||||||||||||||||||
| 1195 | - | |||||||||||||||||||||||||||||||||||||
| 1196 | - | |||||||||||||||||||||||||||||||||||||
| 1197 | - | |||||||||||||||||||||||||||||||||||||
| 1198 | dname = directories[i]; | - | ||||||||||||||||||||||||||||||||||||
| 1199 | dflags = flags & ~(0x001|0x010|0x200); | - | ||||||||||||||||||||||||||||||||||||
| 1200 | if ((
| 0-363 | ||||||||||||||||||||||||||||||||||||
| 1201 | dflags |= 0x010|0x200; executed 63 times by 1 test: dflags |= 0x010|0x200;Executed by:
| 63 | ||||||||||||||||||||||||||||||||||||
| 1202 | if (dname[0] == '\0'
| 0-422 | ||||||||||||||||||||||||||||||||||||
| 1203 | { | - | ||||||||||||||||||||||||||||||||||||
| 1204 | dflags |= 0x100; | - | ||||||||||||||||||||||||||||||||||||
| 1205 | dname = "."; | - | ||||||||||||||||||||||||||||||||||||
| 1206 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 1207 | temp_results = glob_vector (filename, dname, dflags); | - | ||||||||||||||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||||||||||||||
| 1209 | - | |||||||||||||||||||||||||||||||||||||
| 1210 | if (temp_results ==
| 0-432 | ||||||||||||||||||||||||||||||||||||
| 1211 | ((void *)0)
| 0-432 | ||||||||||||||||||||||||||||||||||||
| 1212 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1213 | goto never executed: memory_error;goto memory_error;never executed: goto memory_error; | 0 | ||||||||||||||||||||||||||||||||||||
| 1214 | else if (temp_results == (char **)&glob_error_return
| 114-318 | ||||||||||||||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||||||||||||||
| 1216 | ; executed 114 times by 1 test: ;Executed by:
| 114 | ||||||||||||||||||||||||||||||||||||
| 1217 | else | - | ||||||||||||||||||||||||||||||||||||
| 1218 | { | - | ||||||||||||||||||||||||||||||||||||
| 1219 | char **array; | - | ||||||||||||||||||||||||||||||||||||
| 1220 | register unsigned int l; | - | ||||||||||||||||||||||||||||||||||||
| 1221 | - | |||||||||||||||||||||||||||||||||||||
| 1222 | - | |||||||||||||||||||||||||||||||||||||
| 1223 | - | |||||||||||||||||||||||||||||||||||||
| 1224 | if ((
| 0-255 | ||||||||||||||||||||||||||||||||||||
| 1225 | { | - | ||||||||||||||||||||||||||||||||||||
| 1226 | if ((
| 0-63 | ||||||||||||||||||||||||||||||||||||
| 1227 | ((
| 0 | ||||||||||||||||||||||||||||||||||||
| 1228 | - | |||||||||||||||||||||||||||||||||||||
| 1229 | { | - | ||||||||||||||||||||||||||||||||||||
| 1230 | register int i, n; | - | ||||||||||||||||||||||||||||||||||||
| 1231 | for (n = 0; temp_results[n]
| 0 | ||||||||||||||||||||||||||||||||||||
| 1232 | ; never executed: ; | 0 | ||||||||||||||||||||||||||||||||||||
| 1233 | i = n; | - | ||||||||||||||||||||||||||||||||||||
| 1234 | do | - | ||||||||||||||||||||||||||||||||||||
| 1235 | temp_results[i - n] = temp_results[i]; never executed: temp_results[i - n] = temp_results[i]; | 0 | ||||||||||||||||||||||||||||||||||||
| 1236 | while (temp_results[i++] != 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1237 | array = temp_results; | - | ||||||||||||||||||||||||||||||||||||
| 1238 | shouldbreak = 1; | - | ||||||||||||||||||||||||||||||||||||
| 1239 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1240 | else | - | ||||||||||||||||||||||||||||||||||||
| 1241 | array = temp_results; executed 63 times by 1 test: array = temp_results;Executed by:
| 63 | ||||||||||||||||||||||||||||||||||||
| 1242 | } | - | ||||||||||||||||||||||||||||||||||||
| 1243 | else | - | ||||||||||||||||||||||||||||||||||||
| 1244 | array = glob_dir_to_array (directories[i], temp_results, flags); executed 255 times by 1 test: array = glob_dir_to_array (directories[i], temp_results, flags);Executed by:
| 255 | ||||||||||||||||||||||||||||||||||||
| 1245 | l = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1246 | while (array[l] !=
| 318-414 | ||||||||||||||||||||||||||||||||||||
| 1247 | ((void *)0)
| 318-414 | ||||||||||||||||||||||||||||||||||||
| 1248 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1249 | ++ executed 414 times by 1 test: l;++l;Executed by:
executed 414 times by 1 test: ++l;Executed by:
| 414 | ||||||||||||||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||||||||||||||
| 1251 | new_result = (char **)realloc (result, (result_size + l) * sizeof (char *)); | - | ||||||||||||||||||||||||||||||||||||
| 1252 | - | |||||||||||||||||||||||||||||||||||||
| 1253 | if (new_result ==
| 0-318 | ||||||||||||||||||||||||||||||||||||
| 1254 | ((void *)0)
| 0-318 | ||||||||||||||||||||||||||||||||||||
| 1255 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1256 | { | - | ||||||||||||||||||||||||||||||||||||
| 1257 | for (l = 0; array[l]
| 0 | ||||||||||||||||||||||||||||||||||||
| 1258 | sh_xfree((array[l]), "glob.c", 1278); never executed: sh_xfree((array[l]), "glob.c", 1278); | 0 | ||||||||||||||||||||||||||||||||||||
| 1259 | sh_xfree(((char *)array), "glob.c", 1279); | - | ||||||||||||||||||||||||||||||||||||
| 1260 | goto never executed: memory_error;goto memory_error;never executed: goto memory_error; | 0 | ||||||||||||||||||||||||||||||||||||
| 1261 | } | - | ||||||||||||||||||||||||||||||||||||
| 1262 | result = new_result; | - | ||||||||||||||||||||||||||||||||||||
| 1263 | - | |||||||||||||||||||||||||||||||||||||
| 1264 | for (l = 0; array[l] !=
| 318-414 | ||||||||||||||||||||||||||||||||||||
| 1265 | ((void *)0)
| 318-414 | ||||||||||||||||||||||||||||||||||||
| 1266 | ; ++l) | - | ||||||||||||||||||||||||||||||||||||
| 1267 | result[result_size++ - 1] = array[l]; executed 414 times by 1 test: result[result_size++ - 1] = array[l];Executed by:
| 414 | ||||||||||||||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||||||||||||||
| 1269 | result[result_size - 1] = | - | ||||||||||||||||||||||||||||||||||||
| 1270 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 1271 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1272 | - | |||||||||||||||||||||||||||||||||||||
| 1273 | - | |||||||||||||||||||||||||||||||||||||
| 1274 | if (array != temp_results
| 73-245 | ||||||||||||||||||||||||||||||||||||
| 1275 | sh_xfree(((char *) array), "glob.c", 1291); executed 245 times by 1 test: sh_xfree(((char *) array), "glob.c", 1291);Executed by:
| 245 | ||||||||||||||||||||||||||||||||||||
| 1276 | else if ((
| 0-63 | ||||||||||||||||||||||||||||||||||||
| 1277 | sh_xfree((temp_results), "glob.c", 1293); executed 63 times by 1 test: sh_xfree((temp_results), "glob.c", 1293);Executed by:
| 63 | ||||||||||||||||||||||||||||||||||||
| 1278 | - | |||||||||||||||||||||||||||||||||||||
| 1279 | if (shouldbreak
| 0-318 | ||||||||||||||||||||||||||||||||||||
| 1280 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1281 | } executed 318 times by 1 test: end of blockExecuted by:
| 318 | ||||||||||||||||||||||||||||||||||||
| 1282 | } | - | ||||||||||||||||||||||||||||||||||||
| 1283 | - | |||||||||||||||||||||||||||||||||||||
| 1284 | for (i = 0; directories[i]
| 29-432 | ||||||||||||||||||||||||||||||||||||
| 1285 | sh_xfree((directories[i]), "glob.c", 1301); executed 432 times by 1 test: sh_xfree((directories[i]), "glob.c", 1301);Executed by:
| 432 | ||||||||||||||||||||||||||||||||||||
| 1286 | - | |||||||||||||||||||||||||||||||||||||
| 1287 | sh_xfree(((char *) directories), "glob.c", 1303); | - | ||||||||||||||||||||||||||||||||||||
| 1288 | - | |||||||||||||||||||||||||||||||||||||
| 1289 | return executed 29 times by 1 test: (result);return (result);Executed by:
executed 29 times by 1 test: return (result);Executed by:
| 29 | ||||||||||||||||||||||||||||||||||||
| 1290 | } | - | ||||||||||||||||||||||||||||||||||||
| 1291 | - | |||||||||||||||||||||||||||||||||||||
| 1292 | only_filename: code before this statement executed 805 times by 1 test: only_filename:Executed by:
| 805 | ||||||||||||||||||||||||||||||||||||
| 1293 | - | |||||||||||||||||||||||||||||||||||||
| 1294 | if (*
| 0-810 | ||||||||||||||||||||||||||||||||||||
| 1295 | { | - | ||||||||||||||||||||||||||||||||||||
| 1296 | result = (char **) realloc ((char *) result, 2 * sizeof (char *)); | - | ||||||||||||||||||||||||||||||||||||
| 1297 | if (result ==
| 0 | ||||||||||||||||||||||||||||||||||||
| 1298 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1299 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1300 | { | - | ||||||||||||||||||||||||||||||||||||
| 1301 | if (free_dirname
| 0 | ||||||||||||||||||||||||||||||||||||
| 1302 | sh_xfree((directory_name), "glob.c", 1316); never executed: sh_xfree((directory_name), "glob.c", 1316); | 0 | ||||||||||||||||||||||||||||||||||||
| 1303 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1304 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1305 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1306 | } | - | ||||||||||||||||||||||||||||||||||||
| 1307 | - | |||||||||||||||||||||||||||||||||||||
| 1308 | result[0] = (char *) malloc (directory_len + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1309 | if (result[0] ==
| 0 | ||||||||||||||||||||||||||||||||||||
| 1310 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1311 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1312 | goto never executed: memory_error;goto memory_error;never executed: goto memory_error; | 0 | ||||||||||||||||||||||||||||||||||||
| 1313 | bcopy (directory_name, result[0], directory_len + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1314 | if (free_dirname
| 0 | ||||||||||||||||||||||||||||||||||||
| 1315 | sh_xfree((directory_name), "glob.c", 1325); never executed: sh_xfree((directory_name), "glob.c", 1325); | 0 | ||||||||||||||||||||||||||||||||||||
| 1316 | result[1] = | - | ||||||||||||||||||||||||||||||||||||
| 1317 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 1318 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1319 | return never executed: (result);return (result);never executed: return (result); | 0 | ||||||||||||||||||||||||||||||||||||
| 1320 | } | - | ||||||||||||||||||||||||||||||||||||
| 1321 | else | - | ||||||||||||||||||||||||||||||||||||
| 1322 | { | - | ||||||||||||||||||||||||||||||||||||
| 1323 | char **temp_results; | - | ||||||||||||||||||||||||||||||||||||
| 1324 | - | |||||||||||||||||||||||||||||||||||||
| 1325 | - | |||||||||||||||||||||||||||||||||||||
| 1326 | - | |||||||||||||||||||||||||||||||||||||
| 1327 | - | |||||||||||||||||||||||||||||||||||||
| 1328 | if (directory_len > 0
| 107-703 | ||||||||||||||||||||||||||||||||||||
| 1329 | dequote_pathname (directory_name); executed 107 times by 1 test: dequote_pathname (directory_name);Executed by:
| 107 | ||||||||||||||||||||||||||||||||||||
| 1330 | - | |||||||||||||||||||||||||||||||||||||
| 1331 | - | |||||||||||||||||||||||||||||||||||||
| 1332 | - | |||||||||||||||||||||||||||||||||||||
| 1333 | sh_xfree((result), "glob.c", 1341); | - | ||||||||||||||||||||||||||||||||||||
| 1334 | - | |||||||||||||||||||||||||||||||||||||
| 1335 | - | |||||||||||||||||||||||||||||||||||||
| 1336 | - | |||||||||||||||||||||||||||||||||||||
| 1337 | - | |||||||||||||||||||||||||||||||||||||
| 1338 | dflags = flags & ~0x001; | - | ||||||||||||||||||||||||||||||||||||
| 1339 | if (directory_len == 0
| 107-703 | ||||||||||||||||||||||||||||||||||||
| 1340 | dflags |= 0x100; executed 703 times by 1 test: dflags |= 0x100;Executed by:
| 703 | ||||||||||||||||||||||||||||||||||||
| 1341 | if ((
| 0-780 | ||||||||||||||||||||||||||||||||||||
| 1342 | { | - | ||||||||||||||||||||||||||||||||||||
| 1343 | dflags |= 0x010|0x200; | - | ||||||||||||||||||||||||||||||||||||
| 1344 | if (directory_len == 0
| 3-24 | ||||||||||||||||||||||||||||||||||||
| 1345 | dflags &= ~0x200; executed 9 times by 1 test: dflags &= ~0x200;Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||
| 1346 | } executed 27 times by 1 test: end of blockExecuted by:
| 27 | ||||||||||||||||||||||||||||||||||||
| 1347 | temp_results = glob_vector (filename, | - | ||||||||||||||||||||||||||||||||||||
| 1348 | (directory_len == 0 ? "." : directory_name), | - | ||||||||||||||||||||||||||||||||||||
| 1349 | dflags); | - | ||||||||||||||||||||||||||||||||||||
| 1350 | - | |||||||||||||||||||||||||||||||||||||
| 1351 | if (temp_results ==
| 0-810 | ||||||||||||||||||||||||||||||||||||
| 1352 | ((void *)0)
| 0-810 | ||||||||||||||||||||||||||||||||||||
| 1353 | || temp_results == (char **)&glob_error_return
| 56-754 | ||||||||||||||||||||||||||||||||||||
| 1354 | { | - | ||||||||||||||||||||||||||||||||||||
| 1355 | if (free_dirname
| 0-56 | ||||||||||||||||||||||||||||||||||||
| 1356 | sh_xfree((directory_name), "glob.c", 1370); executed 56 times by 1 test: sh_xfree((directory_name), "glob.c", 1370);Executed by:
| 56 | ||||||||||||||||||||||||||||||||||||
| 1357 | do { if (terminating_signal
never executed: if (interrupt_statetermsig_handler (terminating_signal);
never executed: } while (0);throw_to_top_level (); | 0-56 | ||||||||||||||||||||||||||||||||||||
| 1358 | run_pending_traps (); | - | ||||||||||||||||||||||||||||||||||||
| 1359 | return executed 56 times by 1 test: (temp_results);return (temp_results);Executed by:
executed 56 times by 1 test: return (temp_results);Executed by:
| 56 | ||||||||||||||||||||||||||||||||||||
| 1360 | } | - | ||||||||||||||||||||||||||||||||||||
| 1361 | - | |||||||||||||||||||||||||||||||||||||
| 1362 | result = glob_dir_to_array ((dflags & 0x010) ? "" : directory_name, temp_results, flags); | - | ||||||||||||||||||||||||||||||||||||
| 1363 | - | |||||||||||||||||||||||||||||||||||||
| 1364 | if (free_dirname
| 56-698 | ||||||||||||||||||||||||||||||||||||
| 1365 | sh_xfree((directory_name), "glob.c", 1379); executed 56 times by 1 test: sh_xfree((directory_name), "glob.c", 1379);Executed by:
| 56 | ||||||||||||||||||||||||||||||||||||
| 1366 | return executed 754 times by 1 test: (result);return (result);Executed by:
executed 754 times by 1 test: return (result);Executed by:
| 754 | ||||||||||||||||||||||||||||||||||||
| 1367 | } | - | ||||||||||||||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||||||||||||||
| 1369 | - | |||||||||||||||||||||||||||||||||||||
| 1370 | - | |||||||||||||||||||||||||||||||||||||
| 1371 | memory_error: | - | ||||||||||||||||||||||||||||||||||||
| 1372 | if (result !=
| 0 | ||||||||||||||||||||||||||||||||||||
| 1373 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1374 | ) | - | ||||||||||||||||||||||||||||||||||||
| 1375 | { | - | ||||||||||||||||||||||||||||||||||||
| 1376 | register unsigned int i; | - | ||||||||||||||||||||||||||||||||||||
| 1377 | for (i = 0; result[i] !=
| 0 | ||||||||||||||||||||||||||||||||||||
| 1378 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1379 | ; ++i) | - | ||||||||||||||||||||||||||||||||||||
| 1380 | sh_xfree((result[i]), "glob.c", 1390); never executed: sh_xfree((result[i]), "glob.c", 1390); | 0 | ||||||||||||||||||||||||||||||||||||
| 1381 | sh_xfree(((char *) result), "glob.c", 1391); | - | ||||||||||||||||||||||||||||||||||||
| 1382 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1383 | - | |||||||||||||||||||||||||||||||||||||
| 1384 | if (free_dirname
| 0 | ||||||||||||||||||||||||||||||||||||
| 1385 | sh_xfree((directory_name), "glob.c", 1395); never executed: sh_xfree((directory_name), "glob.c", 1395); | 0 | ||||||||||||||||||||||||||||||||||||
| 1386 | - | |||||||||||||||||||||||||||||||||||||
| 1387 | do { if (terminating_signal
never executed: if (interrupt_statetermsig_handler (terminating_signal);
never executed: } while (0);throw_to_top_level (); | 0 | ||||||||||||||||||||||||||||||||||||
| 1388 | run_pending_traps (); | - | ||||||||||||||||||||||||||||||||||||
| 1389 | - | |||||||||||||||||||||||||||||||||||||
| 1390 | return never executed: (return ( ((void *)0) );never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1391 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1392 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 1393 | } | - | ||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |