last: fix uninitialized length

length was unset when using "last --time-format=iso"

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
last: --time-format=full should do the same like -F

For no reason "full" did something else than "iso" or -F as you
see here:
$ ./last  -f ../tests/ts/last/wtmp.LE  --time-format=full  | grep -A2 "no logout"
torvalds linux        hobby            Mon Aug 26 02:57:08 1991    gone                    - no logout
reboot   system boot  system-name      Wed Aug 28 20:00:00 2013   still                    running
reboot   system boot  system-name      Wed Aug 28 18:00:00 2013 - Wed Aug 28 19:00:00 2013  (01:00)
$ ./last  -f ../tests/ts/last/wtmp.LE  --time-format=iso  | grep -A2 "no logout"
torvalds linux        hobby            1991-08-26T02:57:08+0200   gone - no logout
reboot   system boot  system-name      2013-08-28T20:00:00+0200   still running
reboot   system boot  system-name      2013-08-28T18:00:00+0200 - 2013-08-28T19:00:00+0200  (01:00)
$ ./last  -f ../tests/ts/last/wtmp.LE  -F  | grep -A2 "no logout"
torvalds linux        hobby            Mon Aug 26 02:57:08 1991   gone - no logout
reboot   system boot  system-name      Wed Aug 28 20:00:00 2013   still running
reboot   system boot  system-name      Wed Aug 28 18:00:00 2013 - Wed Aug 28 19:00:00 2013  (01:00)

Also note the useless leading space before "gone"

The only thing which matters is fmt->out width when printing these
strings like "still running". Now ctl->fulltime flag is unsused and
removed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests: add test case for last -time-format=full

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
last: minor cleanup if statements

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests: call ts_init_env as early as possible

Soon we want to use some env vars within ts_has_option(). That's
why we move some lines to make this possible.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests: allow test options to be overridden by env

Specially for automated builds the user may want to have some
fine granulated influence like

export TS_OPT_libmount_verbose="yes"
export TS_OPT_ipcs_fake="yes"
export TS_OPT_ipcs_limits2_fake="no"
if <big endian> then
  export TS_OPT_hexdump_fake="yes"
fi
make check

Even for interactive developers this could be useful for example to
debug just one particuar test while having a regular run with stress:

TS_OPT_script_verbose="yes" \
TS_OPT_script_memcheck="yes" \
../tests/run.sh --parallel=256 --srcdir=.. --builddir=. --nonroot

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests: fix var names

Translate "." and "-" to "_". We assume that nobody will add
completely stupid test file names.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
last: avoid leading "-" before "no logout"

This affects option --time-format=notime.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests: add exit case "KNOWN FAILED"

Now we can mark tests as known to be broken without bothering
users with exit failure. In the build log this "KNOWN FAILED"
may be interpreted as TODO ;)

The main advantage of "known-fail" instead of just skipping
is that we will still find the test diff.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests: allow to add or override test suite options

Now we can do something like this
  make check TS_OPTS="--fake --parallel=32"

Note we still always set --parallel but the last one wins.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests: style Makefile and make output

We break long lines and make output sill looks nice with and without
V=1.

As a side effect we can now run
  make TS_COMMAND="true"
to do nothing but building all check_PROGRAMS.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Merge branch 'tests-features' of https://github.com/rudimeier/util-linux

* 'tests-features' of https://github.com/rudimeier/util-linux:
  tests: style Makefile and make output
  tests: allow to add or override test suite options
  tests: add exit case "KNOWN FAILED"
  tests: fix var names
  tests: allow test options to be overridden by env
  tests: call ts_init_env as early as possible
tests: check /proc availability, and go-around if it is incomplete

Unavailability of /proc is fatal for kill, and continuing with the test
in that case does not make sense as it will only mean false positive
errors.

Where /proc/<pid>/status file(s) does not exist the check will perform
opportunistic sleep with assumption the test_sigreceive will be ready to
be killed if it has some time to init.

[kzak@redhat.com: - remove dependence on gawk, just use shell
                  - fix typo in "test /proc"]

CC: Ruediger Meier <sweet_f_a@gmx.de>
Reference: https://travis-ci.org/rudimeier/util-linux/jobs/24561058
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
cytune: remove from util-linux

Assumption is there are not many who need this tool.  Whom ever they
might be the recommendation is to use the command from old util-linux
release.  Second reason to removal is difficulty to test hardware
specific command when none of the active project members does not seem to
have such.  Basically the command has reached dead end what comes to
maintainability of it.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
blkid: remove unused variable

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
logger: fail when io vector number exceeds maximum

Earlier version silently failed without logging anything.

$ logger --journald=/etc/services ; echo $?
1

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
logger: check numeric priority and facility input values

Earlier use of unknown facility or priority number was accepted, and
resulted in unexpected result.  For example when looking journalctl
--priority=7.8 was converted to priotity 0 and facility 1.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
build-sys: remove unnecessary void casts

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
term-utils: avoid error message string length couting errors

Remove various magic numbers with either a string lenght count, or a
symbolic variable that is recognized by gdb.

[kzak@redhat.com: - use snprintf() everywhere,
                  - check snprintf() return code rather than mess up
                    the code with strlens]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
wall: replace magic number by named value

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>