261a8f431c5d8b1b46496cf7867ccf7814e2fd7a
[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 LIBRARY
14 .Lb libc
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
34 each return a pointer to an object with the
35 following structure
36 containing the broken-out
37 fields of a line in the rpc program number data base,
38 .Pa /etc/rpc :
39 .Bd -literal
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_aliases -offset indent
49 .It Va r_name
50 The name of the server for this rpc program.
51 .It Va r_aliases
52 A zero terminated list of alternate names for the rpc program.
53 .It Va r_number
54 The rpc program number for this service.
55 .El
56 .Pp
57 The
58 .Fn getrpcent
59 function
60 reads the next line of the file, opening the file if necessary.
61 .Pp
62 The
63 .Fn setrpcent
64 function
65 opens and rewinds the file.  If the
66 .Fa stayopen
67 flag is non-zero,
68 the net data base will not be closed after each call to
69 .Fn getrpcent
70 (either directly, or indirectly through one of
71 the other
72 .Dq getrpc
73 calls).
74 .Pp
75 The
76 .Fn endrpcent
77 function
78 closes the file.
79 .Pp
80 The
81 .Fn getrpcbyname
82 and
83 .Fn getrpcbynumber
84 functions
85 sequentially search from the beginning
86 of the file until a matching rpc program name or
87 program number is found, or until end-of-file is encountered.
88 .Sh FILES
89 .Bl -tag -width /etc/rpc -compact
90 .It Pa /etc/rpc
91 .El
92 .Sh SEE ALSO
93 .Xr rpc 5 ,
94 .Xr rpcinfo 8 ,
95 .Xr ypserv 8
96 .Sh DIAGNOSTICS
97 A
98 .Dv NULL
99 pointer is returned on
100 .Dv EOF
101 or error.
102 .Sh BUGS
103 All information
104 is contained in a static area
105 so it must be copied if it is
106 to be saved.