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