Retrieves a network host entry.
Standard C Library (libc.a) (libbind) (libnis) (liblocal)
#include <netdb.h> int gethostent_r (htent, ht_data) struct hostent *htent; struct hostent_data *ht_data;
When using DNS/BIND name service resolution, the gethostent_r subroutine is not defined.
When using NIS name service resolution or searching the local /etc/hosts file, the gethostent_r subroutine reads the next line of the /etc/hosts file, and opens the file if necessary.
The gethostent_r subroutine internally calls the gethostent subroutine, and stores the values in the htent and ht_data structures.
The gethostent subroutine overwrites the static data returned in subsequent calls. The gethostent_r subroutine does not.
htent | Points to the hostent structure |
ht_data | Points to the hostent_data structure |
This subroutine returns a 0 if successful, and a -1 if unsuccessful.
/etc/hosts | Contains the host name database. |
/etc/netsvc.conf | Contains the name services ordering. |
/usr/include/netdb.h | Contains the network database structure. |
gethostbyaddr_r Subroutine, gethostbyname_r Subroutine, sethostent_r Subroutine, and endhostent_r Subroutine.