diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-05-29 15:47:20 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-05-29 15:47:20 +0000 |
commit | 34acedff7dc3b9c997f692babd81e43ccd205235 (patch) | |
tree | 701fab62123331f95a152afc2bee3fc12451f949 /bin/pax | |
parent | 16ae970e8eeab5e19c594979680f614b30f41a82 (diff) |
Fix -o option and add -O.
Diffstat (limited to 'bin/pax')
-rw-r--r-- | bin/pax/options.c | 19 | ||||
-rw-r--r-- | bin/pax/tar.1 | 7 |
2 files changed, 20 insertions, 6 deletions
diff --git a/bin/pax/options.c b/bin/pax/options.c index 9872ac0aa55..bf6047293ab 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.24 1997/04/16 03:50:23 millert Exp $ */ +/* $OpenBSD: options.c,v 1.25 1997/05/29 15:47:18 millert Exp $ */ /* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: options.c,v 1.24 1997/04/16 03:50:23 millert Exp $"; +static char rcsid[] = "$OpenBSD: options.c,v 1.25 1997/05/29 15:47:18 millert Exp $"; #endif #endif /* not lint */ @@ -129,6 +129,7 @@ FSUB fsub[] = { #define F_OCPIO 0 /* format when called as cpio -6 */ #define F_ACPIO 1 /* format when called as cpio -c */ #define F_CPIO 3 /* format when called as cpio */ +#define F_OTAR 4 /* format when called as tar -o */ #define F_TAR 5 /* format when called as tar */ #define DEFLT 5 /* default write format from list above */ @@ -600,6 +601,7 @@ tar_options(argc, argv) { register int c; int fstdin = 0; + int Oflag = 0; /* * Set default values. @@ -610,7 +612,7 @@ tar_options(argc, argv) * process option flags */ while ((c = getoldopt(argc, argv, - "b:cef:hmopruts:vwxzBC:HLPXZ014578")) + "b:cef:hmopruts:vwxzBC:HLOPXZ014578")) != EOF) { switch(c) { case 'b': @@ -665,6 +667,8 @@ tar_options(argc, argv) case 'o': if (opt_add("write_opt=nodir") < 0) tar_usage(); + case 'O': + Oflag = 1; break; case 'p': /* @@ -794,9 +798,14 @@ tar_options(argc, argv) /* * if we are writing (ARCHIVE) specify tar, otherwise run like pax + * (unless -o specified) */ - if (act == ARCHIVE) - frmt = &(fsub[F_TAR]); + if (act == ARCHIVE || act == APPND) + frmt = &(fsub[Oflag ? F_OTAR : F_TAR]); + else if (Oflag) { + paxwarn(1, "The -O/-o options are only valid when writing an archive"); + tar_usage(); /* only valid when writing */ + } /* * process the args as they are interpreted by the operation mode diff --git a/bin/pax/tar.1 b/bin/pax/tar.1 index 2f8634bb244..9e31fb2e721 100644 --- a/bin/pax/tar.1 +++ b/bin/pax/tar.1 @@ -27,7 +27,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: tar.1,v 1.12 1997/04/16 03:50:24 millert Exp $ +.\" $OpenBSD: tar.1,v 1.13 1997/05/29 15:47:19 millert Exp $ .\" .Dd June 11, 1996 .Dt TAR 1 @@ -100,10 +100,15 @@ Follow symbolic links as if they were normal files or directories. .It Fl m Do not preserve modification time. +.It Fl O +Write old-style (non-POSIX) archives. .It Fl o Don't write directory information that the older (V7) style .Nm is unable to decode. +This implies the +.Fl O +flag. .It Fl p Preserve user id, group id, file mode, access and modification times if possible. The user id and group id will only be set |