diff options
Diffstat (limited to 'ls.c')
-rw-r--r-- | ls.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -543,16 +543,16 @@ static struct dnode **list_dir(char *path) | |||
543 | } | 543 | } |
544 | while ((entry = readdir(dir)) != NULL) { | 544 | while ((entry = readdir(dir)) != NULL) { |
545 | /* are we going to list the file- it may be . or .. or a hidden file */ | 545 | /* are we going to list the file- it may be . or .. or a hidden file */ |
546 | if ((strcmp(entry->d_name, ".")==0) && !(disp_opts & DISP_DOT)) continue; | 546 | if ((strcmp(entry->d_name, ".")==0) && !(disp_opts & DISP_DOT)) |
547 | if ((strcmp(entry->d_name, "..")==0) && !(disp_opts & DISP_DOT)) continue; | 547 | continue; |
548 | if ((entry->d_name[0] == '.') && !(disp_opts & DISP_HIDDEN)) continue; | 548 | if ((strcmp(entry->d_name, "..")==0) && !(disp_opts & DISP_DOT)) |
549 | continue; | ||
550 | if ((entry->d_name[0] == '.') && !(disp_opts & DISP_HIDDEN)) | ||
551 | continue; | ||
549 | cur= (struct dnode *)xmalloc(sizeof(struct dnode)); | 552 | cur= (struct dnode *)xmalloc(sizeof(struct dnode)); |
550 | cur->fullname = xmalloc(strlen(path)+1+strlen(entry->d_name)+1); | 553 | cur->fullname = concat_path_file(path, entry->d_name); |
551 | strcpy(cur->fullname, path); | 554 | cur->name = cur->fullname + |
552 | if (cur->fullname[strlen(cur->fullname)-1] != '/') | 555 | (strlen(cur->fullname) - strlen(entry->d_name)); |
553 | strcat(cur->fullname, "/"); | ||
554 | cur->name= cur->fullname + strlen(cur->fullname); | ||
555 | strcat(cur->fullname, entry->d_name); | ||
556 | if (my_stat(cur)) | 556 | if (my_stat(cur)) |
557 | continue; | 557 | continue; |
558 | cur->next= dn; | 558 | cur->next= dn; |