Merge from vendor branch LIBPCAP:
[dragonfly.git] / lib / libc / rpc / getrpcent.3
1 .\" @(#)getrpcent.3n    2.2 88/08/02 4.0 RPCSRC; from 1.11 88/03/14 SMI
2 .\" $FreeBSD: src/lib/libc/rpc/getrpcent.3,v 1.11.2.3 2001/12/14 18:33:56 ru Exp $
3 .\" $DragonFly: src/lib/libc/rpc/getrpcent.3,v 1.3 2006/02/17 19:35:06 swildner Exp $
4 .\"
5 .Dd December 14, 1987
6 .Dt GETRPCENT 3
7 .Os
8 .Sh NAME
9 .Nm getrpcent ,
10 .Nm getrpcbyname ,
11 .Nm getrpcbynumber ,
12 .Nm endrpcent ,
13 .Nm setrpcent
14 .Nd get RPC entry
15 .Sh SYNOPSIS
16 .In rpc/rpc.h
17 .Ft struct rpcent *
18 .Fn getrpcent void
19 .Ft struct rpcent *
20 .Fn getrpcbyname "char *name"
21 .Ft struct rpcent *
22 .Fn getrpcbynumber "int number"
23 .Ft void
24 .Fn setrpcent "int stayopen"
25 .Ft void
26 .Fn endrpcent void
27 .Sh DESCRIPTION
28 The
29 .Fn getrpcent ,
30 .Fn getrpcbyname ,
31 and
32 .Fn getrpcbynumber
33 functions each return a pointer to an object with the
34 following structure
35 containing the broken-out
36 fields of a line in the rpc program number data base,
37 .Pa /etc/rpc .
38 .Bd -literal
39
40 struct  rpcent {
41         char    *r_name;        /* name of server for this rpc program */
42         char    **r_aliases;    /* alias list */
43         long    r_number;       /* rpc program number */
44 };
45 .Ed
46 .Pp
47 The members of this structure are:
48 .Bl -tag -width r_aliasesxxx
49 .It Fa r_name
50 The name of the server for this rpc program.
51 .It Fa r_aliases
52 A zero terminated list of alternate names for the rpc program.
53 .It Fa r_number
54 The rpc program number for this service.
55 .El
56 .Pp
57 The
58 .Fn getrpcent
59 function reads the next line of the file, opening the file if necessary.
60 The
61 .Fn setrpcent
62 function opens and rewinds the file.  If the
63 .Fa stayopen
64 flag is non-zero,
65 the net data base will not be closed after each call to
66 .Fn getrpcent
67 (either directly, or indirectly through one of
68 the other
69 .Fn getrpcent
70 function family.
71 .Pp
72 .Fn endrpcent
73 closes the file.
74 .Pp
75 .Fn getrpcbyname
76 and
77 .Fn getrpcbynumber
78 sequentially search from the beginning
79 of the file until a matching rpc program name or
80 program number is found, or until end-of-file is encountered.
81 .Sh FILES
82 .Bl -tag -width /etc/rpc -compact
83 .It Pa /etc/rpc
84 .El
85 .Sh DIAGNOSTICS
86 A
87 .Dv NULL
88 pointer is returned on
89 .Dv EOF
90 or error.
91 .Sh "SEE ALSO"
92 .Xr rpc 5 ,
93 .Xr rpcinfo 8 ,
94 .Xr ypserv 8
95 .Sh BUGS
96 All information
97 is contained in a static area
98 so it must be copied if it is
99 to be saved.