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