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