[hackers] [sbase] sort: Don't do fallback top-level sort in check mode || Michael Forney

From: <git_AT_suckless.org>
Date: Sat, 4 Jan 2020 01:12:47 +0100 (CET)

commit e5284b15378085f541449532798d3d99b13cacd2
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Fri Jan 3 15:32:07 2020 -0800
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Fri Jan 3 15:42:33 2020 -0800

    sort: Don't do fallback top-level sort in check mode
    
    The fallback useful to provide a consistent order of tied lines, but
    in check mode, we don't want it to report disorder for equal lines
    (according to the passed flags).
    
    Thanks to Richard Ipsum for the bug report and proposed patch.

diff --git a/sort.c b/sort.c
index a51997f..fbb1abf 100644
--- a/sort.c
+++ b/sort.c
_AT_@ -385,7 +385,8 @@ main(int argc, char *argv[])
         /* -b shall only apply to custom key definitions */
         if (TAILQ_EMPTY(&kdhead) && global_flags)
                 addkeydef("1", global_flags & ~(MOD_STARTB | MOD_ENDB));
- addkeydef("1", global_flags & MOD_R);
+ if (TAILQ_EMPTY(&kdhead) || (!Cflag && !cflag))
+ addkeydef("1", global_flags & MOD_R);
 
         if (!argc) {
                 if (Cflag || cflag) {
Received on Sat Jan 04 2020 - 01:12:47 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 04 2020 - 01:24:23 CET