Commit Graph

37 Commits

Author SHA1 Message Date
lukem 7c6d79f87c provide the ability to remove support for generating or checking various
digests by #define-ing NO_MD5, NO_RMD160, or NO_SHA1.  the keywords are
still parsed.
2001-11-10 14:58:20 +00:00
lukem e8b2f3326f User interface changes from (or inspired by) FreeBSD:
- Add -L to walk the tree `logically', by following symbolic links in
  the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
  and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
  directories from its traversal.  excludes-file contains fnmatch(3)
  patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
  it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
  previous one.

User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
	- Device type (retaining existing ownership).
	- Symlink target.

Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
  The previous code got majorly confused if fts(3) couldn't descend
  into a subdir, resulting in leaf nodes getting attached to the wrong
  directory.
  XXX: This new method is much much more robust, even though it's not 100%
  perfect; it might result in a couple of following entries in the spec
  to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
  doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
  there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
  the fts(3) walk.

Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
2001-11-07 08:01:51 +00:00
lukem 57566f70f8 - enforce the top-most entry must be "." and must be a directory; avoids
various potential problems when intermixing full and relative paths
- changes to make it much easier to use spec() - the specfile parser - in
  other programs (via .PATHing spec.c and misc.c):
	- move excludetags, includetags and keys from mtree.c to misc.c
	- implement mtree_err() using vwarnx() instead of assuming name is
	  "mtree"
	- move inotype() and nodetype() from compare.c to misc.c
	- add nodetoinode(), to convert from an mtree F_* type to a
	  mode_t S_IF* type
	- clean up #include use; don't assume "mtree.h" pulls in some
	  standard includes
	- change spec() to take a FILE * arg (where the specfile is read from)
2001-10-22 07:07:46 +00:00
lukem f644bd620b complete WARNS=2 cleanup (with a bit of ickiness for the fts_open argv issue) 2001-10-18 05:06:01 +00:00
lukem 98df36b3a5 make this mostly WARNS=2 safe 2001-10-18 04:37:56 +00:00
lukem bc1697fc70 Add "device" keyword, which allows the device number to be specified,
to be later checked and possibly created. Uses parsing and encoding
routines from mknod(8).
2001-10-09 04:50:00 +00:00
lukem 7c30045cef features:
- add a new keyword - "tags" - which is a comma separated list of tags
  associated with that file.
- add "-E tags"; exclude files in -D output with matching tags
- add "-I tags"; only include files in -D output with matching tags
  (default is to list all)

fixes:
- move all extern variable references from individual files into extern.h
- `quote' some more user-specified strings in error messages
- man page: list an options arguments in the description, and sort xrefs.
2001-10-04 04:51:27 +00:00
lukem 0c2c66fb9a - implement -D - dump the specfile out in a manner that's parseable
by various tools
- implement -R key  - remove the given key(s) from the list of keys to print
  (now it's possible with "-k type -R type" to remove all keys :)
- rename ftype() to nodetype(), and make it public
- use pwcache(3) functions instead of get{gr,pw}{nam,uid}(3)
- add dump_nodes(), which provides the guts for -D.
2001-10-01 02:30:40 +00:00
simonb 7cbb4e05a0 ANSIfy, KNF, in preperation for more work. 2001-03-09 03:09:45 +00:00
hubertf 1156c833f6 Remove all the "#ifdef __APPLE__" code, to make this actually
build again on Darwin. The code in question is outdated.

OK'd by Wilfredo Sanchez wsanchez@MIT.EDU.
2001-02-20 19:45:51 +00:00
is 0e32b4bfb3 LP64 format string cleanup. Problem reported by garbled. 2000-10-15 12:27:25 +00:00
is d8302e2d73 More format string cleanups by sommerfeld. 2000-10-11 20:23:46 +00:00
wennmach dff19e227b Now that we have strsvis, use it. 1999-12-01 22:12:52 +00:00
wennmach 7db0eb0492 Encode file names using strvis(3) when creating a specification.
Escape white space characters and `#' characters. Do the inverse
when reading specs.

This is a temporary fix until we have strzouvis(3) (or some such)
which is an improved version of strvis (taking an additional list
of characters to encode).

Fixes PR 5006 and PR 7663
1999-11-07 20:23:01 +00:00
christos 78a99dbab7 portability fixes:
- don't use timespecs in struct stat on non 4.4BSD systems
- don't assume that tv_sec is a time_t
1999-07-06 15:11:14 +00:00
hubertf 657f0ba4f7 Actually generate MD5 checksums, as reported in PR 7928.
Approved by Dr. Lex Wennmacher <wennmach@geo.Uni-Koeln.DE>
1999-07-06 12:59:12 +00:00
mrg f2aaba6db6 - add -m and -i to change file flags more usefully.
- fix bugs in fileflags checking

all of the above from dr. lex wennmacher <wennmach@geo.Uni-Koeln.DE>
with some error fixes from egcs via myself.
1999-02-11 15:32:23 +00:00
christos 62871103f9 Appease gcc-2.8.1, make printf formats more portable. 1998-12-19 15:38:45 +00:00
christos e091e64548 Namespace protection against MAXUID etc. 1998-11-03 15:14:40 +00:00
mrg f2fb63efda add support for 4.4BSD file flags. we take a `flags=xxx' parameter,
using the same style of naming as chflags, ls & xinstall use, plus an
additional `none' to turn off a default setting.
1998-10-10 07:50:27 +00:00
wsanchez c45946d27c Use u_int32_t rather than Sys-V u_long.
Rename err() to mtree_err(), to avoid conflict with libc.
1998-10-08 02:04:55 +00:00
nathanw b757463521 Add braces to satisfy egcs. 1998-08-30 03:20:09 +00:00
ross 5b1f2d4c8c Add {} pairs to shut up egcs. 1998-08-27 18:03:42 +00:00
mrg 32f519716b - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
1998-07-06 06:56:06 +00:00
lukem 4eb7653054 WARNSify, getopt returns -1 not EOF 1997-10-17 11:46:30 +00:00
mikel fb325bad88 fix printf() formats, make explicit comparisons to NULL (gcc -Wall) 1997-07-11 07:05:29 +00:00
mycroft e73875ce0a Only record sizes for regular files. 1996-09-05 09:24:19 +00:00
jtc dd05bd5124 Rename struct timespec fields to conform to POSIX.1b 1996-02-01 00:04:52 +00:00
cgd 94f5a7441c add NetBSD id's 1995-03-07 21:12:04 +00:00
cgd d03f028e33 clean up import, fix a few bugs, etc. 1995-03-07 15:28:32 +00:00
cgd 7af90ebe38 off_t exp. 1994-03-27 09:09:49 +00:00
cgd 44c6a0bbc1 make things a bit more consistent 1993-11-17 11:00:52 +00:00
cgd 476023b5bb latest mtree from uunet. doesn't compile, but that'll be fixed soon.
(want to have 'pseudo-virgin' sources, for when fixed fnmatch stuff
is released...)
1993-11-02 07:51:06 +00:00
jtc 99cd400e2e Use *->fts_errno instead of errno after fts_read(). The fts manpage
indicates that the fts_errno will be set to the correct value, but there
are no guarentees about errno.
1993-10-01 01:03:22 +00:00
deraadt 5bfebdcaf0 update for fts library change 1993-08-06 03:48:27 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00