From a90bd1c833b3475e434bd2de95ab9dd0347f1780 Mon Sep 17 00:00:00 2001 From: Bert Date: Fri, 8 Apr 2011 10:23:42 +0200 Subject: Refactored recursive directory util functions --- util.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index 34e9b18..8e8a20d 100644 --- a/util.h +++ b/util.h @@ -21,6 +21,7 @@ #include #include +#include #define ABS(a) ((a) < 0 ? (-(a)) : (a)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) @@ -35,6 +36,16 @@ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } +typedef struct { + DIR *dir; + char *name; + int d; + + char **stack; + int stcap; + int stlen; +} r_dir_t; + void* s_malloc(size_t); void* s_realloc(void*, size_t); @@ -45,8 +56,10 @@ void size_readable(float*, const char**); char* absolute_path(const char*); -int create_dir_rec(const char*); -char** read_dir_rec(const char*); +int r_opendir(r_dir_t*, const char*); +int r_closedir(r_dir_t*); +char* r_readdir(r_dir_t*); +int r_mkdir(const char *); char* readline(FILE*); -- cgit v1.2.3