Merge pull request #10 from seekbytes/patch-1

Do not print "." and ".." while printing available commands
This commit is contained in:
Enrico Fraccaroli
2022-07-07 13:12:26 -04:00
committed by GitHub
+7 -4
View File
@@ -19,10 +19,13 @@ int main(int argc, char *argv[])
dirent_t dent;
int per_line = 0;
while (getdents(fd, &dent, sizeof(dirent_t)) == sizeof(dirent_t)) {
printf("%10s ", dent.d_name);
if (++per_line == 6) {
per_line = 0;
putchar('\n');
// Shows only regular files
if(dent.d_type == DT_REG){
printf("%10s ", dent.d_name);
if (++per_line == 6) {
per_line = 0;
putchar('\n');
}
}
}
putchar('\n');