Luna/apps/src/ls.c

22 lines
357 B
C
Raw Normal View History

#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
DIR* dp = opendir("/bin");
if (!dp)
{
perror("opendir");
return 1;
}
do {
struct dirent* ent = readdir(dp);
if (!ent) break;
printf("%s\n", ent->d_name);
} while (1);
closedir(dp);
return 0;
}