]>
Commit | Line | Data |
---|---|---|
7cac9316 XL |
1 | #define _XOPEN_SOURCE 500 |
2 | #include <ftw.h> | |
3 | #include <stdio.h> | |
4 | #include <stdlib.h> | |
5 | #include <string.h> | |
6 | #include <stdint.h> | |
7 | ||
8 | static int | |
9 | display_info(const char *fpath, const struct stat *sb, | |
10 | int tflag, struct FTW *ftwbuf) | |
11 | { | |
12 | printf("%s\n", fpath); | |
13 | return 0; | |
14 | } | |
15 | ||
16 | int | |
17 | main(int argc, char *argv[]) | |
18 | { | |
19 | int flags = FTW_PHYS; | |
20 | if (nftw((argc < 2) ? "." : argv[1], display_info, 20, flags) == -1) { | |
21 | perror("nftw"); | |
22 | exit(EXIT_FAILURE); | |
23 | } | |
24 | exit(EXIT_SUCCESS); | |
25 | } |