home *** CD-ROM | disk | FTP | other *** search
- #include <string.h>
- #include <stdlib.h>
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <libraries/dos.h>
-
- #include <proto/exec.h>
- #include <proto/dos.h>
-
- void __stdargs fprintf(BPTR, const char *, ...);
-
- void main(int argc, char *argv[])
- {
- struct FileInfoBlock *fib;
- BPTR lock, stdout;
-
- char *pattern = argv[1];
-
- stdout = Output();
-
- if((fib = AllocMem(sizeof(struct FileInfoBlock), MEMF_CLEAR)) != NULL)
- {
- if((lock = Lock("", ACCESS_READ)) != 0)
- {
- if((Examine(lock, fib)) != DOSFALSE)
- {
- if((astcsma(fib->fib_FileName, pattern)) > 0)
- fprintf(stdout, "%s\n", fib->fib_FileName);
-
- while((ExNext(lock, fib)) != DOSFALSE)
- {
- if((astcsma(fib->fib_FileName, pattern)) > 0)
- fprintf(stdout, "%s\n", fib->fib_FileName);
- }
-
- if(IoErr() != ERROR_NO_MORE_ENTRIES)
- fprintf(stdout, "Fehler bei ExNext()!\n");
- }
- UnLock(lock);
- }
- FreeMem(fib, sizeof(struct FileInfoBlock));
- }
- }
-