/* CMS REPLACEMENT HISTORY, Element RLS.C */ /* 1I1 25-APR-2006 16:29:35 MYTH "V56 baselevel code freeze" */ /* 1H1 13-JUN-2004 15:46:38 MILLIGAN "V55 baselevel code freeze" */ /* 1G1 11-MAY-2003 23:09:35 TIBBERT "V54 baselevel code freeze" */ /* 1F1 22-JAN-2002 20:12:04 SYSTEM "V53 baselevel code freeze" */ /* 1E1 2-MAY-2001 04:47:06 MILLIGAN "V52 baselevel code freeze" */ /* 1D1 11-DEC-2000 23:06:27 MYTH "V51 baselevel code freeze" */ /* 1C1 12-MAY-2000 05:54:21 MUGGERIDGE "V51IFT baselevel code freeze" */ /* 1B1 28-OCT-1998 21:14:08 MUGGERIDGE "V50SSB baselevel code freeze" */ /* 1A1 18-JUN-1998 08:00:45 MUGGERIDGE "V50IFT baselevel code freeze" */ /* *1 9-OCT-1997 19:19:15 GEMIGNANI "Initial population of IPv6 source" */ /* CMS REPLACEMENT HISTORY, Element RLS.C */ /* * rls.c: Remote directory listing client */ #include #include #include #include /* always need this */ #include "dir.h" main(argc, argv) int argc; char *argv[]; { CLIENT *cl; char *dir; namelist nl; readdir_res *result; char *server; if (argc != 3) { fprintf(stderr, "usage: %s host directory\n", argv[0]); exit(1); } server = argv[1]; dir = argv[2]; /* ** Create client "handle" used for calling DIRPROG on ** the server designated on the command line. Use ** the tcp protocol when contacting the server. */ cl = clnt_create(server, DIRPROG, DIRVERS, "tcp"); if (cl == NULL) { /* ** Couldn't establish connection with server. ** Print error message and stop. */ clnt_pcreateerror(server); exit(1); } /* ** Call the remote procedure readdir on the server */ result = readdir_1(&dir, cl); if (result == NULL) { /* ** An RPC error occurred while calling the server. ** Print error message and stop. */ clnt_perror(cl, server); exit(1); } /* ** Okay, we successfully called the remote procedure. */ if (result->Errno != 0) { /* ** A remote system error occurred. ** Print error message and stop. **/ errno = result->Errno; perror(dir); exit(1); } /* ** Successfully got a directory listing. ** Print it out. */ for (nl = result->readdir_res_u.list; nl != NULL; nl = nl->next) printf("%s\n", nl->name); exit(0); }