summaryrefslogtreecommitdiffstats
path: root/vendor/walkdir/compare/nftw.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:47:55 +0000
commit2aadc03ef15cb5ca5cc2af8a7c08e070742f0ac4 (patch)
tree033cc839730fda84ff08db877037977be94e5e3a /vendor/walkdir/compare/nftw.c
parentInitial commit. (diff)
downloadcargo-upstream.tar.xz
cargo-upstream.zip
Adding upstream version 0.70.1+ds1.upstream/0.70.1+ds1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/walkdir/compare/nftw.c')
-rw-r--r--vendor/walkdir/compare/nftw.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/walkdir/compare/nftw.c b/vendor/walkdir/compare/nftw.c
new file mode 100644
index 0000000..7d36e2f
--- /dev/null
+++ b/vendor/walkdir/compare/nftw.c
@@ -0,0 +1,25 @@
+#define _XOPEN_SOURCE 500
+#include <ftw.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+static int
+display_info(const char *fpath, const struct stat *sb,
+ int tflag, struct FTW *ftwbuf)
+{
+ printf("%s\n", fpath);
+ return 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+ int flags = FTW_PHYS;
+ if (nftw((argc < 2) ? "." : argv[1], display_info, 20, flags) == -1) {
+ perror("nftw");
+ exit(EXIT_FAILURE);
+ }
+ exit(EXIT_SUCCESS);
+}