Easy way to find hostname/domainname

Nickolay Saukh nms at saukh.rd.jvd.su
Sat Sep 29 02:20:12 AEST 1990


I need advice/software to figure out the hostname & domain name for C
programs and shell scripts. In C for hostname it seems to be quite easy:

	#if defined(BSD)
		gethostname(...);
	#endif

	#if defined(USG)
		uname(...);
	#endif

	#if defined(ANYTHING_ELSE)
		popen("uuname -l", ...);
	#endif

But how to find domain name? Look at some file with magic name? What the
name should be (with portabily issues in mind)?

The same problem for shell scripts. I know about 'hostname' command in
BSD world, 'uuname -l' for SV world (and 'uname' also).

This problem is one more 'iron curtain' (-:, which separates *NIXes
of the world. Help them unite!!!
-- 
| Nickolay Saukh | nms at saukh.rd.jvd.su | ...!fuug!demos!jvdrd!saukh!nms |



More information about the Comp.unix.programmer mailing list