From 6c7f288bd81648e789a3d6717a8a651fc557b059 Mon Sep 17 00:00:00 2001 From: Connor Lane Smith Date: Thu, 26 May 2011 05:03:37 +0100 Subject: [PATCH] separate dirs --- ln.1 | 1 - ls.c | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ln.1 b/ln.1 index bb3c408..edb1e60 100644 --- a/ln.1 +++ b/ln.1 @@ -22,6 +22,5 @@ be linked into the given directory. create a symbolic link. .SH SEE ALSO .IR cp (1), -.IR mv (1), .IR link (2), .IR symlink (2) diff --git a/ls.c b/ls.c index 10a82b6..d491479 100644 --- a/ls.c +++ b/ls.c @@ -32,6 +32,7 @@ static bool aflag = false; static bool dflag = false; static bool lflag = false; static bool tflag = false; +static bool first = true; static bool many; int @@ -113,8 +114,12 @@ lsdir(const char *path) closedir(dp); qsort(ents, n, sizeof *ents, (int (*)(const void *, const void *))entcmp); - if(many) + if(many) { + if(!first) + putchar('\n'); printf("%s:\n", path); + first = false; + } for(i = 0; i < n; i++) { output(&ents[i]); free(ents[i].name);