All OSes implementing the standard C API has the calls
gethostbyname and gethostbyaddr. These can get information from
several different sources. Which sources it gets it from is
configured in /etc/nsswitch.conf
on FreeBD (and some other
Unixes). This is a long file specifying from which file or database
to get different kinds of data types. It usually contains helpful
comments at the top, which you should consider reading. After that
find the line starting with `hosts:
'; it should read:
hosts: files dns
(You remembered about the leading spaces, right? I won't mention them again.)
If there is no line starting with `hosts:
' then put in the one
above. It says that programs should first look in the
/etc/hosts
file, then check DNS according to
resolv.conf
.