Merge pull request #10 from seekbytes/patch-1
Do not print "." and ".." while printing available commands
This commit is contained in:
+7
-4
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user