diff options
author | Yousong Zhou | 2019-07-29 03:24:29 +0200 |
---|---|---|
committer | Karel Zak | 2019-07-29 10:33:58 +0200 |
commit | 325bfd53e889fd52f240e4bcbd690b03dddc7570 (patch) | |
tree | 743b7c742d84669da2758fef45350a8da7ee8d71 /text-utils/column.c | |
parent | lscpu: (man) add note about cache sizes (diff) | |
download | kernel-qcow2-util-linux-325bfd53e889fd52f240e4bcbd690b03dddc7570.tar.gz kernel-qcow2-util-linux-325bfd53e889fd52f240e4bcbd690b03dddc7570.tar.xz kernel-qcow2-util-linux-325bfd53e889fd52f240e4bcbd690b03dddc7570.zip |
column: fix outputing empty column at the end of line
The following commands manifests the problem. In old versions before
commit 4762ae9d60 ("column: use libsmartcols for --table"), both of them
should output with 2 "|"
echo '||' | column -o '|' -s '|' -t
echo '|| ' | column -o '|' -s '|' -t
Fixes: 4762ae9d60 ("column: use libsmartcols for --table")
Signed-off-by: Yousong Zhou <zhouyousong@yunionyun.com>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'text-utils/column.c')
-rw-r--r-- | text-utils/column.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/text-utils/column.c b/text-utils/column.c index 13b39537e..9d56e514c 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -169,7 +169,7 @@ static wchar_t *local_wcstok(wchar_t *p, const wchar_t *separator, int greedy, w return strtok_r(p, separator, state); #endif if (!p) { - if (!*state || !**state) + if (!*state) return NULL; p = *state; } |