home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / fsp / part01 / fprocmd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-12  |  1.7 KB  |  77 lines

  1.     /*********************************************************************\
  2.     *  Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu)   *
  3.     *                                                                     *
  4.     *  You may copy or modify this file in any manner you wish, provided  *
  5.     *  that this notice is always included, and that you hold the author  *
  6.     *  harmless for any loss or damage resulting from the installation or *
  7.     *  use of this software.                                              *
  8.     \*********************************************************************/
  9.  
  10. #include "client_def.h"
  11.  
  12. extern char **glob(), *util_abs_path();
  13.  
  14. main(argc,argv,envp)
  15.     int argc;
  16.     char **argv,**envp;
  17. {
  18.     char **av, *av2[2], *key;
  19.  
  20.     env_client();
  21.  
  22.     if(argv[1]    && (argv[1][0] == '+' || argv[1][0] == '-')
  23.         && (argv[1][1] == 'c' || argv[1][1] == 'd'))
  24.     {
  25.         key = *++argv;
  26.  
  27.     while(*++argv)
  28.     {
  29.         if(!(av = glob(*argv))) { av = av2; av2[0] = *argv; av2[1] = 0; }
  30.         while(*av) set_pro(*av++,key);
  31.     }
  32.  
  33.     } else
  34.     {
  35.     if(argv[1]) while(*++argv)
  36.     {
  37.         if(!(av = glob(*argv))) { av = av2; av2[0] = *argv; av2[1] = 0; }
  38.         while(*av) print_pro(*av++);
  39.  
  40.     } else print_pro(".");
  41.     }
  42.  
  43.     client_done();
  44.  
  45.     exit(0);
  46. }
  47.  
  48. print_pro(p)
  49.     char *p;
  50. {
  51.     char *op;
  52.     UBUF *ub;
  53.  
  54.     op = util_abs_path(p);
  55.  
  56.     ub = client_interact(CC_GET_PRO,0L, strlen(op),op+1, 0,NULLP);
  57.  
  58.     printf("%s\t: %s\n",p,ub->buf);
  59.  
  60.     return(0);
  61. }
  62.  
  63. set_pro(p,key)
  64.     char *p, *key;
  65. {
  66.     char *op;
  67.     UBUF *ub;
  68.  
  69.     op = util_abs_path(p);
  70.  
  71.     ub = client_interact(CC_SET_PRO,0L, strlen(op),op+1, strlen(key)+1,key);
  72.  
  73.     printf("%s\t: %s\n",p,ub->buf);
  74.  
  75.     return(0);
  76. }
  77.