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
Karel Zak
3e094e5fe2
column: make more obvious what is default behavior
...
The man page contains mistakes. The default is to fill columns before
lines:
$ printf 'aaaaaaaaaaaaaaaaaaaaaa\nBBBBBBBBBBBBBBBBBBBBB\nXXXXXXX\nYYYYYYYYYYY\nZZZZZ' > data
$ column --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa XXXXXXX ZZZZZ
BBBBBBBBBBBBBBBBBBBBB YYYYYYYYYYY
$ column --fillrows --columns 80 < data
aaaaaaaaaaaaaaaaaaaaaa BBBBBBBBBBBBBBBBBBBBB XXXXXXX
YYYYYYYYYYY ZZZZZ
The patch also rename functions in the code to make it more obvious
for code readers.
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-01 12:25:16 +01:00
Sami Kerola
2ba641e5f3
misc: add static keyword to where needed [smatch scan]
...
text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be
static?
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 12:58:49 +01:00
Sami Kerola
8791804065
misc: do not use plain 0 as NULL [smatch scan]
...
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer
Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.
Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 12:58:49 +01:00
Carlos Santos
9ea8ded37b
build-sys: fix compilation with ncurses and uClibc or musl libc
...
Compiling util-linux with musl and uClibc-ng toolchains when wide-char
support is not enabled in ncurses results in compilation failures with
the following message:
error: two or more data types in declaration specifiers
#define
wchar_t char
The problem occurs because util-linux #defines its own wchar_t (as char)
when configured without widechar support. This conflicts with definition
of wchar_t contained in stddef.h.
This error can be reproduced running "<toolchain-cc -o test test.c" with
the following test program:
#include <ctype.h>
#define wchar_t char
#include <stddef.h>
int main()
{
return 0;
}
The only way to avoid the problem it to reorder the inclusion of headers
in some files under the text-utils directory.
Addresses:
http://autobuild.buildroot.net/results/3a2f228e0fa7b5cc28a13d49f48f1a6aef8d9d7a
http://autobuild.buildroot.net/results/99e96069f652d511c6212a5bb6be29e68fb1747c
http://autobuild.buildroot.net/results/2dc5721aef93b7b410153bafad78248fac3db941
http://autobuild.buildroot.net/results/8a9e197ba7a292b18f8c0c36dca974685556a38a
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
2017-01-20 11:07:46 +01:00
Karel Zak
d7a3bf949b
column: rename --columns to --output-width
...
* rename to use less confusing option name
* cleanup usage()
* update man page
Addresses: https://github.com/karelzak/util-linux/pull/327
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-17 13:14:05 +01:00
Karel Zak
677ec86cef
Use --help suggestion on invalid option
...
The current default is to print all usage() output. This is overkill
in many case.
Addresses: https://github.com/karelzak/util-linux/issues/338
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 13:13:34 +01:00
Karel Zak
683ddbd5c4
column: ignore non-printable chars
...
echo -e '\033[33mb\033[mXFoo\n\033[33mbar\033[mXFoo' | column -s X -t
old version:
b Foo
bar Foo
fixed version:
b Foo
bar Foo
References: https://github.com/karelzak/util-linux/issues/252
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-13 10:08:39 +01:00
Boris Egorov
43b4f7ea5f
lib/tty: Pass default width to get_terminal_width()
...
Almost any code calling get_terminal_width() checks returned width for
non-positive values and sets it to some default value (say, 80). So,
let's pass this default value directly to the function.
[kzak@redhat.com: - get_terminal_width() refactoring]
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-06 12:22:07 +01:00
Benno Schulenberg
451dbcfae1
textual: add a docstring to most of the utilities
...
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html ).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Sami Kerola
f627750083
textual: use version printing macro everywhere
...
Only mount, umount, and blkid remains not using the macro because they
are print also library references.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:23 +02:00
Sami Kerola
acb5f9b56e
column: inform user when multibyte conversion error occurs
...
The column(1) read input until conversion error, and used incomplete
input when outputing, that made at least me to wonder where the rest
disappeared without explanation. IMHO it is better to fail immediately
rather than do only half of the task.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-07 11:28:48 +02:00
Karel Zak
cd70a4606a
column: fix mem leak [coverity scan]
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-14 17:55:05 +01:00