#
# file: hostname.pl
# usage: $hostname = &'hostname;
#
# purpose: get hostname -- try method until we get an answer 
#	or return "Amnesiac!"
#
#  This software was derived from SATAN 1.1.1 by Dan Farmer and Wietse Venema
#  (http://www.porcupine.org/satan).
#

package hostname;

sub main'hostname {
    if (!defined $hostname) {
	$hostname =  ( -x '/bin/hostname'     && `/bin/hostname` ) 
		  || ( -x '/usr/ucb/hostname' && `/usr/ucb/hostname` )
		  || ( -x '/bin/uname'        && `/bin/uname -n` )
		  || ( -x '/usr/bin/uuname'   && `/usr/bin/uuname -l`)
		  || 'Amnesiac! ';  # trailing space is for chop
	chop $hostname;
    }
    $hostname;
}

1;
