home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / AROS / dos / deletefile.c < prev    next >
Encoding:
C/C++ Source or Header  |  1978-03-06  |  2.1 KB  |  85 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: deletefile.c,v 1.3 1996/10/24 15:50:26 aros Exp $
  4.     $Log: deletefile.c,v $
  5.     Revision 1.3  1996/10/24 15:50:26  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.2  1996/09/21 14:14:22  digulla
  9.     Hand DOSBase to DoName()
  10.  
  11.     Revision 1.1  1996/09/11 12:54:45  digulla
  12.     A couple of new DOS functions from M. Fleischer
  13.  
  14.     Desc:
  15.     Lang: english
  16. */
  17. #include <exec/memory.h>
  18. #include <clib/exec_protos.h>
  19. #include <utility/tagitem.h>
  20. #include <dos/dos.h>
  21. #include <dos/filesystem.h>
  22. #include <clib/dos_protos.h>
  23. #include <clib/utility_protos.h>
  24. #include "dos_intern.h"
  25.  
  26. /*****************************************************************************
  27.  
  28.     NAME */
  29.     #include <clib/dos_protos.h>
  30.  
  31.     AROS_LH1(BOOL, DeleteFile,
  32.  
  33. /*  SYNOPSIS */
  34.     AROS_LHA(STRPTR, name, D1),
  35.  
  36. /*  LOCATION */
  37.     struct DosLibrary *, DOSBase, 12, Dos)
  38.  
  39. /*  FUNCTION
  40.     Tries to delete a file or directory by a given name.
  41.     May fail if the file is in use or protected from deletion.
  42.  
  43.     INPUTS
  44.     name       - NUL terminated name.
  45.  
  46.     RESULT
  47.     !=0 if the file is gone, 0 if is still there.
  48.     IoErr() gives additional information in that case.
  49.  
  50.     NOTES
  51.  
  52.     EXAMPLE
  53.  
  54.     BUGS
  55.  
  56.     SEE ALSO
  57.  
  58.     INTERNALS
  59.  
  60.     HISTORY
  61.     29-10-95    digulla automatically created from
  62.                 dos_lib.fd and clib/dos_protos.h
  63.  
  64. *****************************************************************************/
  65. {
  66.     AROS_LIBFUNC_INIT
  67.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  68.  
  69.     /* Get pointer to process structure */
  70.     struct Process *me=(struct Process *)FindTask(NULL);
  71.  
  72.     /* Get pointer to I/O request. Use stackspace for now. */
  73.     struct IOFileSys io,*iofs=&io;
  74.  
  75.     /* Prepare I/O request. */
  76.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  77.     iofs->IOFS.io_Message.mn_ReplyPort     =&me->pr_MsgPort;
  78.     iofs->IOFS.io_Message.mn_Length     =sizeof(struct IOFileSys);
  79.     iofs->IOFS.io_Flags=0;
  80.     iofs->IOFS.io_Command=FSA_DELETE_OBJECT;
  81.     /* io_Args[0] is the name which is set by DoName(). */
  82.     return !DoName(iofs,name,DOSBase);
  83.     AROS_LIBFUNC_EXIT
  84. } /* DeleteFile */
  85.