Re: [dev] [sbase][PATCH] ls: only display directory headers when more than one directory is specified

From: tty0 <tty0_AT_teknik.io>
Date: Sun, 14 Feb 2016 14:37:09 -0800

On 2016-02-14 13:59, tty0 wrote:
> ---
> ls.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/ls.c b/ls.c
> index 3611a87..36a1fb6 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;
>
> 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 Sun Feb 14 2016 - 23:37:09 CET

This archive was generated by hypermail 2.3.0 : Sun Feb 14 2016 - 23:48:11 CET