[hackers] [sbase] Actually move past the field separator || FRIGN

From: <git_AT_suckless.org>
Date: Thu, 10 Mar 2016 09:48:17 +0100 (CET)

commit 9d120b7b3204dc4fa5b90be9ee272f4c35914b15
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Mon Mar 7 00:20:24 2016 +0100
Commit: sin <sin_AT_2f30.org>
CommitDate: Thu Mar 10 08:48:09 2016 +0000

    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.

diff --git a/sort.c b/sort.c
index 00061fd..cb6f851 100644
--- a/sort.c
+++ b/sort.c
_AT_@ -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;
Received on Thu Mar 10 2016 - 09:48:17 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 10 2016 - 10:00:25 CET