Hostname: Difference between revisions

Added COBOL
mNo edit summary
(Added COBOL)
Line 90:
<lang shell>
java -cp clojure.jar clojure.main -e "(.. java.net.InetAddress getLocalHost getHostName)"
</lang>
 
=={{header|COBOL}}==
<lang cobol> identification division.
program-id. hostname.
 
data division.
working-storage section.
01 hostname pic x(256).
01 nullpos pic 999 value 1.
 
procedure division.
call "gethostname" using hostname by value length of hostname
string hostname delimited by low-value into hostname
with pointer nullpos
display "Host: " hostname(1 : nullpos - 1)
goback.
end program hostname.
</lang>
 
Anonymous user