home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / workbench / c / assign.c next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  770 b   |  42 lines

  1. /*
  2.     (C) 1995-97 AROS - The Amiga Replacement OS
  3.     $Id: assign.c,v 1.5 1997/01/27 00:22:36 ldp Exp $
  4.  
  5.     Desc: Assign CLI command
  6.     Lang: english
  7. */
  8.  
  9. #include <exec/memory.h>
  10. #include <exec/execbase.h>
  11. #include <proto/exec.h>
  12. #include <dos/dos.h>
  13. #include <proto/dos.h>
  14. #include <utility/tagitem.h>
  15.  
  16. int main (int argc, char ** argv)
  17. {
  18.     STRPTR args[2]={ NULL, NULL };
  19.     struct RDArgs *rda;
  20.     BPTR dir;
  21.     LONG error=0;
  22.  
  23.     rda=ReadArgs("DEVICE/A,DIR/A",(IPTR *)args,NULL);
  24.     if(rda!=NULL)
  25.     {
  26.     dir=Lock(args[1],SHARED_LOCK);
  27.     if(dir)
  28.     {
  29.         STRPTR s=args[0];
  30.         while(*s)
  31.         if(*s++==':')
  32.             s[-1]=0;
  33.         AssignLock(args[0],dir);
  34.     }
  35.     FreeArgs(rda);
  36.     }else
  37.     error=RETURN_FAIL;
  38.     if(error)
  39.     PrintFault(IoErr(),"Assign");
  40.     return error;
  41. }
  42.