- Fixed reporting of Chip RAM for Total RAM.
[AROS.git] / rom / dos / exnext.c
blob667ec77ec1ce4166200fb9eaf909d606766a1f28
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #define DEBUG 0
10 #include <aros/debug.h>
11 #include <proto/exec.h>
13 #include "dos_intern.h"
15 /*****************************************************************************
17 NAME */
18 #include <proto/dos.h>
20 AROS_LH2(LONG, ExNext,
22 /* SYNOPSIS */
23 AROS_LHA(BPTR , lock, D1),
24 AROS_LHA(struct FileInfoBlock *, fileInfoBlock, D2),
26 /* LOCATION */
27 struct DosLibrary *, DOSBase, 18, Dos)
29 /* FUNCTION
31 Examine the next entry in a directory.
33 INPUTS
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())
39 RESULT
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.
45 NOTES
47 If scanning a filesystem tree recursively, you'll need to allocate a
48 new FileInfoBlock for each directory level.
50 EXAMPLE
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).
62 BUGS
64 SEE ALSO
66 Examine(), IoErr(), AllocDosObject(), ExAll()
68 INTERNALS
70 *****************************************************************************/
72 AROS_LIBFUNC_INIT
74 /* Get pointer to filehandle */
75 struct FileLock *fl = BADDR(lock);
76 LONG ret;
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));
83 if (ret) {
84 fixfib(fileInfoBlock);
85 D(bug("[ExNext] '%s'\n", fileInfoBlock->fib_FileName));
86 } else {
87 D(bug("[ExNext] ret=%d err=%d\n", ret, IoErr()));
89 return ret;
91 AROS_LIBFUNC_EXIT
92 } /* ExNext */