remove manual subsections
[unix-history] / usr / src / lib / libc / net / getnetent.3
CommitLineData
56e6bd55
KB
1.\" Copyright (c) 1983 The Regents of the University of California.
2.\" All rights reserved.
dc3d0ecb 3.\"
56e6bd55
KB
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
dc3d0ecb 15.\"
56e6bd55
KB
16.\" @(#)getnetent.3 6.4 (Berkeley) %G%
17.\"
18.TH GETNETENT 3 ""
dc3d0ecb
KM
19.UC 5
20.SH NAME
21getnetent, getnetbyaddr, getnetbyname, setnetent, endnetent \- get network entry
22.SH SYNOPSIS
23.nf
24.ft B
25#include <netdb.h>
26.PP
27.ft B
28struct netent *getnetent()
29.PP
30.ft B
31struct netent *getnetbyname(name)
32char *name;
33.PP
34.ft B
f837eec2 35struct netent *getnetbyaddr(net, type)
dc3d0ecb 36long net;
f837eec2 37int type;
dc3d0ecb
KM
38.PP
39.ft B
40setnetent(stayopen)
f837eec2 41int stayopen;
dc3d0ecb
KM
42.PP
43.ft B
44endnetent()
45.fi
46.SH DESCRIPTION
47.IR Getnetent ,
48.IR getnetbyname ,
49and
50.I getnetbyaddr
51each return a pointer to an object with the
52following structure
53containing the broken-out
54fields of a line in the network data base,
55.IR /etc/networks .
56.RS
57.PP
58.nf
59struct netent {
f837eec2
JL
60 char *n_name; /* official name of net */
61 char **n_aliases; /* alias list */
62 int n_addrtype; /* net number type */
63 unsigned long n_net; /* net number */
dc3d0ecb
KM
64};
65.ft R
66.ad
67.fi
68.RE
69.PP
70The members of this structure are:
71.TP \w'n_addrtype'u+2n
72n_name
73The official name of the network.
74.TP \w'n_addrtype'u+2n
75n_aliases
76A zero terminated list of alternate names for the network.
77.TP \w'n_addrtype'u+2n
78n_addrtype
79The type of the network number returned; currently only AF_INET.
80.TP \w'n_addrtype'u+2n
81n_net
82The network number. Network numbers are returned in machine byte
83order.
84.PP
85.I Getnetent
86reads the next line of the file, opening the file if necessary.
87.PP
88.I Setnetent
89opens and rewinds the file. If the
90.I stayopen
91flag is non-zero,
92the net data base will not be closed after each call to
ec178508
JL
93.I getnetbyname
94or
95.IR getnetbyaddr .
dc3d0ecb
KM
96.PP
97.I Endnetent
98closes the file.
99.PP
100.I Getnetbyname
101and
102.I getnetbyaddr
103sequentially search from the beginning
104of the file until a matching
105net name or
f837eec2 106net address and type is found,
dc3d0ecb
KM
107or until EOF is encountered.
108Network numbers are supplied in host order.
109.SH FILES
110/etc/networks
111.SH "SEE ALSO"
112networks(5)
113.SH DIAGNOSTICS
114Null pointer
115(0) returned on EOF or error.
116.SH BUGS
117All information
118is contained in a static area
119so it must be copied if it is
120to be saved. Only Internet network
121numbers are currently understood.
122Expecting network numbers to fit
123in no more than 32 bits is probably
124naive.