k9core

Unnamed repository
Log | Files | Refs | LICENSE

commit a6bfb9207236540d2b7f73d9a0157e44cefce9aa
parent 530bb5c584f9d96065a3d5f6df880336fd403ddd
Author: qorg11 <qorg@vxempire.xyz>
Date:   Mon, 15 Jun 2020 15:08:11 +0200

Added ls.c

Diffstat:
Asrc/ls.c | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/ls.c b/src/ls.c @@ -0,0 +1,20 @@ +#include <stdio.h> +#include <dirent.h> +#include <unistd.h> + +int +main(void) +{ + DIR *dir = opendir("."); + struct dirent *ent; + + if(dir != NULL) + { + while((ent = readdir(dir)) != NULL) + printf("%s ",ent->d_name); /* TODO: sort, and do not display . and .. */ + } + closedir(dir); + printf("\n"); + + return 0; +}