home *** CD-ROM | disk | FTP | other *** search
- MODULE Files;
-
- IMPORT Dos, Utility, Exec, OberonLib;
-
- VAR
- buffer: Dos.ExAllDataPtr;
- control: Dos.ExAllControlPtr;
- more: BOOLEAN;
- data: Dos.ExAllDataPtr;
- ln: BOOLEAN;
- cd: Dos.FileLockPtr;
-
- CONST
- bufsize = 2048;
-
- PROCEDURE MatchFunk(hook: Utility.HookPtr;
- type: Exec.APTR;
- match: Exec.APTR): LONGINT;
-
- VAR
- m: Dos.ExAllDataPtr;
-
- BEGIN
- m := match;
- IF m.type = Dos.file THEN RETURN -1
- ELSE RETURN 0 END;
- END MatchFunk;
-
-
- BEGIN
- IF Dos.dos.lib.version>=37 THEN
- IF ~ OberonLib.wbStarted THEN
- control := Dos.AllocDosObjectTags(Dos.exAllControl);
- IF control=NIL THEN
- Dos.PrintF("AllocDosObject failed!\n");
- ELSE
- control.lastKey := 0;
- NEW(control.matchFunc);
- Utility.InitHook(control.matchFunc,MatchFunk);
- OberonLib.New(buffer,bufsize);
- ln := FALSE;
- cd := Dos.Lock("",Dos.sharedLock);
- IF cd=NIL THEN
- Dos.PrintF("Lock failed!\n");
- ELSE
- REPEAT
- more := Dos.ExAll(cd,buffer^,bufsize,Dos.size,control);
- IF ~more & (Dos.IoErr()#Dos.noMoreEntries) THEN
- Dos.PrintF("Fehler!\n");
- ELSE
- IF control.entries>0 THEN
- data := buffer;
- REPEAT
- Dos.PrintF("%-24s %8ld ",data.name,data.size);
- IF ln THEN Dos.PrintF("\n") END;
- ln := ~ln;
- data := data.next;
- UNTIL data=NIL;
- END;
- END;
- UNTIL ~more;
- IF ln THEN Dos.PrintF("\n") END;
- Dos.UnLock(cd);
- END;
- Dos.FreeDosObject(Dos.exAllControl,control);
- END;
- END;
- END;
- END Files.
-