1.\" @(#)getrpcent.3n 2.2 88/08/02 4.0 RPCSRC; from 1.11 88/03/14 SMI 2.\" $NetBSD: getrpcent.3,v 1.9 2002/02/07 07:00:23 ross 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. If the 61.Fa stayopen 62flag is non-zero, 63the net data base will not be closed after each call to 64.Fn getrpcent 65(either directly, or indirectly through one of 66the other 67.Dq getrpc 68calls). 69.Pp 70.Fn endrpcent 71closes the file. 72.Pp 73.Fn getrpcbyname 74and 75.Fn getrpcbynumber 76sequentially search from the beginning 77of the file until a matching rpc program name or 78program number is found, or until end-of-file is encountered. 79.Sh FILES 80.Pa /etc/rpc 81.Sh DIAGNOSTICS 82A 83.Dv NULL 84pointer is returned on 85.Dv EOF 86or error. 87.Sh SEE ALSO 88.Xr rpc 5 , 89.Xr rpcinfo 8 , 90.Xr ypserv 8 91.Sh BUGS 92All information 93is contained in a static area 94so it must be copied if it is 95to be saved. 96