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

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