include/c: add get_hostname_max() inline function

Using sysconf(_SC_HOST_NAME_MAX) does not work everywhere.  At such even
header values for hostname length should be preferred, and if nothing
else works guess the maxium being 64 bytes.

Based-on-code-by: Karel Zak <kzak@redhat.com>
CC: Mike Frysinger <vapier@gentoo.org>
References: http://www.spinics.net/lists/util-linux-ng/msg07050.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
include/env: unify indentation

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
include/xalloc: add xgethostname()

The new function allocates memory by xalloc() for hostname and
fill in the buffer by gethostname().

Signed-off-by: Karel Zak <kzak@redhat.com>
login: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
agetty: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
write: stop using MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
last: stop usig MAXHOSTNAMELEN

Signed-off-by: Karel Zak <kzak@redhat.com>
include/c: remove MAXHOSTNAMELEN macro

Signed-off-by: Karel Zak <kzak@redhat.com>
docs: add line breaks to whereis.1

Fix to tools script checkmans.sh warning.

testing: /home/src/util-linux/misc-utils/whereis.1
:120: warning [p 1, 10.8i, div `an-div', 0.0i]: can't break line

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
fsck.cramfs: compile with -DINCLUDE_FS_TESTS for make check

 make check
 sudo su -
 cd tests
 ./run.sh cramfs

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount, eject: replace index() and rindex() with strrch() or strrchr()

Both index() and rindex() are legacy functions which may be withdrawn in
a future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html
Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/rindex.html
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
logger: replace gethostbyname() with getaddrinfo()

The gethostbyname() is legacy function which may be withdrawn in a
future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
agetty: replace gethostbyname() with getaddrinfo()

The gethostbyname() is legacy function which may be withdrawn in a
future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
build-sys: remove gethostbyname() check

Removed as unnecessary, there are no references to gethostbyname() in
code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
include/c: move usleep() fallback to c.h

To make it available everywhere in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
login: fix compiler warning [-Wunused-result]

It's probably unnecessary paranoia, but let's check if we're able to
restore the original IDs after ~/.hushlogin file check.

Signed-off-by: Karel Zak <kzak@redhat.com>
lsblk: add parent kernel name column

For raw output used in scripts it is sometimes necessary
to reconstruct tree of devices.

Parent kernel name (PKNAME) provides needed information
to do that easily.

Signed-off-by: Milan Broz <mbroz@redhat.com>
lsblk: add SCSI H:C:T:L attribute

For block devices it is sometimes useful to print SCSI device ID"
Host:Channel:Target:LUN.

Patch adds column name HCTL which can be used in lsblk.

Signed-off-by: Milan Broz <mbroz@redhat.com>
lsblk: add SCSI transport type attribute

Patch adds "SCSI transport layer" similar attribute to "lsscsi -t".

This is useful for script where you want to distinguish e.g. FC, iSCSI
or USB devices from local disks.

Detection logic is quite simplified in comparison to lsscsi but it
should provide the same output (except detailed transport attributes).

Signed-off-by: Milan Broz <mbroz@redhat.com>
lib/tt: don't ignore "extreme" columns if an free space is available

Signed-off-by: Karel Zak <kzak@redhat.com>