column: fix outputing empty column at the end of line
The following commands manifests the problem. In old versions before commit4762ae9d60
("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>
This commit is contained in:
parent
8bad603ae0
commit
325bfd53e8
|
@ -0,0 +1 @@
|
|||
|
|
|
@ -0,0 +1 @@
|
|||
||
|
|
@ -116,4 +116,12 @@ ts_init_subtest "empty-column"
|
|||
printf ':a:b\n' | $TS_CMD_COLUMN --table --separator ':' --output-separator ':' >> $TS_OUTPUT 2>&1
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "empty-column-at-eol"
|
||||
printf '|' | $TS_CMD_COLUMN --separator '|' --output-separator '|' --table >> $TS_OUTPUT 2>&1
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "empty-column-at-eol2"
|
||||
printf '||' | $TS_CMD_COLUMN --separator '|' --output-separator '|' --table >> $TS_OUTPUT 2>&1
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_finalize
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue