[comp.unix.wizards] GETTING HOSTNAME FROM UTMP

michiel@baan.UUCP (Michiel Wories) (01/30/91)

Howdy folks,

Does anybody know a standard way to retrieve the hostname from /etc/utmp
or getting this hostname any other standard way?
It should work for UNIX V.2 through UNIX V.4 and BSD (...).
I am aware of the fact /etc/utmp hasn't always a ut_host member in
its structure.

NOTE: who gives this output:
michiel    ttyp0        Jan 30 10:33  (bv8c55.baan.nl)
I'm interested in this entry ----------^

Many thanks,

--------------------------------------------------------
Michiel Wories @ Baan International, The Netherlands
..!hp4nl!baan!michiel