sort: allow keys where start_col > end_col
Useful in (rare) cases like: $ printf 'aaaa c\nx a\n0 b\n' | sort -k 2,1.3 And this is how POSIX wants it.
This commit is contained in:
parent
061932a31b
commit
403b047a30
2
sort.c
2
sort.c
@ -157,7 +157,7 @@ parse_keydef(struct keydef *kd, char *s, int flags)
|
||||
return -1;
|
||||
if (*rest == ',') {
|
||||
kd->end_column = strtol(rest+1, &rest, 10);
|
||||
if (kd->end_column && kd->end_column < kd->start_column)
|
||||
if (kd->end_column < 1)
|
||||
return -1;
|
||||
if (*rest == '.') {
|
||||
kd->end_char = strtol(rest+1, &rest, 10);
|
||||
|
Loading…
Reference in New Issue
Block a user