27 lines
574 B
C
27 lines
574 B
C
#if !defined(lint) && defined(SCCSIDS)
|
|
static char sccsid[] = "@(#)getrpcport.c 1.1 94/10/31 SMI";
|
|
#endif
|
|
|
|
/*
|
|
* Copyright (c) 1985 by Sun Microsystems, Inc.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <rpc/rpc.h>
|
|
#include <netdb.h>
|
|
#include <sys/socket.h>
|
|
|
|
getrpcport(host, prognum, versnum, proto)
|
|
char *host;
|
|
{
|
|
struct sockaddr_in addr;
|
|
struct hostent *hp;
|
|
|
|
if ((hp = gethostbyname(host)) == NULL)
|
|
return (0);
|
|
bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length);
|
|
addr.sin_family = AF_INET;
|
|
addr.sin_port = 0;
|
|
return (pmap_getport(&addr, prognum, versnum, proto));
|
|
}
|