View | Details | Raw Unified | Return to bug 21725
Collapse All | Expand All

(-)mtree.8 (-1 / +5 lines)
Lines 40-46 Link Here
40
.Nd map a directory hierarchy
40
.Nd map a directory hierarchy
41
.Sh SYNOPSIS
41
.Sh SYNOPSIS
42
.Nm mtree
42
.Nm mtree
43
.Op Fl cdeinrUux
43
.Op Fl cdeiLnPrUux
44
.Op Fl f Ar spec
44
.Op Fl f Ar spec
45
.Op Fl K Ar keywords
45
.Op Fl K Ar keywords
46
.Op Fl k Ar keywords
46
.Op Fl k Ar keywords
Lines 85-90 Link Here
85
Use the ``type'' keyword plus the specified (whitespace or comma separated)
85
Use the ``type'' keyword plus the specified (whitespace or comma separated)
86
.Ar keywords
86
.Ar keywords
87
instead of the current set of keywords.
87
instead of the current set of keywords.
88
.It Fl L
89
Symbolic links in file hierarchies are followed (default).
88
.It Fl n
90
.It Fl n
89
Do not emit pathname comments when creating a specification.  Normally 
91
Do not emit pathname comments when creating a specification.  Normally 
90
a comment is emitted before each directory and before the close of that
92
a comment is emitted before each directory and before the close of that
Lines 95-100 Link Here
95
Use the file hierarchy rooted in
97
Use the file hierarchy rooted in
96
.Ar path  ,
98
.Ar path  ,
97
instead of the current directory.
99
instead of the current directory.
100
.It Fl P
101
No symbolic links are followed.
98
.It Fl r
102
.It Fl r
99
Remove any files in the file hierarchy that are not described in the
103
Remove any files in the file hierarchy that are not described in the
100
specification.
104
specification.
(-)mtree.c (-4 / +26 lines)
Lines 57-64 Link Here
57
57
58
extern long int crc_total;
58
extern long int crc_total;
59
59
60
int ftsoptions = FTS_LOGICAL;
60
int ftsoptions = 0;
61
int cflag, dflag, eflag, iflag, nflag, rflag, sflag, uflag, Uflag;
61
int cflag, dflag, eflag, iflag, nflag, rflag, sflag, uflag, Uflag;
62
int Lflag, Pflag;
62
u_int keys;
63
u_int keys;
63
char fullpath[MAXPATHLEN];
64
char fullpath[MAXPATHLEN];
64
65
Lines 77-83 Link Here
77
	keys = KEYDEFAULT;
78
	keys = KEYDEFAULT;
78
	init_excludes();
79
	init_excludes();
79
80
80
	while ((ch = getopt(argc, argv, "cdef:iK:k:np:rs:UuxX:")) != -1)
81
	while ((ch = getopt(argc, argv, "cdef:iK:k:Lnp:Prs:UuxX:")) != -1)
81
		switch((char)ch) {
82
		switch((char)ch) {
82
		case 'c':
83
		case 'c':
83
			cflag = 1;
84
			cflag = 1;
Lines 106-117 Link Here
106
				if (*p != '\0')
107
				if (*p != '\0')
107
					keys |= parsekey(p, NULL);
108
					keys |= parsekey(p, NULL);
108
			break;
109
			break;
110
		case 'L':
111
			if (Pflag)
112
				usage();
113
			Lflag = 1;
114
			break;
109
		case 'n':
115
		case 'n':
110
			nflag = 1;
116
			nflag = 1;
111
			break;
117
			break;
112
		case 'p':
118
		case 'p':
113
			dir = optarg;
119
			dir = optarg;
114
			break;
120
			break;
121
		case 'P':
122
			if (Lflag)
123
				usage();
124
			Pflag = 1;
125
			break;
115
		case 'r':
126
		case 'r':
116
			rflag = 1;
127
			rflag = 1;
117
			break;
128
			break;
Lines 143-148 Link Here
143
	if (argc)
154
	if (argc)
144
		usage();
155
		usage();
145
156
157
	if (Lflag + Pflag > 1)
158
		usage();
159
160
	if (Lflag + Pflag == 0)
161
		Lflag = 1;			/* -L (follow symlinks) default */
162
163
	if (Lflag)
164
		ftsoptions |= FTS_LOGICAL;
165
166
	if (Pflag)
167
		ftsoptions |= FTS_PHYSICAL;
168
146
	if (dir && chdir(dir))
169
	if (dir && chdir(dir))
147
		err(1, "%s", dir);
170
		err(1, "%s", dir);
148
171
Lines 163-169 Link Here
163
usage()
186
usage()
164
{
187
{
165
	(void)fprintf(stderr,
188
	(void)fprintf(stderr,
166
"usage: mtree [-cdeinrUux] [-f spec] [-K key] [-k key] [-p path] [-s seed]\n"
189
"usage: mtree [-cdeiLnPrUux] [-f spec] [-K key] [-k key] [-p path] [-s seed]\n"
167
"\t[-X excludes]\n");
190
"\t[-X excludes]\n");
168
	exit(1);
191
	exit(1);
169
}
192
}
170
- CUT HERE --

Return to bug 21725