diff options
author | Bartosz Golaszewski <bartekgola@gmail.com> | 2014-01-19 09:10:14 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-01-19 09:10:14 +0100 |
commit | 5c13ab41bb9472b792797a339f93a3a3ca62fd7a (patch) | |
tree | 864ee45c1fec26cd160dce0bbbb95e1a95f6e27f /coreutils | |
parent | 1a4d9f652169afa08680d3ff2c2cf9efa2a76a1b (diff) | |
download | busybox-w32-5c13ab41bb9472b792797a339f93a3a3ca62fd7a.tar.gz busybox-w32-5c13ab41bb9472b792797a339f93a3a3ca62fd7a.tar.bz2 busybox-w32-5c13ab41bb9472b792797a339f93a3a3ca62fd7a.zip |
sort: check global flags on fallback sort
Sort now performs global reverse on fallback sort if -r is set. Before
only key local flags were checked.
function old new delta
compare_keys 712 738 +26
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/sort.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/coreutils/sort.c b/coreutils/sort.c index 0b3b650c9..1cb4c3e3f 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -302,10 +302,14 @@ static int compare_keys(const void *xarg, const void *yarg) | |||
302 | } /* for */ | 302 | } /* for */ |
303 | 303 | ||
304 | /* Perform fallback sort if necessary */ | 304 | /* Perform fallback sort if necessary */ |
305 | if (!retval && !(option_mask32 & FLAG_s)) | 305 | if (!retval && !(option_mask32 & FLAG_s)) { |
306 | retval = strcmp(*(char **)xarg, *(char **)yarg); | 306 | retval = strcmp(*(char **)xarg, *(char **)yarg); |
307 | flags = option_mask32; | ||
308 | } | ||
309 | |||
310 | if (flags & FLAG_r) | ||
311 | return -retval; | ||
307 | 312 | ||
308 | if (flags & FLAG_r) return -retval; | ||
309 | return retval; | 313 | return retval; |
310 | } | 314 | } |
311 | 315 | ||