add support for search domains to dns resolver

search is only performed if the search or domain keyword is used in
resolv.conf and the queried name has fewer than ndots dots. there is
no default domain and names with >=ndots dots are never subjected to
search; failure in the root scope is final.

the (non-POSIX) res_search API presently does not honor search. this
may be added at some point in the future if needed.

resolv.conf is now parsed twice, at two different layers of the code
involved. this will be fixed in a subsequent patch.
1 file changed