Added kernel module for starting the usb stack at boot time. It's not activated thoug...
[cake.git] / rom / dos / exnext.c
blob14614ac3d65369d617c67a2a87310554ec51ac07
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include <proto/exec.h>
10 #include "dos_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/dos.h>
17 AROS_LH2(BOOL, ExNext,
19 /* SYNOPSIS */
20 AROS_LHA(BPTR , lock, D1),
21 AROS_LHA(struct FileInfoBlock *, fileInfoBlock, D2),
23 /* LOCATION */
24 struct DosLibrary *, DOSBase, 18, Dos)
26 /* FUNCTION
28 Examine the next entry in a directory.
30 INPUTS
32 lock -- lock on the direcory the contents of which to examine
33 fib -- a FileInfoBlock previously initialized by Examine()
34 (or used before with ExNext())
36 RESULT
38 success -- a boolean telling whether the operation was successful
39 or not. A failure occurs also if there is no "next" entry in
40 the directory. Then IoErr() equals ERROR_NO_MORE_ENTRIES.
42 NOTES
44 If scanning a filesystem tree recursively, you'll need to allocated a
45 new FilInfoBlock for each directory level.
47 EXAMPLE
49 To examine a directory, do the following:
51 1. Pass a lock on the directory and a FileInfoBlock (allocated by
52 AllocDosObject()) to Examine().
53 2. Pass the same parameters to ExNext().
54 3. Do something with the FileInfoBlock returned.
55 4. Call ExNext() repeatedly until it returns FALSE and use the
56 information you are provided. When ExNext returns FALSE, check IoErr()
57 to make sure that there was no real failure (ERROR_NO_MORE_ENTRIES).
59 BUGS
60 At the moment it is necessary that the lock passed to this
61 function is a directory(!!) that has previously been
62 assigned (i.e. assign env: env).
64 SEE ALSO
66 Examine(), IoErr(), AllocDosObject(), ExAll()
68 INTERNALS
70 *****************************************************************************/
72 AROS_LIBFUNC_INIT
74 /* Get pointer to filehandle */
75 struct FileHandle *fh = (struct FileHandle *)BADDR(lock);
77 /* Get pointer to I/O request. Use stackspace for now. */
78 struct IOFileSys iofs;
80 /* Prepare I/O request. */
81 InitIOFS(&iofs, FSA_EXAMINE_NEXT, DOSBase);
83 iofs.IOFS.io_Device = fh->fh_Device;
84 iofs.IOFS.io_Unit = fh->fh_Unit;
86 iofs.io_Union.io_EXAMINE_NEXT.io_fib = fileInfoBlock;
88 /* Send the request. */
89 DosDoIO(&iofs.IOFS);
91 /* Set error code and return */
92 SetIoErr(iofs.io_DosError);
94 if(iofs.io_DosError != 0)
95 return DOSFALSE;
96 else
97 return DOSTRUE;
99 AROS_LIBFUNC_EXIT
100 } /* ExNext */