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
62fa0883be
text-utils: use errexec()
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:40:43 +01:00
Sami Kerola
fcf841f8d3
misc: fix typos
...
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-28 14:39:13 +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
b305445495
misc: consolidate all --help option descriptions
...
Now we are always using the same text also for commands
which had still hardcoded descriptions or where we can't
use the standard print_usage_help_options macro.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:28:36 +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
86be6a32d3
misc: cosmetics, remove argument from usage(FILE*)
...
This patch is trivial and changes nothing, because
we were always using usage(stdout)
Now all our usage() functions look very similar. If wanted we
could auto-generate another big cosmetical patch to remove all
the useless "FILE *out" constants and use printf and puts
rather than their f* friends. Such patch could be automatically
synchronized with the translation project (newlines!) to not
make the translators sick.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +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
Ruediger Meier
6e1eda6f22
misc: never use usage(stderr)
...
Here we fix all cases where we have usage(FILE*)
functions.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Ruediger Meier
9325dbfd20
misc: cleanup and fix --unknownopt issues
...
Fixed checkusage.sh warnings:
rtcwake: --unknownopt, non-empty stdout
rtcwake: --unknownopt, stderr too long: 21
blockdev: --unknownopt, stderr too long: 28
lsipc: --unknownopt, stderr too long: 77
pg: --unknownopt, stderr too long: 23
renice: --unknownopt, stderr too long: 18
sulogin: --unknownopt, stderr too long: 17
write: --unknownopt, stderr too long: 12
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Ruediger Meier
c1da6d1eec
more: add --help and --version
...
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-22 21:35:01 +02:00
Ruediger Meier
0caad87fdb
misc: remove superfluous null pointer checks for optarg
...
This is only needed for optional arguments.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-22 02:56:57 +02:00
Ruediger Meier
d0c5e5c241
more: remove unused variable
...
slow_tty is at least unused since util-linux 2.2.
FYI here is another derived more.c where slow_tty is still used:
https://github.com/sergev/LiteBSD/blob/master/old/more/more.c
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-15 08:55:40 +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
Sami Kerola
b1557fe981
misc: fix ggc-7 fallthrough warnings
...
(Original patch and commit message edited by Rudi.)
gcc-7 adds -Wimplicit-fallthrough=3 to our default flag -Wextra.
This warning can be silenced by using comment /* fallthrough */
which is also recognized by other tools like coverity. There are
also other valid comments (see man gcc-7) but we consolidate this
style now.
We could have also used __attribute__((fallthrough)) but the comment
looks nice and does not need to be ifdef'ed for compatibility.
Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652
Reference: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
Reviewed-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Suggested-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 11:48:22 +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
3947ca4ca9
build-sys: ncurses headers cleanup
...
* assume ncursesw headers in ncursesw/ directory only
* prefer long paths, <term.h> and <ncurses.h> should be last
possibility
* fix typos
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-31 11:01:46 +02:00
Karel Zak
2ac1bc84d7
text-utils: use proper paths to term.h
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-30 17:15:37 +02:00
Sami Kerola
2571d74382
docs: make column.1 example to use ascii output
...
In same go ease reading by having data and arguments in same order.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-05-10 10:53:28 +02:00
Sami Kerola
b6b5272b03
col: avoid extra newline if no input
...
BSD fix missed for 22 years, and all util-linux releases so far.
Backported-from: 2a15260a2a
Addresses: https://github.com/karelzak/util-linux/issues/422
Reported-by: Pavel Raiskup <praiskup@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-05-10 10:53:28 +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
60102db546
column: add note that circular dependencies are ignored
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-05 11:52:04 +02:00
Karel Zak
435846ef99
column: add --tree to the man page
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-05 11:47:46 +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
960ee8e3f1
build-sys: remove column-old.c
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-03 10:40:46 +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
838ca70ce7
columns: add note about 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
236092172a
column: clean up man page
...
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