sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit e7adf603a1b21646adc578ded05088fe9577f299
parent 0cb461898426a98e3d460c784dd5389af60a7b88
Author: tty0 <tty0@teknik.io>
Date:   Mon Feb 15 09:56:11 +0000

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

Diffstat:
ls.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ls.c b/ls.c @@ -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); @@ -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]); @@ -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':