[hackers] [sbase] ls: only display directory headers when more than one directory is specified || tty0

From: <git_AT_suckless.org>
Date: Mon, 15 Feb 2016 10:59:16 +0100 (CET)

commit b107489bf2cda579ca53551206270b9eee80c059
Author: tty0 <tty0_AT_teknik.io>
AuthorDate: Mon Feb 15 09:56:11 2016 +0000
Commit: sin <sin_AT_2f30.org>
CommitDate: Mon Feb 15 09:59:09 2016 +0000

    ls: only display directory headers when more than one directory is specified

diff --git a/ls.c b/ls.c
index 3611a87..b132a3c 100644
--- a/ls.c
+++ b/ls.c
_AT_@ -52,6 +52,7 @@ static int Uflag = 0;
 static int uflag = 0;
 static int first = 1;
 static char sort = 0;
+static size_t ds = 0;
 
 static void ls(const char *, const struct entry *, int);
 
_AT_@ -269,7 +270,7 @@ lsdir(const char *path, const struct entry *dir)
         if (!Uflag)
                 qsort(ents, n, sizeof(*ents), entcmp);
 
- if (path[0] || dir->name[0] != '.')
+ if (ds > 1 && (path[0] || dir->name[0] != '.'))
                 printf("%s:\n", dir->name);
         for (i = 0; i < n; i++)
                 output(&ents[i]);
_AT_@ -360,7 +361,7 @@ int
 main(int argc, char *argv[])
 {
         struct entry ent, *dents, *fents;
- size_t i, ds, fs;
+ size_t i, fs;
 
         ARGBEGIN {
         case '1':
Received on Mon Feb 15 2016 - 10:59:16 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 15 2016 - 11:00:36 CET