home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OL.LZH
/
PROCS.LZH
/
HOSTNAME.ICN
< prev
next >
Wrap
Text File
|
1991-09-05
|
1KB
|
48 lines
############################################################################
#
# Name: hostname.icn
#
# Title: Produce host name
#
# Author: Richard L. Goerwitz
#
# Version: 1.1
#
# Date: June 1, 1991
#
############################################################################
#
# This procedure determines the name of the current host. It takes no
# arguments. Aborts with an error message if the necessary commands
# are not found. Geared specifically for UNIX machines.
#
############################################################################
#
# Requires: UNIX, pipes
#
############################################################################
procedure hostname()
static h_name
initial {
(find("UNIX",&features), find("pipes",&features)) |
stop("hostname: works only under UNIX")
close(open(fname <- "/usr/bin/hostname"|"/bin/uuname"|"/bin/uname"))
fname := {
case \fname of {
"/usr/bin/hostname" : "/usr/bin/hostname"
"/usr/bin/uuname" : "/usr/bin/uuname -l"
"/bin/uname" : "/bin/uname -n"
} | "/usr/bin/uuname -l"
}
get_name := open(fname, "pr") |
stop("hostname: can't find hostname/uuname/uname commands")
h_name := !get_name
close(get_name)
}
return h_name
end