SunOS 4.x has two sets of functions to look up information about users, hosts, groups, and so forth. One set of functions is described in the Reference Manual pages gethostent(3N), getnetent(3N), getnetgrent(3N), getprotoent(3N), getpublickey(3N), getrpcent(3N), getsecretkey(3N) getservent(3N) and yp_get_default_domain(3N). These functions first search the appropriate NIS map. They search the corresponding file in /etc only if NIS is not running. The second set of functions is described in the Reference Manual pages getpwent(3C) and getgrent(3C). These functions first search a file in /etc. If the data is not found and NIS is running, these functions then query NIS. For statically linked applications, each of these functions behaves in SunOS 5.x exactly as it does running under SunOS 4.x.
For SunOS 5.0, and subsequent releases, all of these functions are changed to perform their functions through the Name Service Switch. At run time, the contents of the configuration file /etc/nsswitch.conf determine the sources and the sequence of look ups.
When an application has been statically linked on SunOS 4.x and is run on SunOS 5.x with the Binary Compatibility Package, these functions behave exactly as they do on SunOS 4.x. If the Name Service Switch of the machine running SunOS 5.x is not configured to behave as described in the first paragraph of this section, these functions in statically linked 4.x applications can behave differently than they do in native 5.x applications. These functions in dynamically linked 4.x applications running on SunOS 5.x behave the same as they do in native 5.x applications.