tools/genmodule: Bring back xxx_GetLibbase() functions.
[AROS.git] / test / ExNext.c
blobdb3f727132b5a204e83a3e8426a128bf827c9967
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
5 Test ExNext() function
6 */
8 #include <proto/dos.h>
9 #include <proto/exec.h>
11 #include <dos/dos.h>
12 #include <dos/exall.h>
13 #include <dos/rdargs.h>
14 #include <dos/var.h>
15 #include <exec/memory.h>
16 #include <exec/types.h>
18 #include <utility/tagitem.h>
19 #include <stdio.h>
21 #include <aros/debug.h>
23 #define ARG_TEMPLATE "DIRECTORY"
24 #define TOTAL_ARGS 1
26 static const char version[] = "$VER: ExNext 41.1 (30.01.2000)\n";
28 int main(int argc, char *argv[])
30 struct RDArgs * rda;
31 IPTR * args[TOTAL_ARGS] = { NULL };
32 int Return_Value;
33 BPTR lock;
35 Return_Value = RETURN_OK;
37 rda = ReadArgs(ARG_TEMPLATE, (IPTR *)args, NULL);
38 if (rda)
40 if (!args[0])
41 lock = Lock("", ACCESS_READ);
42 else
43 lock = Lock((STRPTR)args[0], ACCESS_READ);
45 if (lock)
47 struct FileInfoBlock * FIB;
48 BOOL success;
49 FIB = AllocVec(sizeof(struct FileInfoBlock), MEMF_CLEAR);
50 if (FIB)
52 success = Examine(lock, FIB);
53 kprintf("calling ExNext()...\n");
54 success = ExNext(lock, FIB);
55 kprintf("called ExNext()\n");
56 while (success != DOSFALSE)
58 /* don't show dirs */
59 if (FIB->fib_DirEntryType < 0)
60 printf("%s\n",FIB->fib_FileName);
61 else
62 printf("%s (not a file)\n", FIB->fib_FileName);
63 kprintf("calling ExNext()...\n");
64 success = ExNext(lock, FIB);
65 kprintf("called ExNext()\n");
67 FreeVec(FIB);
69 UnLock(lock);
71 else
73 PrintFault(IoErr(), "ExNext");
74 Return_Value = RETURN_FAIL;
77 else
79 PrintFault(IoErr(), "ExNext");
80 Return_Value = RETURN_ERROR;
83 if (rda)
84 FreeArgs(rda);
86 return (Return_Value);
87 } /* main */