diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dirtree.c | 5 | ||||
-rw-r--r-- | lib/lib.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/dirtree.c b/lib/dirtree.c index a2647ee2..6cdacfe6 100644 --- a/lib/dirtree.c +++ b/lib/dirtree.c @@ -50,7 +50,7 @@ struct dirtree *dirtree_add_node(char *path) // structures after use, and return NULL. struct dirtree *dirtree_read(char *path, struct dirtree *parent, - int (*callback)(struct dirtree *node, int after)) + int (*callback)(char *path, struct dirtree *node)) { struct dirtree *dt = NULL, **ddt = &dt; DIR *dir; @@ -72,10 +72,9 @@ struct dirtree *dirtree_read(char *path, struct dirtree *parent, *ddt = dirtree_add_node(path); if (!*ddt) continue; (*ddt)->parent = parent; - if (callback) callback(*ddt, 0); + if (callback) callback(path, *ddt); if (entry->d_type == DT_DIR) (*ddt)->child = dirtree_read(path, *ddt, callback); - if (callback) callback(*ddt, 1); if (callback) free(*ddt); else ddt = &((*ddt)->next); path[len]=0; @@ -41,7 +41,7 @@ struct dirtree { struct dirtree *dirtree_add_node(char *path); struct dirtree *dirtree_read(char *path, struct dirtree *parent, - int (*callback)(struct dirtree *node, int after)); + int (*callback)(char *path, struct dirtree *node)); // lib.c void xstrcpy(char *dest, char *src, size_t size); |