CVS commit: src/bin/pax

2020-04-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Apr  3 16:13:32 UTC 2020

Modified Files:
src/bin/pax: extern.h options.c

Log Message:
Move definition of chdname and do_chroot to options.c


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/bin/pax/extern.h
cvs rdiff -u -r1.118 -r1.119 src/bin/pax/options.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/extern.h
diff -u src/bin/pax/extern.h:1.59 src/bin/pax/extern.h:1.60
--- src/bin/pax/extern.h:1.59	Thu Aug  9 08:09:21 2012
+++ src/bin/pax/extern.h	Fri Apr  3 16:13:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.59 2012/08/09 08:09:21 christos Exp $	*/
+/*	$NetBSD: extern.h,v 1.60 2020/04/03 16:13:32 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -204,9 +204,8 @@ void options(int, char **);
 OPLIST * opt_next(void);
 int bad_opt(void);
 int mkpath(char *);
-char *chdname;
 #if !HAVE_NBTOOL_CONFIG_H
-int do_chroot;
+extern int do_chroot;
 #endif
 
 /*

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.118 src/bin/pax/options.c:1.119
--- src/bin/pax/options.c:1.118	Sat Dec 19 18:45:52 2015
+++ src/bin/pax/options.c	Fri Apr  3 16:13:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.118 2015/12/19 18:45:52 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.119 2020/04/03 16:13:32 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.118 2015/12/19 18:45:52 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.119 2020/04/03 16:13:32 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -74,6 +74,11 @@ __RCSID("$NetBSD: options.c,v 1.118 2015
 #include "mtree.h"
 #endif	/* SMALL */
 
+char *chdname;
+#if !HAVE_NBTOOL_CONFIG_H
+int do_chroot;
+#endif
+
 /*
  * Routines which handle command line options
  */



CVS commit: src/bin/pax

2019-04-24 Thread Aleksey Cheusov
Module Name:src
Committed By:   cheusov
Date:   Wed Apr 24 17:27:08 UTC 2019

Modified Files:
src/bin/pax: pax.c

Log Message:
Fix compilation failure with gcc-8.
  Equal pointers to 'struct sigaction' should not be passed to sigaction(2).
  So, we pass NULL as an "old sigaction" structure.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/bin/pax/pax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.c
diff -u src/bin/pax/pax.c:1.48 src/bin/pax/pax.c:1.49
--- src/bin/pax/pax.c:1.48	Mon Oct  2 21:55:35 2017
+++ src/bin/pax/pax.c	Wed Apr 24 17:27:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pax.c,v 1.48 2017/10/02 21:55:35 joerg Exp $	*/
+/*	$NetBSD: pax.c,v 1.49 2019/04/24 17:27:08 cheusov Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19
 #if 0
 static char sccsid[] = "@(#)pax.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: pax.c,v 1.48 2017/10/02 21:55:35 joerg Exp $");
+__RCSID("$NetBSD: pax.c,v 1.49 2019/04/24 17:27:08 cheusov Exp $");
 #endif
 #endif /* not lint */
 
@@ -453,28 +453,28 @@ gen_init(void)
 
 	if ((sigaction(SIGHUP, &n_hand, &o_hand) < 0) &&
 	(o_hand.sa_handler == SIG_IGN) &&
-	(sigaction(SIGHUP, &o_hand, &o_hand) < 0))
+	(sigaction(SIGHUP, &o_hand, NULL) < 0))
 		goto out;
 
 	if ((sigaction(SIGTERM, &n_hand, &o_hand) < 0) &&
 	(o_hand.sa_handler == SIG_IGN) &&
-	(sigaction(SIGTERM, &o_hand, &o_hand) < 0))
+	(sigaction(SIGTERM, &o_hand, NULL) < 0))
 		goto out;
 
 	if ((sigaction(SIGINT, &n_hand, &o_hand) < 0) &&
 	(o_hand.sa_handler == SIG_IGN) &&
-	(sigaction(SIGINT, &o_hand, &o_hand) < 0))
+	(sigaction(SIGINT, &o_hand, NULL) < 0))
 		goto out;
 
 	if ((sigaction(SIGQUIT, &n_hand, &o_hand) < 0) &&
 	(o_hand.sa_handler == SIG_IGN) &&
-	(sigaction(SIGQUIT, &o_hand, &o_hand) < 0))
+	(sigaction(SIGQUIT, &o_hand, NULL) < 0))
 		goto out;
 
 #ifdef SIGXCPU
 	if ((sigaction(SIGXCPU, &n_hand, &o_hand) < 0) &&
 	(o_hand.sa_handler == SIG_IGN) &&
-	(sigaction(SIGXCPU, &o_hand, &o_hand) < 0))
+	(sigaction(SIGXCPU, &o_hand, NULL) < 0))
 		goto out;
 #endif
 	n_hand.sa_handler = SIG_IGN;



CVS commit: src/bin/pax

2019-03-19 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Mar 20 03:13:39 UTC 2019

Modified Files:
src/bin/pax: file_subs.c tar.c

Log Message:
pax: fix typos in comments in file_subs.c & tar.c

Stamp out "greengrocers' apostrophes" in various places (arguably there
are still more present, but style guides vary on that, and my energies
spent corralling wayward punctuation marks could be spent elsewhere).


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/bin/pax/file_subs.c
cvs rdiff -u -r1.74 -r1.75 src/bin/pax/tar.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/file_subs.c
diff -u src/bin/pax/file_subs.c:1.63 src/bin/pax/file_subs.c:1.64
--- src/bin/pax/file_subs.c:1.63	Mon Jul 29 17:46:36 2013
+++ src/bin/pax/file_subs.c	Wed Mar 20 03:13:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: file_subs.c,v 1.63 2013/07/29 17:46:36 christos Exp $	*/
+/*	$NetBSD: file_subs.c,v 1.64 2019/03/20 03:13:39 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)file_subs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: file_subs.c,v 1.63 2013/07/29 17:46:36 christos Exp $");
+__RCSID("$NetBSD: file_subs.c,v 1.64 2019/03/20 03:13:39 gutteridge Exp $");
 #endif
 #endif /* not lint */
 
@@ -895,7 +895,7 @@ set_chflags(char *fnm, u_int32_t flags)
  *	actual storage is quite small (the files are sparse). The problem is
  *	the holes read as all zeros so are probably stored on the archive that
  *	way (there is no way to determine if the file block is really a hole,
- *	we only know that a file block of all zero's can be a hole).
+ *	we only know that a file block of all zeros can be a hole).
  *	At this writing, no major archive format knows how to archive files
  *	with holes. However, on extraction (or during copy, -rw) we have to
  *	deal with these files. Without detecting the holes, the files can
