Sun callrpc() example
Sandeep Phadke
phadke at nunki.usc.edu
Fri Jun 15 03:24:08 AEST 1990
This works for me. The order of the include files is important.
I got it from the latest manuals Chap.3 Rev.A, May 88.
#include <stdio.h>
#include <rpc/rpc.h>
#include <utmp.h>
#include <rpcsvc/rusers.h>
main(argc, argv)
int argc; char **argv;
{
unsigned long nusers;
if (argc < 2) {
fprintf(stderr, "usage: %s hostname\n", argv[0]);
exit(-1);
}
if (callrpc(argv[1], RUSERSPROG, RUSERSVERS, RUSERSPROC_NUM,
xdr_void , 0, xdr_u_long, &nusers)) {
fprintf(stderr, "error: callrpc\n");
exit(1);
}
printf("%d users on %s\n", nusers, argv[1]);
exit(0);
}
--Sandeep Phadke
More information about the Comp.unix.wizards
mailing list