aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-03-16 22:39:19 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-03-16 22:39:19 +1300
commita07d38f5afe8747bbed0bab7248c58649c378bb2 (patch)
treef0af4892fbe7d11cf838f4543f536450751a0c3c
downloadtunics-a07d38f5afe8747bbed0bab7248c58649c378bb2.tar.gz
tunics-a07d38f5afe8747bbed0bab7248c58649c378bb2.zip
ls(1) works, doesn't even sort yet though
-rw-r--r--ls.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ls.c b/ls.c
new file mode 100644
index 0000000..592d6f3
--- /dev/null
+++ b/ls.c
@@ -0,0 +1,19 @@
+#include <dirent.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+int main(int argc, char **argv)
+{
+ struct dirent *dirent;
+ DIR *dir;
+
+ dir = opendir(".");
+
+ while ((dirent = readdir(dir)) != NULL) {
+ fprintf(stdout, "%s\n", &(dirent->d_name));
+ }
+
+ exit(EXIT_SUCCESS);
+}
+