"Updated
| Author | Mitja Felicijan <m@mitjafelicijan.com> | 2023-05-20 19:12:05 +0000 |
| Committer | Mitja Felicijan <m@mitjafelicijan.com> | 2023-05-20 19:12:05 +0000 |
| Commit | 78f67b44eed6c3c60b17df67ee1912d2e2eb466b (patch) |
|
| diff --git a/mkfile b/mkfile | |||
| ... | |||
| 3 | run: |
3 | run: |
| 4 | $CC $CFLAGS tree.c |
4 | $CC $CFLAGS tree.c |
| 5 | $LD $LDFLAGS -o tree tree.$O |
5 | $LD $LDFLAGS -o tree tree.$O |
| 6 | |||
| diff --git a/tree.c b/tree.c | |||
| ... | |||
| 4 | #include <thread.h> |
4 | #include <thread.h> |
| 5 | #include <9p.h> |
5 | #include <9p.h> |
| 6 | 6 | ||
| 7 | void print_tree(char *basepath, int depth, char *prefix, int max_depth) |
7 | void |
| 8 | print_tree(char *basepath, int depth, char *prefix, int max_depth) |
||
| 8 | { |
9 | { |
| 9 | Dir *dirs; |
10 | Dir *dirs; |
| 10 | int i, n, fd; |
11 | int i, n, fd; |
| ... | |||
| 49 | close(fd); |
50 | close(fd); |
| 50 | } |
51 | } |
| 51 | 52 | ||
| 52 | void main(int argc, char *argv[]) |
53 | void |
| 54 | main(int argc, char *argv[]) |
||
| 53 | { |
55 | { |
| 54 | int max_depth = -1; |
56 | int max_depth = -1; |
| 55 | char *start_dir = "."; |
57 | char *start_dir = "."; |
| ... | |||
| 71 | print_tree(start_dir, 0, "", max_depth); |
73 | print_tree(start_dir, 0, "", max_depth); |
| 72 | exits(0); |
74 | exits(0); |
| 73 | } |
75 | } |
| 76 | |||