commit 8c81a09bafcbe6c38175b0bb430dea4ff78ed3fb parent a6bfb9207236540d2b7f73d9a0157e44cefce9aa Author: qorg11 <qorg@vxempire.xyz> Date: Mon, 15 Jun 2020 19:09:50 +0200 Do not print dot files in ls.c The -a flag is needed. Diffstat:
M | src/ls.c | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/ls.c b/src/ls.c @@ -11,7 +11,11 @@ main(void) if(dir != NULL) { while((ent = readdir(dir)) != NULL) - printf("%s ",ent->d_name); /* TODO: sort, and do not display . and .. */ + { + if(ent->d_name[0] == '.') + continue; + printf("%s ",ent->d_name); /* TODO: sort, and do not display . and .. */ + } } closedir(dir); printf("\n");