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