> Anyone have a simple example of how to use this function..
This should work (and is really reduced to a minimum)
=====================================================
struct hostent *hostentry;
if ( (hostentry = gethostbyname("localhost")) == NULL) {
// Error handling
}
printf("Name: %s; Alias: %s\n",
hostentry->h_name, hostentry->h_aliases[0]);
=====================================================
At my system the output is just:
"Name: localhost; Alias: (null)"
Note that gethostbyname tries to get information from the nameserver
or /etc/hosts. (I don't know if the order in which these are accessed
depends on /etc/host.conf and I also do not know if the lookup in
/etc/hosts only occurs if the local name server is not running - it
seems so to me, according to gethostbyname(3))
Cheers,
Frank
--
Be aware that this message has been written by a FreeBSD newbie!
Using FreeBSD for approximately 6 weeks and 3 days now :)
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message