Changeset 832 for trunk/dll/literal.c
- Timestamp:
- Sep 5, 2007, 4:09:22 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/literal.c
r795 r832 204 204 const BOOL fNotFileSpec) 205 205 { 206 const CHAR *fstr = pszBuf; 207 PSZ fcard = pszWildCard; 206 207 const CHAR *fstr = strrev(pszBuf); 208 PSZ fcard = strrev(pszWildCard); 208 209 INT wmatch = TRUE; 209 210 210 while (wmatch && *fcard && *fstr) { 211 211 switch (*fcard) { 212 212 case '?': /* character substitution */ 213 213 fcard++; … … 219 219 /* find next non-wild character in wildcard */ 220 220 while (*fcard && (*fcard == '?' || *fcard == '*')) 221 fcard++; 222 if (!*fcard) /* if last char of wildcard is *, it matches */ 221 fcard++; 222 if (!*fcard){ /* if last char of wildcard is *, it matches */ 223 fstr = strrev(pszBuf); 224 fcard = strrev(pszWildCard); 223 225 return TRUE; 226 } 224 227 /* skip until partition, match, or eos */ 225 228 while (*fstr && toupper(*fstr) != toupper(*fcard) && 226 229 (fNotFileSpec || (*fstr != '\\' && 227 230 *fstr != '/' && *fstr != '.'))) 228 231 fstr++; 229 232 if (!fNotFileSpec && !*fstr) /* implicit '.' */ … … 234 237 default: 235 238 if (!fNotFileSpec && ((*fstr == '/' || *fstr == '\\') && 236 239 (*fcard == '/' || *fcard == '\\'))) 237 240 wmatch = TRUE; 238 241 else … … 243 246 } 244 247 } 248 if ((*fcard && *fcard != '*') || *fstr){ 249 fstr = strrev(pszBuf); 250 fcard = strrev(pszWildCard); 251 return 0; 252 } 253 else{ 254 fstr = strrev(pszBuf); 255 fcard = strrev(pszWildCard); 256 return wmatch; 257 } 258 } 259 260 BOOL wildcard2(const PSZ pszBuf, const PSZ pszWildCard, 261 const BOOL fNotFileSpec) 262 { 263 const CHAR *fstr = pszBuf; 264 PSZ fcard = pszWildCard; 265 CHAR tcard[50]; 266 INT wmatch = TRUE; 267 268 while (wmatch && *fcard && *fstr) { 269 switch (*fcard) { 270 case '?': /* character substitution */ 271 fcard++; 272 if (fNotFileSpec || (*fstr != '.' && *fstr != '/' && *fstr != '\\')) 273 fstr++; /* skip (match) next character */ 274 break; 275 276 case '*': 277 /* find next non-wild character in wildcard */ 278 while (*fcard && (*fcard == '?' || *fcard == '*')) 279 fcard++; 280 if (!*fcard) /* if last char of wildcard is *, it matches */ 281 return TRUE; 282 /* skip until partition, match, or eos */ 283 while (*fstr && toupper(*fstr) != toupper(*fcard) && 284 (fNotFileSpec || (*fstr != '\\' && 285 *fstr != '/' && *fstr != '.'))) 286 fstr++; 287 if (!fNotFileSpec && !*fstr) /* implicit '.' */ 288 if (*fcard == '.') 289 fcard++; 290 break; 291 292 default: 293 if (!fNotFileSpec && ((*fstr == '/' || *fstr == '\\') && 294 (*fcard == '/' || *fcard == '\\'))) 295 wmatch = TRUE; 296 else 297 wmatch = (toupper(*fstr) == toupper(*fcard)); 298 fstr++; 299 fcard++; 300 break; 301 } 302 } //while 245 303 246 304 if ((*fcard && *fcard != '*') || *fstr) … … 249 307 return wmatch; 250 308 } 309 251 310 252 311 // fixup - quote literal character array … … 298 357 } 299 358 300 #pragma alloc_text(LITERAL,literal,index,fixup,wildcard )301 359 #pragma alloc_text(LITERAL,literal,index,fixup,wildcard, wildcard2) 360
Note:
See TracChangeset
for help on using the changeset viewer.