summaryrefslogtreecommitdiff
path: root/src/tc-dir.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-02-04 14:09:54 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-02-04 14:09:54 +0100
commitbd82d030011cd8b9655e5ded6b6df9343b42a6bd (patch)
treede82d886dfea0cb7dbb6e80436218a25cb211bc3 /src/tc-dir.c
Imported Upstream version 3.22upstream/3.22
Diffstat (limited to 'src/tc-dir.c')
-rw-r--r--src/tc-dir.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/tc-dir.c b/src/tc-dir.c
new file mode 100644
index 0000000..b87517a
--- /dev/null
+++ b/src/tc-dir.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright Jan Engelhardt
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the WTF Public License version 2 or
+ * (at your option) any later version.
+ */
+#ifndef __cplusplus
+# include <stdio.h>
+# include <stdlib.h>
+#else
+# include <cstdio>
+# include <cstdlib>
+#endif
+#include <libHX/init.h>
+#include <libHX/misc.h>
+
+static void lookatdir(const char *dname)
+{
+ struct HXdir *dh;
+ const char *n;
+
+ dh = HXdir_open(dname);
+ printf("Available files in %s:\n", dname);
+ while ((n = HXdir_read(dh)) != NULL)
+ printf("\t" "%s\n", n);
+ HXdir_close(dh);
+}
+
+int main(int argc, const char **argv)
+{
+ if (HX_init() <= 0)
+ abort();
+ if (argc == 1) {
+ /* On Windows VCRT, "/" yields nothing, "c:/" is needed */
+ lookatdir("/");
+ lookatdir("c:/");
+ lookatdir(".");
+ } else {
+ while (*++argv != NULL)
+ lookatdir(*argv);
+ }
+ HX_exit();
+ return EXIT_SUCCESS;
+}