#ifndef __SLOTS__SEARCH_H__4612270218569 #define __SLOTS__SEARCH_H__4612270218569 #include #include // Wrapper for stat's S_ISDIR(mode) macro. Implemented as: return S_ISDIR(mode) int S_ISDIR_WRAPPER(mode_t mode); // Wrapper for stat's S_ISREG(mode) macro. Implemented as: return S_ISREG(mode) int S_ISREG_WRAPPER(mode_t mode); // Sort out nodes in a scanned directory using one of stat's S_IS--- functions int nodesort(const struct dirent *node, int (*S_IS_CALLBACK)(mode_t)); int foldersort(const struct dirent *node); // Only display folders when using scandir int filesort(const struct dirent *node); // Only display files when using scandir // Create a linked list of full paths to folders, using CMP to order them. Returns NULL on error struct nodelist* scanfolders(const char *STARTPATH, int (*cmp)(const struct dirent **, const struct dirent **)); // Create a linked list of full paths to files, using CMP to order them. Returns NULL on error struct nodelist* scanfiles(const char *STARTPATH, int (*cmp)(const struct dirent **, const struct dirent **)); #endif