Commit Graph

346 Commits

Author SHA1 Message Date
mrg a9a7ae57f7 fix "pax -rw" processing. for some reason, it was now written to process
"pax -rwvpe a b" as "pax -rwvpe b a", and "pax -rwvpe a b c" as
"pax -rwvpe b c a".  only the part of revision 1.40 that broken this has
been reverted.
2002-10-13 11:31:02 +00:00
mrg 20bac70304 make this build on LP64 2002-10-13 00:34:16 +00:00
mrg ed83539f6e add a "+" to the options string rather than setting POSIXLY_CORRECT 2002-10-13 00:32:09 +00:00
mrg 9b3e4b9e61 include <string.h> for mem* and str* 2002-10-13 00:31:28 +00:00
wiz eb12ddd1f9 Miscellaneous fixes. 2002-10-12 22:36:01 +00:00
thorpej 6fe78b30af Only include <rmt.h> if SUPPORT_RMT. 2002-10-12 19:21:12 +00:00
thorpej 32c48247e8 It doesn't help much to skip linking librmt if HOSTPROG but leave
all the librmt calls in the program.  So, make librmt support conditional
on #ifdef SUPPORT_RMT, and define that when NOT building as a HOSTPROG.
2002-10-12 18:49:28 +00:00
christos 0c61202168 merge OpenBSD changes:
- correct -C processing
    - add ability to read filenames and flags from a file
    - don't print dangerous escape sequences to the terminal
    - use strlcpy/strncpy properly.
    - handle tmpfile creation better.
    - improve documentation of options.
    - handle stdout/stderr list selection correctly.
    - kill gzip when we get interrupted.
    - simplify gzip setup.
    - add more flags to programs.

additional changes:
    - librmt processing.
    - set POSIXLY_CORRECT in options parsing.
    - prevent more string overruns.
    - support -T

we don't turn the switch on to replace tar and cpio yet.
2002-10-12 15:39:29 +00:00
christos b73dcc21ce man pages from OpenBSD.
TODO: add long option documentation.
2002-10-12 15:30:54 +00:00
christos 35bdad4ed7 str{n,l}cpy fixes and buffer limit fixes from OpenBSD 2002-10-11 13:07:36 +00:00
wiz 14dfaa4b03 New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
2002-09-25 15:18:36 +00:00
lukem 146a774973 Use ${NETBSDSRCDIR}/some/path instead of ${.CURDIR}/../../some/path (etc). 2002-08-19 09:56:00 +00:00
wiz 0f88938132 Remove unneeded utmp.h include. 2002-08-01 18:41:34 +00:00
lukem e0fcc669c4 Change how "cd .." is handled in next_file() with -M, to ensure that curdir[]
isn't addressed with a negative offset when back at the top of the tree.
This caused pax -M on sparc64 to generate corrupt tar files.
Problem found by Tim Goodwin <tjg@star.le.ac.uk> in [bin/17412].
2002-06-28 11:29:45 +00:00
wiz 46f7269fa1 End sentence with a dot. 2002-04-21 00:10:09 +00:00
lukem 94f2b78379 - Directories marked `optional' won't be stored, even though their
contents will be.
- Document that `optional' faked-up entries won't be created.
2002-04-20 23:36:48 +00:00
lukem a879a977d2 If an entry is in the specfile but not in the underlying file system, and it's
marked "optional", don't add it.
2002-04-12 04:44:08 +00:00
wiz 9baadd8ee5 "doesn't" should have an 's'. 2002-02-11 11:19:26 +00:00
wiz f78eb76cbe achive is not a good word. 2002-02-11 10:57:57 +00:00
ross dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
lukem c22ef7801b make smaller if SMALLPROG is defined, not CRUNCHEDPROG; it's feasible
that a crunchgen(3)ed version of pax wants -USMALL ...
2002-02-02 12:41:14 +00:00
lukem 6ee4925cf5 - don't compile in support for -M (mtree specfile input) or -N dbdir
(alternate directory for id info) if SMALL is defined
- enable -DSMALL and remove unused objects if CRUNCHEDPROG is defined
- minor cleanup in next_file() (preparation for future work)
2002-02-02 12:34:39 +00:00
tv 9fbd88883c Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
  sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
