1N/A# From: asherman@fmrco.com (Aaron Sherman)
1N/A#
1N/A# This library is no longer being maintained, and is included for backward
1N/A# compatibility with Perl 4 programs which may require it.
1N/A#
1N/A# In particular, this should not be used as an example of modern Perl
1N/A# programming techniques.
1N/A#
1N/A# Suggested alternative: Sys::Hostname
1N/A#
1N/Asub hostname
1N/A{
1N/A local(*P,@tmp,$hostname,$_);
1N/A if (open(P,"hostname 2>&1 |") && (@tmp = <P>) && close(P))
1N/A {
1N/A chop($hostname = $tmp[$#tmp]);
1N/A }
1N/A elsif (open(P,"uname -n 2>&1 |") && (@tmp = <P>) && close(P))
1N/A {
1N/A chop($hostname = $tmp[$#tmp]);
1N/A }
1N/A else
1N/A {
1N/A die "$0: Cannot get hostname from 'hostname' or 'uname -n'\n";
1N/A }
1N/A @tmp = ();
1N/A close P; # Just in case we failed in an odd spot....
1N/A $hostname;
1N/A}
1N/A
1N/A1;