2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
5 Desc: Test of the DOS functions MatchFirst, MatchNext and MatchEnd.
9 #include <proto/exec.h>
11 #include <dos/dosasl.h>
12 #include <exec/types.h>
13 #include <exec/memory.h>
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. */
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
);
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
);
66 //CurrentDir(oldlock);