2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
10 #include <aros/debug.h>
11 #include <proto/exec.h>
13 #include "dos_intern.h"
15 /*****************************************************************************
18 #include <proto/dos.h>
20 AROS_LH2(LONG
, ExNext
,
23 AROS_LHA(BPTR
, lock
, D1
),
24 AROS_LHA(struct FileInfoBlock
*, fileInfoBlock
, D2
),
27 struct DosLibrary
*, DOSBase
, 18, Dos
)
31 Examine the next entry in a directory.
35 lock -- lock on the direcory the contents of which to examine
36 fib -- a FileInfoBlock previously initialized by Examine()
37 (or used before with ExNext())
41 success -- a boolean telling whether the operation was successful
42 or not. A failure occurs also if there is no "next" entry in
43 the directory. Then IoErr() equals ERROR_NO_MORE_ENTRIES.
47 If scanning a filesystem tree recursively, you'll need to allocate a
48 new FileInfoBlock for each directory level.
52 To examine a directory, do the following:
54 1. Pass a lock on the directory and a FileInfoBlock (allocated by
55 AllocDosObject()) to Examine().
56 2. Pass the same parameters to ExNext().
57 3. Do something with the FileInfoBlock returned.
58 4. Call ExNext() repeatedly until it returns FALSE and use the
59 information you are provided. When ExNext returns FALSE, check IoErr()
60 to make sure that there was no real failure (ERROR_NO_MORE_ENTRIES).
66 Examine(), IoErr(), AllocDosObject(), ExAll()
70 *****************************************************************************/
74 /* Get pointer to filehandle */
75 struct FileLock
*fl
= BADDR(lock
);
78 ASSERT_VALID_PTR_OR_NULL(BADDR(lock
));
79 ASSERT_VALID_FILELOCK(lock
);
81 D(bug("[ExNext] lock=%x fib=%x\n", fl
, fileInfoBlock
));
82 ret
= dopacket2(DOSBase
, NULL
, fl
->fl_Task
, ACTION_EXAMINE_NEXT
, lock
, MKBADDR(fileInfoBlock
));
84 fixfib(fileInfoBlock
);
85 D(bug("[ExNext] '%s'\n", fileInfoBlock
->fib_FileName
));
87 D(bug("[ExNext] ret=%d err=%d\n", ret
, IoErr()));