version 1.5, 1997/04/22 01:49:16 |
version 1.6, 1997/04/22 02:55:42 |
|
|
tv.tv_sec = 15; |
tv.tv_sec = 15; |
tv.tv_usec = 0; |
tv.tv_usec = 0; |
client = clntudp_create(sin, YPBINDPROG, YPBINDVERS, tv, &sock); |
client = clntudp_create(sin, YPBINDPROG, YPBINDVERS, tv, &sock); |
if (client==NULL) { |
|
fprintf(stderr, "can't clntudp_create: %s\n", |
if (client == NULL) { |
yperr_string(YPERR_YPBIND)); |
fprintf(stderr, "ypwhich: host is not bound to a ypmaster\n"); |
return YPERR_YPBIND; |
return YPERR_YPBIND; |
} |
} |
|
|
tv.tv_sec = 5; |
tv.tv_sec = 5; |
tv.tv_usec = 0; |
tv.tv_usec = 0; |
|
|
r = clnt_call(client, YPBINDPROC_DOMAIN, |
r = clnt_call(client, YPBINDPROC_DOMAIN, |
xdr_domainname, &dom, xdr_ypbind_resp, &ypbr, tv); |
xdr_domainname, &dom, xdr_ypbind_resp, &ypbr, tv); |
if (r != RPC_SUCCESS) { |
if (r != RPC_SUCCESS) { |
|
|
|
|
bcopy(&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, |
bcopy(&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, |
&ss_addr, sizeof (ss_addr)); |
&ss_addr, sizeof (ss_addr)); |
/*printf("%08x\n", ss_addr);*/ |
|
hent = gethostbyaddr((char *)&ss_addr, sizeof(ss_addr), AF_INET); |
hent = gethostbyaddr((char *)&ss_addr, sizeof(ss_addr), AF_INET); |
if (hent) |
if (hent != NULL) |
printf("%s\n", hent->h_name); |
printf("%s\n", hent->h_name); |
else |
else |
printf("%s\n", inet_ntoa(ss_addr)); |
printf("%s\n", inet_ntoa(ss_addr)); |
|
|
return 0; |
return 0; |
} |
} |
|
|
|
|
int notrans, mode, getmap; |
int notrans, mode, getmap; |
int c, r, i; |
int c, r, i; |
|
|
yp_get_default_domain(&domain); |
|
|
|
map = NULL; |
map = NULL; |
getmap = notrans = mode = 0; |
getmap = notrans = mode = 0; |
while ((c=getopt(argc, argv, "xd:mt")) != -1) |
|
switch (c) { |
yp_get_default_domain(&domain); |
|
while ((c = getopt(argc, argv, "xd:mt")) != -1) |
|
switch(c) { |
case 'x': |
case 'x': |
for (i=0; i<sizeof ypaliases/sizeof ypaliases[0]; i++) |
for (i=0; i<sizeof ypaliases/sizeof ypaliases[0]; i++) |
printf("Use \"%s\" for \"%s\"\n", |
printf("Use \"%s\" for \"%s\"\n", |
|
|
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
|
|
if (mode==0) { |
if (mode == 0) { |
switch (argc) { |
switch(argc) { |
case 0: |
case 0: |
bzero(&sin, sizeof sin); |
bzero(&sin, sizeof sin); |
sin.sin_family = AF_INET; |
sin.sin_family = AF_INET; |
|
|
for (i=0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++) |
for (i=0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++) |
if (strcmp(map, ypaliases[i].alias) == 0) |
if (strcmp(map, ypaliases[i].alias) == 0) |
map = ypaliases[i].name; |
map = ypaliases[i].name; |
|
|
r = yp_master(domain, map, &master); |
r = yp_master(domain, map, &master); |
switch (r) { |
switch (r) { |
case 0: |
case 0: |