Commit Graph

51 Commits

Author SHA1 Message Date
Tim Kientzle
fc1f10af70 Make -I and --files-from be synonyms for -T 2004-08-13 07:23:02 +00:00
Tim Kientzle
b757c8251b gtar uses -F for another purpose, so bsdtar no longer treats it as a
synonym for --format.  Update the man page to reflect this.  While
I'm here, change the man page to document "tar" rather than "bsdtar,"
update some comments about -l compatibility and fix a few grammar nits.
2004-08-08 17:20:23 +00:00
Tim Kientzle
991f1d87bb Move the smart chdir logic into a couple of utility functions in util.c.
Then use them to provide consistent -C support throughout the program.
Thanks to: Christoph Mallon
2004-08-08 05:50:10 +00:00
Tim Kientzle
dd1a40a3c0 It shouldn't be an error to specify the same mode twice: allow -cc but not -ct.
Thanks to: Christoph Mallon (whose proposed patch was actually
   simpler than what I ended up with)
2004-08-08 05:10:10 +00:00
Tim Kientzle
8095e9d82b Add --totals option. Unlike gtar, this reports the bytes actually
written to the archive, not the ones written to the compressor.
For uncompressed archives, these numbers are the same, of course.
2004-08-07 19:25:34 +00:00
Tim Kientzle
dfee4c496f Linux port corrections:
* Add a more reasonable default device for linux
   * Add an autoconf check for the FNM_LEADING_DIR extension
     (which isn't yet obeyed in the code)
2004-08-07 17:17:11 +00:00
Tim Kientzle
5232906014 Add "make distfile" capabilities to bsdtar, including informational
COPYING file and some conditional compilation cleanups.
2004-08-07 03:24:49 +00:00
Tim Kientzle
a6cc81c62c GNU and POSIX disagree about -o and -l.
For -l, upset everyone by breaking it.  Specifically, -l now produces
a lengthy error message that suggests --check-links (POSIX -l) or
--one-file-system (GNU -l) instead.  However, if POSIXLY_CORRECT is set,
use the POSIX interpretation.

For -o, please everyone by making it work both ways:
  * -xo uses POSIX behavior
  * -co uses "almost GNU" behavior (as close as we can get until
    libarchive implements a true V7 tar format)
2004-08-03 06:19:08 +00:00
Tim Kientzle
556d6e605e Add a --version option to bsdtar that prints the versions of
both bsdtar and libarchive.  Of course, this requires that bsdtar
have a version number.  Let's call this 1.00, shall we? ;-)
2004-07-26 03:21:41 +00:00
Tim Kientzle
4f23b47afa A bunch of style and security fixes (error checking return values, etc),
mostly from: Tim J Robbins
2004-07-25 04:15:50 +00:00
Tim Kientzle
62010d3541 A bunch of stuff from Christoph Mellon:
* Whitespace fixes
  * Check some malloc calls
  * Simplify long_help formatting
  * Spell "LINUX" -> "linux"
  * A few other miscellaneous style improvements
2004-07-24 22:13:44 +00:00
Tim Kientzle
040d3851d1 Guard against argv[0] being NULL.
Thanks to: Tim J Robbins
2004-07-19 14:54:38 +00:00
Tim Kientzle
5ebbe2f056 Remove unused user_uname variable.
Add range-checking to argument of -b.

Thanks to: Tim J Robbins
2004-07-17 18:21:00 +00:00
Tim Kientzle
b3ea6ecd42 Validate -o usage. Strictly speaking, -o only makes sense with -x,
of course, but I make an effort to accomodate GNU tar scripts that
use -o with -c (with a meaning that totally contradicts SUSv2) by
only issuing a benign warning message in that case.
2004-07-17 04:17:50 +00:00
Tim Kientzle
b9916968df Make the day/month ordering dependent on the current locale by
testing the locale at program startup and setting a flag, then
using that flag to determine appropriate strftime() arguments.
2004-07-15 03:14:46 +00:00
Tim Kientzle
3481100baf Fix tab/space screwup in long_help() 2004-07-12 13:13:42 +00:00
Tim Kientzle
0ddb95d12c Pass the pointy hat, please:
All of --help should go to stdout, not some to stdout and some to stderr.
2004-07-04 18:13:01 +00:00
Tim Kientzle
77d2ac4af5 Add yet another synonym for -n. 2004-06-28 14:02:22 +00:00
Tim Kientzle
da9cbfaa5d Update -p:
* Don't change the umask; the library now ignores the umask if
    you set EXTRACT_PERM
  * Set the EXTRACT_ACL and EXTRACT_FFLAGS bits (used to be
    controlled by EXTRACT_PERM).
2004-06-27 23:29:44 +00:00
Tim Kientzle
d3d1a208cb Augment the -T handling:
* Add --null option (sort #defines here)
 * Add process_lines function to util.c that reads newline-terminated
   or null-terminated lines (with self-sizing buffers, etc) and iteratively
   invokes a provided function.  Use this to dramatically simplify:
   -T handling for -c, --exclude-from-file, and --include-from-file.
 * Add -T handling to -x (via include_from_file)

Hopefully, this will fix the openoffice port and a couple of
others that rely on -T and --null.
2004-06-27 06:29:03 +00:00
Tim Kientzle
0674dded37 Rename C=dir to -C dir, which is what people expect.
This requires some non-trivial surgery to the options parsing.

While here, let people who only have getopt() access long options
through the -W longopt=value convention.
2004-06-26 22:49:51 +00:00
Tim Kientzle
d18eca7d48 Update some internal comments about the --no-same-permissions option.
Thanks to: Kris Kennaway for doing some gtar research for me.
2004-06-15 07:16:44 +00:00
Tim Kientzle
4150562c7b As near as I can tell, --no-same-permissions is a no-op in
gtar, so that makes it easy to implement.

Required by: audio/timidity port
Thanks to: Kris Kennaway
2004-06-15 06:44:41 +00:00
Tim Kientzle
d2286340c9 Oops. bsdtar's old -X option didn't take an argument; the new
(gtar-compatible) one does require an argument.
2004-06-15 06:24:54 +00:00
Tim Kientzle
b7ec47bb9f Add gtar-compatible -X/--exclude-from 2004-06-15 05:55:41 +00:00
Tim Kientzle
b9d38fa25a Fix build. 2004-06-15 01:51:45 +00:00
Tim Kientzle
24220f2890 Rename -X to --one-file-system, as GNU tar uses -X for
something else.  I would really like a short option for
this, but all of the obvious ones conflict with something else.
2004-06-15 00:28:34 +00:00
Tim Kientzle
5a57a7f095 Clean up usage message(s):
* Usage goes to stderr, not stdout
  * Use correct argument markup
  * bsdtar --help  no longer exits with an error return code
  * ensure that the word "bsdtar" appears in the first
    line output from "bsdtar --help" (even if the program is
    invoked as "tar")

In particular, scripts can now test for the presence of bsdtar.
For example, in /bin/sh:

if (tar --help 2>&1 | grep bsdtar >/dev/null 2>&1) then \
          echo bsdtar; else echo not bsdtar; fi
2004-06-15 00:07:23 +00:00
Tim Kientzle
c066ba2f01 Oops: gtar's --dereference should be a synonym for bsdtar's -L, not -H.
Pointed out by: devel/nspr port
Thanks to: Kris Kennaway
2004-06-11 01:35:56 +00:00
Tim Kientzle
a55bfb25e7 The --include='pattern' option is the natural counterpart to
--exclude='pattern'.

I should have added this a long time ago, since it's so useful for testing.
In particular, it allows me to select a few entries from a troublesome
archive so that I can easily focus my debugging efforts:
   bsdtar -czf new.tgz --include='*foo*' @old.tgz
2004-06-07 03:49:48 +00:00
Tim Kientzle
e1f5ccf6fb If -b is specified, then force full padding for the last block. 2004-06-07 03:19:57 +00:00
Tim Kientzle
755e3f9b2e Improve help handling:
* --help produces long help message on systems with getopt_long
   * -h with no other options also produces long help message
     (If a mode is specified, -h has its usual meaning.)
2004-06-02 21:01:27 +00:00
Tim Kientzle
e5572b4b7c Correction: -h should be a synonym for -L, not -H.
(as specified by Linux Standards Base, GNU tar, and 4.4BSD documentation)
2004-05-31 20:22:41 +00:00
Tim Kientzle
de10ed4154 Permit (but ignore) -Z with -x or -t, now that libarchive
recognizes and decompresses .Z format.
2004-05-30 00:09:43 +00:00
Tim Kientzle
8df3c224c0 Provide framework for exiting with non-zero value on non-critical errors. 2004-05-27 04:30:59 +00:00
Tim Kientzle
26eddc7f41 Add --no-same-owner as a synonym for -o.
Note that bsdtar's -o (which follows SUSv2) is not the same as GNU tar's -o.
In GNU tar, -o and --no-same-owner are not synonyms.

Pointed out by: Kris Kennaway (required by xpenguins port)
2004-05-22 17:49:54 +00:00
Tim Kientzle
c5ce4977e6 Add --dereference as a synonym for -H
Pointed out by: Kris Kennaway (unbreaks nspr port build)
2004-05-21 18:40:32 +00:00
Tim Kientzle
04e2d02e20 Default is to restore timestamps, even when operating as root. <sigh> 2004-05-19 01:21:11 +00:00
Tim Kientzle
656e70b49a Accept (but ignore) GNU tar's -B option. bsdtar never
needs it, but it does no harm for people to specify it.
2004-05-18 17:16:55 +00:00
Tim Kientzle
088bdb251d Propagate struct bsdtar down into a lot more places.
Move global progname variable into struct bsdtar.
2004-05-17 05:44:53 +00:00
Tim Kientzle
4a07f42b98 Make symlink protection a bit more useful:
* Remove terminal symlinks so they can be replaced.
  * If -U, remove intermediate symlinks as well
  * Otherwise, refuse the extraction
2004-05-17 03:33:06 +00:00
Tim Kientzle
81f3488f97 Add --unlink and --unlink-first synonyms for -U
Make indentation of tar_longopts array more consistent.
2004-05-05 21:06:37 +00:00
Tim Kientzle
f1fe72c1cc Style: Use single tab after #define 2004-05-02 22:58:18 +00:00
Tim Kientzle
cc52bf3428 --help is only supported if you have getopt_long().
This allows bsdtar to compile on FreeBSD 4.x.
2004-04-16 03:50:04 +00:00
Tim Kientzle
855e109158 As suggested by Julian Elischer, use a self-sizing hash
table for the hardlink cache.  This dramatically improves
performance when archiving millions of hardlinked files.

While I'm here, clean up some style bugs (per Bruce Evans)
and clarify some comments.
2004-04-15 22:37:54 +00:00
Tim Kientzle
17834543c8 A simple cache of uid->uname lookups and gid->gname lookups eliminates
almost 1/2 of the CPU time required to create an uncompressed archive
and makes a noticable reduction in wallclock time.
2004-04-14 00:40:54 +00:00
Tim Kientzle
de60e4436b Manpage changes suggested by Irina Liakh.
Also, add -h as a synonym for -H, for Linux Standards Base compliance.
2004-04-13 19:45:55 +00:00
Tim Kientzle
4cbbc3a35e Add DPADD to Makefile (thanks to Andrey for pointing this out).
Generally clean up Makefile, remove dmalloc references from source
(there are better ways to do this than pollute the FreeBSD src tree).
2004-04-12 00:13:23 +00:00
Tim Kientzle
f6f4796250 Allow arguments to appear in any order.
While I'm here, add a couple of extra sanity-checks to
the argument parsing (reject -j -z, for instance) and
update the docs a bit.

Requested by: most everyone ;-)
2004-04-08 19:37:01 +00:00
Tim Kientzle
330924f9bd Add support for -T option on create.
(Required by pkg_create.)
2004-04-08 06:12:01 +00:00