lib/strutils: move *swith() functions to private library

Avoid code dublication in libmount and time-util.

Proposed-by: Karel Zak <kzak@redhat.com>
Reference: http://markmail.org/message/h7zexvqsieqngtmx
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: parse easy to use time formats

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
lib/time-util: move YYYYMMDDHHMMSS to common parser

Even while the YYYYMMDDHHMMSS time format it not magnificent it is best
to make it to be part of the one, and only, time format parser.

Proposed-by: Karel Zak <kzak@redhat.com>
References: http://markmail.org/message/6baqt4ttkopu7ra6
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: add --since time spec option

The --since and --until options are companions often needed together.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
docs: add --since and time option formats to last(1) manual

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: fix --present option logic error

Printing of sessions 'still logged in' was skipped because an error in
logic.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: use configuration struct

This allows reducing global variables and will minimize number of
arguments for functions making code a little bit easier to read, and
maintain.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: add --time-format with iso-8601 format

The ISO-8601 format makes consuming time stamps easy with various
parsers.  The format includes time zone information which is crucial when
an investigator is trying to make sense outputs collected from systems
all a across planet.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
docs: add --time-format to last(1) manual page

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: never restrict session time

When a session time will reach whopping 10000 days the last round bracket
is unnecessarily removed from output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tests: add last(1) test

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: trim trailing white spaces

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: tell verbally system is still running

Use of uptime time stamp as previous boot login time makes the output not
constant, which is rather difficult to test.  Verbal message 'system is
still running' makes testing easy, and noticing which boot is still
running clear to a person.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last, utmpdump, agetty, wall, write: avoid compatibility hacks

In include/bits/utmp.h the ut_user and ut_time macros are marked with
comment they are backwards compatibility hacks.  It is probably best to
avoid use of these macros where ever possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
utmpdump: make IPv6 addresses work

(unless bug[s]) This change is backwards compatibile.  Earlier binary to
text dumps can be converted back to binary, or otherway around.

The only thing that will not work are IPv6 addresses that possible
earlier conversion had broke.  Such conversions resulted with random IPv4
in place of IPv6 address in text format, and original information is gone
forever.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tests: check last(1) and utmpdump(1) IPv6 functionality

Signed-off-by: Sami Kerola <kerolasa@iki.fi>