gethostbyname man page on Archlinux

Printed from http://www.polarhome.com/service/man/?qf=gethostbyname&af=0&tf=2&of=Archlinux

GETHOSTBYNAME(3)	   Linux Programmer's Manual	      GETHOSTBYNAME(3)

NAME
       gethostbyname,	gethostbyaddr,	 sethostent,  gethostent,  endhostent,
       h_errno, herror, hstrerror, gethostbyaddr_r, gethostbyname2, gethostby‐
       name2_r, gethostbyname_r, gethostent_r - get network host entry

SYNOPSIS
       #include <netdb.h>
       extern int h_errno;

       struct hostent *gethostbyname(const char *name);

       #include <sys/socket.h>	     /* for AF_INET */
       struct hostent *gethostbyaddr(const void *addr,
				     socklen_t len, int type);

       void sethostent(int stayopen);

       void endhostent(void);

       void herror(const char *s);

       const char *hstrerror(int err);

       /* System V/POSIX extension */
       struct hostent *gethostent(void);

       /* GNU extensions */
       struct hostent *gethostbyname2(const char *name, int af);

       int gethostent_r(
	       struct hostent *ret, char *buf, size_t buflen,
	       struct hostent **result, int *h_errnop);

       int gethostbyaddr_r(const void *addr, socklen_t len, int type,
	       struct hostent *ret, char *buf, size_t buflen,
	       struct hostent **result, int *h_errnop);

       int gethostbyname_r(const char *name,
	       struct hostent *ret, char *buf, size_t buflen,
	       struct hostent **result, int *h_errnop);

       int gethostbyname2_r(const char *name, int af,
	       struct hostent *ret, char *buf, size_t buflen,
	       struct hostent **result, int *h_errnop);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       gethostbyname2(), gethostent_r(), gethostbyaddr_r(), gethostbyname_r(),
       gethostbyname2_r():
	   _BSD_SOURCE || _SVID_SOURCE

       herror(), hstrerror():
	   Since glibc 2.8:
	       _BSD_SOURCE || _SVID_SOURCE
	   Before glibc 2.8:
	       none

       h_errno:
	   Since glibc 2.12:
	       _BSD_SOURCE || _SVID_SOURCE ||
		   (_POSIX_C_SOURCE < 200809L && _XOPEN_SOURCE < 700)
	   Before glibc 2.12:
	       none

DESCRIPTION
       The gethostbyname*(), gethostbyaddr*(), herror(), and hstrerror() func‐
       tions  are  obsolete.  Applications should use getaddrinfo(3), getname‐
       info(3), and gai_strerror(3) instead.

       The gethostbyname() function returns a structure of  type  hostent  for
       the  given  host	 name.	 Here  name  is	 either a hostname, or an IPv4
       address in standard dot notation (as  for  inet_addr(3)),  or  an  IPv6
       address	in  colon  (and possibly dot) notation.	 (See RFC 1884 for the
       description of IPv6 addresses.)	If name is an IPv4 or IPv6 address, no
       lookup  is  performed  and  gethostbyname() simply copies name into the
       h_name field and its struct in_addr equivalent into the	h_addr_list[0]
       field  of the returned hostent structure.  If name doesn't end in a dot
       and the environment variable HOSTALIASES is set, the alias file pointed
       to  by HOSTALIASES will first be searched for name (see hostname(7) for
       the file format).  The current domain  and  its	parents	 a