=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ypwhich/ypwhich.c,v retrieving revision 1.7 retrieving revision 1.8 diff -c -r1.7 -r1.8 *** src/usr.bin/ypwhich/ypwhich.c 1997/06/23 01:03:57 1.7 --- src/usr.bin/ypwhich/ypwhich.c 1997/07/21 19:12:46 1.8 *************** *** 1,4 **** ! /* $OpenBSD: ypwhich.c,v 1.7 1997/06/23 01:03:57 deraadt Exp $ /* $NetBSD: ypwhich.c,v 1.6 1996/05/13 02:43:48 thorpej Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: ypwhich.c,v 1.8 1997/07/21 19:12:46 deraadt Exp $ */ /* $NetBSD: ypwhich.c,v 1.6 1996/05/13 02:43:48 thorpej Exp $ */ /* *************** *** 34,49 **** */ #ifndef LINT ! static char rcsid[] = "$Id: ypwhich.c,v 1.7 1997/06/23 01:03:57 deraadt Exp $"; #endif #include #include #include #include #include #include #include #include #include #include --- 34,57 ---- */ #ifndef LINT ! static char rcsid[] = "$Id: ypwhich.c,v 1.8 1997/07/21 19:12:46 deraadt Exp $"; #endif #include #include #include + + #include + #include + #include + #include + #include #include #include #include + #include + #include #include #include *************** *** 62,67 **** --- 70,76 ---- { "ethers", "ethers.byname" }, }; + void usage() { fprintf(stderr, "Usage:\n"); *************** *** 74,90 **** /* * Like yp_bind except can query a specific host */ bind_host(dom, sin) char *dom; struct sockaddr_in *sin; { struct hostent *hent = NULL; struct ypbind_resp ypbr; - struct dom_binding *ysd; struct timeval tv; CLIENT *client; int sock, r; ! u_int32_t ss_addr; sock = RPC_ANYSOCK; tv.tv_sec = 15; --- 83,99 ---- /* * Like yp_bind except can query a specific host */ + int bind_host(dom, sin) char *dom; struct sockaddr_in *sin; { struct hostent *hent = NULL; struct ypbind_resp ypbr; struct timeval tv; CLIENT *client; int sock, r; ! struct in_addr ss_addr; sock = RPC_ANYSOCK; tv.tv_sec = 15; *************** *** 116,125 **** } clnt_destroy(client); ! bcopy(&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, ! &ss_addr, sizeof (ss_addr)); ! hent = gethostbyaddr((char *)&ss_addr, sizeof(ss_addr), AF_INET); if (hent != NULL) printf("%s\n", hent->h_name); else --- 125,135 ---- } clnt_destroy(client); ! memmove(&ss_addr.s_addr, &ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, ! sizeof (ss_addr)); ! hent = gethostbyaddr((char *)&ss_addr.s_addr, sizeof(ss_addr.s_addr), ! AF_INET); if (hent != NULL) printf("%s\n", hent->h_name); else *************** *** 130,136 **** int main(argc, argv) ! char **argv; { char *domain, *master, *map; struct ypmaplist *ypml, *y; --- 140,147 ---- int main(argc, argv) ! int argc; ! char **argv; { char *domain, *master, *map; struct ypmaplist *ypml, *y; *************** *** 143,148 **** --- 154,162 ---- getmap = notrans = mode = 0; yp_get_default_domain(&domain); + if (domain == NULL) + errx(1, "YP domain name not set"); + while ((c = getopt(argc, argv, "xd:mt")) != -1) switch(c) { case 'x': *************** *** 168,174 **** if (mode == 0) { switch(argc) { case 0: ! bzero(&sin, sizeof sin); sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); --- 182,188 ---- if (mode == 0) { switch(argc) { case 0: ! memset(&sin, 0, sizeof sin); sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);