Actually move past the field separator

Previously, sort(1) failed on key-based sorting and was caught in an
infinite loop with the c-flag.
This commit is contained in:
FRIGN 2016-03-07 00:20:24 +01:00 committed by sin
parent 0e25f09b56
commit 9d120b7b32

3
sort.c
View File

@ -62,8 +62,9 @@ skipcolumn(struct linebufline *a, int skip_to_next_col)
if (fieldsep) { if (fieldsep) {
if ((s = memmem(a->data, a->len, fieldsep, fieldseplen))) { if ((s = memmem(a->data, a->len, fieldsep, fieldseplen))) {
if (skip_to_next_col) { if (skip_to_next_col) {
a->len = a->len - (s - a->data); s += fieldseplen;
a->data = s; a->data = s;
a->len = a->len - (s - a->data);
} }
} else { } else {
a->data += a->len - 1; a->data += a->len - 1;