| 529 | }; |
| 530 | |
| 531 | bool CModFindFiles::Start(const char *wildcard, char *namebuf) { |
| 532 | ASSERT(wildcard); |
| 533 | ASSERT(namebuf); |
| 534 | |
| 535 | if (globindex != -1) |
| 536 | Close(); |
| 537 | |
| 538 | int rc, flags; |
| 539 | flags = GLOB_MARK; |
| 540 | rc = glob(wildcard, flags, globerrfn, &ffres); |
| 541 | if (rc == GLOB_NOSPACE) { |
| 542 | mprintf(0, "Out of space during glob\n"); |
| 543 | globindex = -1; |
| 544 | return false; |
| 545 | } |
| 546 | if (!ffres.gl_pathc) { |
| 547 | globindex = -1; |
| 548 | return false; |
| 549 | } |
| 550 | |
| 551 | globindex = 0; |
| 552 | char ext[256]; |
| 553 | dd_SplitPath(ffres.gl_pathv[0], NULL, namebuf, ext); |
| 554 | strcat(namebuf, ext); |
| 555 | return true; |
| 556 | } |
| 557 | |
| 558 | bool CModFindFiles::Next(char *namebuf) { |
| 559 | ASSERT(namebuf); |
no test coverage detected