[comp.unix.questions] getting the system's domain name in a C program

jim@tiamat.fsc.com (Jim O'Connor) (01/17/90)

Is there a system call or library function that is supposed to return the
name of the current host, complete with the domain attached?

I'm a little confused, since when I set up TCP/IP on a Xenix machine, the
installation scripts created the command "hostname tiamat.fsc.com" in the
TCP/IP startup file, so using "hostname" or "gethostname()" returns the
whole thing, and I can always use "uanme" to get just the host name with
out the domain part.

However, when I installed TCP/IP on our HP 9000 Model 815 machine, the
installation created the command "hostname guinan" in the TCP/IP start
up file.  So, on guinan, I don't get the domain name with "gethostname".

Which way is "right"?  Is there a "right" way?

Thanks for any help.
------------- 
James B. O'Connor			jim@tiamat.fsc.com
Ahlstrom Filtration, Inc.		615/821-4022 x. 651

*** Altos users unite! mail to "info-altos-request@tiamat.fsc.com" ***