Oberon || Library || Module Index || Search Engine || Definition || Module
CONST dirsize = 255; (* BSD file system *)
CONST namelength = dirsize+1;
TYPE FileName = ARRAY namelength OF CHAR;
TYPE Inode = LONGINT;
TYPE Entry =
RECORD
inode: Inode;
name: FileName;
END;
TYPE Stream = POINTER TO StreamRec;
TYPE StreamRec = RECORD (Streams.StreamRec) END;
PROCEDURE Open(VAR dir: Streams.Stream; dirname: ARRAY OF CHAR;
errors: RelatedEvents.Object) : BOOLEAN;
PROCEDURE ListFiles(dirname: ARRAY OF CHAR);
VAR
dir: Streams.Stream;
entry: UnixDirectories.Entry;
BEGIN
IF UnixDirectories.Open(dir, dirname, NIL) THEN
WHILE Streams.Read(dir, entry) DO
Write.Line(entry.name);
END;
Streams.Release(dir);
ELSE
(* cannot open dirname *)
END;
END ListFiles;
During the initialization time, UnixDirectories checks several internal conversion formats of SysConversions against record sizes as computed by the compiler.
The constant dirsize and the field components of Entry with the exception of name depend on the UNIX version.
Oberon || Library || Module Index || Search Engine || Definition || Module