Merge from vendor branch GDB:
[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.4 2007/08/18 20:48:47 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 LIBRARY
16 .Lb libc
17 .Sh SYNOPSIS
18 .In rpc/rpc.h
19 .Ft struct rpcent *
20 .Fn getrpcent void
21 .Ft struct rpcent *
22 .Fn getrpcbyname "char *name"
23 .Ft struct rpcent *
24 .Fn getrpcbynumber "int number"
25 .Ft void
26 .Fn setrpcent "int stayopen"
27 .Ft void
28 .Fn endrpcent void
29 .Sh DESCRIPTION
30 The
31 .Fn getrpcent ,
32 .Fn getrpcbyname ,
33 and
34 .Fn getrpcbynumber
35 functions each return a pointer to an object with the
36 following structure
37 containing the broken-out
38 fields of a line in the rpc program number data base,
39 .Pa /etc/rpc .
40 .Bd -literal
41
42 struct  rpcent {
43         char    *r_name;        /* name of server for this rpc program */
44         char    **r_aliases;    /* alias list */
45         long    r_number;       /* rpc program number */
46 };
47 .Ed
48 .Pp
49 The members of this structure are:
50 .Bl -tag -width r_aliasesxxx
51 .It Fa r_name
52 The name of the server for this rpc program.
53 .It Fa r_aliases
54 A zero terminated list of alternate names for the rpc program.
55 .It Fa r_number
56 The rpc program number for this service.
57 .El
58 .Pp
59 The
60 .Fn getrpcent
61 function reads the next line of the file, opening the file if necessary.
62 The
63 .Fn setrpcent
64 function opens and rewinds the file.  If the
65 .Fa stayopen
66 flag is non-zero,
67 the net data base will not be closed after each call to
68 .Fn getrpcent
69 (either directly, or indirectly through one of
70 the other
71 .Fn getrpcent
72 function family.
73 .Pp
74 .Fn endrpcent
75 closes the file.
76 .Pp
77 .Fn getrpcbyname
78 and
79 .Fn getrpcbynumber
80 sequentially search from the beginning
81 of the file until a matching rpc program name or
82 program number is found, or until end-of-file is encountered.
83 .Sh FILES
84 .Bl -tag -width /etc/rpc -compact
85 .It Pa /etc/rpc
86 .El
87 .Sh DIAGNOSTICS
88 A
89 .Dv NULL
90 pointer is returned on
91 .Dv EOF
92 or error.
93 .Sh "SEE ALSO"
94 .Xr rpc 5 ,
95 .Xr rpcinfo 8 ,
96 .Xr ypserv 8
97 .Sh BUGS
98 All information
99 is contained in a static area
100 so it must be copied if it is
101 to be saved.