include "fsproto.m"; fsproto := load FSproto FSproto->PATH; Direntry: type (string, string, ref Sys->Dir); init: fn(): string; readprotofile: fn(proto: string, root: string, entries: chan of Direntry, warnings: chan of (string, string)): string; readprotostring: fn(proto: string, root: string, entries: chan of Direntry, warnings: chan of (string, string));
Init must be called before any other function in the module.
Readprotofile reads a file system prototype from the file proto. It traverses the file system, starting at the given root, and each file or directory encountered that is mentioned in the prototype causes readprotofile to send a Direntry tuple on the channel entries. The tuple has the form (old,new,dir) where old is the name of the current file or directory, rooted at root, new is the same file's name relative to root, and dir is a reference to the Sys->Dir directory information for old, as produced by sys-stat(2). When all files in root have been examined, readprotofile sends a single tuple with all nil components on entries. For each error that occurs during processing (eg, unable to open a directory) readprotofile sends a tuple (old,diag) on the channel warnings, naming the file and giving a diagnostic string, but processing continues.
Readprotostring reads a file system prototype from the string proto itself. Otherwise, its operation is the same as readprotofile.
FSPROTO(2 ) | Rev: Thu Feb 15 14:43:27 GMT 2007 |