diff --git a/myls1.c b/myls1.c new file mode 100644 index 0000000..7863dc2 --- /dev/null +++ b/myls1.c @@ -0,0 +1,24 @@ +#include +#include + +#define NAME_MAX 80 +#include + +int main(int argc, char *argv[]) +{ + DIR *dir ; + struct dirent *de; + + if (argc != 1) + exit(1); + + if ((dir = opendir(".")) == NULL) + exit(1); + + while ((de = readdir(dir)) != NULL) + printf("%s\t", de->d_name); + + printf("\n"); + closedir(dir); + exit(0); +}