The --separator and --columns long options in util-linux-2.21.2 and in
a git clone from 5 minutes ago, don't work:
$ echo foobar | column -s x
foobar
$ echo foobar | column -c 10
foobar
$ echo foobar | column --separator=x
column: option '--separator' doesn't allow an argument
$ echo foobar | column --separator x
Segmentation fault
$ echo foobar | column --columns 10
column: bad columns width value: '(null)': Invalid argument
$ echo foobar | column --columns=10
column: option '--columns' doesn't allow an argument
Looks like a simple case of missing has_arg flag in the "struct
option" initialization for these two options. The patch just adds the
flag. I haven't done thorough testing of the patched code, but it
seems to work OK and it no longer segfaults or tries to dereference a
null pointer.
Signed-off-by: Karel Zak <kzak@redhat.com>
Variables from global scope are moved to main, and passed as
function arguments where ever they are needed.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Solaris lacks err, errx, warn and warnx. This also means the err.h header
doesn't exist. Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Following warnings will longer appear when one will compile with
gcc flags -Wall -Wextra -pedantic
column.c:364:2: warning: comparison of unsigned expression < 0 is always false
column.c:369:2: warning: comparison of unsigned expression < 0 is always false
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
For the last line of the file lenght of line should be determined
where the EOF is instead of new line. Old output was
$ printf "1 2\n3" | column -t
column: line too long
1 2
which this commit will change to
$ printf "1 2\n3" | column -t
1 2
3
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
There has been unexpected mix of HAVE_WIDECHAR and ENABLE_WIDECHAR macros. The
ENABLE_WIDECHAR is old version and has to be replaced everywhere otherwise we
will see bugs with multibyte stuff.
Signed-off-by: Karel Zak <kzak@redhat.com>