[hackers] [PATCH] Fix showing directories when -R flag is set in ls(1)

From: Pekka Jylhä-Ollila <pekka.jylha.ollila_AT_gmail.com>
Date: Wed, 17 Feb 2016 18:27:19 +0200

The directory names weren't displayed at all with the -R flag.
They should always be shown when it is set.
---
 ls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ls.c b/ls.c
index b132a3c..b4dad41 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 > 1 && (path[0] || dir->name[0] != '.')) || Rflag)
 		printf("%s:\n", dir->name);
 	for (i = 0; i < n; i++)
 		output(&ents[i]);
-- 
2.1.4
Received on Wed Feb 17 2016 - 17:27:19 CET

This archive was generated by hypermail 2.3.0 : Wed Feb 17 2016 - 19:12:15 CET