home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / setprotection.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  2.2 KB  |  91 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: setprotection.c,v 1.5 1997/01/27 00:36:32 ldp Exp $
  4.     $Log: setprotection.c,v $
  5.     Revision 1.5  1997/01/27 00:36:32  ldp
  6.     Polish
  7.  
  8.     Revision 1.4  1996/12/09 13:53:45  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.3  1996/10/24 15:50:37  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.2  1996/09/21 14:14:24  digulla
  17.     Hand DOSBase to DoName()
  18.  
  19.     Revision 1.1  1996/09/11 12:54:47  digulla
  20.     A couple of new DOS functions from M. Fleischer
  21.  
  22.     Desc:
  23.     Lang: english
  24. */
  25. #include <proto/exec.h>
  26. #include <dos/dosextens.h>
  27. #include <dos/filesystem.h>
  28. #include <proto/dos.h>
  29. #include "dos_intern.h"
  30.  
  31. /*****************************************************************************
  32.  
  33.     NAME */
  34. #include <proto/dos.h>
  35.  
  36.     AROS_LH2(BOOL, SetProtection,
  37.  
  38. /*  SYNOPSIS */
  39.     AROS_LHA(STRPTR, name,    D1),
  40.     AROS_LHA(ULONG,  protect, D2),
  41.  
  42. /*  LOCATION */
  43.     struct DosLibrary *, DOSBase, 31, Dos)
  44.  
  45. /*  FUNCTION
  46.  
  47.     INPUTS
  48.     name    - name of the file
  49.     protect - new protection bits
  50.  
  51.     RESULT
  52.     !=0 if all went well, 0 else. IoErr() gives additional
  53.     information in that case.
  54.  
  55.     NOTES
  56.  
  57.     EXAMPLE
  58.  
  59.     BUGS
  60.  
  61.     SEE ALSO
  62.  
  63.     INTERNALS
  64.  
  65.     HISTORY
  66.     29-10-95    digulla automatically created from
  67.                 dos_lib.fd and clib/dos_protos.h
  68.  
  69. *****************************************************************************/
  70. {
  71.     AROS_LIBFUNC_INIT
  72.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  73.  
  74.     /* Get pointer to process structure */
  75.     struct Process *me=(struct Process *)FindTask(NULL);
  76.  
  77.     /* Get pointer to I/O request. Use stackspace for now. */
  78.     struct IOFileSys io,*iofs=&io;
  79.  
  80.     /* Prepare I/O request. */
  81.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  82.     iofs->IOFS.io_Message.mn_ReplyPort     =&me->pr_MsgPort;
  83.     iofs->IOFS.io_Message.mn_Length     =sizeof(struct IOFileSys);
  84.     iofs->IOFS.io_Flags=0;
  85.     iofs->IOFS.io_Command=FSA_SET_PROTECT;
  86.     /* io_Args[0] is the name which is set by DoName(). */
  87.     iofs->io_Args[1]=protect;
  88.     return !DoName(iofs,name,DOSBase);
  89.     AROS_LIBFUNC_EXIT
  90. } /* SetProtection */
  91.