Re: getting fqdn from gethostname on a hamm box
Alan Su wrote:
> when i call gethostname() on my hamm, it returns only the name of the
> machine, rather than a fqdn. i distinctly remember that when i was
> running bo, i got a fqdn. does anyone know how i can make it return
> the fqdn? or is there another function i should be using? thanks.
>
> (btw, getdomainname() returns "(none)", which suggests to me that
> something else is going on here. am i right?)
check /etc/hostname
check /usr/bin/hostname
If you want to write portable programs then you use gethostname() to
determine the hostname, check for a '.' and if it's not included you
use gethostbyname() to get the fqdn. For an example, take a look at
the syslogd source.
Regards,
Joey
--
A mathematician is a machine for converting coffee into theorems.
Reply to: