]> git.ipfire.org Git - thirdparty/util-linux.git/commit
column: fix greedy mode on -l
authorKarel Zak <kzak@redhat.com>
Thu, 4 Aug 2022 08:13:49 +0000 (10:13 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 4 Aug 2022 08:21:06 +0000 (10:21 +0200)
commit8ac75e31de0ece74515e98e0b22e54cc0a9808bd
tree59d561950214561040ad2fda200b2b930b4f7f00
parent4aacf57da1e41643fa789d3ffe848d50029a62de
column: fix greedy mode on -l

In the 'greedy' mode strtok() skips leading white chars, but code for
-l (merge remaining data to the last column) do not count the skipped
chars.

Old version:

$ printf '  a b c\n1 2 3\n' | column -t -o '-' -l2
a-a
1-2 3

Fixed version:

$ printf '  a b c\n1 2 3\n' | column -t -o '-' -l2
a-b c
1-2 3

Note, see leading white chars '  a b c'.

Fexes: https://github.com/util-linux/util-linux/issues/1763
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/column.c