home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume34 / fsp / part04 / fcdcmd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-18  |  1.3 KB  |  57 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();
  13. extern char *env_dir;
  14. extern char *util_abs_path();
  15.  
  16. static print_pro(p)
  17.     char *p;
  18. {
  19.     UBUF *ub;
  20.  
  21.     ub = client_interact(CC_GET_PRO,0L, strlen(p),p+1, 0,NULLP);
  22.  
  23.     if(ub->cmd == CC_ERR)
  24.     {
  25.     fprintf(stderr,"ERR: %s\n",ub->buf);
  26.     return(0);
  27.  
  28.     } else
  29.     {
  30.     fprintf(stderr,"directory mode: %s\n",ub->buf);
  31.     return(1);
  32.     }
  33. }
  34.  
  35. main(argc,argv,envp)
  36.     int argc;
  37.     char **argv, **envp;
  38. {
  39.     char *np;
  40.     char **av, *av2[2];
  41.  
  42.     env_client();
  43.     if(argc == 1)
  44.     {
  45.     print_pro("/");
  46.     puts("/");
  47.     }
  48.     else
  49.     {
  50.         if(!(av = glob(argv[1]))) { av = av2; av2[0] = *argv; av2[1] = 0; }
  51.     np = util_abs_path(*av);
  52.     if(print_pro(np)) puts(np); else puts(env_dir);
  53.     }
  54.     client_done();
  55.     exit(0);
  56. }
  57.