diff options
author | Bert <ber.t@gmx.com> | 2011-04-08 10:23:42 +0200 |
---|---|---|
committer | Bert <ber.t@gmx.com> | 2011-04-08 10:23:42 +0200 |
commit | a90bd1c833b3475e434bd2de95ab9dd0347f1780 (patch) | |
tree | a7500bd675b360719eaf0f9e4b3727b864991864 /util.h | |
parent | e9996882cb55c5b6974a3448f29bda32d6aa373d (diff) |
Refactored recursive directory util functions
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -21,6 +21,7 @@ #include <stdio.h> #include <stdarg.h> +#include <dirent.h> #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*); |