.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" SUCH DAMAGE.
.\"
.\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/net/getnetent.3,v 1.11.2.3 2001/08/17 15:42:38 ru Exp $
+.\" $FreeBSD: src/lib/libc/net/getnetent.3,v 1.23 2007/01/09 00:28:02 imp Exp $
.\"
.Dd June 4, 1993
.Dt GETNETENT 3
.Os
.Sh NAME
-.Nm endnetent ,
+.Nm getnetent ,
.Nm getnetbyaddr ,
.Nm getnetbyname ,
-.Nm getnetent ,
-.Nm setnetent
+.Nm setnetent ,
+.Nm endnetent
.Nd get network entry
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.Fd #include <netdb.h>
-.Ft void
-.Fo endnetent
-.Fa void
-.Fc
+.In netdb.h
.Ft struct netent *
-.Fo getnetbyaddr
-.Fa "uint32_t net"
-.Fa "int type"
-.Fc
+.Fn getnetent void
.Ft struct netent *
-.Fo getnetbyname
-.Fa "const char *name"
-.Fc
+.Fn getnetbyname "const char *name"
.Ft struct netent *
-.Fo getnetent
-.Fa void
-.Fc
+.Fn getnetbyaddr "uint32_t net" "int type"
.Ft void
-.Fo setnetent
-.Fa "int stayopen"
-.Fc
+.Fn setnetent "int stayopen"
+.Ft void
+.Fn endnetent void
.Sh DESCRIPTION
The
.Fn getnetent ,
.Fn getnetbyaddr
functions
each return a pointer to an object with the
-following structure
-containing the broken-out
-fields of a line in the network data base,
+following structure describing an internet network.
+.\"This structure contains either the information obtained
+.\"from the nameserver,
+.\".Xr named 8 ,
+.\"broken-out fields of a line in the network data base
+.\".Pa /etc/networks ,
+.\"or entries supplied by the
+.\".Xr yp 8
+.\"system.
+.\"The order of the lookups is controlled by the
+.\"`networks' entry in
+.\".Xr nsswitch.conf 5 .
+This structure contains information obtained from
+.Xr DirectoryService 8 ,
+including records in
.Pa /etc/networks .
+.Pp
.Bd -literal -offset indent
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net number type */
- unsigned long n_net; /* net number */
+ uint32_t n_net; /* net number */
};
.Ed
.Pp
.It Fa n_addrtype
The type of the network number returned; currently only AF_INET.
.It Fa n_net
-The network number. Network numbers are returned in machine byte
+The network number.
+Network numbers are returned in machine byte
order.
.El
.Pp
The
.Fn setnetent
function
-opens and rewinds the file. If the
+opens and rewinds the file.
+If the
.Fa stayopen
flag is non-zero,
the net data base will not be closed after each call to
is encountered.
The
.Fa type
+argument
must be
.Dv AF_INET .
Network numbers are supplied in host order.
.Sh FILES
-.Bl -tag -width /etc/networks -compact
+.Bl -tag -width /etc/nsswitch.conf -compact
.It Pa /etc/networks
+.\".It Pa /etc/nsswitch.conf
+.It Pa /etc/resolv.conf
.El
.Sh DIAGNOSTICS
Null pointer
.Bx 4.2 .
.Sh BUGS
The data space used by
-these functions is static; if future use requires the data, it should be
+these functions is thread-specific; if future use requires the data, it should be
copied before any subsequent calls to these functions overwrite it.
Only Internet network
numbers are currently understood.