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