diff options
| author | @syxhe <https://t.me/syxhe> | 2024-06-18 18:51:36 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2024-06-18 18:51:36 -0500 |
| commit | c92b4f7cf884cde740d2c5986d6f88be7dcafcc2 (patch) | |
| tree | a586ac66e2c8de61b6e412e53949e28ccbbc7271 /src/search.h | |
| parent | 1e9915d2ce9baa31506a8c04929d6e44a29f106b (diff) | |
Almost make scanning folders work
Diffstat (limited to 'src/search.h')
| -rw-r--r-- | src/search.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/search.h b/src/search.h index 9a5a086..8b5f502 100644 --- a/src/search.h +++ b/src/search.h | |||
| @@ -1,12 +1,19 @@ | |||
| 1 | #ifndef __SLOTS__SEARCH_H__1863390513307 | 1 | #ifndef __SLOTS__SEARCH_H__4612270218569 |
| 2 | #define __SLOTS__SEARCH_H__1863390513307 | 2 | #define __SLOTS__SEARCH_H__4612270218569 |
| 3 | 3 | ||
| 4 | #include <sys/types.h> | ||
| 4 | #include <dirent.h> | 5 | #include <dirent.h> |
| 5 | 6 | ||
| 6 | // scandir filter: filter out anything that isn't a directory | 7 | // Wrapper for stat's S_ISDIR(mode) macro. Implemented as: return S_ISDIR(mode) |
| 7 | int folderonly(const struct dirent64 *tester); | 8 | int S_ISDIR_WRAPPER(mode_t mode); |
| 9 | |||
| 10 | // Wrapper for stat's S_ISREG(mode) macro. Implemented as: return S_ISREG(mode) | ||
| 11 | int S_ISREG_WRAPPER(mode_t mode); | ||
| 12 | |||
| 13 | // Sort out nodes in a scanned directory using one of stat's S_IS--- functions | ||
| 14 | int nodesort(const struct dirent *node, int (*S_IS_CALLBACK)(mode_t)); | ||
| 15 | int foldersort(const struct dirent *node); // Only display folders when using scandir | ||
| 16 | int filesort(const struct dirent *node); // Only display files when using scandir | ||
| 8 | 17 | ||
| 9 | // scandir filter: filter out anything that isn't a regular file | ||
| 10 | int fileonly(const struct dirent64 *tester); | ||
| 11 | 18 | ||
| 12 | #endif \ No newline at end of file | 19 | #endif \ No newline at end of file |
