Commit Graph

15 Commits

Author SHA1 Message Date
Poul-Henning Kamp
bd39966d9b Make the output of mtree(8) more systematic and machine readable.
The new format is:

        filename        {changed,missing,extra}
                $field expected $foo found $bar
                ...

Fix various bugs along the way:
        Don't complain about directory sizes differing.
        Correctly check flags.
2000-10-03 13:13:47 +00:00
Warner Losh
c96eb6d2e8 Add -q. this will cause the warning messages about missing
directories to not be printed.  This is from OpenBSD (and I think
NetBSD also) and makes our mtree more compatible with other BSDs.
This makes cross compilation easier than it was before.  Other changes
will be needed to allow NetBSD or OpenBSD to cross build on FreeBSD,
but this is a start.

Reviewed by: andrey
Obtained from: OpenBSD
Concentric Red Circles by: My own stupidity
2000-07-25 19:05:09 +00:00
Josef Karthauser
94401addc5 Allow symlinks to be created if they appear in the mtree specification.
PR:	bin/14171
2000-07-13 22:28:39 +00:00
Josef Karthauser
0f4a1f9b5c Added a flag (-S) to mtree to specify that symlinks shouldn't be
followed.  This allows type=link matches to work properly and match
the link itself, instead of the file/directory that the link is
pointing to.
2000-07-13 22:13:42 +00:00
Garrett Wollman
dc785636aa Give mtree the ability to exclude files and directories from its traversal.
PR:		16944
2000-05-12 03:03:00 +00:00
Josef Karthauser
68bc9a5737 Added support for file flags, mostly merged from the NetBSD version.
The way is now open to schg and sappnd key files and directories in
our tree.  There are recommendations in bin/15229.

PR:		bin/15229
Reviewed by:	imp, brian
1999-12-09 20:38:36 +00:00
Bill Fumerola
a590ad80ac -Wall fixes.
Submitted by:	nrahlstr
1999-09-27 00:36:03 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Peter Wemm
573761ee0e There is no need to make nochange imply ignore as well.
Suggested by: bde
1998-06-10 06:45:08 +00:00
Peter Wemm
7840cfdd8b Create a new flag, "nochange", which will specify that a directory is
to be created if it's missing, otherwise completely ignore it's modes and
owners.  Primary intended targets:  /usr/src and /usr/obj.

Adjust the 'not created: File exists' message to mention that it's a
directory that's the problem, otherwise it doesn't make sense.

I had created chown-style  -L and -P flag to control logical/physical mode
(ie: whether symlinks were followed), but the nochange flag is enough to
get the blasted thing out of my hair so I took them back out.
1998-06-05 14:43:42 +00:00
Philippe Charnier
de1ef5eb94 Use err(3) instead of local redefinition. 1997-10-01 06:30:02 +00:00
Bruce Evans
6f4640cac6 Use p->fts_level instead of unsuccessfully trying to keep track of the
level ourself.  We failed for unreadable directories.  E.g.,
`mtree -d -f /etc/mtree/BSD.usr.dist -p /usr' run by `nobody' was
confused after it couldn't descend into /usr/games/hide.  It looked
for /usr/include and subsequent directories in /usr/games.

Don't search for `extra' files when the spec depth is less than the
fts level.  The spec depth isn't incremented for leaf nodes because
that would give a NULL level pointer and make it inconvenient to go
back to the parent level.  Leaf nodes are built for directories that
are empty in the spec.  Since they are empty in the spec, all files
in them are extra.  The search looked for files one spec level
too high, so for `mtree -d -f /etc/mtree/BSD.usr.dist -p /usr',
obj/sbin matched ./sbin and wasn't considered extra, so it was
descended into and lots of bogus extra things in it were found.
This was harmful for `mtree -U' (as reported in pr623) and worse
for `mtree -r'.

Use rmdir(), not unlink(), to remove `extra' directories.  unlink()
succeeds for root but unlinking directories normally damages the
file system.

Report `fts_errno' instead of `errno' when the former applies.
1995-07-24 02:52:42 +00:00
Rodney W. Grimes
709e8f9ae1 Remove trailing whitespace. 1995-05-30 03:57:47 +00:00
Rodney W. Grimes
10c4c64eb7 1. Remove commented out CFLAGS+=-DDEBUG from Makefile
2.  Clean up code so it compiles -Wall (except for sccsid's and copyright).
    This included fixing several printf formats that where not correct,
    and changing the data types of a few things.

3.  Implement new option -i that produces indented mtree output files.

4.  Implement new option -n that turns off directory comments.

5.  Only emit /set records if something has changed since the last one.
1994-09-18 21:17:40 +00:00
Rodney W. Grimes
dea673e932 BSD 4.4 Lite usr.sbin Sources 1994-05-26 05:23:31 +00:00