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