2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
8 #include <dos/dosextens.h>
9 #include <dos/dosasl.h>
10 #include <proto/exec.h>
11 #include <proto/dos.h>
17 /****************************************************************************************/
19 static void showacflags(struct AChain
*ac
)
21 BYTE flags
= ac
->an_Flags
;
25 if (flags
& DDF_PatternBit
)
27 flags
&= ~DDF_PatternBit
;
28 printf("DDF_PatternBit ");
31 if (flags
& DDF_ExaminedBit
)
33 flags
&= ~DDF_ExaminedBit
;
34 printf("DDF_ExaminedBit ");
37 if (flags
& DDF_Completed
)
39 flags
&= ~DDF_Completed
;
40 printf("DDF_Completed ");
43 if (flags
& DDF_AllBit
)
49 if (flags
& DDF_Single
)
52 printf("DDF_Single ");
57 printf("UNKNOWN = %8x ", flags
);
63 static void showaclist(struct AChain
*ac
)
67 printf("achain: address = %p flags = %x ", ac
, ac
->an_Flags
);
69 printf(" string=\"%s\"\n", ac
->an_String
);
75 /****************************************************************************************/
77 #define ARG_TEMPLATE "FILE/A,ALL/S"
82 /****************************************************************************************/
85 static char *filename
;
87 static struct RDArgs
*myargs
;
88 static IPTR args
[NUM_ARGS
];
90 /****************************************************************************************/
92 static void cleanup(char *msg
)
94 if (msg
) printf("newmatch: %s\n", msg
);
96 if (myargs
) FreeArgs(myargs
);
101 /****************************************************************************************/
103 static void doserror(void)
105 Fault(IoErr(), 0, s
, 255);
109 /****************************************************************************************/
111 static void getarguments(void)
113 if (!(myargs
= ReadArgs(ARG_TEMPLATE
, args
, 0)))
118 filename
= (char *)args
[ARG_FILE
];
119 all
= args
[ARG_ALL
] ? TRUE
: FALSE
;
122 /****************************************************************************************/
124 static void my_matchme(char *pattern
, BOOL all
)
126 struct AnchorPath stackap
[2], *AP
;
129 AP
= (struct AnchorPath
*)((((IPTR
)stackap
) + 3) & ~3);
131 memset(AP
, 0, sizeof(struct AnchorPath
));
133 error
= MatchFirst(pattern
, AP
);
137 printf("MatchFirst: error = %d\n", (int)error
);
141 printf("direntrytype = %d\n", (int)AP
->ap_Info
.fib_DirEntryType
);
142 if (!(AP
->ap_Flags
& APF_ITSWILD
) &&
143 (AP
->ap_Info
.fib_DirEntryType
> 0))
145 /* pattern was an explicitely named directory */
146 AP
->ap_Flags
|= APF_DODIR
;
149 printf("ap_Flags = %x\n", AP
->ap_Flags
);
150 NameFromLock(AP
->ap_Current
->an_Lock
, s
, 300);
151 printf("BaseLock = \"%s\"\n", s
);
153 showaclist(AP
->ap_Base
);
157 if (AP
->ap_Flags
& APF_DIDDIR
)
161 if (all
&& (AP
->ap_Info
.fib_DirEntryType
> 0))
163 AP
->ap_Flags
|= APF_DODIR
;
164 printf("DOING DIR: ");
167 printf("fib_FileName = \"%s\"\n", AP
->ap_Info
.fib_FileName
);
169 error
= MatchNext(AP
);
178 /****************************************************************************************/
179 /****************************************************************************************/
184 my_matchme(filename
, all
);
189 /****************************************************************************************/