Mercurial > hg > toybox
diff lib/dirtree.c @ 263:7c53152a483b
Make cp pass most of its test suite. Still need to add symlink support.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 21 Feb 2008 04:44:42 -0600 |
parents | 70f36d9c5387 |
children | e9f75ffd3200 |
line wrap: on
line diff
--- a/lib/dirtree.c Wed Feb 20 01:47:56 2008 -0600 +++ b/lib/dirtree.c Thu Feb 21 04:44:42 2008 -0600 @@ -50,7 +50,7 @@ // 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 @@ *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;