Cleaner fix part 1
[bluesky.git] / TBBT / trace_play / rpc / getrpcport.c
1 #ifndef lint
2 static char sfs_getrpcport_id[] = "@(#)getrpcport.c     2.1     97/10/23";
3 #endif
4 /* @(#)getrpcport.c     2.1 88/07/29 4.0 RPCSRC */
5 #if !defined(lint) && defined(SCCSIDS)
6 static  char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI";
7 #endif
8 /*
9  *   Copyright (c) 1992-1997,2001 by Standard Performance Evaluation Corporation
10  *      All rights reserved.
11  *              Standard Performance Evaluation Corporation (SPEC)
12  *              6585 Merchant Place, Suite 100
13  *              Warrenton, VA 20187
14  *
15  *      This product contains benchmarks acquired from several sources who
16  *      understand and agree with SPEC's goal of creating fair and objective
17  *      benchmarks to measure computer performance.
18  *
19  *      This copyright notice is placed here only to protect SPEC in the
20  *      event the source is misused in any manner that is contrary to the
21  *      spirit, the goals and the intent of SPEC.
22  *
23  *      The source code is provided to the user or company under the license
24  *      agreement for the SPEC Benchmark Suite for this product.
25  */
26 /*
27  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
28  * unrestricted use provided that this legend is included on all tape
29  * media and as a part of the software program in whole or part.  Users
30  * may copy or modify Sun RPC without charge, but are not authorized
31  * to license or distribute it to anyone else except as part of a product or
32  * program developed by the user.
33  * 
34  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
35  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
36  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
37  * 
38  * Sun RPC is provided with no support and without any obligation on the
39  * part of Sun Microsystems, Inc. to assist in its use, correction,
40  * modification or enhancement.
41  * 
42  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
43  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
44  * OR ANY PART THEREOF.
45  * 
46  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
47  * or profits or other special, indirect and consequential damages, even if
48  * Sun has been advised of the possibility of such damages.
49  * 
50  * Sun Microsystems, Inc.
51  * 2550 Garcia Avenue
52  * Mountain View, California  94043
53  */
54
55 /*
56  * Copyright (c) 1985 by Sun Microsystems, Inc.
57  */
58
59 #include <stdio.h>
60 #include <string.h>
61 #include "rpc/rpc.h"
62 #include <netdb.h>
63 #include "rpc/osdep.h"
64
65 getrpcport(host, prognum, versnum, proto)
66         char *host;
67 {
68         struct sockaddr_in addr;
69         struct hostent *hp;
70
71         if ((hp = gethostbyname(host)) == NULL)
72                 return (0);
73         memmove((char *) &addr.sin_addr, hp->h_addr, hp->h_length);
74         addr.sin_family = AF_INET;
75         addr.sin_port =  0;
76         return (pmap_getport(&addr, prognum, versnum, proto));
77 }