From c92b4f7cf884cde740d2c5986d6f88be7dcafcc2 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Tue, 18 Jun 2024 18:51:36 -0500 Subject: Almost make scanning folders work --- src/search.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/search.h') 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 @@ -#ifndef __SLOTS__SEARCH_H__1863390513307 -#define __SLOTS__SEARCH_H__1863390513307 +#ifndef __SLOTS__SEARCH_H__4612270218569 +#define __SLOTS__SEARCH_H__4612270218569 +#include #include -// scandir filter: filter out anything that isn't a directory -int folderonly(const struct dirent64 *tester); +// 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 -// scandir filter: filter out anything that isn't a regular file -int fileonly(const struct dirent64 *tester); #endif \ No newline at end of file -- cgit v1.2.3