[hackers] [sbase] Fix showing directories when -R flag is set in ls(1) || pekka.jylha.ollila_AT_gmail.com
commit bb83eade399e7d6f3642ae3a5e2cdebab6f222a1
Author: pekka.jylha.ollila_AT_gmail.com <pekka.jylha.ollila_AT_gmail.com>
AuthorDate: Wed Feb 17 20:56:39 2016 +0200
Commit: sin <sin_AT_2f30.org>
CommitDate: Wed Feb 17 19:49:07 2016 +0000
Fix showing directories when -R flag is set in ls(1)
Here's a better version of the patch.
When the R flag is used with a single directory, the given directory name is
omitted. With multiple directories each directory name is listed.
Directories that start with './' and '../' are now also printed.
diff --git a/ls.c b/ls.c
index b132a3c..72d7434 100644
--- a/ls.c
+++ b/ls.c
_AT_@ -270,7 +270,7 @@ lsdir(const char *path, const struct entry *dir)
if (!Uflag)
qsort(ents, n, sizeof(*ents), entcmp);
- if (ds > 1 && (path[0] || dir->name[0] != '.'))
+ if (ds++)
printf("%s:\n", dir->name);
for (i = 0; i < n; i++)
output(&ents[i]);
Received on Wed Feb 17 2016 - 20:49:12 CET
This archive was generated by hypermail 2.3.0
: Wed Feb 17 2016 - 21:00:14 CET