home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / fsp / part03 / fprocmd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-18  |  1.6 KB  |  76 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. static print_pro(p)
  15.     char *p;
  16. {
  17.     char *op;
  18.     UBUF *ub;
  19.  
  20.     op = util_abs_path(p);
  21.  
  22.     ub = client_interact(CC_GET_PRO,0L, strlen(op),op+1, 0,NULLP);
  23.  
  24.     printf("%s\t: %s\n",p,ub->buf);
  25.  
  26.     return(0);
  27. }
  28.  
  29. static set_pro(p,key)
  30.     char *p, *key;
  31. {
  32.     char *op;
  33.     UBUF *ub;
  34.  
  35.     op = util_abs_path(p);
  36.  
  37.     ub = client_interact(CC_SET_PRO,0L, strlen(op),op+1, strlen(key)+1,key);
  38.  
  39.     printf("%s\t: %s\n",p,ub->buf);
  40.  
  41.     return(0);
  42. }
  43.  
  44. main(argc,argv,envp)
  45.     int argc;
  46.     char **argv,**envp;
  47. {
  48.     char **av, *av2[2], *key;
  49.  
  50.     env_client();
  51.  
  52.     if(argv[1]    && (argv[1][0] == '+' || argv[1][0] == '-') && !argv[1][2])
  53.     {
  54.         key = *++argv;
  55.  
  56.     while(*++argv)
  57.     {
  58.         if(!(av = glob(*argv))) { av = av2; av2[0] = *argv; av2[1] = 0; }
  59.         while(*av) set_pro(*av++,key);
  60.     }
  61.  
  62.     } else
  63.     {
  64.     if(argv[1]) while(*++argv)
  65.     {
  66.         if(!(av = glob(*argv))) { av = av2; av2[0] = *argv; av2[1] = 0; }
  67.         while(*av) print_pro(*av++);
  68.  
  69.     } else print_pro(".");
  70.     }
  71.  
  72.     client_done();
  73.  
  74.     exit(0);
  75. }
  76.