aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/ls.c18
-rw-r--r--ls.c18
2 files changed, 18 insertions, 18 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 8f4cae10d..d24ba9866 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -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;
diff --git a/ls.c b/ls.c
index 8f4cae10d..d24ba9866 100644
--- a/ls.c
+++ b/ls.c
@@ -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;