summaryrefslogtreecommitdiffstats
path: root/third_party/rust/walkdir/compare
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/rust/walkdir/compare
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/walkdir/compare')
-rw-r--r--third_party/rust/walkdir/compare/nftw.c25
-rw-r--r--third_party/rust/walkdir/compare/walk.py10
2 files changed, 35 insertions, 0 deletions
diff --git a/third_party/rust/walkdir/compare/nftw.c b/third_party/rust/walkdir/compare/nftw.c
new file mode 100644
index 0000000000..7d36e2fdf4
--- /dev/null
+++ b/third_party/rust/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);
+}
diff --git a/third_party/rust/walkdir/compare/walk.py b/third_party/rust/walkdir/compare/walk.py
new file mode 100644
index 0000000000..303d323e24
--- /dev/null
+++ b/third_party/rust/walkdir/compare/walk.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import, division, print_function
+
+import os
+import sys
+
+for dirpath, dirnames, filenames in os.walk(sys.argv[1]):
+ for n in dirnames:
+ print(os.path.join(dirpath, n))
+ for n in filenames:
+ print(os.path.join(dirpath, n))