Detabbed
[AROS.git] / rom / dos / deletefile.c
blob889a364ec470e25f1b5c830ce3f28cc7a8ec6dbf
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Delete a file or directory.
6 Lang: English
7 */
8 #include <aros/debug.h>
9 #include <exec/memory.h>
10 #include <proto/exec.h>
11 #include <utility/tagitem.h>
12 #include <dos/dos.h>
13 #include <proto/dos.h>
14 #include <proto/utility.h>
15 #include "dos_intern.h"
17 /*****************************************************************************
19 NAME */
20 #include <proto/dos.h>
22 AROS_LH1(BOOL, DeleteFile,
24 /* SYNOPSIS */
25 AROS_LHA(CONST_STRPTR, name, D1),
27 /* LOCATION */
28 struct DosLibrary *, DOSBase, 12, Dos)
30 /* FUNCTION
31 Tries to delete a file or directory by a given name.
32 May fail if the file is in use or protected from deletion.
34 INPUTS
35 name - NUL terminated name.
37 RESULT
38 != 0 if the file is gone, 0 if is still there.
39 IoErr() gives additional information in that case.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 LONG status = 0;
56 struct PacketHelperStruct phs;
58 D(bug("[DeleteFile] '%s'\n", name));
60 if (getpacketinfo(DOSBase, name, &phs)) {
61 status = dopacket2(DOSBase, NULL, phs.port, ACTION_DELETE_OBJECT, phs.lock, phs.name);
62 freepacketinfo(DOSBase, &phs);
65 return status;
67 AROS_LIBFUNC_EXIT
68 } /* DeleteFile */