Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / dos / exnext.c
blob7eaa74a9c6fc3afda81a65601d4b1edee940a903
1 /*
2 Copyright © 1995-2006, 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
73 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
75 /* Get pointer to filehandle */
76 struct FileHandle *fh = (struct FileHandle *)BADDR(lock);
78 /* Get pointer to I/O request. Use stackspace for now. */
79 struct IOFileSys iofs;
81 /* Prepare I/O request. */
82 InitIOFS(&iofs, FSA_EXAMINE_NEXT, DOSBase);
84 iofs.IOFS.io_Device = fh->fh_Device;
85 iofs.IOFS.io_Unit = fh->fh_Unit;
87 iofs.io_Union.io_EXAMINE_NEXT.io_fib = fileInfoBlock;
89 /* Send the request. */
90 DosDoIO(&iofs.IOFS);
92 /* Set error code and return */
93 SetIoErr(iofs.io_DosError);
95 if(iofs.io_DosError != 0)
96 return DOSFALSE;
97 else
98 return DOSTRUE;
100 AROS_LIBFUNC_EXIT
101 } /* ExNext */