typedef void Protoenum(char *new, char *old, Dir *d, void *a)
typedef void Protowarn(char *msg, void *a)
int rdproto(char *proto, char *root, Protoenum *enm,
Protowarn *warn, void *a)
Rdproto reads and interprets the named
proto file relative to the
Each line of the
proto file specifies a file to copy.
Blank lines and lines beginning with
# are ignored.
Indentation (usually tabs) is significant,
with each level of indentation corresponding to a level in the file tree.
Fields within a line are separated by white space.
The first field is the last path element in the destination file tree.
The second field specifies the permissions.
The third field is the owner of the file,
and the fourth is the group owning the file.
The fifth field is the name of the file from which to copy;
this file is read from the current name space,
not the source file tree.
All fields except the first are optional.
- for permissions, owner, or group
rdproto to fetch the corresponding information
from the file rather than override it.
(This is the default behavior when the fields
are not present; explicitly specifying
- is useful when one wishes to set, say,
the file owner without setting the permissions.)
Names beginning with a
are expanded as environment variables.
If the first file specified in a directory is
all of the files in that directory are considered listed.
If the first file is
all of the files are copied, and all subdirectories
are recursively considered listed.
All files are considered relative to
For each file named by the
enm is called with
new pointing at the name of the file (without the root prefix),
old pointing at the name of the source file (with the root prefix,
Dir at the desired directory information for the new file.
length fields are guaranteed to be valid.
a is the same argument passed to
rdproto; typically it points at some extra state
used by the enumeration function.
When files or directories do not exist or
cannot be read by
rdproto, it formats a warning message, calls
warn, and continues processing;
warn is nil,
rdproto prints the warning message to standard error.
Rdproto returns zero
proto was processed, -1 if it could not be opened.