/* Listing #18 * / #include #include #include int main(int argc, char* argv [ ]) { struct RDArgs *rda ; char ** files; struct AnchorPath *ap; if (!(ap=AllocMem(sizeof(struct AnchorPath), MEMF^CLEAR | MEMF_PUBLIC))) { PrintFault(ERROR_NO_FREE_STORE, argv[0]); return 10; ) if (!(rda=ReadArgs("FILES/A/M", (LONG*)&files, 0))) { PrintFault(IoErr() , argv[0]) ; FreeMem(ap, sizeof(struct AnchorPath) ) ; return 10 ; } while (*files { LONG err; if (err=MatchFirst(*files, ap)) { PrintFault(err, *files) ; break; } do { char buf [255]; if (NameFromLock(ap->ap"Current->an_Lock, buf , sizeofbuf) && AddPart(buf, ap->ap_lnfo,fib_FileName/ sizeof buf)) Printf("%s\n", buf) ; err=MatchNext(ap); } while ( !err) ; MatchEnd(ap); if (err!=ERROR_NO_MORE_ENTRIES ) { PrintFault(err, argv[0]) ; break ; } files++; } FreeArgs(rda) ; FreeMem(ap, sizeof(struct AnchorPath)) ; return 0; }