diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-03-16 22:39:19 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-03-16 22:39:19 +1300 |
commit | a07d38f5afe8747bbed0bab7248c58649c378bb2 (patch) | |
tree | f0af4892fbe7d11cf838f4543f536450751a0c3c | |
download | tunics-a07d38f5afe8747bbed0bab7248c58649c378bb2.tar.gz tunics-a07d38f5afe8747bbed0bab7248c58649c378bb2.zip |
ls(1) works, doesn't even sort yet though
-rw-r--r-- | ls.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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); +} + |