added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / rom / dos / createdir.c
blob701977ce64f46c5d7fb68bfe83b7fe2976768c5c
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Create a new directory.
6 Lang: English
7 */
9 #include <exec/memory.h>
10 #include <proto/exec.h>
11 #include <utility/tagitem.h>
12 #include <dos/dos.h>
13 #include <dos/filesystem.h>
14 #include <proto/dos.h>
15 #include <proto/utility.h>
16 #include "dos_intern.h"
18 /*****************************************************************************
20 NAME */
21 #include <proto/dos.h>
23 AROS_LH1(BPTR, CreateDir,
25 /* SYNOPSIS */
26 AROS_LHA(CONST_STRPTR, name, D1),
28 /* LOCATION */
29 struct DosLibrary *, DOSBase, 20, Dos)
31 /* FUNCTION
32 Creates a new directory under the given name. If all went an
33 exclusive lock on the new diretory is returned.
35 INPUTS
36 name -- NUL terminated name.
38 RESULT
39 Exclusive lock to the new directory or 0 if couldn't be created.
40 IoErr() gives additional information in that case.
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
50 INTERNALS
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct FileHandle *fh;
57 struct IOFileSys iofs;
58 struct DevProc *dvp;
60 if ((fh = (struct FileHandle *) AllocDosObject(DOS_FILEHANDLE, NULL)) == NULL) {
61 SetIoErr(ERROR_NO_FREE_STORE);
62 return NULL;
65 InitIOFS(&iofs, FSA_CREATE_DIR, DOSBase);
66 iofs.io_Union.io_CREATE_DIR.io_Protection = 0;
68 if (DoIOFS(&iofs, NULL, name, DOSBase) != 0) {
69 FreeDosObject(DOS_FILEHANDLE, fh);
70 return NULL;
73 fh->fh_Device = iofs.IOFS.io_Device;
74 fh->fh_Unit = iofs.IOFS.io_Unit;
76 return MKBADDR(fh);
78 AROS_LIBFUNC_EXIT
79 } /* CreateDir */