cltp_usrreq.c made separate file in conf/files
[unix-history] / usr / src / usr.sbin / mtree / mtree.8
CommitLineData
25f14064
KB
1.\" Copyright (c) 1989 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15.\"
2dd8a2d1 16.\" @(#)mtree.8 5.3 (Berkeley) %G%
25f14064
KB
17.\"
18.TH MTREE 8 ""
19.UC 7
20.SH NAME
21mtree \- map a directory hierarchy
22.SH SYNOPSIS
23.B mtree
24[
25.B \-cderux
26] [
27.B \-f
28spec ] [
29.B \-p
30path ]
31.SH DESCRIPTION
32.I Mtree
33maps a directory hierarchy, or tree, to a specification.
34The
35specification is read from the standard input by default, or from
36the file
37.I spec
38if the
f504b637 39.I \-f
25f14064
KB
40option is provided.
41.I Mtree
42then walks the tree specified by the
f504b637 43.I \-p
25f14064
KB
44option, or by default, the tree rooted in the current directory, and
45verifies that the tree matches the specification.
46Messages are written to standard output for any nodes which exist
47only in the specification or the tree and for any nodes whose
48characteristics do not match those of the specification.
49.PP
50The options are as follows:
51.TP
f504b637 52\-c
25f14064
KB
53Print to standard output a specification for the tree.
54.TP
f504b637 55\-d
25f14064
KB
56Ignore everything except directory type nodes.
57.TP
f504b637 58\-e
25f14064
KB
59Stops
60.I mtree
61from objecting to nodes that are in the tree but not in the
62specification.
63.TP
f504b637 64\-r
25f14064
KB
65Remove any nodes in the tree that are not described in the
66specification.
67.TP
f504b637 68\-u
25f14064 69The
f504b637 70.I \-u
25f14064
KB
71option causes
72.I mtree
73to modify the owner, group, and permissions of existing nodes to
74match the specification.
75Missing directories are also created.
76.TP
f504b637 77\-x
25f14064
KB
78Don't traverse any mount points when creating a specification.
79.PP
80Specifications consist of ``keywords'', i.e. special strings that specify
81values relating to nodes.
82No keywords have default values, and if a keyword has no set value no
83checks on it are performed.
84The only keyword which
85.B must
f504b637
KB
86be set is
87.BR type .
25f14064
KB
88Currently supported keywords are as follows:
89.TP
f504b637 90.B cksum
25f14064
KB
91The checksum of the file using the algorithm specified by
92the program
93.IR cksum (1).
f504b637
KB
94Ignored for any nodes other than type
95.BR file .
25f14064 96.TP
f504b637 97.B dmode
25f14064
KB
98The directory type node's permissions as an octal value.
99This keyword may only be used globally, i.e. not as part of a node
100specification line.
101.TP
f504b637 102.B fmode
25f14064
KB
103The file type node's permissions as an octal value.
104This keyword may only be used globally, i.e. not as part of a node
105specification line.
106.TP
f504b637 107.B group
25f14064
KB
108The group of the node; may be either numeric or symbolic.
109.TP
f504b637 110.B mode
25f14064
KB
111The current node's permissions as an octal value.
112This keyword may only be used locally, i.e. not for setting a value
113to be retained for future node specifications.
114.TP
f504b637 115.B nlink
25f14064 116The number of hard links the node is expected to have.
f504b637
KB
117Ignored for nodes of type
118.BR directory .
25f14064 119.TP
f504b637 120.B owner
25f14064
KB
121The owner of the node; may be either numeric or symbolic.
122.TP
f504b637 123.B size
25f14064 124The size, in bytes, of the node.
f504b637
KB
125Ignored for any nodes other than type
126.BR file .
25f14064 127.TP
f504b637 128.B slink
25f14064 129The file a symbolic link is expected to reference.
f504b637
KB
130Ignored for any nodes other than type
131.BR link .
25f14064 132.TP
f504b637 133.B type
25f14064 134The type of the node; may be set to one of the following:
2dd8a2d1 135.IP
f504b637 136\fBblock\fP block special device
2dd8a2d1
KB
137.IP
138\fBchar\fP character special device
139.IP
140\fBdir\fP directory
141.IP
142\fBfile\fP regular file
143.IP
144\fBlink\fP symbolic link
145.IP
f504b637 146\fBsocket\fP socket
25f14064
KB
147.PP
148There are five types of lines in a specification.
149.PP
150The first type sets the value of a keyword and consists of three fields:
f504b637
KB
151the string
152.BR /set ,
153a keyword, an equals sign, and the keyword's value.
154Whitespace is required between the
155.B set
156and the keyword, but no whitespace is allowed in the rest of the line.
25f14064
KB
157Once a key word is set, the value remains unchanged until either
158reset or unset.
159.PP
160The second type of line unsets keywords and consists of two fields:
f504b637
KB
161the string
162.B /unset
163and a keyword, separated by whitespace.
25f14064 164.PP
f504b637
KB
165The third type of line consists of two fields: the string
166.B /ignore
167and a name, separated by whitespace.
25f14064
KB
168This causes
169.I mtree
170to ignore the referenced file as well as all files below it in the tree.
171.PP
172The fourth type of line is a node specification and consists of the name
173of a file followed by zero or more whitespace separated fields.
f504b637 174The name may be preceded by any amount of whitespace characters.
25f14064
KB
175Each of these fields consists of a keyword, followed by an equals
176sign (=), followed by the keyword's value, without intervening whitespace.
177The values override, without changing, the current value of the
178corresponding keyword.
179.PP
180The node name may contain any of the standard file name matching characters.
181In this case, any file in the current directory with a name matching the
182pattern will have the specification applied to it.
183.PP
184All paths are relative.
185Any directory specification will cause the current directory path to
186descend one level.
187Any non-directory will be presumed to be below the current directory
188path.
189Which brings us to the last type of line in a specification: a line
f504b637
KB
190containing just the string
191.B ..
192causes the current directory path to ascend one level.
25f14064 193.PP
f504b637
KB
194Empty lines and lines whose first non-whitespace character is a hash mark
195(``#'') are ignored.
25f14064
KB
196.PP
197.I Mtree
198exits 0 on success and >0 if an error occurred or the tree did not
199match the specification.
200.SH "SEE ALSO"
201find(1), stat(2), ftwalk(3), mkproto(8)
202.SH EXAMPLE
203.TS
204l l l l l l.
205# BSD root file system
206#
f504b637
KB
207/set type=file
208/set owner=bin
209/set group=bin
210/set dmode=755
211/set fmode=555
212/set links=1
25f14064
KB
213
214bin type=directory
215 adb
216 cat
217\..
f504b637 218/set fmode=640
25f14064
KB
219dev
220 MAKEDEV
221 kmem type=char group=kmem
222 null type=char group=kmem
223 rdk* type=char group=operator
224 dk* type=block group=operator
225\..
226etc type=directory
227 disklabels type=directory
228 * mode=444
229 \..
230\..
231.TE