Blame


1 058b0118 2005-01-03 devnull .TH PROTO 3
2 058b0118 2005-01-03 devnull .SH NAME
3 058b0118 2005-01-03 devnull rdproto \- parse and process a proto file listing
4 058b0118 2005-01-03 devnull .SH SYNOPSIS
5 058b0118 2005-01-03 devnull .nf
6 058b0118 2005-01-03 devnull .ft L
7 058b0118 2005-01-03 devnull #include <u.h>
8 058b0118 2005-01-03 devnull #include <libc.h>
9 058b0118 2005-01-03 devnull #include <disk.h>
10 058b0118 2005-01-03 devnull .ft
11 058b0118 2005-01-03 devnull .PP
12 058b0118 2005-01-03 devnull .B
13 058b0118 2005-01-03 devnull typedef void Protoenum(char *new, char *old, Dir *d, void *a)
14 058b0118 2005-01-03 devnull .PP
15 058b0118 2005-01-03 devnull .B
16 058b0118 2005-01-03 devnull typedef void Protowarn(char *msg, void *a)
17 058b0118 2005-01-03 devnull .PP
18 058b0118 2005-01-03 devnull .B
19 058b0118 2005-01-03 devnull int rdproto(char *proto, char *root, Protoenum *enm,
20 058b0118 2005-01-03 devnull .br
21 058b0118 2005-01-03 devnull .B
22 058b0118 2005-01-03 devnull Protowarn *warn, void *a)
23 058b0118 2005-01-03 devnull .SH DESCRIPTION
24 058b0118 2005-01-03 devnull .I Rdproto
25 058b0118 2005-01-03 devnull reads and interprets the named
26 058b0118 2005-01-03 devnull .I proto
27 977b25a7 2020-08-14 rsc file relative to the
28 058b0118 2005-01-03 devnull root directory
29 058b0118 2005-01-03 devnull .IR root .
30 058b0118 2005-01-03 devnull .PP
31 058b0118 2005-01-03 devnull Each line of the
32 058b0118 2005-01-03 devnull .I proto
33 058b0118 2005-01-03 devnull file specifies a file to copy.
34 058b0118 2005-01-03 devnull Blank lines and lines beginning with
35 058b0118 2005-01-03 devnull .B #
36 058b0118 2005-01-03 devnull are ignored.
37 058b0118 2005-01-03 devnull Indentation (usually tabs) is significant,
38 058b0118 2005-01-03 devnull with each level of indentation corresponding to a level in the file tree.
39 058b0118 2005-01-03 devnull Fields within a line are separated by white space.
40 058b0118 2005-01-03 devnull The first field is the last path element in the destination file tree.
41 058b0118 2005-01-03 devnull The second field specifies the permissions.
42 058b0118 2005-01-03 devnull The third field is the owner of the file,
43 058b0118 2005-01-03 devnull and the fourth is the group owning the file.
44 058b0118 2005-01-03 devnull The fifth field is the name of the file from which to copy;
45 058b0118 2005-01-03 devnull this file is read from the current name space,
46 058b0118 2005-01-03 devnull not the source file tree.
47 058b0118 2005-01-03 devnull All fields except the first are optional.
48 977b25a7 2020-08-14 rsc Specifying
49 058b0118 2005-01-03 devnull .B -
50 977b25a7 2020-08-14 rsc for permissions, owner, or group
51 058b0118 2005-01-03 devnull causes
52 058b0118 2005-01-03 devnull .I rdproto
53 058b0118 2005-01-03 devnull to fetch the corresponding information
54 058b0118 2005-01-03 devnull from the file rather than override it.
55 058b0118 2005-01-03 devnull (This is the default behavior when the fields
56 058b0118 2005-01-03 devnull are not present; explicitly specifying
57 058b0118 2005-01-03 devnull .B -
58 058b0118 2005-01-03 devnull is useful when one wishes to set, say,
59 058b0118 2005-01-03 devnull the file owner without setting the permissions.)
60 058b0118 2005-01-03 devnull .PP
61 058b0118 2005-01-03 devnull Names beginning with a
62 058b0118 2005-01-03 devnull .L $
63 058b0118 2005-01-03 devnull are expanded as environment variables.
64 058b0118 2005-01-03 devnull If the first file specified in a directory is
65 058b0118 2005-01-03 devnull .LR * ,
66 058b0118 2005-01-03 devnull all of the files in that directory are considered listed.
67 058b0118 2005-01-03 devnull If the first file is
68 058b0118 2005-01-03 devnull .LR + ,
69 058b0118 2005-01-03 devnull all of the files are copied, and all subdirectories
70 058b0118 2005-01-03 devnull are recursively considered listed.
71 058b0118 2005-01-03 devnull All files are considered relative to
72 058b0118 2005-01-03 devnull .IR root .
73 058b0118 2005-01-03 devnull .PP
74 058b0118 2005-01-03 devnull For each file named by the
75 058b0118 2005-01-03 devnull .IR proto ,
76 058b0118 2005-01-03 devnull .I enm
77 058b0118 2005-01-03 devnull is called with
78 058b0118 2005-01-03 devnull .I new
79 058b0118 2005-01-03 devnull pointing at the name of the file (without the root prefix),
80 058b0118 2005-01-03 devnull .I old
81 058b0118 2005-01-03 devnull pointing at the name of the source file (with the root prefix,
82 058b0118 2005-01-03 devnull when applicable),
83 058b0118 2005-01-03 devnull and
84 058b0118 2005-01-03 devnull .I Dir
85 058b0118 2005-01-03 devnull at the desired directory information for the new file.
86 058b0118 2005-01-03 devnull Only the
87 058b0118 2005-01-03 devnull .BR name ,
88 058b0118 2005-01-03 devnull .BR uid ,
89 058b0118 2005-01-03 devnull .BR gid ,
90 058b0118 2005-01-03 devnull .BR mode ,
91 058b0118 2005-01-03 devnull .BR mtime ,
92 058b0118 2005-01-03 devnull and
93 058b0118 2005-01-03 devnull .B length
94 058b0118 2005-01-03 devnull fields are guaranteed to be valid.
95 977b25a7 2020-08-14 rsc The argument
96 058b0118 2005-01-03 devnull .I a
97 058b0118 2005-01-03 devnull is the same argument passed to
98 058b0118 2005-01-03 devnull .IR rdproto ;
99 058b0118 2005-01-03 devnull typically it points at some extra state
100 058b0118 2005-01-03 devnull used by the enumeration function.
101 058b0118 2005-01-03 devnull .PP
102 977b25a7 2020-08-14 rsc When files or directories do not exist or
103 977b25a7 2020-08-14 rsc cannot be read by
104 058b0118 2005-01-03 devnull .IR rdproto ,
105 977b25a7 2020-08-14 rsc it formats a warning message, calls
106 058b0118 2005-01-03 devnull .IR warn ,
107 977b25a7 2020-08-14 rsc and continues processing;
108 058b0118 2005-01-03 devnull if
109 058b0118 2005-01-03 devnull .I warn
110 977b25a7 2020-08-14 rsc is nil,
111 058b0118 2005-01-03 devnull .I rdproto
112 058b0118 2005-01-03 devnull prints the warning message to standard error.
113 058b0118 2005-01-03 devnull .PP
114 058b0118 2005-01-03 devnull .I Rdproto
115 058b0118 2005-01-03 devnull returns zero
116 058b0118 2005-01-03 devnull if
117 977b25a7 2020-08-14 rsc .I proto
118 058b0118 2005-01-03 devnull was processed, \-1 if it could not be opened.
119 058b0118 2005-01-03 devnull .SH FILES
120 058b0118 2005-01-03 devnull .TF /sys/lib/sysconfig/proto/portproto
121 058b0118 2005-01-03 devnull .TP
122 058b0118 2005-01-03 devnull .B /sys/lib/sysconfig/proto/
123 058b0118 2005-01-03 devnull directory of prototype files.
124 058b0118 2005-01-03 devnull .TP
125 058b0118 2005-01-03 devnull .B /sys/lib/sysconfig/proto/portproto
126 058b0118 2005-01-03 devnull generic prototype file.
127 058b0118 2005-01-03 devnull .SH SOURCE
128 c3674de4 2005-01-11 devnull .B \*9/src/libdisk/proto.c
129 058b0118 2005-01-03 devnull .SH SEE ALSO
130 d32deab1 2020-08-16 rsc .MR mk9660 (1) ,
131 977b25a7 2020-08-14 rsc Plan 9's
132 977b25a7 2020-08-14 rsc .IR mkfs (8)