There are several command line utilities to resolve host names (
nslookup), however they all use nameservers exclusively, while applications in general look in
/etc/hosts first (using gethostbyname I believe).
Is there a command line utility to resolve host names that behaves like a usual application, thus looking in
/etc/hosts first and only then asking a nameserver?
(I am aware that it would probably be like 3 lines of c, but I need it inside of a somewhat portable shell script.)