version 1.5, 1996/11/03 22:25:58 |
version 1.6, 1997/02/11 18:10:57 |
|
|
{ |
{ |
struct exportslist *exp; |
struct exportslist *exp; |
struct grouplist *grp; |
struct grouplist *grp; |
int estat, rpcs = 0, mntvers = 1; |
struct sockaddr_in clnt_sin; |
|
struct hostent *hp; |
|
struct timeval timeout; |
|
int rpcs = 0, mntvers = 1; |
|
enum clnt_stat estat; |
|
CLIENT *client; |
char *host; |
char *host; |
int ch; |
int ch, clnt_sock; |
|
|
while ((ch = getopt(argc, argv, "ade3")) != -1) |
while ((ch = getopt(argc, argv, "ade3")) != -1) |
switch((char)ch) { |
switch((char)ch) { |
|
|
if (rpcs == 0) |
if (rpcs == 0) |
rpcs = DODUMP; |
rpcs = DODUMP; |
|
|
if (rpcs & DODUMP) |
if ((hp = gethostbyname(host)) == NULL) { |
if ((estat = callrpc(host, RPCPROG_MNT, mntvers, |
fprintf(stderr, "showmount: unknown host %s\n", host); |
RPCMNT_DUMP, xdr_void, (char *)0, |
exit(1); |
xdr_mntdump, (char *)&mntdump)) != 0) { |
} |
|
bzero(&clnt_sin, sizeof clnt_sin); |
|
clnt_sin.sin_len = sizeof clnt_sin; |
|
clnt_sin.sin_family = AF_INET; |
|
bcopy(hp->h_addr, (char *)&clnt_sin.sin_addr, hp->h_length); |
|
clnt_sock = RPC_ANYSOCK; |
|
client = clnttcp_create(&clnt_sin, RPCPROG_MNT, mntvers, |
|
&clnt_sock, 0, 0); |
|
if (client == NULL) { |
|
clnt_pcreateerror("showmount: clnttcp_create"); |
|
exit(1); |
|
} |
|
timeout.tv_sec = 30; |
|
timeout.tv_usec = 0; |
|
|
|
if (rpcs & DODUMP) { |
|
estat = clnt_call(client, RPCMNT_DUMP, xdr_void, (char *)0, |
|
xdr_mntdump, (char *)&mntdump, timeout); |
|
if (estat != RPC_SUCCESS) { |
fprintf(stderr, "showmount: Can't do Mountdump rpc: "); |
fprintf(stderr, "showmount: Can't do Mountdump rpc: "); |
clnt_perrno(estat); |
clnt_perrno(estat); |
exit(1); |
exit(1); |
} |
} |
if (rpcs & DOEXPORTS) |
} |
if ((estat = callrpc(host, RPCPROG_MNT, mntvers, |
if (rpcs & DOEXPORTS) { |
RPCMNT_EXPORT, xdr_void, (char *)0, |
estat = clnt_call(client, RPCMNT_EXPORT, xdr_void, (char *)0, |
xdr_exports, (char *)&exports)) != 0) { |
xdr_exports, (char *)&exports, timeout); |
|
if (estat != RPC_SUCCESS) { |
fprintf(stderr, "showmount: Can't do Exports rpc: "); |
fprintf(stderr, "showmount: Can't do Exports rpc: "); |
clnt_perrno(estat); |
clnt_perrno(estat); |
exit(1); |
exit(1); |
} |
} |
|
} |
|
|
/* Now just print out the results */ |
/* Now just print out the results */ |
if (rpcs & DODUMP) { |
if (rpcs & DODUMP) { |
|
|
if (!xdr_bool(xdrsp, &grpbool)) |
if (!xdr_bool(xdrsp, &grpbool)) |
return (0); |
return (0); |
while (grpbool) { |
while (grpbool) { |
gp = (struct grouplist *)malloc(sizeof(struct grouplist)); |
gp = (struct grouplist *)malloc( |
|
sizeof(struct grouplist)); |
if (gp == NULL) |
if (gp == NULL) |
return (0); |
return (0); |
strp = gp->gr_name; |
strp = gp->gr_name; |