* Resets the position of the directory stream to which dirp refers to the * beginning of the directory. It also causes the directory stream to refer * to the current state of the corresponding directory, as a call to opendir() * would have done. If dirp does not refer to a directory stream, the effect * is undefined. */
| 346 | * is undefined. |
| 347 | */ |
| 348 | static void rewinddir(DIR* dirp) |
| 349 | { |
| 350 | if (dirp != NULL) { |
| 351 | /* release search handle */ |
| 352 | if (dirp->search_handle != INVALID_HANDLE_VALUE) { |
| 353 | FindClose (dirp->search_handle); |
| 354 | } |
| 355 | |
| 356 | /* open new search handle and retrieve the first entry */ |
| 357 | dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->find_data); |
| 358 | if (dirp->search_handle != INVALID_HANDLE_VALUE) { |
| 359 | /* a directory entry is now waiting in memory */ |
| 360 | dirp->cached = 1; |
| 361 | } else { |
| 362 | /* failed to re-open directory: no directory entry in memory */ |
| 363 | dirp->cached = 0; |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | |
| 369 | #ifdef __cplusplus |
nothing calls this directly
no outgoing calls
no test coverage detected