home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume6 / rpc2 / part01 / rpc / toys / sortit.c < prev   
Encoding:
C/C++ Source or Header  |  1986-11-30  |  622 b   |  37 lines

  1. /*
  2.  * sortit.c
  3.  * Client side application which sorts argc, argv.
  4.  */
  5. #include <stdio.h>
  6. #include <rpc/rpc.h>
  7. #include "sort_prot.h"
  8.  
  9. main(argc, argv)
  10.     int argc;
  11.     char **argv;
  12. {
  13.     char *machinename;
  14.     struct sortstrings args, res;
  15.     int i;
  16.  
  17.     if (argc < 2) {
  18.         fprintf(stderr, "usage: %s machinename [s1 ...]\n", argv[0]);
  19.         exit(1);
  20.     }
  21.     machinename = argv[1];
  22.     args.ns = argc;
  23.     args.s = argv;
  24.     res.s = (char **)NULL;
  25.  
  26.     callrpc(machinename, SORTPROG, SORTVERS, SORT,
  27.         xdr_sortstrings, &args, xdr_sortstrings, &res);
  28.  
  29.     for (i = 0; i < res.ns; i++) {
  30.         printf("%s\n", res.s[i]);
  31.     }
  32.  
  33.     /* should free res here */
  34.     exit(0);
  35. }
  36.  
  37.