2002-01-31 22:43:33 +00:00
tv 47b0d14e39 Protect __RCSID and __COPYRIGHT from being invoked if not defined. 2002-01-31 19:27:53 +00:00
tv a328e34106 Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
2002-01-29 10:20:28 +00:00
lukem 1a63c49a4f provide meaningful warning if -N is called with a dodgy dbdir 2002-01-26 02:22:54 +00:00
martin 5bb1b47a42 Do not .include <bsd.prog.mk> if building as a host tool. 2002-01-25 22:11:11 +00:00
lukem ae5120dc49 Add '-N dbdir', to specify that user & group lookups (via pwcache(3)) are to
be done from dbdir/master.passwd and dbdir/group, using simple text file
parsing routines from ../../usr.sbin/mtree/getid.c.
This does not affect the -G and -U options, which always use the
system databases.
2002-01-24 07:45:33 +00:00
wiz b4371d47f5 Replace some misuses of "then" with "than". 2001-12-04 17:56:30 +00:00
hubertf dc9f52db45 Add a second example for copying directory trees, this time as root
(using -pe, which also preserves ownership).

Proof-read by Perry.
2001-11-08 00:02:10 +00:00
hubertf ab7c58c99d * Fix example on how to copy a tree.
Noted in PR 14486 by Hiramatsu Yoshifumi <hiramatu@boreas.dti.ne.jp>
 * In the same example, add flags to preserve permissions (-pp)
