xref: /netbsd/lib/libc/rpc/getrpcent.3 (revision c4a72b64)
1.\"	@(#)getrpcent.3n	2.2 88/08/02 4.0 RPCSRC; from 1.11 88/03/14 SMI
2.\"	$NetBSD: getrpcent.3,v 1.10 2002/10/01 17:22:01 wiz 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 LIBRARY
15.Lb libc
16.Sh SYNOPSIS
17.Fd #include \*[Lt]rpc/rpc.h\*[Gt]
18.Ft struct rpcent *
19.Fn getrpcent void
20.Ft struct rpcent *
21.Fn getrpcbyname "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
29.Fn getrpcent ,
30.Fn getrpcbyname ,
31and
32.Fn getrpcbynumber ,
33each return a pointer to an object with the
34following structure
35containing the broken-out
36fields of a line in the rpc program number data base,
37.Pa /etc/rpc :
38.Bd -literal -offset indent
39struct rpcent {
40	char	*r_name;	/* name of server for this rpc program */
41	char	**r_aliases;	/* alias list */
42	long	r_number;	/* rpc program number */
43};
44.Ed
45.Pp
46The members of this structure are:
47.Bl -tag -width r_aliases -offset indent
48.It r_name
49The name of the server for this rpc program.
50.It r_aliases
51A zero terminated list of alternative names for the rpc program.
52.It r_number
53The rpc program number for this service.
54.El
55.Pp
56.Fn getrpcent
57reads the next line of the file, opening the file if necessary.
58.Pp
59.Fn setrpcent
60opens and rewinds the file.
61If the
62.Fa stayopen
63flag is non-zero,
64the net data base will not be closed after each call to
65.Fn getrpcent
66(either directly, or indirectly through one of
67the other
68.Dq getrpc
69calls).
70.Pp
71.Fn endrpcent
72closes the file.
73.Pp
74.Fn getrpcbyname
75and
76.Fn getrpcbynumber
77sequentially search from the beginning
78of the file until a matching rpc program name or
79program number is found, or until end-of-file is encountered.
80.Sh FILES
81.Pa /etc/rpc
82.Sh DIAGNOSTICS
83A
84.Dv NULL
85pointer is returned on
86.Dv EOF
87or error.
88.Sh SEE ALSO
89.Xr rpc 5 ,
90.Xr rpcinfo 8 ,
91.Xr ypserv 8
92.Sh BUGS
93All information
94is contained in a static area
95so it must be copied if it is
96to be saved.
97