Sami Kerola
073abd4ca8
column: pass control struct to local_wcstok()
...
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-08-21 15:00:16 +02:00
Yousong Zhou
325bfd53e8
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>
2019-07-29 10:33:58 +02:00
Karel Zak
dd45b90eef
column: make code more robust [coverity scan]
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-28 13:25:15 +02:00
Karel Zak
2c308875a7
misc: consolidate version printing and close_stdout()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Karel Zak
2698f9ba88
column: add --table-empty-lines
...
The option allows to add empty line to the table. The default behavior
is to ignore empty lines at all.
echo -e "A\nAA\nAAA\n\nAAAA" | ./column --table
A
AA
AAA
AAAA
$ echo -e "A\nAA\nAAA\n\nAAAA" | ./column --table --table-empty-lines
A
AA
AAA
AAAA
Addresses: https://github.com/karelzak/util-linux/issues/593
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-23 13:34:43 +02:00
Karel Zak
651c5d428c
column: fix leading space characters bug
...
The bug has been introduced during column(1) rewrite. The function
read_input() need to skip leading space only temporary to detect empty
lines, but the rest of the code has to use the original buffer (line).
I've tried to fix one of the symptoms by 5c7b67fbbf
(alter), but this solution is unnecessary and too complex.
Changes:
* don't ignore leading space
* remove unnecessary stuff introduced by 5c7b67fbbf
* fix regression test with incorrect separator
Addresses: https://github.com/karelzak/util-linux/issues/575
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1560283
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-27 10:55:27 +02:00
Karel Zak
d658091710
column: fix memory leak [coverity scan]
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-20 14:48:26 +01:00
Karel Zak
5c7b67fbbf
column: don't ignore space-char separators at begin of the line
...
Non-space separator:
$ echo -e ",col1,col2\nrow,1,2" | column -t -s "," --table-columns A,B,C
A B C
col1 col2
row 1 2
Space-char (\t) separator:
$ echo -e "\tcol1\tcol2\nrow\t1\t2" | column -t -s "$(echo -e '\t')" --table-columns A,B,C
A B C
col1 col2
row 1 2
Fixed version:
$ echo -e "\tcol1\tcol2\nrow\t1\t2" | column -t -s "$(echo -e '\t')" --table-columns A,B,C
A B C
col1 col2
row 1 2
Addresses: https://github.com/karelzak/util-linux/issues/575
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-12 14:06:02 +01:00
Karel Zak
dda229c7b2
column: use \x<hex> for invalid multibyte seq.
...
Addresses: https://github.com/karelzak/util-linux/issues/542
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-22 14:43:36 +01:00
Karel Zak
b5de9e6942
column: allow to hide unnamed columns
...
Addresses: https://github.com/karelzak/util-linux/pull/327
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-13 14:17:23 +01:00
Karel Zak
785e543645
column: add --table-noheadings
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-13 12:56:21 +01:00
Karel Zak
00e8e677e6
column: (-t) disable encoding for non-printable chars
...
$ echo -e '\033[34mBLUE{1\n\033[31mRED{2\n' | ./column -s '{' -t
BLUE 1
RED 2
Addresses: https://github.com/karelzak/util-linux/issues/490
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-31 11:48:38 +02:00
Ruediger Meier
f45f3ec34a
misc: consolidate macro style USAGE_HELP_OPTIONS
...
changed in include/c.h and applied via sed:
sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-29 16:54:33 +02:00
Carlos Santos
ccedd0d7b1
column: fix compilation when libc lacks wide-character support
...
Commit 4762ae9d
removed mtsafe_strtok() but left behind calls to wcstok
and wcspbrk. This leads to build failures when libc does not have the
wide-character functions, like some uClibc builds.
Solve the problem by using strtok_r and strpbrk when HAVE_WIDECHAR is
not defined.
Fixes:
http://autobuild.buildroot.net/results/fd8a1a8e0cef3aeed9588540e8e663664f6b43aa
http://autobuild.buildroot.net/results/5ad73ea8b471321988c50d80a5e50d4504151dd6
http://autobuild.buildroot.net/results/04411b7280dc51ecd51236967981a42352bbeb3e
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
2017-06-29 13:03:43 +02:00
Ruediger Meier
b1a294c448
misc: introduce print_usage_help_options()
...
Consolidate --help and --version descriptions. We are
now able to align them to the other options.
We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:26:19 +02:00
Ruediger Meier
fa2cd89aca
misc: cosmetics, remove argument from usage(int)
...
This patch is trivial and changes nothing, because
we were always using usage(0).
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Sami Kerola
f4d3783867
misc: remove stray semicolons
...
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 12:21:29 +02:00
Karel Zak
d9eddf72a3
column: add --table-header-repeat
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-13 11:14:46 +02:00
Alexander Kuleshov
8bc5195be9
column: add missed semicolons in case of !HAVE_WIDECHAR
...
In other case we will get:
error: expected ‘;’ before ‘}’ token
error.
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
2017-06-01 10:56:08 +02:00
Karel Zak
da06d42197
column: be robust on empty table
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-05 13:56:40 +02:00
Karel Zak
cb3fdf2ae9
column: require column names for JSON
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-05 12:49:51 +02:00
Karel Zak
c467fdaf80
column: use libsmartcols to avoid circular dependences
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-05 12:13:15 +02:00
Karel Zak
b0f00a9471
column: fix --tree id-parent loop crash
...
The loop is silently ignored.
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-05 11:31:47 +02:00
Karel Zak
74cc7c2515
column: parent and child has to be independent
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
bd6b5a6498
column: force to follow specified width
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
c728e00012
column: use NOEXTREMES for the last column
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
90852c3e12
column: add support for trees
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
7e947f48e7
column: clean up usage() and options order
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
166271a90b
column: add --table-order
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
2483c4c9da
column: fix typo
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
9624f6157c
column: add --table-hide
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
68916af3b9
column: add --table-wrap
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
1ae24ec239
column: add --table-noextreme
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
3ba01db0ab
column: add --table-truncate
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
01e335c9e4
column: rename options
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
f05593e100
column: fix greedy initialization
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
dbed2f8c63
column: add --table-colright
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
be03f65232
column: use err_exclusive_options()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
86399c3306
column: make mbs/wcs conversions more robust
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
9dbe8e1c02
column: add --json
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
11a1092ad6
column: add --table-colnames
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
739e58ffe0
column: rename too generic macro
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
4762ae9d60
column: use libsmartcols for --table
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
8f1be58816
column: clean up multi-byte #ifelse
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
37d84d6d26
column: reorder functions
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
d6b63b9f1d
column: rename functions
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak
3cc2ade826
column: don't ignore mbs_to_wcs() errors
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:17:59 +02:00
Karel Zak
0784187d14
column: make input() more generic
...
* remove line size limit
* use multi-byte rather than wchar when read input
* prepare for future libsmartcols use in input() for table
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:17:59 +02:00
Karel Zak
2593c13998
column: use colntrol struct on more places
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:17:59 +02:00
Karel Zak
7d07df62a2
columns: add control struct
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:17:59 +02:00