-.\" $OpenBSD: ypset.8,v 1.2 1996/03/25 15:56:23 niklas Exp $
+.\" $OpenBSD: ypset.8,v 1.3 1996/04/24 21:39:27 deraadt Exp $
.\" $NetBSD: ypset.8,v 1.2 1996/02/28 01:25:08 thorpej Exp $
.\"
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
.Xr ypwhich 1 ,
.Xr yp 8
.Sh AUTHOR
-Theo De Raadt
+Theo de Raadt
#include <netdb.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
-#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
#include <arpa/inet.h>
CLIENT *client;
int sock, port;
int r;
+ struct in_addr iaddr;
if( (port=htons(getrpcport(server, YPPROG, YPPROC_NULL, IPPROTO_UDP))) == 0) {
fprintf(stderr, "%s not running ypserv.\n", server);
bzero(&ypsd, sizeof ypsd);
- if (inet_aton(server, &ypsd.ypsetdom_addr) == 0) {
+ if (inet_aton(server, &iaddr) == 0) {
hp = gethostbyname(server);
if (hp == NULL) {
fprintf(stderr, "ypset: can't find address for %s\n", server);
exit(1);
}
- bcopy(hp->h_addr, &ypsd.ypsetdom_addr, sizeof(ypsd.ypsetdom_addr));
+ bcopy(hp->h_addr, &iaddr, sizeof(iaddr));
}
-
- strncpy(ypsd.ypsetdom_domain, dom, sizeof ypsd.ypsetdom_domain);
- ypsd.ypsetdom_port = port;
+ ypsd.ypsetdom_domain = dom;
+ bcopy(&iaddr, &ypsd.ypsetdom_binding.ypbind_binding_addr,
+ sizeof(ypsd.ypsetdom_binding.ypbind_binding_addr));
+ bcopy(&port, &ypsd.ypsetdom_binding.ypbind_binding_port,
+ sizeof(ypsd.ypsetdom_binding.ypbind_binding_port));
ypsd.ypsetdom_vers = YPVERS;
tv.tv_sec = 15;