commit 9d120b7b3204dc4fa5b90be9ee272f4c35914b15
parent 0e25f09b56d2a9e1e4e32cbb74a11b248c50ba71
Author: FRIGN <dev@frign.de>
Date: Mon, 7 Mar 2016 00:20:24 +0100
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.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sort.c b/sort.c
@@ -62,8 +62,9 @@ skipcolumn(struct linebufline *a, int skip_to_next_col)
if (fieldsep) {
if ((s = memmem(a->data, a->len, fieldsep, fieldseplen))) {
if (skip_to_next_col) {
- a->len = a->len - (s - a->data);
+ s += fieldseplen;
a->data = s;
+ a->len = a->len - (s - a->data);
}
} else {
a->data += a->len - 1;