bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fileutils-4.1 ls suggestion


From: John Love-Jensen
Subject: fileutils-4.1 ls suggestion
Date: Wed, 27 Feb 2002 15:25:27 -0600
User-agent: Microsoft-Entourage/10.0.0.1309

Hello list,

It's really nice to have the directories grouped together at the front of
the directory listing.  In my opinion.

I asked for this before, and was told "NO!"  I assume the answer has not
changed.

Anyway, many years ago, I had made the small change to implement the
feature.  It's a quick kluge, and it's lacking coding goodness.  I just
instrumented the current code, and thought I'd share with the world.

Code base:  fileutils-4.1

Sincerely,
John "Eljay" Love-Jensen

--------------------------

(bash): diff ls.c.original ls.c
437a438
> static int group_dir;
666c667,668
<   TIME_OPTION
---
>   TIME_OPTION,
>   GROUP_DIR_OPTION
703a706
>   {"group-dir", no_argument, 0, GROUP_DIR_OPTION},
1294a1298,1301
>       case GROUP_DIR_OPTION:
>         group_dir = 1;
>         break;
> 
2133a2141,2149
> int (*gSortFunc)();
> static int
> compare_dir (const struct fileinfo *file1, const struct fileinfo *file2)
> {
>   int flag;
>   flag = S_ISDIR(file2->stat.st_mode) - S_ISDIR(file1->stat.st_mode);
>   if(flag) return flag;
>   return (*gSortFunc)(file1, file2);
> }
2173a2190,2195
>     }
> 
>   if(group_dir)
>     {
>       gSortFunc = func;
>       func = compare_dir;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]