@@ -968,7 +968,7 @@ file_write(int fd, char *str, int cnt, i
 		if (*isempt) {
 			/*
 			 * have not written to this block yet, so we keep
-			 * looking for zero's
+			 * looking for zeros
 			 */
 			pt = st;
 			end = st + wcnt;

Index: src/bin/pax/tar.c
diff -u src/bin/pax/tar.c:1.74 src/bin/pax/tar.c:1.75
--- src/bin/pax/tar.c:1.74	Fri Nov 30 00:53:11 2018
+++ src/bin/pax/tar.c	Wed Mar 20 03:13:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tar.c,v 1.74 2018/11/30 00:53:11 christos Exp $	*/
+/*	$NetBSD: tar.c,v 1.75 2019/03/20 03:13:39 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)tar.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: tar.c,v 1.74 2018/11/30 00:53:11 christos Exp $");
+__RCSID("$NetBSD: tar.c,v 1.75 2019/03/20 03:13:39 gutteridge Exp $");
 #endif
 #endif /* not lint */
 
@@ -351,7 +351,7 @@ tar_chksm(char *blk, int len)
 	 * checksum field as the sum of 8 blanks (which is pre-computed as
 	 * BLNKSUM).
 	 * ASSUMED: len is greater than CHK_OFFSET. (len is where our 0 padding
-	 * starts, no point in summing zero's)
+	 * starts, no point in summing zeros)
 	 */
 	pt += CHK_LEN;
 	stop = blk + len;
@@ -368,7 +368,7 @@ tar_chksm(char *blk, int len)
  * tar_id()
  *	determine if a block given to us is a valid tar header (and not a USTAR
  *	header). We have to be on the lookout for those pesky blocks of	all
- *	zero's.
+ *	zeros.
  * Return:
  *	0 if a tar header, -1 otherwise
  */
@@ -386,7 +386,7 @@ tar_id(char *blk, int size)
 	uhd = (HD_USTAR *)blk;
 
 	/*
-	 * check for block of zero's first, a simple and fast test, then make
+	 * check for block of zeros first, a simple and fast test, then make
 	 * sure this is not a ustar header by looking for the ustar magic
 	 * cookie. We should use TMAGLEN, but some USTAR archive programs are
 	 * wrong and create archives missing the \0. Last we check the
@@ -769,7 +769,7 @@ ustar_stwr(void)
 /*
  * ustar_id()
  *	determine if a block given to us is a valid ustar header. We have to
- *	be on the lookout for those pesky blocks of all zero's
+ *	be on the lookout for those pesky blocks of all zeros
  * Return:
  *	0 if a ustar header, -1 otherwise
  */
@@ -784,7 +784,7 @@ ustar_id(char *blk, int size)
 	hd = (HD_USTAR *)blk;
 
 	/*
-	 * check for block of zero's first, a simple and fast test then check
+	 * check for block of zeros first, a simple and fast test then check
 	 * ustar magic cookie. We should use TMAGLEN, but some USTAR archive
 	 * programs are fouled up and create archives missing the \0. Last we
 	 * check the checksum. If ok we have to assume it is a valid header.
@@ -1379,7 +1379,7 @@ tar_gnutar_exclude_one(const char *line,
 }
 
 /*
- * deal with GNU tar -X/--exclude-from & --exclude switchs.  basically,
+ * deal with GNU tar -X/--exclude-from & --exclude switches.  basically,
  * we go through each line of the file, building a string from the "glob"
  * lines in the file into RE lines, of t

CVS commit: src/bin/pax

2019-03-19 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Mar 20 02:50:50 UTC 2019

Modified Files:
src/bin/pax: pat_rep.c

Log Message:
pax: minor adjustments to comments in pat_rep.c

Amend several comments to match present reality (the functionality was
added back in 2007).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/pax/pat_rep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pat_rep.c
diff -u src/bin/pax/pat_rep.c:1.30 src/bin/pax/pat_rep.c:1.31
--- src/bin/pax/pat_rep.c:1.30	Wed Jun 13 15:14:40 2018
+++ src/bin/pax/pat_rep.c	Wed Mar 20 02:50:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pat_rep.c,v 1.30 2018/06/13 15:14:40 christos Exp $	*/
+/*	$NetBSD: pat_rep.c,v 1.31 2019/03/20 02:50:50 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)pat_rep.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: pat_rep.c,v 1.30 2018/06/13 15:14:40 christos Exp $");
+__RCSID("$NetBSD: pat_rep.c,v 1.31 2019/03/20 02:50:50 gutteridge Exp $");
 #endif
 #endif /* not lint */
 
@@ -85,12 +85,13 @@ static int resub(regex_t *, regmatch_t *
  *	parses the -s replacement string; compiles the regular expression
  *	and stores the compiled value and its replacement string together in
  *	replacement string list. Input to this function is of the form:
- *		/old/new/pg
+ *		/old/new/gps
  *	The first char in the string specifies the delimiter used by this
  *	replacement string. "Old" is a regular expression in "ed" format which
  *	is compiled by regcomp() and is applied to filenames. "new" is the
- *	substitution string; p and g are options flags for printing and global
- *	replacement (over the single filename)
+ *	substitution string; g, p, and s are options flags for global
+ *	replacement (over the single filename), printing, and preventing
+ *	substitutions on symbolic link destinations.
  * Return:
  *	0 if a proper replacement string and regular expression was added to
  *	the list of replacement patterns; -1 otherwise.
@@ -895,7 +896,7 @@ fix_path( char *or_name, int *or_len, ch
  *	namelen the size of the name buffer.
  *	nlen is the length of this name (and is modified to hold the length of
  *	the final string).
- *	prnt is a flag that says whether to print the final result.
+ *	flags contains various options to control behavior.
  * Return:
  *	0 if substitution was successful, 1 if we are to skip the file (the name
  *	ended up empty)



CVS commit: src/bin/pax

2019-03-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 19 10:14:46 UTC 2019

Modified Files:
src/bin/pax: tar.1

Log Message:
Whitespace nits.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.38 src/bin/pax/tar.1:1.39
--- src/bin/pax/tar.1:1.38	Tue Mar 19 00:36:14 2019
+++ src/bin/pax/tar.1	Tue Mar 19 10:14:46 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.38 2019/03/19 00:36:14 gutteridge Exp $
+.\" $NetBSD: tar.1,v 1.39 2019/03/19 10:14:46 wiz Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -107,10 +107,10 @@ then the archive will be processed using
 .It Fl h , Fl Fl dereference
 Follow symbolic links as if they were normal files
 or directories.
-.It Fl J, Fl Fl xz
+.It Fl J , Fl Fl xz
 Compress/decompress archive using
 .Xr xz 1 .
-.It Fl j, Fl Fl bzip2, Fl Fl bunzip2
+.It Fl j , Fl Fl bzip2 , Fl Fl bunzip2
 Use
 .Xr bzip2 1
 for compression of the archive.



CVS commit: src/bin/pax

2019-03-18 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Mar 19 00:36:14 UTC 2019

Modified Files:
src/bin/pax: pax.1 tar.1

Log Message:
pax.1 & tar.1: add a minor clarification about "-s"

As a somewhat pedantic clarification, "-s" does not accept backslashes
as delimiters. (While here, also make the macro use of an expression
shared between pax.1 and tar.1 consistent.)


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/bin/pax/pax.1
cvs rdiff -u -r1.37 -r1.38 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.70 src/bin/pax/pax.1:1.71
--- src/bin/pax/pax.1:1.70	Tue Mar 19 00:12:08 2019
+++ src/bin/pax/pax.1	Tue Mar 19 00:36:14 2019
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.70 2019/03/19 00:12:08 gutteridge Exp $
+.\"$NetBSD: pax.1,v 1.71 2019/03/19 00:36:14 gutteridge Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -585,7 +585,8 @@ The
 string may also contain
 .Aq Dv newline
 characters.
-Any non-null character can be used as a delimiter (/ is shown here).
+Any non-null character except a backslash (\\) can be used as a delimiter
+(/ is shown here).
 Multiple
 .Fl s
 expressions can be specified.

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.37 src/bin/pax/tar.1:1.38
--- src/bin/pax/tar.1:1.37	Mon Jul  3 21:33:23 2017
+++ src/bin/pax/tar.1	Tue Mar 19 00:36:14 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.37 2017/07/03 21:33:23 wiz Exp $
+.\" $NetBSD: tar.1,v 1.38 2019/03/19 00:36:14 gutteridge Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\"
 .\"	OpenBSD: tar.1,v 1.28 2000/11/09 23:58:56 aaron Exp
 .\"
-.Dd December 19, 2015
+.Dd March 19, 2019
 .Dt TAR 1
 .Os
 .Sh NAME
@@ -177,7 +177,8 @@ The
 string may also contain
 .Aq Dv newline
 characters.
-Any non-null character can be used as a delimiter (/ is shown here).
+Any non-null character except a backslash (\\) can be used as a delimiter
+(/ is shown here).
 Multiple
 .Fl s
 expressions can be specified.
@@ -196,7 +197,7 @@ The optional trailing
 will cause the final result of a successful substitution to be written to
 .Dv standard error
 in the following format:
-.Dl  >> 
+.Dl Ao "original pathname" Ac >> Ao "new pathname" Ac
 File or archive member names that substitute to the empty string
 are not selected and will be skipped.
 The substitutions are applied by default to the destination hard and symbolic



CVS commit: src/bin/pax

2019-03-18 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Mar 19 00:12:08 UTC 2019

Modified Files:
src/bin/pax: pax.1

Log Message:
pax.1: document the "s" flag of the "s" option

Note the "s" option has an "s" flag that "prevents substitutions from
being performed on symbolic link destinations". Carry over r. 1.25 from
christos@ and part of r. 1.26 from wiz@ from tar.1, since this
functionality is available in pax as well as tar.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.69 src/bin/pax/pax.1:1.70
--- src/bin/pax/pax.1:1.69	Mon Jul  3 21:33:23 2017
+++ src/bin/pax/pax.1	Tue Mar 19 00:12:08 2019
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.69 2017/07/03 21:33:23 wiz Exp $
+.\"$NetBSD: pax.1,v 1.70 2019/03/19 00:12:08 gutteridge Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\"
 .\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\"
-.Dd August 12, 2016
+.Dd March 19, 2019
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -572,7 +572,7 @@ using the syntax of the
 .Xr ed 1
 utility regular expressions.
 The format of these regular expressions are:
-.Dl /old/new/[gp]
+.Dl /old/new/[gps]
 As in
 .Xr ed 1 ,
 .Cm old
@@ -607,6 +607,11 @@ in the following format:
 .Dl Ao "original pathname" Ac >> Ao "new pathname" Ac
 File or archive member names that substitute to the empty string
 are not selected and will be skipped.
+The substitutions are applied by default to the destination hard and symbolic
+links.
+The optional trailing
+.Cm s
+prevents the substitutions from being performed on symbolic link destinations.
 .It Fl t
 Reset the access times of any file or directory read or accessed by
 .Nm



CVS commit: src/bin/pax

2018-11-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Nov 30 00:53:11 UTC 2018

Modified Files:
src/bin/pax: gen_subs.c tar.c

Log Message:
Add base-256 decoding support (Micha Gorny)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/pax/gen_subs.c
cvs rdiff -u -r1.73 -r1.74 src/bin/pax/tar.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/gen_subs.c
diff -u src/bin/pax/gen_subs.c:1.36 src/bin/pax/gen_subs.c:1.37
--- src/bin/pax/gen_subs.c:1.36	Thu Aug  9 04:09:21 2012
+++ src/bin/pax/gen_subs.c	Thu Nov 29 19:53:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gen_subs.c,v 1.36 2012/08/09 08:09:21 christos Exp $	*/
+/*	$NetBSD: gen_subs.c,v 1.37 2018/11/30 00:53:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)gen_subs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: gen_subs.c,v 1.36 2012/08/09 08:09:21 christos Exp $");
+__RCSID("$NetBSD: gen_subs.c,v 1.37 2018/11/30 00:53:11 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -306,12 +306,10 @@ u32_asc(uintmax_t val, char *str, int le
 
 /*
  * asc_umax()
- *	convert hex/octal character string into a uintmax. We do
- *	not have to to check for overflow! (the headers in all supported
- *	formats are not large enough to create an overflow).
+ *	convert hex/octal/base-256 value into a uintmax.
  *	NOTE: strings passed to us are NOT TERMINATED.
  * Return:
- *	uintmax_t value
+ *	uintmax_t value; UINTMAX_MAX for overflow/negative
  */
 
 uintmax_t
@@ -323,6 +321,30 @@ asc_umax(char *str, int len, int base)
 	stop = str + len;
 
 	/*
+	 * if the highest bit of first byte is set, it's base-256 encoded
+	 * (base-256 is basically (n-1)-bit big endian signed
+	 */
+	if (str < stop && (*str & 0x80)) {
+		/*
+		 * uintmax_t can't be negative, so fail on negative numbers
+		 */
+		if (*str & 0x40)
+			return UINTMAX_MAX;
+
+		tval = *str++ & 0x3f;
+		while (str < stop) {
+			/*
+			 * check for overflow
+			 */
+			if (tval > (UINTMAX_MAX/256))
+return UINTMAX_MAX;
+			tval = (tval << 8) | ((*str++) & 0xFF);
+		}
+
+		return tval;
+	}
+
+	/*
 	 * skip over leading blanks and zeros
 	 */
 	while ((str < stop) && ((*str == ' ') || (*str == '0')))

Index: src/bin/pax/tar.c
diff -u src/bin/pax/tar.c:1.73 src/bin/pax/tar.c:1.74
--- src/bin/pax/tar.c:1.73	Sat Dec 19 13:28:54 2015
+++ src/bin/pax/tar.c	Thu Nov 29 19:53:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tar.c,v 1.73 2015/12/19 18:28:54 christos Exp $	*/
+/*	$NetBSD: tar.c,v 1.74 2018/11/30 00:53:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)tar.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: tar.c,v 1.73 2015/12/19 18:28:54 christos Exp $");
+__RCSID("$NetBSD: tar.c,v 1.74 2018/11/30 00:53:11 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -486,6 +486,8 @@ tar_rd(ARCHD *arcn, char *buf)
 	arcn->sb.st_uid = (uid_t)asc_u32(hd->uid, sizeof(hd->uid), OCT);
 	arcn->sb.st_gid = (gid_t)asc_u32(hd->gid, sizeof(hd->gid), OCT);
 	arcn->sb.st_size = (off_t)ASC_OFFT(hd->size, sizeof(hd->size), OCT);
+	if (arcn->sb.st_size == -1)
+		return -1;
 	arcn->sb.st_mtime = (time_t)(int32_t)asc_u32(hd->mtime, sizeof(hd->mtime), OCT);
 	arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
 
@@ -860,6 +862,8 @@ ustar_rd(ARCHD *arcn, char *buf)
 	arcn->sb.st_mode = (mode_t)(asc_u32(hd->mode, sizeof(hd->mode), OCT) &
 	0xfff);
 	arcn->sb.st_size = (off_t)ASC_OFFT(hd->size, sizeof(hd->size), OCT);
+	if (arcn->sb.st_size == -1)
+		return -1;
 	arcn->sb.st_mtime = (time_t)(int32_t)asc_u32(hd->mtime, sizeof(hd->mtime), OCT);
 	arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
 



CVS commit: src/bin/pax

2018-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 13 15:14:41 UTC 2018

Modified Files:
src/bin/pax: pat_rep.c

Log Message:
PR/53362: Thomas Barabosch: Use strlcpy() to prevent theoretical buffer
overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/pax/pat_rep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pat_rep.c
diff -u src/bin/pax/pat_rep.c:1.29 src/bin/pax/pat_rep.c:1.30
--- src/bin/pax/pat_rep.c:1.29	Tue Apr  7 15:52:35 2009
+++ src/bin/pax/pat_rep.c	Wed Jun 13 11:14:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pat_rep.c,v 1.29 2009/04/07 19:52:35 perry Exp $	*/
+/*	$NetBSD: pat_rep.c,v 1.30 2018/06/13 15:14:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)pat_rep.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: pat_rep.c,v 1.29 2009/04/07 19:52:35 perry Exp $");
+__RCSID("$NetBSD: pat_rep.c,v 1.30 2018/06/13 15:14:40 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -924,7 +924,7 @@ rep_name(char *name, size_t namelen, int
 	 * (the user already saw that substitution go by)
 	 */
 	pt = rephead;
-	(void)strcpy(buf1, name);
+	(void)strlcpy(buf1, name, sizeof(buf1));
 	inpt = buf1;
 	outpt = nname;
 	endpt = outpt + PAXPATHLEN;



CVS commit: src/bin/pax

2018-03-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar 19 03:11:39 UTC 2018

Modified Files:
src/bin/pax: buf_subs.c

Log Message:
s/copy copy/copy/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/pax/buf_subs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/buf_subs.c
diff -u src/bin/pax/buf_subs.c:1.28 src/bin/pax/buf_subs.c:1.29
--- src/bin/pax/buf_subs.c:1.28	Sun Apr 29 20:23:34 2007
+++ src/bin/pax/buf_subs.c	Mon Mar 19 03:11:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf_subs.c,v 1.28 2007/04/29 20:23:34 msaitoh Exp $	*/
+/*	$NetBSD: buf_subs.c,v 1.29 2018/03/19 03:11:39 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)buf_subs.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: buf_subs.c,v 1.28 2007/04/29 20:23:34 msaitoh Exp $");
+__RCSID("$NetBSD: buf_subs.c,v 1.29 2018/03/19 03:11:39 msaitoh Exp $");
 #endif
 #endif /* not lint */
 
@@ -493,7 +493,7 @@ wr_rdbuf(char *out, int outcnt)
 	int cnt;
 
 	/*
-	 * while there is data to copy copy into the write buffer. when the
+	 * while there is data to copy into the write buffer. when the
 	 * write buffer fills, flush it to the archive and continue
 	 */
 	while (outcnt > 0) {



CVS commit: src/bin/pax

2017-10-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Oct  2 21:57:59 UTC 2017

Modified Files:
src/bin/pax: ar_io.c

Log Message:
Include time.h for time(2). Sort.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/bin/pax/ar_io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.57 src/bin/pax/ar_io.c:1.58
--- src/bin/pax/ar_io.c:1.57	Tue May 31 03:32:36 2016
+++ src/bin/pax/ar_io.c	Mon Oct  2 21:57:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ar_io.c,v 1.57 2016/05/31 03:32:36 dholland Exp $	*/
+/*	$NetBSD: ar_io.c,v 1.58 2017/10/02 21:57:59 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,27 +42,27 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.57 2016/05/31 03:32:36 dholland Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.58 2017/10/02 21:57:59 joerg Exp $");
 #endif
 #endif /* not lint */
 
-#include 
 #include 
-#include 
-#include 
 #include 
 #ifdef HAVE_SYS_MTIO_H
 #include 
 #endif
+#include 
+#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #ifdef SUPPORT_RMT
 #define __RMTLIB_PRIVATE
 #include 



CVS commit: src/bin/pax

2017-10-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Oct  2 21:55:35 UTC 2017

Modified Files:
src/bin/pax: pax.c

Log Message:
Include time.h for time(2). Sort.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/bin/pax/pax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.c
diff -u src/bin/pax/pax.c:1.47 src/bin/pax/pax.c:1.48
--- src/bin/pax/pax.c:1.47	Mon Aug 29 14:47:48 2011
+++ src/bin/pax/pax.c	Mon Oct  2 21:55:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pax.c,v 1.47 2011/08/29 14:47:48 joerg Exp $	*/
+/*	$NetBSD: pax.c,v 1.48 2017/10/02 21:55:35 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -44,23 +44,23 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19
 #if 0
 static char sccsid[] = "@(#)pax.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: pax.c,v 1.47 2011/08/29 14:47:48 joerg Exp $");
+__RCSID("$NetBSD: pax.c,v 1.48 2017/10/02 21:55:35 joerg Exp $");
 #endif
 #endif /* not lint */
 
-#include 
 #include 
+#include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include 
+#include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
 #include "pax.h"
 #include "extern.h"



CVS commit: src/bin/pax

2016-08-11 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 12 01:52:22 UTC 2016

Modified Files:
src/bin/pax: pax.1

Log Message:
Document the version pax first appeared.
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.67 src/bin/pax/pax.1:1.68
--- src/bin/pax/pax.1:1.67	Sat Dec 19 18:48:41 2015
+++ src/bin/pax/pax.1	Fri Aug 12 01:52:22 2016
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.67 2015/12/19 18:48:41 wiz Exp $
+.\"$NetBSD: pax.1,v 1.68 2016/08/12 01:52:22 sevan Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\"
 .\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\"
-.Dd December 19, 2015
+.Dd August 12, 2016
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -1290,6 +1290,11 @@ and
 operations are extensions to the
 .Tn POSIX
 standard.
+.Sh HISTORY
+A
+.Nm
+utility appeared in
+.Bx 4.4 .
 .Sh AUTHORS
 .An -nosplit
 .An Keith Muller



CVS commit: src/bin/pax

2016-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue May 31 03:32:36 UTC 2016

Modified Files:
src/bin/pax: ar_io.c

Log Message:
Don't use the length return from snprintf to write out the result
buffer. If snprintf truncated the output, the length returned will be
greater and we'll write trash. Just call strlen instead. (And since
what we're doing is writing progress messages to the user, checking
carefully for truncation isn't really worthwhile either.)

Spotted when attending to PR 50998 from David Binderman; the issue
there (computation of an unused value) popped up because one of the
prints was already calling strlen.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/bin/pax/ar_io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.56 src/bin/pax/ar_io.c:1.57
--- src/bin/pax/ar_io.c:1.56	Mon Mar  9 23:38:08 2015
+++ src/bin/pax/ar_io.c	Tue May 31 03:32:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ar_io.c,v 1.56 2015/03/09 23:38:08 sevan Exp $	*/
+/*	$NetBSD: ar_io.c,v 1.57 2016/05/31 03:32:36 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.56 2015/03/09 23:38:08 sevan Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.57 2016/05/31 03:32:36 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -1631,7 +1631,6 @@ void
 ar_summary(int n)
 {
 	time_t secs;
-	int len;
 	char buf[BUFSIZ];
 	char tbuf[MAXPATHLEN/4];	/* XXX silly size! */
 	char s1buf[MAXPATHLEN/8];	/* XXX very silly size! */
@@ -1657,33 +1656,32 @@ ar_summary(int n)
 	 * could have written anything yet.
 	 */
 	if (frmt == NULL && act != COPY) {
-		len = snprintf(buf, sizeof(buf),
+		snprintf(buf, sizeof(buf),
 		"unknown format, %s skipped in %s\n",
 		sizefmt(s1buf, sizeof(s1buf), rdcnt),
 		timefmt(tbuf, sizeof(tbuf), rdcnt, secs, "bytes"));
 		if (n == 0)
 			(void)fprintf(outf, "%s: %s", argv0, buf);
 		else
-			(void)write(STDERR_FILENO, buf, len);
+			(void)write(STDERR_FILENO, buf, strlen(buf));
 		return;
 	}
 
 
 	if (n != 0 && *archd.name) {
-		len = snprintf(buf, sizeof(buf), "Working on `%s' (%s)\n",
+		snprintf(buf, sizeof(buf), "Working on `%s' (%s)\n",
 		archd.name, sizefmt(s1buf, sizeof(s1buf), archd.sb.st_size));
-		(void)write(STDERR_FILENO, buf, len);
-		len = 0;
+		(void)write(STDERR_FILENO, buf, strlen(buf));
 	}
 
 
 	if (act == COPY) {
-		len = snprintf(buf, sizeof(buf),
+		snprintf(buf, sizeof(buf),
 		"%lu files in %s\n",
 		(unsigned long)flcnt,
 		timefmt(tbuf, sizeof(tbuf), flcnt, secs, "files"));
 	} else {
-		len = snprintf(buf, sizeof(buf),
+		snprintf(buf, sizeof(buf),
 		"%s vol %d, %lu files, %s read, %s written in %s\n",
 		frmt->name, arvol-1, (unsigned long)flcnt,
 		sizefmt(s1buf, sizeof(s1buf), rdcnt),



CVS commit: src/bin/pax

2016-05-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon May 30 17:34:36 UTC 2016

Modified Files:
src/bin/pax: dumptar.c

Log Message:
Remove undefined behavior in buf(); use buf() as intended in intarg().
While here also add includes to fix the build. Retires PR 50999 from
David Binderman.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/bin/pax/dumptar.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/dumptar.c
diff -u src/bin/pax/dumptar.c:1.2 src/bin/pax/dumptar.c:1.3
--- src/bin/pax/dumptar.c:1.2	Mon Apr 28 20:22:51 2008
+++ src/bin/pax/dumptar.c	Mon May 30 17:34:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumptar.c,v 1.2 2008/04/28 20:22:51 martin Exp $	*/
+/*	$NetBSD: dumptar.c,v 1.3 2016/05/30 17:34:35 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,8 +30,12 @@
  */
 
 #include 
-#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -39,20 +43,25 @@
 
 #define ussum(a) 1
 
+/*
+ * Ensure null termination.
+ */
 static char *
 buf(const char *p, size_t s)
 {
 	static char buf[1024];
-	(void)snprintf(buf, sizeof(buf), "%s", p);
+
+	assert(s < sizeof(buf));
+	memcpy(buf, p, s);
 	buf[s] = '\0';
 	return buf;
 }
 
-int
+static int
 intarg(const char *p, size_t s)
 {
 	char *ep, *b = buf(p, s);
-	int r = (int)strtol(p, &ep, 8);
+	int r = (int)strtol(b, &ep, 8);
 	return r;
 }
 



CVS commit: src/bin/pax

2015-12-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec 19 18:48:41 UTC 2015

Modified Files:
src/bin/pax: pax.1

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.66 src/bin/pax/pax.1:1.67
--- src/bin/pax/pax.1:1.66	Sat Dec 19 18:45:52 2015
+++ src/bin/pax/pax.1	Sat Dec 19 18:48:41 2015
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.66 2015/12/19 18:45:52 christos Exp $
+.\"$NetBSD: pax.1,v 1.67 2015/12/19 18:48:41 wiz Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -747,7 +747,7 @@ Store all modification times in the arch
 .Ar timestamp
 given instead of the actual modification time of the individual archive member
 so that repeatable builds are possible.
-The 
+The
 .Ar timestamp
 can be a
 .Pa pathname ,



CVS commit: src/bin/pax

2015-12-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec 19 18:48:33 UTC 2015

Modified Files:
src/bin/pax: cpio.1

Log Message:
Use An in AUTHORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/pax/cpio.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/cpio.1
diff -u src/bin/pax/cpio.1:1.13 src/bin/pax/cpio.1:1.14
--- src/bin/pax/cpio.1:1.13	Sun Jun 19 07:34:24 2011
+++ src/bin/pax/cpio.1	Sat Dec 19 18:48:33 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpio.1,v 1.13 2011/06/19 07:34:24 wiz Exp $
+.\" $NetBSD: cpio.1,v 1.14 2015/12/19 18:48:33 wiz Exp $
 .\"
 .\" Copyright (c) 1997 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -297,7 +297,8 @@ specific archive format specification.
 .Xr pax 1 ,
 .Xr tar 1
 .Sh AUTHORS
-Keith Muller at the University of California, San Diego.
+.An Keith Muller
+at the University of California, San Diego.
 .Sh BUGS
 The
 .Fl s



CVS commit: src/bin/pax

2015-12-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 19 18:45:53 UTC 2015

Modified Files:
src/bin/pax: options.c pax.1

Log Message:
Add the timestamp option to the pax front end.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/bin/pax/options.c
cvs rdiff -u -r1.65 -r1.66 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.117 src/bin/pax/options.c:1.118
--- src/bin/pax/options.c:1.117	Sat Dec 19 13:28:54 2015
+++ src/bin/pax/options.c	Sat Dec 19 13:45:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.117 2015/12/19 18:28:54 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.118 2015/12/19 18:45:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.117 2015/12/19 18:28:54 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.118 2015/12/19 18:45:52 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -257,6 +257,8 @@ struct option pax_longopts[] = {
 		OPT_XZ },
 	{ "gnu",		no_argument,		0,
 		OPT_GNU },
+	{ "timestamp",		required_argument,	0,
+		OPT_TIMESTAMP },
 	{ 0,			0,			0,
 		0 },
 };
@@ -667,6 +669,14 @@ pax_options(int argc, char **argv)
 		case OPT_GNU:
 			is_gnutar = 1;
 			break;
+#ifndef SMALL
+		case OPT_TIMESTAMP:
+			if (set_tstamp(optarg, &tst) == -1) {
+tty_warn(1, "Invalid timestamp `%s'", optarg);
+tar_usage();
+			}
+			break;
+#endif
 		case '?':
 		default:
 			pax_usage();

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.65 src/bin/pax/pax.1:1.66
--- src/bin/pax/pax.1:1.65	Wed Nov  4 04:24:14 2015
+++ src/bin/pax/pax.1	Sat Dec 19 13:45:52 2015
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.65 2015/11/04 09:24:14 wiz Exp $
+.\"$NetBSD: pax.1,v 1.66 2015/12/19 18:45:52 christos Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\"
 .\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\"
-.Dd November 3, 2015
+.Dd December 19, 2015
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -742,6 +742,19 @@ Typical archive format restrictions incl
 file pathname length, file size, link pathname length and the type of the file.
 .It Fl Fl gnu
 Recognize GNU tar extensions.
+.It Fl Fl timestamp Ar timestamp
+Store all modification times in the archive with the
+.Ar timestamp
+given instead of the actual modification time of the individual archive member
+so that repeatable builds are possible.
+The 
+.Ar timestamp
+can be a
+.Pa pathname ,
+where the timestamps are derived from that file, a parseable date for
+.Xr parsedate 3
+(this option is not yet available in the tools build), or an integer value
+interpreted as the number of seconds from the Epoch.
 .It Fl Fl xz
 Use
 .Xr xz 1



CVS commit: src/bin/pax

2015-12-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec 19 18:28:54 UTC 2015

Modified Files:
src/bin/pax: options.c tar.1 tar.c

Log Message:
PR/50119: Thomas Klausner: Add --timestamp option to tar.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/bin/pax/options.c
cvs rdiff -u -r1.35 -r1.36 src/bin/pax/tar.1
cvs rdiff -u -r1.72 -r1.73 src/bin/pax/tar.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.116 src/bin/pax/options.c:1.117
--- src/bin/pax/options.c:1.116	Sat Apr 11 11:41:33 2015
+++ src/bin/pax/options.c	Sat Dec 19 13:28:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.116 2015/04/11 15:41:33 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.117 2015/12/19 18:28:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.116 2015/04/11 15:41:33 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.117 2015/12/19 18:28:54 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -64,6 +64,7 @@ __RCSID("$NetBSD: options.c,v 1.116 2015
 #include 
 #include 
 #include 
+#include 
 #include "pax.h"
 #include "options.h"
 #include "cpio.h"
@@ -76,6 +77,7 @@ __RCSID("$NetBSD: options.c,v 1.116 2015
 /*
  * Routines which handle command line options
  */
+struct stat tst;		/* Timestamp to set if non-0 */
 
 static int nopids;		/* tar mode: suppress "pids" for -p option */
 static char flgch[] = FLGCH;	/* list of all possible flags (pax) */
@@ -88,6 +90,9 @@ static void printflg(unsigned int);
 static int c_frmt(const void *, const void *);
 static off_t str_offt(char *);
 static char *get_line(FILE *fp);
+#ifndef SMALL
+static int set_tstamp(const char *, struct stat *);
+#endif
 static void pax_options(int, char **);
 __dead static void pax_usage(void);
 static void tar_options(int, char **);
@@ -129,8 +134,9 @@ static int get_line_error;
 #define	OPT_SPARSE			16
 #define OPT_XZ17
 #define OPT_GNU18
+#define	OPT_TIMESTAMP			19
 #if !HAVE_NBTOOL_CONFIG_H
-#define	OPT_CHROOT			19
+#define	OPT_CHROOT			20
 #endif
 
 /*
@@ -803,6 +809,8 @@ struct option tar_longopts[] = {
 	{ "chroot",		no_argument,		0,
 		OPT_CHROOT },
 #endif
+	{ "timestamp",		required_argument,	0,
+		OPT_TIMESTAMP },
 #if 0 /* Not implemented */
 	{ "catenate",		no_argument,		0,	'A' },	/* F */
 	{ "concatenate",	no_argument,		0,	'A' },	/* F */
@@ -1144,6 +1152,14 @@ tar_options(int argc, char **argv)
 			do_chroot = 1;
 			break;
 #endif
+#ifndef SMALL
+		case OPT_TIMESTAMP:
+			if (set_tstamp(optarg, &tst) == -1) {
+tty_warn(1, "Invalid timestamp `%s'", optarg);
+tar_usage();
+			}
+			break;
+#endif
 		default:
 			tar_usage();
 			break;
@@ -2083,6 +2099,43 @@ get_line(FILE *f)
 	return temp;
 }
 
+#ifndef SMALL
+/*
+ * set_tstamp()
+ *	Use a specific timestamp for all individual files created in the
+ *	archive
+ */
+static int
+set_tstamp(const char *b, struct stat *st)
+{
+	time_t when;
+	char *eb;
+	long long l;
+
+	if (stat(b, st) != -1)
+		return 0;
+
+#ifndef HAVE_NBTOOL_CONFIG_H
+	errno = 0;
+	if ((when = parsedate(b, NULL, NULL)) == -1 && errno != 0)
+#endif
+	{
+		errno = 0;
+		l = strtoll(b, &eb, 0);
+		if (b == eb || *eb || errno)
+			return -1;
+		when = (time_t)l;
+	}
+
+	st->st_ino = 1;
+#if HAVE_STRUCT_STAT_BIRTHTIME 
+	st->st_birthtime =
+#endif
+	st->st_mtime = st->st_ctime = st->st_atime = when;
+	return 0;
+}
+#endif
+
 /*
  * no_op()
  *	for those option functions where the archive format has nothing to do.

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.35 src/bin/pax/tar.1:1.36
--- src/bin/pax/tar.1:1.35	Sat Apr 11 12:22:07 2015
+++ src/bin/pax/tar.1	Sat Dec 19 13:28:54 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.35 2015/04/11 16:22:07 wiz Exp $
+.\" $NetBSD: tar.1,v 1.36 2015/12/19 18:28:54 christos Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\"
 .\"	OpenBSD: tar.1,v 1.28 2000/11/09 23:58:56 aaron Exp
 .\"
-.Dd April 11, 2015
+.Dd December 19, 2015
 .Dt TAR 1
 .Os
 .Sh NAME
@@ -297,6 +297,19 @@ can be processed.
 Cause files of type directory being copied or archived, or archive members of
 type directory being extracted, to match only the directory file or archive
 member and not the file hierarchy rooted at the directory.
+.It Fl Fl timestamp Ar timestamp
+Store all modification times in the archive with the
+.Ar timestamp
+given instead of the actual modification time of the individual archive member
+so that repeatable builds are possible.
+The
+.Ar timestamp
+can be a
+.Pa pathname ,
+where the timestamps are derived from that file, a parseable date for
+.Xr parsedate 3
+(this option is not yet available in the tools build), or an integer value
+interpreted as the number of seconds from the Epoch.
 .El
 .Pp
 The 

CVS commit: src/bin/pax

2015-11-04 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Nov  4 09:24:14 UTC 2015

Modified Files:
src/bin/pax: pax.1

Log Message:
Use An in AUTHORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.64 src/bin/pax/pax.1:1.65
--- src/bin/pax/pax.1:1.64	Tue Nov  3 03:01:35 2015
+++ src/bin/pax/pax.1	Wed Nov  4 09:24:14 2015
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.64 2015/11/03 03:01:35 pgoyette Exp $
+.\"$NetBSD: pax.1,v 1.65 2015/11/04 09:24:14 wiz Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -1278,6 +1278,9 @@ operations are extensions to the
 .Tn POSIX
 standard.
 .Sh AUTHORS
-Keith Muller at the University of California, San Diego.
-Luke Mewburn implemented
+.An -nosplit
+.An Keith Muller
+at the University of California, San Diego.
+.An Luke Mewburn
+implemented
 .Fl M .



CVS commit: src/bin/pax

2015-11-02 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Nov  3 03:01:35 UTC 2015

Modified Files:
src/bin/pax: pax.1

Log Message:
By my count, [cc]yy]mm]dd]hh]mm[.ss] has seven fields, not six!


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.63 src/bin/pax/pax.1:1.64
--- src/bin/pax/pax.1:1.63	Thu Nov 14 07:45:05 2013
+++ src/bin/pax/pax.1	Tue Nov  3 03:01:35 2015
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.63 2013/11/14 07:45:05 wiz Exp $
+.\"$NetBSD: pax.1,v 1.64 2015/11/03 03:01:35 pgoyette Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\"
 .\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\"
-.Dd November 13, 2013
+.Dd November 3, 2015
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -958,11 +958,11 @@ Time comparisons using both file times i
 is used to create a time based incremental archive (only files that were
 changed during a specified time range will be archived).
 .Pp
-A time range is made up of six different fields and each field must contain two
-digits.
+A time range is made up of seven different fields and each field must contain
+two digits.
 The format is:
 .Dl [cc]yy]mm]dd]hh]mm[\&.ss]
-Where
+where
 .Cm cc
 is the first two digits of the year (the century),
 .Cm yy



CVS commit: src/bin/pax

2015-04-11 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Apr 11 16:22:07 UTC 2015

Modified Files:
src/bin/pax: tar.1

Log Message:
Use An in AUTHORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.34 src/bin/pax/tar.1:1.35
--- src/bin/pax/tar.1:1.34	Sat Apr 11 15:41:33 2015
+++ src/bin/pax/tar.1	Sat Apr 11 16:22:07 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.34 2015/04/11 15:41:33 christos Exp $
+.\" $NetBSD: tar.1,v 1.35 2015/04/11 16:22:07 wiz Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -355,4 +355,5 @@ A
 command first appeared in
 .At v7 .
 .Sh AUTHORS
-Keith Muller at the University of California, San Diego.
+.An Keith Muller
+at the University of California, San Diego.



CVS commit: src/bin/pax

2015-04-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 11 15:41:33 UTC 2015

Modified Files:
src/bin/pax: options.c tar.1

Log Message:
Add -J/--xz to specifically decompress xz compressed files. We don't really
need this because -z autodetects the compression format; this is for syntax
compatibility with other tar implementations. From Joachim Henke


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/bin/pax/options.c
cvs rdiff -u -r1.33 -r1.34 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.115 src/bin/pax/options.c:1.116
--- src/bin/pax/options.c:1.115	Wed Nov 13 23:00:48 2013
+++ src/bin/pax/options.c	Sat Apr 11 11:41:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.115 2013/11/14 04:00:48 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.116 2015/04/11 15:41:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.115 2013/11/14 04:00:48 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.116 2015/04/11 15:41:33 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -773,6 +773,7 @@ struct option tar_longopts[] = {
 	{ "gunzip",		no_argument,		0,	'z' },
 	{ "read-full-blocks",	no_argument,		0,	'B' },
 	{ "directory",		required_argument,	0,	'C' },
+	{ "xz",			no_argument,		0,	'J' },
 	{ "to-stdout",		no_argument,		0,	'O' },
 	{ "absolute-paths",	no_argument,		0,	'P' },
 	{ "sparse",		no_argument,		0,	'S' },
@@ -798,8 +799,6 @@ struct option tar_longopts[] = {
 		OPT_EXCLUDE },
 	{ "no-recursion",	no_argument,		0,
 		OPT_NORECURSE },
-	{ "xz",			no_argument,		0,
-		OPT_XZ },
 #if !HAVE_NBTOOL_CONFIG_H
 	{ "chroot",		no_argument,		0,
 		OPT_CHROOT },
@@ -877,7 +876,7 @@ tar_options(int argc, char **argv)
 	 * process option flags
 	 */
 	while ((c = getoldopt(argc, argv,
-	"+b:cef:hjklmopqrs:tuvwxzBC:HI:OPST:X:Z014578",
+	"+b:cef:hjklmopqrs:tuvwxzBC:HI:JOPST:X:Z014578",
 	tar_longopts, NULL))
 	!= -1)  {
 		switch(c) {
@@ -966,9 +965,6 @@ tar_options(int argc, char **argv)
 nopids = 1;
 			}
 			break;
-		case 'O':
-			Oflag = 1;
-			break;
 		case 'p':
 			/*
 			 * preserve user id, group id, file
@@ -1064,6 +1060,12 @@ tar_options(int argc, char **argv)
 			incfiles[nincfiles - 1].file = optarg;
 			incfiles[nincfiles - 1].dir = chdname;
 			break;
+		case 'J':
+			gzip_program = XZ_CMD;
+			break;
+		case 'O':
+			Oflag = 1;
+			break;
 		case 'P':
 			/*
 			 * do not remove leading '/' from pathnames
@@ -1142,9 +1144,6 @@ tar_options(int argc, char **argv)
 			do_chroot = 1;
 			break;
 #endif
-		case OPT_XZ:
-			gzip_program = XZ_CMD;
-			break;
 		default:
 			tar_usage();
 			break;
@@ -2134,8 +2133,8 @@ pax_usage(void)
 static void
 tar_usage(void)
 {
-	(void)fputs("usage: tar [-]{crtux}[-befhjklmopqvwzHOPSXZ014578] [archive] "
-		"[blocksize]\n"
+	(void)fputs("usage: tar [-]{crtux}[-befhjklmopqvwzHJOPSXZ014578] "
+		"[archive] [blocksize]\n"
 		"   [-C directory] [-T file] [-s replstr] "
 		"[file ...]\n", stderr);
 	exit(1);

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.33 src/bin/pax/tar.1:1.34
--- src/bin/pax/tar.1:1.33	Thu Mar 22 03:58:17 2012
+++ src/bin/pax/tar.1	Sat Apr 11 11:41:33 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.33 2012/03/22 07:58:17 wiz Exp $
+.\" $NetBSD: tar.1,v 1.34 2015/04/11 15:41:33 christos Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\"
 .\"	OpenBSD: tar.1,v 1.28 2000/11/09 23:58:56 aaron Exp
 .\"
-.Dd June 18, 2011
+.Dd April 11, 2015
 .Dt TAR 1
 .Os
 .Sh NAME
@@ -34,7 +34,7 @@
 .Sh SYNOPSIS
 .Nm tar
 .Sm off
-.Oo \&- Oc {crtux} Op Fl 014578befHhjklmOoPpqSvwXZz
+.Oo \&- Oc {crtux} Op Fl 014578befHhJjklmOoPpqSvwXZz
 .Sm on
 .Op Ar archive
 .Op Ar blocksize
@@ -107,6 +107,9 @@ then the archive will be processed using
 .It Fl h , Fl Fl dereference
 Follow symbolic links as if they were normal files
 or directories.
+.It Fl J, Fl Fl xz
+Compress/decompress archive using
+.Xr xz 1 .
 .It Fl j, Fl Fl bzip2, Fl Fl bunzip2
 Use
 .Xr bzip2 1
@@ -209,9 +212,6 @@ This option causes
 .Nm
 to prompt the user for the filename to use when storing or
 extracting files in an archive.
-.It Fl Fl xz
-Compress/decompress archive using 
-.Xr xz 1 .
 .It Fl z , Fl Fl gzip , Fl Fl gunzip
 Compress/decompress archive using
 .Xr gzip 1 .



CVS commit: src/bin/pax

2015-03-09 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Mar  9 23:38:08 UTC 2015

Modified Files:
src/bin/pax: ar_io.c

Log Message:
>From OpenBSD r1.49
Fix comment grammar


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/pax/ar_io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.55 src/bin/pax/ar_io.c:1.56
--- src/bin/pax/ar_io.c:1.55	Fri Aug  8 14:48:55 2014
+++ src/bin/pax/ar_io.c	Mon Mar  9 23:38:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ar_io.c,v 1.55 2014/08/08 14:48:55 joerg Exp $	*/
+/*	$NetBSD: ar_io.c,v 1.56 2015/03/09 23:38:08 sevan Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.55 2014/08/08 14:48:55 joerg Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.56 2015/03/09 23:38:08 sevan Exp $");
 #endif
 #endif /* not lint */
 
@@ -255,7 +255,7 @@ ar_open(const char *name)
 	}
 
 	/*
-	 * make sure we beyond any doubt that we only can unlink regular files
+	 * make sure beyond any doubt that we can unlink only regular files
 	 * we created
 	 */
 	if (artyp != ISREG)



CVS commit: src/bin/pax

2014-08-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Aug  8 14:48:55 UTC 2014

Modified Files:
src/bin/pax: ar_io.c

Log Message:
Fix RCS ID.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/bin/pax/ar_io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.54 src/bin/pax/ar_io.c:1.55
--- src/bin/pax/ar_io.c:1.54	Tue Mar 20 18:42:28 2012
+++ src/bin/pax/ar_io.c	Fri Aug  8 14:48:55 2014
@@ -1,4 +1,4 @@
-/*	$netbsd: ar_io.c,v 1.48 2007/04/23 18:40:22 christos Exp $	*/
+/*	$NetBSD: ar_io.c,v 1.55 2014/08/08 14:48:55 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.54 2012/03/20 18:42:28 matt Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.55 2014/08/08 14:48:55 joerg Exp $");
 #endif
 #endif /* not lint */
 



CVS commit: src/bin/pax

2013-11-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Nov 14 07:45:05 UTC 2013

Modified Files:
src/bin/pax: pax.1

Log Message:
Stop hissing.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.62 src/bin/pax/pax.1:1.63
--- src/bin/pax/pax.1:1.62	Thu Nov 14 04:00:48 2013
+++ src/bin/pax/pax.1	Thu Nov 14 07:45:05 2013
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.62 2013/11/14 04:00:48 christos Exp $
+.\"$NetBSD: pax.1,v 1.63 2013/11/14 07:45:05 wiz Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -741,7 +741,7 @@ The individual archive formats may impos
 Typical archive format restrictions include (but are not limited to):
 file pathname length, file size, link pathname length and the type of the file.
 .It Fl Fl gnu
-Recognize GNU tar extensionss.
+Recognize GNU tar extensions.
 .It Fl Fl xz
 Use
 .Xr xz 1



CVS commit: src/bin/pax

2013-11-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 14 04:00:48 UTC 2013

Modified Files:
src/bin/pax: options.c pax.1

Log Message:
add --gnu for pax.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/bin/pax/options.c
cvs rdiff -u -r1.61 -r1.62 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.114 src/bin/pax/options.c:1.115
--- src/bin/pax/options.c:1.114	Thu Aug  9 07:05:59 2012
+++ src/bin/pax/options.c	Wed Nov 13 23:00:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.114 2012/08/09 11:05:59 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.115 2013/11/14 04:00:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.114 2012/08/09 11:05:59 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.115 2013/11/14 04:00:48 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -128,8 +128,9 @@ static int get_line_error;
 #define	OPT_STRICT			15
 #define	OPT_SPARSE			16
 #define OPT_XZ17
+#define OPT_GNU18
 #if !HAVE_NBTOOL_CONFIG_H
-#define	OPT_CHROOT			18
+#define	OPT_CHROOT			19
 #endif
 
 /*
@@ -248,6 +249,8 @@ struct option pax_longopts[] = {
 		OPT_USE_COMPRESS_PROGRAM },
 	{ "xz",			no_argument,		0,
 		OPT_XZ },
+	{ "gnu",		no_argument,		0,
+		OPT_GNU },
 	{ 0,			0,			0,
 		0 },
 };
@@ -655,6 +658,9 @@ pax_options(int argc, char **argv)
 		case OPT_XZ:
 			gzip_program = XZ_CMD;
 			break;
+		case OPT_GNU:
+			is_gnutar = 1;
+			break;
 		case '?':
 		default:
 			pax_usage();

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.61 src/bin/pax/pax.1:1.62
--- src/bin/pax/pax.1:1.61	Sun Jun 19 03:34:24 2011
+++ src/bin/pax/pax.1	Wed Nov 13 23:00:48 2013
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.61 2011/06/19 07:34:24 wiz Exp $
+.\"$NetBSD: pax.1,v 1.62 2013/11/14 04:00:48 christos Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\"
 .\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\"
-.Dd June 18, 2011
+.Dd November 13, 2013
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -740,6 +740,8 @@ as the result of any specific archive fo
 The individual archive formats may impose additional restrictions on use.
 Typical archive format restrictions include (but are not limited to):
 file pathname length, file size, link pathname length and the type of the file.
+.It Fl Fl gnu
+Recognize GNU tar extensionss.
 .It Fl Fl xz
 Use
 .Xr xz 1



CVS commit: src/bin/pax

2013-07-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 29 17:46:36 UTC 2013

Modified Files:
src/bin/pax: file_subs.c

Log Message:
PR/48095: NAKAJIMA Yoshihiro: remove casts from time_t to long


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/bin/pax/file_subs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/file_subs.c
diff -u src/bin/pax/file_subs.c:1.62 src/bin/pax/file_subs.c:1.63
--- src/bin/pax/file_subs.c:1.62	Tue Apr  7 15:52:35 2009
+++ src/bin/pax/file_subs.c	Mon Jul 29 13:46:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: file_subs.c,v 1.62 2009/04/07 19:52:35 perry Exp $	*/
+/*	$NetBSD: file_subs.c,v 1.63 2013/07/29 17:46:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)file_subs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: file_subs.c,v 1.62 2009/04/07 19:52:35 perry Exp $");
+__RCSID("$NetBSD: file_subs.c,v 1.63 2013/07/29 17:46:36 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -791,9 +791,9 @@ set_ftime(char *fnm, time_t mtime, time_
 	struct timeval tv[2];
 	struct stat sb;
 
-	tv[0].tv_sec = (long)atime;
+	tv[0].tv_sec = atime;
 	tv[0].tv_usec = 0;
-	tv[1].tv_sec = (long)mtime;
+	tv[1].tv_sec = mtime;
 	tv[1].tv_usec = 0;
 	if (!frc && (!patime || !pmtime)) {
 		/*



CVS commit: src/bin/pax

2013-01-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 24 17:43:44 UTC 2013

Modified Files:
src/bin/pax: tar.c tar.h

Log Message:
Recognize extended attribute headers and warn about them since we are not
currently handling them.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/bin/pax/tar.c
cvs rdiff -u -r1.9 -r1.10 src/bin/pax/tar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/tar.c
diff -u src/bin/pax/tar.c:1.70 src/bin/pax/tar.c:1.71
--- src/bin/pax/tar.c:1.70	Thu Aug  9 04:09:22 2012
+++ src/bin/pax/tar.c	Thu Jan 24 12:43:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tar.c,v 1.70 2012/08/09 08:09:22 christos Exp $	*/
+/*	$NetBSD: tar.c,v 1.71 2013/01/24 17:43:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)tar.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: tar.c,v 1.70 2012/08/09 08:09:22 christos Exp $");
+__RCSID("$NetBSD: tar.c,v 1.71 2013/01/24 17:43:44 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -948,6 +948,13 @@ ustar_rd(ARCHD *arcn, char *buf)
 			hd->typeflag == LONGLINKTYPE ? "Link" : "File");
 		}
 		break;
+	case FILEXTYPE:
+	case GLOBXTYPE:
+		tty_warn(0, "%s extended headers posix ustar archive."
+		" Extracting as plain files. Following files might be"
+		" in the wrong directory or have wrong attributes.",
+			hd->typeflag == FILEXTYPE ? "File" : "Global");
+		/*FALLTHROUGH*/
 	case CONTTYPE:
 	case AREGTYPE:
 	case REGTYPE:

Index: src/bin/pax/tar.h
diff -u src/bin/pax/tar.h:1.9 src/bin/pax/tar.h:1.10
--- src/bin/pax/tar.h:1.9	Tue May 11 13:12:26 2004
+++ src/bin/pax/tar.h	Thu Jan 24 12:43:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tar.h,v 1.9 2004/05/11 17:12:26 christos Exp $	*/
+/*	$NetBSD: tar.h,v 1.10 2013/01/24 17:43:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -59,6 +59,8 @@
 #define	DIRTYPE		'5'		/* Directory */
 #define	FIFOTYPE	'6'		/* FIFO */
 #define	CONTTYPE	'7'		/* high perf file */
+#define GLOBXTYPE	'g'		/* global extended header */
+#define FILEXTYPE	'x'		/* file extended header */
 
 /*
  * GNU tar compatibility;



CVS commit: src/bin/pax

2012-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 27 00:44:59 UTC 2012

Modified Files:
src/bin/pax: ftree.c

Log Message:
deal properly with empty lines in spec file


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/pax/ftree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/ftree.c
diff -u src/bin/pax/ftree.c:1.41 src/bin/pax/ftree.c:1.42
--- src/bin/pax/ftree.c:1.41	Tue Mar 20 14:42:28 2012
+++ src/bin/pax/ftree.c	Wed Sep 26 20:44:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ftree.c,v 1.41 2012/03/20 18:42:28 matt Exp $	*/
+/*	$NetBSD: ftree.c,v 1.42 2012/09/27 00:44:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = "@(#)ftree.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ftree.c,v 1.41 2012/03/20 18:42:28 matt Exp $");
+__RCSID("$NetBSD: ftree.c,v 1.42 2012/09/27 00:44:59 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -347,7 +347,7 @@ ftree_arg(void)
 			 * the user didn't supply any args, get the file trees
 			 * to process from stdin;
 			 */
-			for (i = 0; i < PAXPATHLEN + 2; i++) {
+			for (i = 0; i < PAXPATHLEN + 2;) {
 c = getchar();
 if (c == EOF)
 	break;
@@ -355,7 +355,7 @@ ftree_arg(void)
 	if (i != 0)
 		break;
 } else
-	farray[0][i] = c;
+	farray[0][i++] = c;
 			}
 			if (i == 0)
 return -1;



CVS commit: src/bin/pax

2012-08-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug  9 11:05:59 UTC 2012

Modified Files:
src/bin/pax: getoldopt.c options.c

Log Message:
add missing include files


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/bin/pax/getoldopt.c
cvs rdiff -u -r1.113 -r1.114 src/bin/pax/options.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/getoldopt.c
diff -u src/bin/pax/getoldopt.c:1.22 src/bin/pax/getoldopt.c:1.23
--- src/bin/pax/getoldopt.c:1.22	Sat Feb 11 05:43:18 2006
+++ src/bin/pax/getoldopt.c	Thu Aug  9 07:05:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getoldopt.c,v 1.22 2006/02/11 10:43:18 dsl Exp $	*/
+/*	$NetBSD: getoldopt.c,v 1.23 2012/08/09 11:05:59 christos Exp $	*/
 
 /*
  * Plug-compatible replacement for getopt() for parsing tar-like
@@ -15,7 +15,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: getoldopt.c,v 1.22 2006/02/11 10:43:18 dsl Exp $");
+__RCSID("$NetBSD: getoldopt.c,v 1.23 2012/08/09 11:05:59 christos Exp $");
 #endif /* not lint */
 
 #if HAVE_NBTOOL_CONFIG_H
@@ -27,6 +27,7 @@ __RCSID("$NetBSD: getoldopt.c,v 1.22 200
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "pax.h"
 #include "extern.h"

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.113 src/bin/pax/options.c:1.114
--- src/bin/pax/options.c:1.113	Tue Mar 20 14:42:28 2012
+++ src/bin/pax/options.c	Thu Aug  9 07:05:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.113 2012/03/20 18:42:28 matt Exp $	*/
+/*	$NetBSD: options.c,v 1.114 2012/08/09 11:05:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.113 2012/03/20 18:42:28 matt Exp $");
+__RCSID("$NetBSD: options.c,v 1.114 2012/08/09 11:05:59 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -62,6 +62,7 @@ __RCSID("$NetBSD: options.c,v 1.113 2012
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "pax.h"
 #include "options.h"



CVS commit: src/bin/pax

2012-08-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug  9 08:09:22 UTC 2012

Modified Files:
src/bin/pax: cpio.c extern.h gen_subs.c pax.h tar.c

Log Message:
PR/46786: Simon Burge: After conversion to 64 bit time_t, tar/pax/cpio
erroneously think that negative time_t's never fit in 32 bits. Rework
conversion code to always use uintmax_t, and detect negative values.
XXX[1]: Perhaps we should do the same (use a signed conversion) for all
fields not just for time_t
XXX[2]: pullup for 6


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/pax/cpio.c
cvs rdiff -u -r1.58 -r1.59 src/bin/pax/extern.h
cvs rdiff -u -r1.35 -r1.36 src/bin/pax/gen_subs.c
cvs rdiff -u -r1.30 -r1.31 src/bin/pax/pax.h
cvs rdiff -u -r1.69 -r1.70 src/bin/pax/tar.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/cpio.c
diff -u src/bin/pax/cpio.c:1.21 src/bin/pax/cpio.c:1.22
--- src/bin/pax/cpio.c:1.21	Sat Mar 26 08:01:06 2011
+++ src/bin/pax/cpio.c	Thu Aug  9 04:09:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpio.c,v 1.21 2011/03/26 12:01:06 martin Exp $	*/
+/*	$NetBSD: cpio.c,v 1.22 2012/08/09 08:09:21 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)cpio.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: cpio.c,v 1.21 2011/03/26 12:01:06 martin Exp $");
+__RCSID("$NetBSD: cpio.c,v 1.22 2012/08/09 08:09:21 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -297,15 +297,15 @@ cpio_rd(ARCHD *arcn, char *buf)
 	 * ascii fields from the header
 	 */
 	arcn->pad = 0L;
-	arcn->sb.st_dev = (dev_t)asc_ul(hd->c_dev, sizeof(hd->c_dev), OCT);
-	arcn->sb.st_ino = (ino_t)asc_ul(hd->c_ino, sizeof(hd->c_ino), OCT);
-	arcn->sb.st_mode = (mode_t)asc_ul(hd->c_mode, sizeof(hd->c_mode), OCT);
-	arcn->sb.st_uid = (uid_t)asc_ul(hd->c_uid, sizeof(hd->c_uid), OCT);
-	arcn->sb.st_gid = (gid_t)asc_ul(hd->c_gid, sizeof(hd->c_gid), OCT);
-	arcn->sb.st_nlink = (nlink_t)asc_ul(hd->c_nlink, sizeof(hd->c_nlink),
+	arcn->sb.st_dev = (dev_t)asc_u32(hd->c_dev, sizeof(hd->c_dev), OCT);
+	arcn->sb.st_ino = (ino_t)asc_u32(hd->c_ino, sizeof(hd->c_ino), OCT);
+	arcn->sb.st_mode = (mode_t)asc_u32(hd->c_mode, sizeof(hd->c_mode), OCT);
+	arcn->sb.st_uid = (uid_t)asc_u32(hd->c_uid, sizeof(hd->c_uid), OCT);
+	arcn->sb.st_gid = (gid_t)asc_u32(hd->c_gid, sizeof(hd->c_gid), OCT);
+	arcn->sb.st_nlink = (nlink_t)asc_u32(hd->c_nlink, sizeof(hd->c_nlink),
 	OCT);
-	arcn->sb.st_rdev = (dev_t)asc_ul(hd->c_rdev, sizeof(hd->c_rdev), OCT);
-	arcn->sb.st_mtime = (time_t)asc_ul(hd->c_mtime, sizeof(hd->c_mtime),
+	arcn->sb.st_rdev = (dev_t)asc_u32(hd->c_rdev, sizeof(hd->c_rdev), OCT);
+	arcn->sb.st_mtime = (time_t)(int32_t)asc_u32(hd->c_mtime, sizeof(hd->c_mtime),
 	OCT);
 	arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
 	arcn->sb.st_size = (off_t)ASC_OFFT(hd->c_filesize,
@@ -315,7 +315,7 @@ cpio_rd(ARCHD *arcn, char *buf)
 	 * check name size and if valid, read in the name of this entry (name
 	 * follows header in the archive)
 	 */
-	if ((nsz = (int)asc_ul(hd->c_namesize,sizeof(hd->c_namesize),OCT)) < 2)
+	if ((nsz = (int)asc_u32(hd->c_namesize,sizeof(hd->c_namesize),OCT)) < 2)
 		return -1;
 	arcn->nlen = nsz - 1;
 	if (rd_nm(arcn, nsz) < 0)
@@ -415,7 +415,7 @@ cpio_wr(ARCHD *arcn)
 		/*
 		 * set data size to hold link name
 		 */
-		if (ul_asc((u_long)arcn->ln_nlen, hd->c_filesize,
+		if (u32_asc((uintmax_t)arcn->ln_nlen, hd->c_filesize,
 		sizeof(hd->c_filesize), OCT))
 			goto out;
 		break;
@@ -423,7 +423,7 @@ cpio_wr(ARCHD *arcn)
 		/*
 		 * all other file types have no file data
 		 */
-		if (ul_asc((u_long)0, hd->c_filesize, sizeof(hd->c_filesize),
+		if (u32_asc((uintmax_t)0, hd->c_filesize, sizeof(hd->c_filesize),
 		 OCT))
 			goto out;
 		break;
@@ -432,24 +432,24 @@ cpio_wr(ARCHD *arcn)
 	/*
 	 * copy the values to the header using octal ascii
 	 */
-	if (ul_asc((u_long)MAGIC, hd->c_magic, sizeof(hd->c_magic), OCT) ||
-	ul_asc((u_long)arcn->sb.st_dev, hd->c_dev, sizeof(hd->c_dev),
+	if (u32_asc((uintmax_t)MAGIC, hd->c_magic, sizeof(hd->c_magic), OCT) ||
+	u32_asc((uintmax_t)arcn->sb.st_dev, hd->c_dev, sizeof(hd->c_dev),
 		OCT) ||
-	ul_asc((u_long)arcn->sb.st_ino, hd->c_ino, sizeof(hd->c_ino),
+	u32_asc((uintmax_t)arcn->sb.st_ino, hd->c_ino, sizeof(hd->c_ino),
 		OCT) ||
-	ul_asc((u_long)arcn->sb.st_mode, hd->c_mode, sizeof(hd->c_mode),
+	u32_asc((uintmax_t)arcn->sb.st_mode, hd->c_mode, sizeof(hd->c_mode),
 		OCT) ||
-	ul_asc((u_long)arcn->sb.st_uid, hd->c_uid, sizeof(hd->c_uid),
+	u32_asc((uintmax_t)arcn->sb.st_uid, hd->c_uid, sizeof(hd->c_uid),
 		OCT) ||
-	ul_asc((u_long)arcn->sb.st_gid, hd->c_gid, sizeof(hd->c_gid),
+	u32_asc((uintmax_t)arcn->sb.st_gid, hd->c_gid, sizeof(hd->c_gid),
 		OCT) ||
-	ul_asc((u_long)arcn->sb.st_nlink, hd->c_nlink, sizeof(hd->c_nlink),
+	u32_asc((uintmax_t)arcn->sb.st_nlink

CVS commit: src/bin/pax

2011-11-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  3 21:59:46 UTC 2011

Modified Files:
src/bin/pax: tar.c

Log Message:
Accept -X -


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/bin/pax/tar.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/tar.c
diff -u src/bin/pax/tar.c:1.67 src/bin/pax/tar.c:1.68
--- src/bin/pax/tar.c:1.67	Sat Feb 14 03:10:06 2009
+++ src/bin/pax/tar.c	Thu Nov  3 17:59:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tar.c,v 1.67 2009/02/14 08:10:06 lukem Exp $	*/
+/*	$NetBSD: tar.c,v 1.68 2011/11/03 21:59:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)tar.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: tar.c,v 1.67 2009/02/14 08:10:06 lukem Exp $");
+__RCSID("$NetBSD: tar.c,v 1.68 2011/11/03 21:59:45 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1386,11 +1386,15 @@ tar_gnutar_X_compat(path)
 	int lineno = 0;
 	size_t len;
 
-	fp = fopen(path, "r");
-	if (fp == NULL) {
-		tty_warn(1, "cannot open %s: %s", path,
-		strerror(errno));
-		return -1;
+	if (path[0] == '-' && path[1] == '\0')
+		fp = stdin;
+	else {
+		fp = fopen(path, "r");
+		if (fp == NULL) {
+			tty_warn(1, "cannot open %s: %s", path,
+			strerror(errno));
+			return -1;
+		}
 	}
 
 	while ((line = fgetln(fp, &len))) {
@@ -1400,7 +1404,9 @@ tar_gnutar_X_compat(path)
 			lineno, path);
 		}
 		if (tar_gnutar_exclude_one(line, len))
-			return (-1);
+			return -1;
 	}
-	return (0);
+	if (fp != stdin)
+		fclose(fp);
+	return 0;
 }



CVS commit: src/bin/pax

2011-08-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Aug 29 14:47:48 UTC 2011

Modified Files:
src/bin/pax: extern.h options.c pax.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/bin/pax/extern.h
cvs rdiff -u -r1.110 -r1.111 src/bin/pax/options.c
cvs rdiff -u -r1.46 -r1.47 src/bin/pax/pax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/extern.h
diff -u src/bin/pax/extern.h:1.57 src/bin/pax/extern.h:1.58
--- src/bin/pax/extern.h:1.57	Sat Jun 18 23:07:04 2011
+++ src/bin/pax/extern.h	Mon Aug 29 14:47:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.57 2011/06/18 23:07:04 christos Exp $	*/
+/*	$NetBSD: extern.h,v 1.58 2011/08/29 14:47:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -204,7 +204,6 @@
 extern int havechd;
 void options(int, char **);
 OPLIST * opt_next(void);
-int opt_add(const char *);
 int bad_opt(void);
 int mkpath(char *);
 char *chdname;
@@ -265,9 +264,6 @@
 extern char *tempfile;
 extern char *tempbase;
 
-int main(int, char **);
-void sig_cleanup(int);
-
 /*
  * sel_subs.c
  */

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.110 src/bin/pax/options.c:1.111
--- src/bin/pax/options.c:1.110	Sat Jun 18 23:07:04 2011
+++ src/bin/pax/options.c	Mon Aug 29 14:47:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.110 2011/06/18 23:07:04 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.111 2011/08/29 14:47:47 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.110 2011/06/18 23:07:04 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.111 2011/08/29 14:47:47 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -81,18 +81,19 @@
 static OPLIST *ophead = NULL;	/* head for format specific options -x */
 static OPLIST *optail = NULL;	/* option tail */
 
+static int opt_add(const char *);
 static int no_op(void);
 static void printflg(unsigned int);
 static int c_frmt(const void *, const void *);
 static off_t str_offt(char *);
 static char *get_line(FILE *fp);
 static void pax_options(int, char **);
-static void pax_usage(void);
+__dead static void pax_usage(void);
 static void tar_options(int, char **);
-static void tar_usage(void);
+__dead static void tar_usage(void);
 #ifndef NO_CPIO
 static void cpio_options(int, char **);
-static void cpio_usage(void);
+__dead static void cpio_usage(void);
 #endif
 
 /* errors from get_line */
@@ -2054,7 +2055,7 @@
 	return num;
 }
 
-char *
+static char *
 get_line(FILE *f)
 {
 	char *name, *temp;
@@ -2095,7 +2096,7 @@
  *	print the usage summary to the user
  */
 
-void
+static void
 pax_usage(void)
 {
 	fprintf(stderr,
@@ -2124,7 +2125,7 @@
  *	print the usage summary to the user
  */
 
-void
+static void
 tar_usage(void)
 {
 	(void)fputs("usage: tar [-]{crtux}[-befhjklmopqvwzHOPSXZ014578] [archive] "
@@ -2141,7 +2142,7 @@
  *	print the usage summary to the user
  */
 
-void
+static void
 cpio_usage(void)
 {
 

Index: src/bin/pax/pax.c
diff -u src/bin/pax/pax.c:1.46 src/bin/pax/pax.c:1.47
--- src/bin/pax/pax.c:1.46	Sat Jun 18 23:07:04 2011
+++ src/bin/pax/pax.c	Mon Aug 29 14:47:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pax.c,v 1.46 2011/06/18 23:07:04 christos Exp $	*/
+/*	$NetBSD: pax.c,v 1.47 2011/08/29 14:47:48 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)pax.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: pax.c,v 1.46 2011/06/18 23:07:04 christos Exp $");
+__RCSID("$NetBSD: pax.c,v 1.47 2011/08/29 14:47:48 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -337,7 +337,7 @@
  *	never
  */
 
-void
+__dead static void
 sig_cleanup(int which_sig)
 {
 	/*



CVS commit: src/bin/pax

2011-08-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 14 10:49:58 UTC 2011

Modified Files:
src/bin/pax: gen_subs.c

Log Message:
eliminate dup code and non literal format strings


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/pax/gen_subs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/gen_subs.c
diff -u src/bin/pax/gen_subs.c:1.34 src/bin/pax/gen_subs.c:1.35
--- src/bin/pax/gen_subs.c:1.34	Sun Feb 24 15:42:46 2008
+++ src/bin/pax/gen_subs.c	Sun Aug 14 06:49:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: gen_subs.c,v 1.34 2008/02/24 20:42:46 joerg Exp $	*/
+/*	$NetBSD: gen_subs.c,v 1.35 2011/08/14 10:49:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)gen_subs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: gen_subs.c,v 1.34 2008/02/24 20:42:46 joerg Exp $");
+__RCSID("$NetBSD: gen_subs.c,v 1.35 2011/08/14 10:49:58 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -83,6 +83,25 @@
 #define UT_GRPSIZE	6
 
 /*
+ * convert time to string
+ */
+static void
+formattime(char *buf, size_t buflen, time_t when)
+{
+	int error;
+	struct tm tm;
+	(void)localtime_r(&when, &tm);
+
+	if (when + SIXMONTHS <= time(NULL))
+		error = strftime(buf, buflen, OLDFRMT, &tm);
+	else
+		error = strftime(buf, buflen, CURFRMT, &tm);
+
+	if (error == 0)
+		buf[0] = '\0';
+}
+
+/*
  * ls_list()
  *	list the members of an archive in ls format
  */
@@ -93,7 +112,7 @@
 	struct stat *sbp;
 	char f_mode[MODELEN];
 	char f_date[DATELEN];
-	const char *timefrmt, *user, *group;
+	const char *user, *group;
 
 	/*
 	 * if not verbose, just print the file name
@@ -113,16 +132,10 @@
 	/*
 	 * time format based on age compared to the time pax was started.
 	 */
-	if ((sbp->st_mtime + SIXMONTHS) <= now)
-		timefrmt = OLDFRMT;
-	else
-		timefrmt = CURFRMT;
-
+	formattime(f_date, sizeof(f_date), arcn->sb.st_mtime);
 	/*
 	 * print file mode, link count, uid, gid and time
 	 */
-	if (strftime(f_date,DATELEN,timefrmt,localtime(&(sbp->st_mtime))) == 0)
-		f_date[0] = '\0';
 	user = user_from_uid(sbp->st_uid, 0);
 	group = group_from_gid(sbp->st_gid, 0);
 	(void)fprintf(fp, "%s%2lu %-*s %-*s ", f_mode,
@@ -162,19 +175,8 @@
 {
 	char f_date[DATELEN];
 	char f_mode[MODELEN];
-	const char *timefrmt;
 
-	if ((arcn->sb.st_mtime + SIXMONTHS) <= time((time_t *)NULL))
-		timefrmt = OLDFRMT;
-	else
-		timefrmt = CURFRMT;
-
-	/*
-	 * convert time to string, and print
-	 */
-	if (strftime(f_date, DATELEN, timefrmt,
-	localtime(&(arcn->sb.st_mtime))) == 0)
-		f_date[0] = '\0';
+	formattime(f_date, sizeof(f_date), arcn->sb.st_mtime);
 	strmode(arcn->sb.st_mode, f_mode);
 	tty_prnt("%s%s %s\n", f_mode, f_date, arcn->name);
 	return;



CVS commit: src/bin/pax

2011-06-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jun 19 07:34:24 UTC 2011

Modified Files:
src/bin/pax: cpio.1 pax.1 tar.1

Log Message:
Use Fl Fl for long options.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/pax/cpio.1
cvs rdiff -u -r1.60 -r1.61 src/bin/pax/pax.1
cvs rdiff -u -r1.31 -r1.32 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/cpio.1
diff -u src/bin/pax/cpio.1:1.12 src/bin/pax/cpio.1:1.13
--- src/bin/pax/cpio.1:1.12	Sun Jun 19 00:55:09 2011
+++ src/bin/pax/cpio.1	Sun Jun 19 07:34:24 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpio.1,v 1.12 2011/06/19 00:55:09 christos Exp $
+.\" $NetBSD: cpio.1,v 1.13 2011/06/19 07:34:24 wiz Exp $
 .\"
 .\" Copyright (c) 1997 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\"
 .\"	OpenBSD: cpio.1,v 1.14 2000/11/10 17:52:02 aaron Exp
 .\"
-.Dd April 23, 2007
+.Dd June 18, 2011
 .Dt CPIO 1
 .Os
 .Sh NAME
@@ -69,16 +69,16 @@
 .Pp
 The options are as follows:
 .Bl -tag -width Ds
-.It Fl o , -create
+.It Fl o , Fl Fl create
 Create an archive.
 Reads the list of files to store in the
 archive from standard input, and writes the archive on standard
 output.
 .Bl -tag -width Ds
-.It Fl a , -reset-access-time
+.It Fl a , Fl Fl reset-access-time
 Reset the access times on files that have been copied to the
 archive.
-.It Fl A , -append
+.It Fl A , Fl Fl append
 Append to the specified archive.
 .It Fl B
 Set block size of output to 5120 bytes.
@@ -119,11 +119,7 @@
 .It Fl v
 Be verbose about operations.
 List filenames as they are written to the archive.
-.It Fl z
-Compress/decompress archive using
-.Xr gzip 1
-format.
-.It Fl -xz
+.It Fl Fl xz
 Compress/decompress archive using
 .Xr xz 1
 format.
@@ -131,8 +127,12 @@
 Compress archive using
 .Xr compress 1
 format.
+.It Fl z
+Compress/decompress archive using
+.Xr gzip 1
+format.
 .El
-.It Fl i , -extract
+.It Fl i , Fl Fl extract
 Restore files from an archive.
 Reads the archive file from
 standard input and extracts files matching the
@@ -150,20 +150,20 @@
 .It Fl C Ar bytes
 Read archive written with a block size of
 .Ar bytes .
-.It Fl d , -make-directories
+.It Fl d , Fl Fl make-directories
 Create any intermediate directories as needed during
 restore.
-.It Fl E Ar file , Fl -pattern-file Ar file
+.It Fl E Ar file , Fl Fl pattern-file Ar file
 Read list of file name patterns to extract or list from
 .Ar file .
-.It Fl f , -nonmatching
+.It Fl f , Fl Fl nonmatching
 Restore all files except those matching the
 .Ar patterns
 given on the command line.
-.It Fl F Ar archive , Fl -file Ar archive
+.It Fl F Ar archive , Fl Fl file Ar archive
 .It Fl I Ar archive
 Use the specified file as the input for the archive.
-.It Fl H Ar format , Fl -format Ar format
+.It Fl H Ar format , Fl Fl format Ar format
 Read an archive of the specified format.
 Recognized formats are:
 .Pp
@@ -187,19 +187,19 @@
 .El
 .It Fl m
 Restore modification times on files.
-.It Fl r , -rename
+.It Fl r , Fl Fl rename
 Rename restored files interactively.
 .It Fl s
 Swap bytes after reading data from the archive.
-.It Fl S , -swap-halfwords
+.It Fl S , Fl Fl swap-halfwords
 Swap words after reading data from the archive.
-.It Fl t , -list
+.It Fl t , Fl Fl list
 Only list the contents of the archive, no files or
 directories will be created.
-.It Fl u , -unconditional
+.It Fl u , Fl Fl unconditional
 Overwrite files even when the file in the archive is
 older than the one that will be overwritten.
-.It Fl v , -verbose
+.It Fl v , Fl Fl verbose
 Be verbose about operations.
 List filenames as they are copied in from the archive.
 .It Fl z
@@ -215,7 +215,7 @@
 .Nm
 format archives.
 .El
-.It Fl p , -pass-through
+.It Fl p , Fl Fl pass-through
 Copy files from one location to another in a single pass.
 The list of files to copy are read from standard input and
 written out to a directory relative to the specified
@@ -227,24 +227,24 @@
 .It Fl d
 Create any intermediate directories as needed to write
 the files at the new location.
-.It Fl l , -link
+.It Fl l , Fl Fl link
 When possible, link files rather than creating an
 extra copy.
-.It Fl L , -dereference
+.It Fl L , Fl Fl dereference
 Follow symbolic links.
-.It Fl m , -preserve-modification-time
+.It Fl m , Fl Fl preserve-modification-time
 Restore modification times on files.
-.It Fl u , -unconditional
+.It Fl u , Fl Fl unconditional
 Overwrite files even when the original file being copied is
 older than the one that will be overwritten.
-.It Fl v , -verbose
+.It Fl v , Fl Fl verbose
 Be verbose about operations.
 List filenames as they are copied.
-.It Fl -force-local
+.It Fl Fl force-local
 Do not interpret filenames that contain a
 .Sq \&:
 as remote files.
-.It Fl -insecure
+.It Fl Fl insecure
 Normally
 .Nm
 ignores filenames that contain

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.60 src/bin/pax/pax.1:1

CVS commit: src/bin/pax

2011-06-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 19 00:55:09 UTC 2011

Modified Files:
src/bin/pax: cpio.1 pax.1 tar.1

Log Message:
document --xz


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/bin/pax/cpio.1
cvs rdiff -u -r1.59 -r1.60 src/bin/pax/pax.1
cvs rdiff -u -r1.30 -r1.31 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/cpio.1
diff -u src/bin/pax/cpio.1:1.11 src/bin/pax/cpio.1:1.12
--- src/bin/pax/cpio.1:1.11	Sun Dec  2 16:16:02 2007
+++ src/bin/pax/cpio.1	Sat Jun 18 20:55:09 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpio.1,v 1.11 2007/12/02 21:16:02 wiz Exp $
+.\" $NetBSD: cpio.1,v 1.12 2011/06/19 00:55:09 christos Exp $
 .\"
 .\" Copyright (c) 1997 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -120,9 +120,13 @@
 Be verbose about operations.
 List filenames as they are written to the archive.
 .It Fl z
-Compress archive using
+Compress/decompress archive using
 .Xr gzip 1
 format.
+.It Fl -xz
+Compress/decompress archive using
+.Xr xz 1
+format.
 .It Fl Z
 Compress archive using
 .Xr compress 1

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.59 src/bin/pax/pax.1:1.60
--- src/bin/pax/pax.1:1.59	Sat Jun 19 07:16:31 2010
+++ src/bin/pax/pax.1	Sat Jun 18 20:55:09 2011
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.59 2010/06/19 11:16:31 wiz Exp $
+.\"$NetBSD: pax.1,v 1.60 2011/06/19 00:55:09 christos Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\"
 .\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\"
-.Dd June 18, 2010
+.Dd June 18, 2011
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -744,6 +744,10 @@
 Use
 .Xr gzip 1
 compression, when reading or writing archive files.
+.It Fl -xz
+Use
+.Xr xz 1
+compression, when reading or writing archive files.
 .It Fl A
 Do not strip leading `/'s from file names.
 .It Fl B Ar bytes

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.30 src/bin/pax/tar.1:1.31
--- src/bin/pax/tar.1:1.30	Mon Apr  5 12:16:53 2010
+++ src/bin/pax/tar.1	Sat Jun 18 20:55:09 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.30 2010/04/05 16:16:53 joerg Exp $
+.\" $NetBSD: tar.1,v 1.31 2011/06/19 00:55:09 christos Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\"
 .\"	OpenBSD: tar.1,v 1.28 2000/11/09 23:58:56 aaron Exp
 .\"
-.Dd March 23, 2010
+.Dd June 18, 2011
 .Dt TAR 1
 .Os
 .Sh NAME
@@ -209,8 +209,12 @@
 .Nm
 to prompt the user for the filename to use when storing or
 extracting files in an archive.
+.It Fl -xz
+Compress/decompress archive using 
+.Xr xz  1 .
 .It Fl z , -gzip , -gunzip
-Compress archive using gzip.
+Compress/decompress archive using
+.Xr gzip 1 .
 .It Fl B , -read-full-blocks
 Reassemble small reads into full blocks (For reading from 4.2BSD pipes).
 .It Fl C Ar directory , Fl -directory Ar directory



CVS commit: src/bin/pax

2011-06-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 18 23:07:04 UTC 2011

Modified Files:
src/bin/pax: extern.h options.c pax.c

Log Message:
add --xz


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/bin/pax/extern.h
cvs rdiff -u -r1.109 -r1.110 src/bin/pax/options.c
cvs rdiff -u -r1.45 -r1.46 src/bin/pax/pax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/extern.h
diff -u src/bin/pax/extern.h:1.56 src/bin/pax/extern.h:1.57
--- src/bin/pax/extern.h:1.56	Tue Apr  7 15:52:35 2009
+++ src/bin/pax/extern.h	Sat Jun 18 19:07:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.56 2009/04/07 19:52:35 perry Exp $	*/
+/*	$NetBSD: extern.h,v 1.57 2011/06/18 23:07:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -233,14 +233,12 @@
 extern int cwdfd;
 extern int dflag;
 extern int iflag;
-extern int jflag;
 extern int kflag;
 extern int lflag;
 extern int nflag;
 extern int tflag;
 extern int uflag;
 extern int vflag;
-extern int zflag;
 extern int Dflag;
 extern int Hflag;
 extern int Lflag;

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.109 src/bin/pax/options.c:1.110
--- src/bin/pax/options.c:1.109	Mon Aug 30 23:16:06 2010
+++ src/bin/pax/options.c	Sat Jun 18 19:07:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.109 2010/08/31 03:16:06 enami Exp $	*/
+/*	$NetBSD: options.c,v 1.110 2011/06/18 23:07:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.109 2010/08/31 03:16:06 enami Exp $");
+__RCSID("$NetBSD: options.c,v 1.110 2011/06/18 23:07:04 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -102,6 +102,7 @@
 
 #define BZIP2_CMD	"bzip2"		/* command to run as bzip2 */
 #define GZIP_CMD	"gzip"		/* command to run as gzip */
+#define XZ_CMD		"xz"		/* command to run as xz */
 #define COMPRESS_CMD	"compress"	/* command to run as compress */
 
 /*
@@ -124,8 +125,9 @@
 #define	OPT_INSECURE			14
 #define	OPT_STRICT			15
 #define	OPT_SPARSE			16
+#define OPT_XZ17
 #if !HAVE_NBTOOL_CONFIG_H
-#define	OPT_CHROOT			17
+#define	OPT_CHROOT			18
 #endif
 
 /*
@@ -242,6 +244,8 @@
 		OPT_FORCE_LOCAL },
 	{ "use-compress-program", required_argument,	0,
 		OPT_USE_COMPRESS_PROGRAM },
+	{ "xz",			no_argument,		0,
+		OPT_XZ },
 	{ 0,			0,			0,
 		0 },
 };
@@ -320,7 +324,6 @@
 			/*
 			 * pass through bzip2
 			 */
-			jflag = 1;
 			gzip_program = BZIP2_CMD;
 			break;
 		case 'k':
@@ -476,7 +479,6 @@
 			/*
 			 * use gzip.  Non standard option.
 			 */
-			zflag = 1;
 			gzip_program = GZIP_CMD;
 			break;
 		case 'A':
@@ -646,9 +648,11 @@
 			forcelocal = 1;
 			break;
 		case OPT_USE_COMPRESS_PROGRAM:
-			zflag = 1;
 			gzip_program = optarg;
 			break;
+		case OPT_XZ:
+			gzip_program = XZ_CMD;
+			break;
 		case '?':
 		default:
 			pax_usage();
@@ -786,6 +790,8 @@
 		OPT_EXCLUDE },
 	{ "no-recursion",	no_argument,		0,
 		OPT_NORECURSE },
+	{ "xz",			no_argument,		0,
+		OPT_XZ },
 #if !HAVE_NBTOOL_CONFIG_H
 	{ "chroot",		no_argument,		0,
 		OPT_CHROOT },
@@ -914,7 +920,6 @@
 			/*
 			 * pass through bzip2. not a standard option
 			 */
-			jflag = 1;
 			gzip_program = BZIP2_CMD;
 			break;
 		case 'k':
@@ -1019,7 +1024,6 @@
 			/*
 			 * use gzip.  Non standard option.
 			 */
-			zflag = 1;
 			gzip_program = GZIP_CMD;
 			break;
 		case 'B':
@@ -1079,7 +1083,6 @@
 			/*
 			 * use compress.
 			 */
-			zflag = 1;
 			gzip_program = COMPRESS_CMD;
 			break;
 		case '0':
@@ -1107,7 +1110,6 @@
 			/* Just ignore -- we always unlink first. */
 			break;
 		case OPT_USE_COMPRESS_PROGRAM:
-			zflag = 1;
 			gzip_program = optarg;
 			break;
 		case OPT_FORCE_LOCAL:
@@ -1132,6 +1134,9 @@
 			do_chroot = 1;
 			break;
 #endif
+		case OPT_XZ:
+			gzip_program = XZ_CMD;
+			break;
 		default:
 			tar_usage();
 			break;
@@ -1431,6 +1436,8 @@
 		OPT_INSECURE },
 	{ "sparse",		no_argument,		0,
 		OPT_SPARSE },
+	{ "xz",			no_argument,		0,
+		OPT_XZ },
 
 #ifdef notyet
 /* Not implemented */
@@ -1745,6 +1752,9 @@
 		case OPT_SPARSE:
 			/* do nothing; we already generate sparse files */
 			break;
+		case OPT_XZ:
+			gzip_program = XZ_CMD;
+			break;
 		default:
 			cpio_usage();
 			break;

Index: src/bin/pax/pax.c
diff -u src/bin/pax/pax.c:1.45 src/bin/pax/pax.c:1.46
--- src/bin/pax/pax.c:1.45	Sat Jul 19 20:52:40 2008
+++ src/bin/pax/pax.c	Sat Jun 18 19:07:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pax.c,v 1.45 2008/07/20 00:52:40 lukem Exp $	*/
+/*	$NetBSD: pax.c,v 1.46 2011/06/18 23:07:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)pax.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: pax.c,v 1.45 2008/07/20 00:52:40 lukem Exp $");
+__RCSID("$NetBSD: pax.c,v 1.46 2011/06/18 23:07:04 christos Exp $");

CVS commit: src/bin/pax

2011-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 26 12:01:07 UTC 2011

Modified Files:
src/bin/pax: cpio.c

Log Message:
Fix bogus paranthesis, From Henning Peternse in PR bin/44773.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/bin/pax/cpio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/cpio.c
diff -u src/bin/pax/cpio.c:1.20 src/bin/pax/cpio.c:1.21
--- src/bin/pax/cpio.c:1.20	Sat Feb 14 08:10:06 2009
+++ src/bin/pax/cpio.c	Sat Mar 26 12:01:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpio.c,v 1.20 2009/02/14 08:10:06 lukem Exp $	*/
+/*	$NetBSD: cpio.c,v 1.21 2011/03/26 12:01:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)cpio.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: cpio.c,v 1.20 2009/02/14 08:10:06 lukem Exp $");
+__RCSID("$NetBSD: cpio.c,v 1.21 2011/03/26 12:01:06 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -649,8 +649,8 @@
 off_t
 vcpio_endrd(void)
 {
-	return (off_t)(sizeof(HD_VCPIO) + sizeof(TRAILER +
-		(VCPIO_PAD(sizeof(HD_VCPIO) + sizeof(TRAILER);
+	return (off_t)(sizeof(HD_VCPIO) + sizeof(TRAILER) +
+		(VCPIO_PAD(sizeof(HD_VCPIO) + sizeof(TRAILER;
 }
 
 /*
@@ -958,8 +958,8 @@
 off_t
 bcpio_endrd(void)
 {
-	return (off_t)(sizeof(HD_BCPIO) + sizeof(TRAILER +
-		(BCPIO_PAD(sizeof(HD_BCPIO) + sizeof(TRAILER);
+	return (off_t)(sizeof(HD_BCPIO) + sizeof(TRAILER) +
+		(BCPIO_PAD(sizeof(HD_BCPIO) + sizeof(TRAILER;
 }
 
 /*



CVS commit: src/bin/pax

2010-08-30 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Tue Aug 31 05:07:10 UTC 2010

Modified Files:
src/bin/pax: ar_io.c

Log Message:
Backout previous; it was wrong fix.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/bin/pax/ar_io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.51 src/bin/pax/ar_io.c:1.52
--- src/bin/pax/ar_io.c:1.51	Tue Aug 31 04:50:07 2010
+++ src/bin/pax/ar_io.c	Tue Aug 31 05:07:09 2010
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.51 2010/08/31 04:50:07 enami Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.52 2010/08/31 05:07:09 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -147,13 +147,11 @@
 			syswarn(0, errno, "Failed open on %s", name);
 			return -1;
 		}
-#if !HAVE_NBTOOL_CONFIG_H
 		if (!isrmt(arfd)) {
 			rmtclose(arfd);
 			tty_warn(0, "Not a remote file: %s", name);
 			return -1;
 		}
-#endif
 		blksz = rdblksz = 8192;
 		lstrval = 1;
 		return 0;



CVS commit: src/bin/pax

2010-08-30 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Tue Aug 31 04:50:07 UTC 2010

Modified Files:
src/bin/pax: ar_io.c

Log Message:
Fix build as tools.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/bin/pax/ar_io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.50 src/bin/pax/ar_io.c:1.51
--- src/bin/pax/ar_io.c:1.50	Tue Aug 31 03:16:06 2010
+++ src/bin/pax/ar_io.c	Tue Aug 31 04:50:07 2010
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.50 2010/08/31 03:16:06 enami Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.51 2010/08/31 04:50:07 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -147,11 +147,13 @@
 			syswarn(0, errno, "Failed open on %s", name);
 			return -1;
 		}
+#if !HAVE_NBTOOL_CONFIG_H
 		if (!isrmt(arfd)) {
 			rmtclose(arfd);
 			tty_warn(0, "Not a remote file: %s", name);
 			return -1;
 		}
+#endif
 		blksz = rdblksz = 8192;
 		lstrval = 1;
 		return 0;



CVS commit: src/bin/pax

2010-08-30 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Tue Aug 31 03:16:06 UTC 2010

Modified Files:
src/bin/pax: ar_io.c options.c

Log Message:
- Raise an error rather than silently creating broken archive
  if user don't specify --force-local but opened file is actually
  a local file.
- Make cpio to accept -F option as described in manpage.
- Make pax to set forcelocal flag if requested to do so.
- Add missing break statement.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/pax/ar_io.c
cvs rdiff -u -r1.108 -r1.109 src/bin/pax/options.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/ar_io.c
diff -u src/bin/pax/ar_io.c:1.49 src/bin/pax/ar_io.c:1.50
--- src/bin/pax/ar_io.c:1.49	Tue Feb  3 05:22:40 2009
+++ src/bin/pax/ar_io.c	Tue Aug 31 03:16:06 2010
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.49 2009/02/03 05:22:40 dbj Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.50 2010/08/31 03:16:06 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -147,6 +147,11 @@
 			syswarn(0, errno, "Failed open on %s", name);
 			return -1;
 		}
+		if (!isrmt(arfd)) {
+			rmtclose(arfd);
+			tty_warn(0, "Not a remote file: %s", name);
+			return -1;
+		}
 		blksz = rdblksz = 8192;
 		lstrval = 1;
 		return 0;

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.108 src/bin/pax/options.c:1.109
--- src/bin/pax/options.c:1.108	Wed Aug 25 21:36:02 2010
+++ src/bin/pax/options.c	Tue Aug 31 03:16:06 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.108 2010/08/25 21:36:02 sjg Exp $	*/
+/*	$NetBSD: options.c,v 1.109 2010/08/31 03:16:06 enami Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.108 2010/08/25 21:36:02 sjg Exp $");
+__RCSID("$NetBSD: options.c,v 1.109 2010/08/31 03:16:06 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -643,7 +643,7 @@
 			secure = 0;
 			break;
 		case OPT_FORCE_LOCAL:
-			forcelocal = 0;
+			forcelocal = 1;
 			break;
 		case OPT_USE_COMPRESS_PROGRAM:
 			zflag = 1;
@@ -1677,6 +1677,7 @@
 			(void)fputs("\n\n", stderr);
 			cpio_usage();
 			break;
+		case 'F':
 		case 'I':
 		case 'O':
 			/*
@@ -1734,13 +1735,13 @@
 			 * process Version 6 cpio format
 			 */
 			frmt = &(fsub[F_BCPIO]);
+			break;
 		case OPT_FORCE_LOCAL:
 			forcelocal = 1;
 			break;
 		case OPT_INSECURE:
 			secure = 0;
 			break;
-
 		case OPT_SPARSE:
 			/* do nothing; we already generate sparse files */
 			break;



CVS commit: src/bin/pax

2010-08-25 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Wed Aug 25 21:36:03 UTC 2010

Modified Files:
src/bin/pax: options.c

Log Message:
Do not throw a usage message for -i followed by -t
since 'cpio -itv' is a valid command.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/bin/pax/options.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.107 src/bin/pax/options.c:1.108
--- src/bin/pax/options.c:1.107	Sat Jun 19 00:43:57 2010
+++ src/bin/pax/options.c	Wed Aug 25 21:36:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.107 2010/06/19 00:43:57 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.108 2010/08/25 21:36:02 sjg Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.107 2010/06/19 00:43:57 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.108 2010/08/25 21:36:02 sjg Exp $");
 #endif
 #endif /* not lint */
 
@@ -1462,6 +1462,8 @@
 {
 	if ((act == APPND && op == ARCHIVE) || (act == ARCHIVE && op == APPND))
 		act = APPND;
+	else if (act == EXTRACT && op == LIST)
+		act = op;
 	else if (act != ERROR && act != op)
 		cpio_usage();
 	else



CVS commit: src/bin/pax

2010-06-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jun 19 11:16:31 UTC 2010

Modified Files:
src/bin/pax: pax.1

Log Message:
Use Fl Fl for long options. Remove unnecessary Bk/Ek.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.58 src/bin/pax/pax.1:1.59
--- src/bin/pax/pax.1:1.58	Sat Jun 19 00:43:57 2010
+++ src/bin/pax/pax.1	Sat Jun 19 11:16:31 2010
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.58 2010/06/19 00:43:57 christos Exp $
+.\"$NetBSD: pax.1,v 1.59 2010/06/19 11:16:31 wiz Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -42,28 +42,15 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl 0cdjnOVvz
-.Bk -words
 .Op Fl E Ar limit
-.Ek
-.Bk -words
 .Op Fl f Ar archive
-.Ek
-.Bk -words
 .Op Fl N Ar dbdir
-.Ek
-.Bk -words
 .Op Fl s Ar replstr
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl U Ar user
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl G Ar group
 .Ar ...\&
-.Ek
-.Bk -words
 .Oo
 .Fl T
 .Sm off
@@ -72,41 +59,23 @@
 .Sm on
 .Oc
 .Ar ...\&
-.Ek
 .Op Ar pattern ...\&
 .Nm
 .Fl r
 .Op Fl AcDdijknOuVvYZz
-.Bk -words
 .Op Fl E Ar limit
-.Ek
-.Bk -words
 .Op Fl f Ar archive
-.Ek
-.Bk -words
 .Op Fl N Ar dbdir
-.Ek
-.Bk -words
 .Op Fl o Ar options
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl p Ar string
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl s Ar replstr
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl U Ar user
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl G Ar group
 .Ar ...\&
-.Ek
-.Bk -words
 .Oo
 .Fl T
 .Sm off
@@ -115,44 +84,26 @@
 .Sm on
 .Oc
 .Ar ...\&
-.Ek
 .Op Ar pattern ...\&
 .Nm
 .Fl w
 .Op Fl AdHijLMOPtuVvXz
-.Bk -words
 .Op Fl b Ar blocksize
-.Ek
 .Oo
 .Op Fl a
 .Op Fl f Ar archive
 .Oc
-.Bk -words
 .Op Fl x Ar format
-.Ek
-.Bk -words
 .Op Fl B Ar bytes
-.Ek
-.Bk -words
 .Op Fl N Ar dbdir
-.Ek
-.Bk -words
 .Op Fl o Ar options
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl s Ar replstr
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl U Ar user
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl G Ar group
 .Ar ...\&
-.Ek
-.Bk -words
 .Oo
 .Fl T
 .Sm off
@@ -162,32 +113,20 @@
 .Sm on
 .Oc
 .Ar ...\&
-.Ek
 .Op Ar file ...\&
 .Nm
 .Fl r
 .Fl w
 .Op Fl ADdHijkLlMnOPtuVvXYZz
-.Bk -words
 .Op Fl N Ar dbdir
-.Ek
-.Bk -words
 .Op Fl p Ar string
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl s Ar replstr
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl U Ar user
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Fl G Ar group
 .Ar ...\&
-.Ek
-.Bk -words
 .Oo
 .Fl T
 .Sm off
@@ -197,10 +136,7 @@
 .Sm on
 .Oc
 .Ar ...\&
-.Ek
-.Bk -words
 .Op Ar file ...\&
-.Ek
 .Ar directory
 .Sh DESCRIPTION
 .Nm
@@ -1089,9 +1025,9 @@
 .It Fl 0
 Use the nul character instead of \en as the file separator when reading
 files from standard input.
-.It Fl -force-local
+.It Fl Fl force-local
 Do not interpret filenames that contain a `:' as remote files.
-.It Fl -insecure
+.It Fl Fl insecure
 Normally
 .Nm
 ignores filenames that contain
@@ -1101,7 +1037,7 @@
 files that contain
 .Dq ..
 can be processed.
-.It Fl -use-compress-program
+.It Fl Fl use-compress-program
 Use the named program as the program to decompress the input or compress
 the output.
 .El



CVS commit: src/bin/pax

2010-06-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 19 00:43:57 UTC 2010

Modified Files:
src/bin/pax: options.c pax.1

Log Message:
add --use-compress-program to pax, requested by mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/bin/pax/options.c
cvs rdiff -u -r1.57 -r1.58 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.106 src/bin/pax/options.c:1.107
--- src/bin/pax/options.c:1.106	Mon Dec 14 00:04:48 2009
+++ src/bin/pax/options.c	Fri Jun 18 20:43:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.106 2009/12/14 05:04:48 dholland Exp $	*/
+/*	$NetBSD: options.c,v 1.107 2010/06/19 00:43:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.106 2009/12/14 05:04:48 dholland Exp $");
+__RCSID("$NetBSD: options.c,v 1.107 2010/06/19 00:43:57 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -240,6 +240,8 @@
 		OPT_INSECURE },
 	{ "force-local",	no_argument,		0,
 		OPT_FORCE_LOCAL },
+	{ "use-compress-program", required_argument,	0,
+		OPT_USE_COMPRESS_PROGRAM },
 	{ 0,			0,			0,
 		0 },
 };
@@ -474,6 +476,7 @@
 			/*
 			 * use gzip.  Non standard option.
 			 */
+			zflag = 1;
 			gzip_program = GZIP_CMD;
 			break;
 		case 'A':
@@ -642,6 +645,10 @@
 		case OPT_FORCE_LOCAL:
 			forcelocal = 0;
 			break;
+		case OPT_USE_COMPRESS_PROGRAM:
+			zflag = 1;
+			gzip_program = optarg;
+			break;
 		case '?':
 		default:
 			pax_usage();

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.57 src/bin/pax/pax.1:1.58
--- src/bin/pax/pax.1:1.57	Mon Apr  5 17:22:37 2010
+++ src/bin/pax/pax.1	Fri Jun 18 20:43:57 2010
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.57 2010/04/05 21:22:37 joerg Exp $
+.\"$NetBSD: pax.1,v 1.58 2010/06/19 00:43:57 christos Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\"
 .\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\"
-.Dd September 6, 2009
+.Dd June 18, 2010
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -1101,6 +1101,9 @@
 files that contain
 .Dq ..
 can be processed.
+.It Fl -use-compress-program
+Use the named program as the program to decompress the input or compress
+the output.
 .El
 .Pp
 The options that operate on the names of files or archive members



CVS commit: src/bin/pax

2010-04-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Apr  5 21:22:37 UTC 2010

Modified Files:
src/bin/pax: pax.1

Log Message:
\\ -> \e


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.56 src/bin/pax/pax.1:1.57
--- src/bin/pax/pax.1:1.56	Sun Sep  6 13:38:50 2009
+++ src/bin/pax/pax.1	Mon Apr  5 21:22:37 2010
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.56 2009/09/06 13:38:50 christos Exp $
+.\"$NetBSD: pax.1,v 1.57 2010/04/05 21:22:37 joerg Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -642,7 +642,7 @@
 .Cm old
 is a basic regular expression and
 .Cm new
-can contain an ampersand (\*[Am]), \\n (where n is a digit) back-references,
+can contain an ampersand (\*[Am]), \en (where n is a digit) back-references,
 or subexpression matching.
 The
 .Cm old
@@ -877,7 +877,7 @@
 name, or when starting with a
 .Cm # ,
 a numeric gid.
-A '\\' can be used to escape the
+A '\e' can be used to escape the
 .Cm # .
 Multiple
 .Fl G
@@ -1059,7 +1059,7 @@
 name, or when starting with a
 .Cm # ,
 a numeric uid.
-A '\\' can be used to escape the
+A '\e' can be used to escape the
 .Cm # .
 Multiple
 .Fl U



CVS commit: src/bin/pax

2010-04-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Apr  5 16:16:53 UTC 2010

Modified Files:
src/bin/pax: tar.1

Log Message:
\\ -> \e


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.29 src/bin/pax/tar.1:1.30
--- src/bin/pax/tar.1:1.29	Tue Mar 23 18:09:16 2010
+++ src/bin/pax/tar.1	Mon Apr  5 16:16:53 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.29 2010/03/23 18:09:16 dholland Exp $
+.\" $NetBSD: tar.1,v 1.30 2010/04/05 16:16:53 joerg Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -167,7 +167,7 @@
 .Cm old
 is a basic regular expression and
 .Cm new
-can contain an ampersand (\*[Am]), \\n (where n is a digit) back-references,
+can contain an ampersand (\*[Am]), \en (where n is a digit) back-references,
 or subexpression matching.
 The
 .Cm old



CVS commit: src/bin/pax

2010-03-23 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Mar 23 18:09:17 UTC 2010

Modified Files:
src/bin/pax: tar.1

Log Message:
bump date for previous


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.28 src/bin/pax/tar.1:1.29
--- src/bin/pax/tar.1:1.28	Tue Mar 23 17:21:40 2010
+++ src/bin/pax/tar.1	Tue Mar 23 18:09:16 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.28 2010/03/23 17:21:40 dholland Exp $
+.\" $NetBSD: tar.1,v 1.29 2010/03/23 18:09:16 dholland Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\"
 .\"	OpenBSD: tar.1,v 1.28 2000/11/09 23:58:56 aaron Exp
 .\"
-.Dd May 4, 2007
+.Dd March 23, 2010
 .Dt TAR 1
 .Os
 .Sh NAME



CVS commit: src/bin/pax

2010-03-23 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Mar 23 17:21:40 UTC 2010

Modified Files:
src/bin/pax: tar.1

Log Message:
The -X option of tar names a file containing exception globs, not
exception filenames, same as in gtar. PR 41168 from Perry.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/pax/tar.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.27 src/bin/pax/tar.1:1.28
--- src/bin/pax/tar.1:1.27	Sun Nov 23 09:51:10 2008
+++ src/bin/pax/tar.1	Tue Mar 23 17:21:40 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.27 2008/11/23 09:51:10 dholland Exp $
+.\" $NetBSD: tar.1,v 1.28 2010/03/23 17:21:40 dholland Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -249,7 +249,7 @@
 A line may also specify the positional argument
 .Dq Fl C Ar directory .
 .It Fl X Ar file , Fl -exclude-from Ar file
-Exclude files listed in the given file.
+Exclude files matching the shell glob patterns listed in the given file.
 .\" exclude should be '-E' and '-X' should be one-file-system
 .Pp
 Note that it would be more standard to use this option to mean ``do not



CVS commit: src/bin/pax

2009-12-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 21 12:44:48 UTC 2009

Modified Files:
src/bin/pax: sel_subs.c

Log Message:
Remove unnecessary casts.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/bin/pax/sel_subs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/sel_subs.c
diff -u src/bin/pax/sel_subs.c:1.22 src/bin/pax/sel_subs.c:1.23
--- src/bin/pax/sel_subs.c:1.22	Mon Dec 21 04:17:37 2009
+++ src/bin/pax/sel_subs.c	Mon Dec 21 07:44:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sel_subs.c,v 1.22 2009/12/21 09:17:37 wiz Exp $	*/
+/*	$NetBSD: sel_subs.c,v 1.23 2009/12/21 12:44:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)sel_subs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: sel_subs.c,v 1.22 2009/12/21 09:17:37 wiz Exp $");
+__RCSID("$NetBSD: sel_subs.c,v 1.23 2009/12/21 12:44:48 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -378,7 +378,7 @@
 	/*
 	 * allocate space for the time range and store the limits
 	 */
-	if ((pt = (TIME_RNG *)malloc(sizeof(TIME_RNG))) == NULL) {
+	if ((pt = malloc(sizeof(TIME_RNG))) == NULL) {
 		tty_warn(1, "Unable to allocate memory for time range");
 		return -1;
 	}
@@ -404,7 +404,7 @@
 			default:
 tty_warn(1, "Bad option %c with time range %s",
 *flgpt, str);
-(void)free((char *)pt);
+free(pt);
 goto out;
 			}
 			++flgpt;
@@ -421,7 +421,7 @@
 		 */
 		if (str_sec(str, &(pt->low_time)) < 0) {
 			tty_warn(1, "Illegal lower time range %s", str);
-			(void)free((char *)pt);
+			free(pt);
 			goto out;
 		}
 		pt->flgs |= HASLOW;
@@ -433,7 +433,7 @@
 		 */
 		if (str_sec(up_pt, &(pt->high_time)) < 0) {
 			tty_warn(1, "Illegal upper time range %s", up_pt);
-			(void)free((char *)pt);
+			free(pt);
 			goto out;
 		}
 		pt->flgs |= HASHIGH;
@@ -446,7 +446,7 @@
 tty_warn(1,
 "Upper %s and lower %s time overlap",
 up_pt, str);
-(void)free((char *)pt);
+free(pt);
 return -1;
 			}
 		}



CVS commit: src/bin/pax

2009-12-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Dec 21 09:17:37 UTC 2009

Modified Files:
src/bin/pax: sel_subs.c

Log Message:
Free pt in another error case.
Found by Henning Petersen using cppcheck, in PR 42488.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/pax/sel_subs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/sel_subs.c
diff -u src/bin/pax/sel_subs.c:1.21 src/bin/pax/sel_subs.c:1.22
--- src/bin/pax/sel_subs.c:1.21	Sun Apr 29 20:23:34 2007
+++ src/bin/pax/sel_subs.c	Mon Dec 21 09:17:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sel_subs.c,v 1.21 2007/04/29 20:23:34 msaitoh Exp $	*/
+/*	$NetBSD: sel_subs.c,v 1.22 2009/12/21 09:17:37 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)sel_subs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: sel_subs.c,v 1.21 2007/04/29 20:23:34 msaitoh Exp $");
+__RCSID("$NetBSD: sel_subs.c,v 1.22 2009/12/21 09:17:37 wiz Exp $");
 #endif
 #endif /* not lint */
 
@@ -404,6 +404,7 @@
 			default:
 tty_warn(1, "Bad option %c with time range %s",
 *flgpt, str);
+(void)free((char *)pt);
 goto out;
 			}
 			++flgpt;



CVS commit: src/bin/pax

2009-12-13 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Dec 14 05:04:48 UTC 2009

Modified Files:
src/bin/pax: options.c

Log Message:
Don't use NOGLOB_MTCH for pax, only for tar. Fixes fix for PR 41167 and
closes PR 42301. Since the 41167 fix was pulled up to -5, this needs to
be too.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/bin/pax/options.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.105 src/bin/pax/options.c:1.106
--- src/bin/pax/options.c:1.105	Mon Jul 13 19:05:39 2009
+++ src/bin/pax/options.c	Mon Dec 14 05:04:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.105 2009/07/13 19:05:39 roy Exp $	*/
+/*	$NetBSD: options.c,v 1.106 2009/12/14 05:04:48 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.105 2009/07/13 19:05:39 roy Exp $");
+__RCSID("$NetBSD: options.c,v 1.106 2009/12/14 05:04:48 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -692,7 +692,7 @@
 	case LIST:
 	case EXTRACT:
 		for (; optind < argc; optind++)
-			if (pat_add(argv[optind], NULL, NOGLOB_MTCH) < 0)
+			if (pat_add(argv[optind], NULL, 0) < 0)
 pax_usage();
 		break;
 	case COPY:



CVS commit: src/bin/pax

2009-09-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep  6 13:38:50 UTC 2009

Modified Files:
src/bin/pax: pax.1

Log Message:
too many dots. noted by anon-ymous


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/pax/pax.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/pax.1
diff -u src/bin/pax/pax.1:1.55 src/bin/pax/pax.1:1.56
--- src/bin/pax/pax.1:1.55	Sun Dec  2 16:13:23 2007
+++ src/bin/pax/pax.1	Sun Sep  6 09:38:50 2009
@@ -1,4 +1,4 @@
-.\"$NetBSD: pax.1,v 1.55 2007/12/02 21:13:23 wiz Exp $
+.\"$NetBSD: pax.1,v 1.56 2009/09/06 13:38:50 christos Exp $
 .\"
 .\" Copyright (c) 1992 Keith Muller.
 .\" Copyright (c) 1992, 1993
@@ -33,7 +33,7 @@
 .\"
 .\"	@(#)pax.1	8.4 (Berkeley) 4/18/94
 .\"
-.Dd April 23, 2007
+.Dd September 6, 2009
 .Dt PAX 1
 .Os
 .Sh NAME
@@ -1257,11 +1257,11 @@
 ownership when copying directory trees.
 This can be done with the following commands:
 .Dl cd olddir
-.Dl pax -rw -pe .\ .../newdir
+.Dl pax -rw -pe .\ ../newdir
 which will copy the contents of
 .Pa olddir
 into
-.Pa .../newdir ,
+.Pa ../newdir ,
 preserving ownership, permissions and access times.
 .Pp
 The command:



CVS commit: src/bin/pax

2009-04-07 Thread Perry E. Metzger
Module Name:src
Committed By:   perry
Date:   Tue Apr  7 19:52:35 UTC 2009

Modified Files:
src/bin/pax: extern.h file_subs.c options.c pat_rep.c pax.h

Log Message:
Fixes from christos for pr-41167

XXX -X is still broken, but that wasn't part of this PR.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/pax/extern.h
cvs rdiff -u -r1.61 -r1.62 src/bin/pax/file_subs.c
cvs rdiff -u -r1.103 -r1.104 src/bin/pax/options.c
cvs rdiff -u -r1.28 -r1.29 src/bin/pax/pat_rep.c
cvs rdiff -u -r1.29 -r1.30 src/bin/pax/pax.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/pax/extern.h
diff -u src/bin/pax/extern.h:1.55 src/bin/pax/extern.h:1.56
--- src/bin/pax/extern.h:1.55	Sun Feb 24 20:42:46 2008
+++ src/bin/pax/extern.h	Tue Apr  7 19:52:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.55 2008/02/24 20:42:46 joerg Exp $	*/
+/*	$NetBSD: extern.h,v 1.56 2009/04/07 19:52:35 perry Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -216,7 +216,7 @@
  * pat_rep.c
  */
 int rep_add(char *);
-int pat_add(char *, char *);
+int pat_add(char *, char *, int);
 void pat_chk(void);
 int pat_sel(ARCHD *);
 int pat_match(ARCHD *);

Index: src/bin/pax/file_subs.c
diff -u src/bin/pax/file_subs.c:1.61 src/bin/pax/file_subs.c:1.62
--- src/bin/pax/file_subs.c:1.61	Thu Jan 10 04:24:51 2008
+++ src/bin/pax/file_subs.c	Tue Apr  7 19:52:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: file_subs.c,v 1.61 2008/01/10 04:24:51 tls Exp $	*/
+/*	$NetBSD: file_subs.c,v 1.62 2009/04/07 19:52:35 perry Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)file_subs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: file_subs.c,v 1.61 2008/01/10 04:24:51 tls Exp $");
+__RCSID("$NetBSD: file_subs.c,v 1.62 2009/04/07 19:52:35 perry Exp $");
 #endif
 #endif /* not lint */
 
@@ -275,15 +275,9 @@
 
 	/*
 	 * We may be running as root, so we have to be sure that link target
-	 * is not a directory, so we lstat and check
+	 * is not a directory, so we lstat and check. XXX: This is still racy.
 	 */
-	if (lstat(arcn->ln_name, &sb) < 0) {
-		syswarn(1, errno, "Cannot link to %s from %s", arcn->ln_name,
-		arcn->name);
-		return -1;
-	}
-
-	if (S_ISDIR(sb.st_mode)) {
+	if (lstat(arcn->ln_name, &sb) != -1 && S_ISDIR(sb.st_mode)) {
 		tty_warn(1, "A hard link to the directory %s is not allowed",
 		arcn->ln_name);
 		return -1;

Index: src/bin/pax/options.c
diff -u src/bin/pax/options.c:1.103 src/bin/pax/options.c:1.104
--- src/bin/pax/options.c:1.103	Sat Feb 14 08:10:06 2009
+++ src/bin/pax/options.c	Tue Apr  7 19:52:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.103 2009/02/14 08:10:06 lukem Exp $	*/
+/*	$NetBSD: options.c,v 1.104 2009/04/07 19:52:35 perry Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.103 2009/02/14 08:10:06 lukem Exp $");
+__RCSID("$NetBSD: options.c,v 1.104 2009/04/07 19:52:35 perry Exp $");
 #endif
 #endif /* not lint */
 
@@ -692,7 +692,7 @@
 	case LIST:
 	case EXTRACT:
 		for (; optind < argc; optind++)
-			if (pat_add(argv[optind], NULL) < 0)
+			if (pat_add(argv[optind], NULL, NOGLOB_MTCH) < 0)
 pax_usage();
 		break;
 	case COPY:
@@ -1234,7 +1234,7 @@
 			free(str);
 			continue;
 		}
-		if (pat_add(str, dir) < 0)
+		if (pat_add(str, dir, NOGLOB_MTCH) < 0)
 			tar_usage();
 		sawpat = 1;
 	}
@@ -1254,7 +1254,7 @@
  		break;
 	chdname = *argv++;
 	havechd++;
-} else if (pat_add(*argv++, chdname) < 0)
+} else if (pat_add(*argv++, chdname, 0) < 0)
 	tar_usage();
 else
 	sawpat = 1;
@@ -1642,7 +1642,7 @@
 cpio_usage();
 			}
 			while ((str = getline(fp)) != NULL) {
-pat_add(str, NULL);
+pat_add(str, NULL, 0);
 			}
 			fclose(fp);
 			if (getline_error) {
@@ -1781,7 +1781,7 @@
 	case LIST:
 	case EXTRACT:
 		for (; optind < argc; optind++)
-			if (pat_add(argv[optind], 0) < 0)
+			if (pat_add(argv[optind], NULL, 0) < 0)
 cpio_usage();
 		break;
 	case COPY:

Index: src/bin/pax/pat_rep.c
diff -u src/bin/pax/pat_rep.c:1.28 src/bin/pax/pat_rep.c:1.29
--- src/bin/pax/pat_rep.c:1.28	Sun Feb 24 20:42:46 2008
+++ src/bin/pax/pat_rep.c	Tue Apr  7 19:52:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pat_rep.c,v 1.28 2008/02/24 20:42:46 joerg Exp $	*/
+/*	$NetBSD: pat_rep.c,v 1.29 2009/04/07 19:52:35 perry Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)pat_rep.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: pat_rep.c,v 1.28 2008/02/24 20:42:46 joerg Exp $");
+__RCSID("$NetBSD: pat_rep.c,v 1.29 2009/04/07 19:52:35 perry Exp $");
 #endif
 #endif /* not lint */
 
@@ -75,7 +75,7 @@
 static int rep_name(char *, size_t, int *, int);
 static int tty_rename(ARCHD *);
 static int fix_path(char *,