Changeset a35b458 in mainline for uspace/lib/posix/src/fnmatch.c
- Timestamp:
- 2018-03-02T20:10:49Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
-
uspace/lib/posix/src/fnmatch.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/src/fnmatch.c
r3061bc1 ra35b458 301 301 return COLL_ELM_INVALID; 302 302 } 303 303 304 304 *pattern = p + 1; 305 305 return _coll_elm_char(*p); … … 359 359 p++; 360 360 } 361 361 362 362 coll_elm_t current_elm = COLL_ELM_INVALID; 363 363 364 364 while (*p != ']') { 365 365 if (*p == '-' && *(p + 1) != ']' && … … 374 374 continue; 375 375 } 376 376 377 377 if (*p == '[' && *(p + 1) == ':') { 378 378 current_elm = COLL_ELM_INVALID; … … 380 380 continue; 381 381 } 382 382 383 383 current_elm = _next_coll_elm(&p, flags); 384 384 if (current_elm == COLL_ELM_INVALID) { … … 460 460 return false; 461 461 } 462 462 463 463 /* None of the above, match anything else. */ 464 464 p++; … … 496 496 497 497 /* Entire sub-pattern matched. */ 498 498 499 499 /* postconditions */ 500 500 assert(*p == '\0' || *p == '*'); 501 501 assert(*p != '\0' || *s == '\0' || (leading_dir && *s == '/')); 502 502 503 503 *pattern = p; 504 504 *string = s; … … 667 667 match("helen??", "helenos", 0); 668 668 match("****booo****", "booo", 0); 669 669 670 670 match("hello[[:space:]]world", "hello world", 0); 671 671 nomatch("hello[[:alpha:]]world", "hello world", 0); 672 672 673 673 match("/hoooo*", "/hooooooo/hooo", 0); 674 674 nomatch("/hoooo*", "/hooooooo/hooo", FNM_PATHNAME); … … 680 680 nomatch("/hoooo", "/hooooooo/hooo", FNM_LEADING_DIR); 681 681 match("/hooooooo", "/hooooooo/hooo", FNM_LEADING_DIR); 682 682 683 683 match("*", "hell", 0); 684 684 match("*?", "hell", 0); … … 687 687 match("??*??", "hell", 0); 688 688 nomatch("???*??", "hell", 0); 689 689 690 690 nomatch("", "hell", 0); 691 691 nomatch("?", "hell", 0); … … 693 693 nomatch("???", "hell", 0); 694 694 match("????", "hell", 0); 695 695 696 696 match("*", "h.ello", FNM_PERIOD); 697 697 match("*", "h.ello", FNM_PATHNAME | FNM_PERIOD);
Note:
See TracChangeset
for help on using the changeset viewer.
