a little more debug to help diagnose boot failure
[AROS.git] / test / dos / matchtest.c
blobd5bbb4ad4f54db2f1e0dfb02533e461bce27e0c0
1 /*
2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Test of the DOS functions MatchFirst, MatchNext and MatchEnd.
6 */
8 #include <proto/dos.h>
9 #include <proto/exec.h>
10 #include <dos/dos.h>
11 #include <dos/dosasl.h>
12 #include <exec/types.h>
13 #include <exec/memory.h>
15 #include <stdio.h>
16 #include <string.h>
18 int main (void)
20 BOOL error;
21 int strlength=160;
22 struct AnchorPath * AP = AllocVec(sizeof(struct AnchorPath) + strlength,MEMF_CLEAR);
23 char * Pattern = AllocVec(80,MEMF_ANY);
25 //dirlock = Lock("sys:",ACCESS_READ);
26 //oldlock = CurrentDir(dirlock);
28 AP->ap_BreakBits = SIGBREAKF_CTRL_C;
29 AP->ap_Flags = 0;//APF_DODIR;
30 AP->ap_Strlen = strlength;
32 printf("Give me a pattern to search for: ");
33 /* the following line breaks AROS in MatchEnd() when calling FreeVec()
34 the second time the program is run. I have no idea why, though. */
35 scanf("%s",Pattern);
36 printf("Pattern to search for: %s\n",Pattern);
38 for(error = MatchFirst(Pattern,AP); error == 0;
39 error = MatchNext(AP))
41 if (AP->ap_Flags & APF_DIDDIR)
43 AP->ap_Flags &= ~APF_DIDDIR;
44 printf(" leaving \033[32m%s\033[39m\n",AP->ap_Buf);
46 else /* if dir then enter it! */
48 if (AP->ap_Info.fib_DirEntryType >= 0)
50 AP->ap_Flags |=APF_DODIR;
51 printf("entering \033[33m%s\033[39m\n",AP->ap_Buf);
53 else
55 //BPTR fl = CurrentDir(AP->ap_Current->an_Lock);
56 //(void)CurrentDir(fl);
58 printf(" %s\n",AP->ap_Buf);
62 printf("error = %i \n",error);
63 MatchEnd(AP);
64 FreeVec(AP);
65 FreeVec(Pattern);
66 //CurrentDir(oldlock);
68 //UnLock(dirlock);
70 return 0;