From 32113a23ce792a718d654bd0ef8387f1b6648a2a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 22 Jun 2008 04:15:36 -0500 Subject: Only apply global flags to fallback sort. --- toys/sort.c | 8 +++++--- 1 file 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); } -- cgit v1.2.3