manual page first distributed with 4.2BSD
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 16 May 1985 07:19:42 +0000 (23:19 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 16 May 1985 07:19:42 +0000 (23:19 -0800)
SCCS-vsn: lib/libc/net/gethostbyname.3 5.1

usr/src/lib/libc/net/gethostbyname.3 [new file with mode: 0644]

diff --git a/usr/src/lib/libc/net/gethostbyname.3 b/usr/src/lib/libc/net/gethostbyname.3
new file mode 100644 (file)
index 0000000..ae7fa39
--- /dev/null
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1983 Regents of the University of California.
+.\" All rights reserved.  The Berkeley software License Agreement
+.\" specifies the terms and conditions for redistribution.
+.\"
+.\"    @(#)gethostbyname.3     5.1 (Berkeley) %G%
+.\"
+.TH GETHOSTENT 3N "9 February 1983"
+.UC 5
+.SH NAME
+gethostent, gethostbyaddr, gethostbyname, sethostent, endhostent \- get network host entry
+.SH SYNOPSIS
+.B "#include <netdb.h>
+.PP
+.B "struct hostent *gethostent()
+.PP
+.B "struct hostent *gethostbyname(name)
+.br
+.B "char *name;
+.PP
+.B "struct hostent *gethostbyaddr(addr, len, type)
+.br
+.B "char *addr; int len, type;
+.PP
+.B "sethostent(stayopen)
+.br
+.B "int stayopen
+.PP
+.B "endhostent()
+.SH DESCRIPTION
+.IR Gethostent ,
+.IR gethostbyname ,
+and
+.I gethostbyaddr
+each return a pointer to an object with the
+following structure
+containing the broken-out
+fields of a line in the network host data base,
+.IR /etc/hosts .
+.RS
+.PP
+.nf
+struct hostent {
+       char    *h_name;        /* official name of host */
+       char    **h_aliases;    /* alias list */
+       int     h_addrtype;     /* address type */
+       int     h_length;       /* length of address */
+       char    *h_addr;        /* address */
+};
+.ft R
+.ad
+.fi
+.RE
+.PP
+The members of this structure are:
+.TP \w'h_addrtype'u+2n
+h_name
+Official name of the host.
+.TP \w'h_addrtype'u+2n
+h_aliases
+A zero terminated array of alternate names for the host.
+.TP \w'h_addrtype'u+2n
+h_addrtype
+The type of address being returned; currently always AF_INET.
+.TP \w'h_addrtype'u+2n
+h_length
+The length, in bytes, of the address.
+.TP \w'h_addrtype'u+2n
+h_addr
+A pointer to the network address for the host.
+Host addresses are returned
+in network byte order.
+.PP
+.I Gethostent
+reads the next line of the file, opening the file if necessary.
+.PP
+.I Sethostent
+opens and rewinds the file.  If the
+.I stayopen
+flag is non-zero,
+the host data base will not be closed after each call to 
+.I gethostent
+(either directly, or indirectly through one of the other
+\*(lqgethost\*(rq calls).
+.PP
+.I Endhostent
+closes the file.
+.PP
+.I Gethostbyname
+and
+.I gethostbyaddr
+sequentially search from the beginning
+of the file until a matching
+host name or
+host address is found,
+or until EOF is encountered.
+Host addresses are supplied in network order.
+.SH FILES
+/etc/hosts
+.SH "SEE ALSO"
+hosts(5)
+.SH DIAGNOSTICS
+Null pointer
+(0) returned on EOF or error.
+.SH BUGS
+All information
+is contained in a static area
+so it must be copied if it is
+to be saved.  Only the Internet
+address format is currently understood.