sethostresorder - specify order of host-address resolution services
int sethostresorder(const char *order);
The gethostbyname(3N) and gethostbyaddr(3N) routines can access three
types of host-address databases:
o the hosts file, /etc/hosts,
o Sun's network information service (NIS) and
o the Berkeley Internet Name Domain service ("BIND name server").
sethostresorder allows a program to specify the order of services to
resolve Internet addresses and hostnames from these databases.
sethostresorder should be called before the first time gethostbyname and
gethostbyaddr are called. The order argument is a character string that
contains keywords for the lookup services. See the description of
hostresorder in resolver(4) for the list and meaning of keywords and
separators. The colon (:) character is equivalent to white space as a
keyword separator. For example,
sethostresorder("nis bind local");
There are two versions of this routine: the standard version in libc
and the NIS version in libsun. The programmatic interface of both
versions is identical, except the standard version ignores the NIS
keyword. The libc default order is ``bind / local'' and the libsun
default is ``nis / bind / local''.
This routine overrides the order specified by the hostresorder keyword in
/etc/resolv.conf and the HOSTRESORDER environment variable.
sethostresorder returns 0 if the order was changed, otherwise it returns
-1. Unrecognized keywords are ignored.
intro(3), gethostbyname(3N), resolver(4)
PPPPaaaaggggeeee 1111 [ Back ]