diff options
author | Rob Landley <rob@landley.net> | 2008-06-22 04:15:36 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2008-06-22 04:15:36 -0500 |
commit | 32113a23ce792a718d654bd0ef8387f1b6648a2a (patch) | |
tree | c7486515e866208ae072fa4cdeb6bea0fcadaddf /toys | |
parent | 7bc357dc70f1f64e607f28b21a779af2c8a09753 (diff) | |
download | toybox-32113a23ce792a718d654bd0ef8387f1b6648a2a.tar.gz |
Only apply global flags to fallback sort.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/sort.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/toys/sort.c b/toys/sort.c index 817d86ec..bf69f42f 100644 --- a/toys/sort.c +++ b/toys/sort.c @@ -253,7 +253,7 @@ static int compare_keys(const void *xarg, const void *yarg) for (key=(struct sort_key *)TT.key_list; !retval && key; key = key->next_key) { - flags = (key->flags) ? key->flags : toys.optflags; + flags = key->flags ? key->flags : toys.optflags; // Chop out and modify key chunks, handling -dfib @@ -272,8 +272,10 @@ static int compare_keys(const void *xarg, const void *yarg) } else retval = compare_values(flags, *xx, *yy); // Perform fallback sort if necessary - - if (!retval && !(toys.optflags&FLAG_s)) retval = strcmp(*xx, *yy); + if (!retval && !(CFG_SORT_BIG && (toys.optflags&FLAG_s))) { + retval = strcmp(*xx, *yy); + flags = toys.optflags; + } return retval * ((flags&FLAG_r) ? -1 : 1); } |