2001-11-07 03:17:24 +00:00
lukem 33b90eebfd fix WARNS=2 2001-11-03 12:49:31 +00:00
wiz ee03b26cd0 Whitespace nits, sort sections, fix Dv usage (doesn't like macro argument). 2001-10-28 19:03:12 +00:00
lukem 9ee82d317a s/u_longlong_t/unsigned long long/ to shut up the parc port 2001-10-28 13:06:43 +00:00
lukem 158048edab improve previous; use %lu and (u_long) to print size_t 2001-10-26 16:03:24 +00:00
lukem 5e919e1699 Cast size_t's to (int) when printing as %d; appeases the sparc port.
Found by Rob Windsor in [bin/14362].
2001-10-26 15:58:43 +00:00
lukem a7febe9ca0 minor improvements in wording and flag testing 2001-10-25 13:54:54 +00:00
lukem 55026d5454 Implement -M flag: During a write or copy operation, treat the list of
files on standard input as an mtree(8) `specfile' specification, and
write or copy only those items in the specfile.

If the file exists in the underlying file system, its permissions and
modification time will be used unless specifically overridden by the
specfile. An error will be raised if the type of entry in the specfile
conflicts with that of an existing file.

Otherwise, it is necessary to specify at least the following parameters
in the specfile: type, mode, gname or gid, and uname or uid, device
(in the case of block or character devices), and link (in the case of
symbolic links). If time isn't provided, the current time will be used.
2001-10-25 08:51:50 +00:00
lukem c1bd745ccb - ansi KNF (just remove all the #ifndef __STDC__ prototype junk,
leaving the ansi stuff)
- use longlong_t instead of quad_t (etc), and rename *uqd*() -> *ull*()
- clean up the NET2_STAT stuff similar to ftpd; provide #defines and
  macros which select which cast to use, etc
- clean up the NET2_FTS and NET2_REGEX #define use
2001-10-25 05:33:32 +00:00
lukem 655fadf63c fix typo 2001-10-24 11:28:55 +00:00
wiz 5893dbb3e5 Fix typo. 2001-10-07 16:28:39 +00:00
wiz 4c99916337 va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
wiz 456dff6cb8 Spell 'occurred' with two 'r's. 2001-09-16 16:34:23 +00:00
wiz 2b3a9dde88 Fix typo (specifc instead of specific). 2001-09-04 21:47:31 +00:00
wiz a9356936b4 seperate -> separate 2001-07-22 13:33:58 +00:00
lukem f819878ce7 use more standard %ll_ in favour of %q_ 2001-01-04 15:39:50 +00:00
kleink a8e69293b0 LC_TIME holds a locale name, which isn't a strftime() format string. 2000-10-22 15:41:31 +00:00
phil c2abf9c643 Don't generate html yet. doc2html needs a fix. 2000-09-26 16:49:22 +00:00
kleink 97f9bd4019 Elaborate a bit on -t. 2000-09-04 07:26:38 +00:00
tv b0477f6d7e Work around a groff bug by splitting a long .Cm into two parts. 2000-08-21 13:53:50 +00:00
thorpej 547c89117a Implement --atime-preserve. 2000-07-04 17:28:47 +00:00
thorpej a3a7c5ccf1 Implement --use-compress-program. 2000-07-04 17:24:47 +00:00
thorpej 4120b8a499 Add GNU tar-style long options for pax's tar front-end. Still many
GNU options not implemented, but there is an #if 0'd out canonical
list.
2000-07-04 17:17:49 +00:00
mrg 27f963a94f minor KNF nits. 2000-06-17 18:19:10 +00:00
simonb 51ee9dc68d Don't declare 'extern opt*' getopt variables. 2000-04-14 05:52:56 +00:00
thorpej d0666190e1 Add a -O option: force one volume. This causes pax to not prompt for
a new volume upon premature end-of-volume (e.g. broken pipe).  This is
especially useful in automated environments where error recovery cannot
be performed by a human.
2000-03-30 17:53:04 +00:00
thorpej 0317a20658 Use an in-core stack for directory permissions rather than a temporary
file.  The temporary file code can be reenabled by building with
-DDIRS_USE_FILE.

Fixes a problem where sysinst would fail to unpack the base set because
the temporary file wouldn't fit in the ramdisk.
2000-03-21 02:15:24 +00:00
soren 1594850f00 Fix doubled 'the' in comment. 2000-03-13 22:46:59 +00:00
itohy f8adf56da0 Cleanup and fix typos.
Partially from FreeBSD.
2000-02-17 03:12:22 +00:00
itohy fae63d9627 Use lseek(2) on devices if not tape drives.
This makes listing on raw disk device much faster.
Reviewed and discussed in tech-kern and tech-userlevel lists.
2000-02-17 03:08:40 +00:00
itohy ba0ae447ef Fix SIGINFO botch (PR #8868).
Continue partial write(2) on signals (xwrite()).
Partial read(2) at a few places are also continued (xread()).

Add {read,write}_with_restart() hooks for porting on systems
which don't restart interrupted read()/write() calls.

Reviewed and discussed in tech-kern and tech-userlevel lists.
2000-02-17 03:06:12 +00:00
mycroft 8493d15a0c Fix a glitch with handling files larger than 2GB. 2000-01-19 18:41:23 +00:00
mycroft e9e9dbbd42 Disable -pf for now, too. 1999-11-07 15:57:31 +00:00
mycroft 5d5e10aec4 Completely disable all the chflags(2) support for now. With this enabled, I
can't even get a build to finish over NFS.  Not acceptable.
1999-11-07 15:48:24 +00:00
mycroft 39b5cd452c Don't try to set file flags for a symlink. 1999-11-07 09:44:11 +00:00
mrg 14c29acc41 whoops; reverse the logic of the previous to make it correct. noted by mycroft. 1999-11-01 17:13:27 +00:00
mrg 058c411cdd add CAF testing to extraction, archiving and listing (where it is used) 1999-11-01 16:46:52 +00:00
mrg b60cafe2fb add a new -p subflag: 'f' to preserve 4.4BSD fileflags. this only
really works for `pax -rw' but that's where it is most useful.
1999-11-01 01:35:58 +00:00
is e413a4ff50 Implement positional -C argument to tar. 1999-10-22 20:59:08 +00:00
mrg 78e294d1bc support ././@LongLink extraction, as created by GNU tar. 1999-10-22 10:43:11 +00:00
mrg f2cf747ebc remove some old cruft. 1999-10-22 10:38:40 +00:00
jdolecek 4ed908a566 add SEE ALSO section, xref tar(1), cpio(1), symlink(7) 1999-09-26 21:19:54 +00:00
enami e9de0d1bbd Don't emphasys punctuations. 1999-09-26 09:57:31 +00:00
tron 10fa22ca89 Fix "tar" mode usage string. 1999-08-24 08:02:27 +00:00
tron 62724fe719 Recognize GnuTAR's "h" (instead of "H") and "P" options. 1999-08-24 08:00:03 +00:00
tron 1fbe6b7eae Strip leading slashes from filenames by default, add new "A" option to
disable this behaviour. Patches supplied by Peter Seebach in PR bin/8233.
1999-08-24 07:57:06 +00:00
kleink 9d3e44943a Add the ability to handle estranged V7 tar archives that use USTAR-style
directories; addresses PR bin/8220.
1999-08-18 17:46:28 +00:00
kleink e97454c22b Honor the contents of $TMPDIR for the creation of temporary files, and use
_PATH_TMP instead of hardcoding /tmp if not set in the environment; fixes
PR bin/7796 from Chris Demetriou.
1999-07-03 14:42:39 +00:00
pk b65081cff2 When substituting backreferences source from the pattern, not the replacement
strings.
1999-03-24 17:00:23 +00:00
garbled f124765044 More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:25:43 +00:00
mycroft fcfc497f58 Do the previous is a slightly different way, to avoid .Po/.Pc. 1999-03-07 22:40:18 +00:00
mycroft 83a97707fb Clean up embedded angle brackets for mdoc2html. 1999-03-07 20:28:55 +00:00
mycroft be61c999f6 Finally get all of the highlighting correct in the -T argument. 1999-03-07 19:58:45 +00:00
mycroft f6590b22cd Clean up SYNOPSIS formatting. 1999-03-07 11:02:05 +00:00
mycroft 7a981b1dc5 Fix formatting errors. 1999-03-07 10:48:31 +00:00
mycroft 976b71d89f Use .Ns a bit. 1999-03-07 03:44:51 +00:00
mycroft c35cd0d402 Improve the formatting of the SYNOPSIS section. 1999-03-07 01:07:57 +00:00
mycroft 12cb4ca205 Add -z option to usage message. 1999-03-07 01:03:32 +00:00
christos 789b715904 Add SIGINFO support. 1999-03-03 18:06:52 +00:00
kleink b75d68301e <sys/fcntl.h> -> <fcntl.h> 1999-02-12 15:04:00 +00:00
tron 7455a4498d Fix opt_add() prototype. 1999-02-07 15:08:50 +00:00
tv 4aa7016df7 Fix opt_add to take const char * so that it can be passed a constant
string legally (it strdup()s the argument).  How pax-as-tar `-o' ever
worked without a coredump is beyond me...

Also modify pax-as-tar `-o' to do three things, which depend on the
create/extract mode:

- write V7 format archives (which, though part of GNU tar, actually
  goes along with the following point--after all, old pax-as-tar created
  V7 archives by default);
- write archives with "write_opt=nodir", as pax already did, and as
  specified by 4.2BSD;
- extract archives with owner/group set to invoking user, as specified
  by SUS.
1999-02-07 00:56:55 +00:00
tv fb3e11970f Lost 5 lines in the version that was committed. Re-add them. 1999-02-02 23:42:41 +00:00
tv 6e7077da0a Uh, when called as "tar" we should still default to "ustar" output, not
V7 tar format.  Also change meaning of pax-as-tar option "-o" to mean
"use V7 output format" (same as GNU tar's -o).
1999-02-02 23:31:52 +00:00
mycroft 75e40b3781 Make this build on the Alpha. 1999-01-21 08:46:06 +00:00
mrg ce6b187617 implement the gnutar -X flag in terms of pax -s. fix some bugs in pax -s handling while i am here... 1999-01-20 14:45:09 +00:00
christos f07f96ffab Fix problem compiling when NET2_STAT is defined. 1998-11-04 19:40:13 +00:00
christos 3c85b6c0b3 char -> unsigned char cast. 1998-11-04 19:38:12 +00:00
christos 7bd45f99ac make printf formats conservative 1998-11-04 19:37:56 +00:00
mycroft 5512409373 Reconstruct a split file name correctly. 1998-10-15 00:07:34 +00:00
tv af575980ab Transparently handle old-style GNU tar archives that may have garbage in
the trailing block and do not have an end-of-archive marker.  (Does this
handling based on whether the ustar id is "ustar" or "ustar  ".)
1998-08-10 22:34:59 +00:00
mycroft d0e267dc7f Use the uid/gid caching moved into libc. Fixed a memory leak! 1998-07-28 17:44:23 +00:00
mycroft ee9e50eacb Be more retentive about use of NOTREACHED and noreturn. 1998-07-28 11:41:40 +00:00
mycroft 9dc385beb1 Delint. 1998-07-28 05:31:22 +00:00
mycroft ac70c0c5ed Slight code reduction. 1998-07-27 17:55:17 +00:00
mycroft dbfa4f81b0 __AUDIT__ cleanup. 1998-07-27 16:43:25 +00:00
mycroft 778e6e0151 const poisoning. 1998-07-26 19:34:10 +00:00
mrg 02a32ed236 oops, fix broken cpio options code. tar options code should be made like pax and cpio code. 1998-06-09 10:53:55 +00:00
kleink 461522b44f Need <time.h> for time(), localtime() and mktime() prototypes. 1998-04-01 14:14:43 +00:00
kleink d3d8c1577f Need <time.h> for strftime(), localtime() and time() prototypes. 1998-04-01 14:06:12 +00:00
kleink 3a5b0ca840 Need <time.h> for time() prototype. 1998-04-01 14:04:52 +00:00
mycroft 0fda14e4f9 Use major(), minor() and makedev(), not a hacked up local equivalent, which
only supported 8-bit major and minor numbers.
1998-03-26 02:14:00 +00:00
mrg 51fc9487fd - implement -C and -l for pax-as-tar, as inspried by GNU tar.
- minor cleanups to the options parsing code.
- add a cpio frontend.

note:  a few GNU/svr4 cpio options are not supported yet (#ifdef
notyet), however all x/open ones are.
1998-03-06 09:13:01 +00:00
mrg d8a6acd10f document pax -z. only 2 years late... 1998-03-02 04:50:57 +00:00
mrg 4b6f5a7390 rename variable to "cpio_swp_head" 1998-02-28 15:53:00 +00:00
mrg dbd4110b3b fix typo in a comment 1998-02-28 15:52:04 +00:00
perry 6982982f8d macroize BSD, NetBSD, FreeBSD and misc cleanup 1998-02-06 05:39:31 +00:00
mycroft 620e5b5b8b Deal with GCC warnings. 1998-02-03 07:48:32 +00:00
mycroft f8c64f2198 Allow a century to be specified in time stamps. 1998-01-21 00:11:15 +00:00
lukem a288a2f633 getoldopt is expect to return -1 (not EOF), so "make it so" 1997-11-01 06:58:44 +00:00
enami c3872193cf Fix .Nm usage. 1997-10-20 08:50:59 +00:00
mycroft a82e8868a6 When copying time stamps, copy the microseconds, too. Also nuke silly
static structure.
1997-10-19 13:02:42 +00:00
christos e230a48b57 CFLAGS->CPPFLAGS 1997-10-10 19:47:50 +00:00
enami 062c3f563a Restore owner/group/mode/atime/mtime of symbolic links. 1997-10-08 22:51:27 +00:00
lukem 332c413b75 * cleanup manpage
* getopt returns -1 not EOF
* deprecate register
1997-09-14 14:54:32 +00:00
thorpej cd1c0efc7e Cast off_t's to (long long) for printing with %q*, for the Alpha. 1997-07-30 05:04:23 +00:00
scottr 2b51de1aee #if __GNUC__, work around bogus initialization warning that occurs on
at least the m68k-based ports.
1997-07-25 23:53:54 +00:00
christos 23edbe3557 Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.
1997-07-20 22:36:20 +00:00
christos f3cd602281 - Rename local warn so tty_warn that we can include <err.h> since this program
uses err() and errx().
- Fix printf format strings.
- Added WARNS=1; note
- Added missing prototypes.
- Split overloaded trail function into trail() and subtrail().
1997-07-20 20:32:15 +00:00
christos 9d27dbbac5 - Rename local warn so tty_warn that we can include <err.h> since this program
uses err() and errx().
- Fix printf format strings.
- Added WARNS=1; note
- Added missing prototypes.
- Split overloaded trail function into trail() and subtrail().
1997-07-20 20:32:12 +00:00
kleink 5d1b524ff3 Fix OBOB: when reassembling a file name from the header block's `prefix'
and `name' fields, don't overwrite the glueing '/' between them.
1997-06-25 22:44:00 +00:00
kleink e5b01aa2f2 Use '0' to front-pad octal strings, not ' '. 1997-05-16 09:38:40 +00:00
mycroft bd05c38cfd Adjust the input string by the right amount if the pattern wasn't at the
beginning.
1997-03-29 15:29:31 +00:00
lukem a5f8609286 use mkstemp() instead of tempnam() 1997-03-22 03:14:27 +00:00
tls 48250187e6 kill 'register' 1997-01-11 02:04:27 +00:00
pk 06b0897774 Change misleading example to read `pax -v -f filename' which doesn't
extract files (Robert Dick; PR#3032)
1996-12-18 23:37:11 +00:00
jtc 26db98be19 Fixed typo in comment 1996-05-17 01:07:47 +00:00
mrg 7f64ea0365 impliment -z (gzip) in pax and tar, and -Z (compress) in tar. 1996-03-26 23:54:13 +00:00
cgd 49f0ad8601 convert to new RCS id conventions. 1995-03-21 09:01:59 +00:00
cgd 5dad143982 from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch
some of the worst style errors.
1994-12-04 07:11:37 +00:00
jtc a5df115331 use strerror() instead of sys_errlist[] 1994-10-11 06:06:44 +00:00
mycroft 06f53b6838 Eliminate uses of some obsolete functions. 1994-09-23 11:28:39 +00:00
jtc eb06615913 Whoever wrote the tar command line argument parsing code didn't realize
that the order of arguments is different if the command flags are specified
without a `-'.  I've integrated getoldopt.c from John Gilmore's pdtar which
handles argument parsing correctly.
1994-06-14 01:16:02 +00:00
mycroft 8c95c5f91f Fix up RCS ids. 1994-06-14 00:40:58 +00:00
jtc 7d76b00baf Add RCS ID's 1994-06-13 16:33:34 +00:00
jtc 8b35abe2bf From 4.4 lite 1994-06-13 16:13:35 +00:00