Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-06 Thread Rob
On Sat, Oct 05, 2013 at 03:47:05PM +0400, Alexander S. wrote: > 2013/10/5 Rob : > > On Fri, Oct 04, 2013 at 05:45:56PM +0400, Alexander S. wrote: > > I disagree - rather than adding a sort call and changing the program's > > runtime complexity, can't we just reduce the amount of lines _and_ > > dup

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-05 Thread Alexander S.
2013/10/5 Rob : > On Fri, Oct 04, 2013 at 05:45:56PM +0400, Alexander S. wrote: >> 2013/10/4 Raphaël Proust : >> If we want to retain this patch, I'd suggest reversing array after >> sorting, not multiplying by `sortorder' in comparison functions. This >> avoids code duplication. > > I disagree - r

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-05 Thread Markus Teich
Rob wrote: > I disagree - rather than adding a sort call and changing the program's > runtime complexity, can't we just reduce the amount of lines _and_ > duplication like this: > > @@ -89,9 +93,9 @@ entcmp(const void *va, const void *vb) > const Entry *a = va, *b = vb; > > - if(tfl

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-05 Thread Rob
On Fri, Oct 04, 2013 at 05:45:56PM +0400, Alexander S. wrote: > 2013/10/4 Raphaël Proust : > If we want to retain this patch, I'd suggest reversing array after > sorting, not multiplying by `sortorder' in comparison functions. This > avoids code duplication. I disagree - rather than adding a sort

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-04 Thread Thorsten Glaser
Raphaël Proust dixit: >On Fri, Oct 4, 2013 at 2:32 PM, Alexander S. wrote: >> Uh, cannot this be achieved by piping output to tac? > >At which points someone asks why is there a sorted order at all in ls >output… cannot this be achieved by piping output to sort? Only if you pipe it through rs¹

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-04 Thread Markus Teich
Alexander S. wrote: > If we want to retain this patch, I'd suggest reversing array after > sorting, not multiplying by `sortorder' in comparison functions. This > avoids code duplication. Good suggestion. I will implement it tonight. --Markus

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-04 Thread Markus Teich
Alexander S. wrote: > Uh, cannot this be achieved by piping output to tac? Roberto E. Vargas Caballero wrote: > Yes, but tac it is no a standard posix tool, and sbase also hasn't it. > I have an awk script in my machine for it: Both solutions mean iterating over the list once more to reverse the

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-04 Thread Nick
On Fri, Oct 04, 2013 at 02:40:57PM +0100, Raphaël Proust wrote: > On Fri, Oct 4, 2013 at 2:32 PM, Alexander S. wrote: > > Uh, cannot this be achieved by piping output to tac? > > At which points someone asks why is there a sorted order at all in ls > output… cannot this be achieved by piping out

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-04 Thread Alexander S.
2013/10/4 Raphaël Proust : > On Fri, Oct 4, 2013 at 2:32 PM, Alexander S. wrote: >> Uh, cannot this be achieved by piping output to tac? > > At which points someone asks why is there a sorted order at all in ls > output… cannot this be achieved by piping output to sort? sort(1) can only sort by n

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-04 Thread Raphaël Proust
On Fri, Oct 4, 2013 at 2:32 PM, Alexander S. wrote: > Uh, cannot this be achieved by piping output to tac? At which points someone asks why is there a sorted order at all in ls output… cannot this be achieved by piping output to sort? -- __ Raphaël Proust

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-04 Thread Roberto E. Vargas Caballero
On Fri, Oct 04, 2013 at 05:32:23PM +0400, Alexander S. wrote: > Uh, cannot this be achieved by piping output to tac? Yes, but tac it is no a standard posix tool, and sbase also hasn't it. I have an awk script in my machine for it: #!/usr/bin/awk -f {line[last++] = $0;} END { for (

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-04 Thread Alexander S.
Uh, cannot this be achieved by piping output to tac?

Re: [dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-03 Thread sin
On Thu, Oct 03, 2013 at 06:42:08PM +0200, Markus Teich wrote: > Now you can list directory contents ordered by mtime with the latest file > displayed last in the output. Please consider using git format-patch. Thanks, sin

[dev] [sbase] [PATCH] ls: add option to reverse the sort order

2013-10-03 Thread Markus Teich
Now you can list directory contents ordered by mtime with the latest file displayed last in the output. --- ls.1 | 3 +++ ls.c | 8 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ls.1 b/ls.1 index 00ae32b..f10c929 100644 --- a/ls.1 +++ b/ls.1 @@ -21,6 +21,9 @@ lists direct