Module Name:    src
Committed By:   riastradh
Date:           Wed Jan 22 06:17:25 UTC 2014

Modified Files:
        src/usr.bin/vndcompress: Makefile common.h main.c vndcompress.c

Log Message:
Rename block size option from `-s' to `-b'.

Makes more sense and makes it consistent with other utilities such as
pax and pigz.  This vndcompress has never gone out in a release, so
changing the name of the option shouldn't cause too many problems...


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/vndcompress/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/vndcompress/common.h
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/vndcompress/main.c
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/vndcompress/vndcompress.c

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

Modified files:

Index: src/usr.bin/vndcompress/Makefile
diff -u src/usr.bin/vndcompress/Makefile:1.11 src/usr.bin/vndcompress/Makefile:1.12
--- src/usr.bin/vndcompress/Makefile:1.11	Wed Jan 22 06:16:59 2014
+++ src/usr.bin/vndcompress/Makefile	Wed Jan 22 06:17:25 2014
@@ -106,10 +106,10 @@ check-part: .PHONY part.orig part.out
 	cmp part.orig part.out
 part.cl2: part.orig part.cl2part vndcompress
 	cp part.cl2part ${.TARGET}.tmp \
-	&& ./vndcompress -s 512 -rR part.orig ${.TARGET}.tmp \
+	&& ./vndcompress -b 512 -rR part.orig ${.TARGET}.tmp \
 	&& mv -f ${.TARGET}.tmp ${.TARGET}
 part.cl2part: part.orig vndcompress
-	./vndcompress -s 512 -p 10 part.orig ${.TARGET}.tmp \
+	./vndcompress -b 512 -p 10 part.orig ${.TARGET}.tmp \
 	&& mv -f ${.TARGET}.tmp ${.TARGET}
 part.orig:
 	head -c 12345 < /usr/share/dict/words > ${.TARGET}.tmp \
@@ -161,7 +161,7 @@ check-pipewindow: smallwindow.cl2
 #	@echo '# expecting failure...'
 #	if head -c $$((64 * 1024 * 1024)) < /dev/zero \
 #	    | (ulimit -v $$((139 * 1024)) && \
-#	        ./vndcompress -l 64m -s 512 /dev/stdin /dev/null); then \
+#	        ./vndcompress -l 64m -b 512 /dev/stdin /dev/null); then \
 #	  echo 'unexpected pass!' && exit 1; \
 #	fi
 #
@@ -169,7 +169,7 @@ check-pipewindow: smallwindow.cl2
 #check-ulimit-window:
 #	head -c $$((64 * 1024 * 1024)) < /dev/zero \
 #	| (ulimit -v $$((139 * 1024)) && \
-#	    ./vndcompress -w 8192 -l 64m -s 512 /dev/stdin /dev/null)
+#	    ./vndcompress -w 8192 -l 64m -b 512 /dev/stdin /dev/null)
 
 TESTSUFFIXES+=	in cl2 cl2x out outx
 

Index: src/usr.bin/vndcompress/common.h
diff -u src/usr.bin/vndcompress/common.h:1.4 src/usr.bin/vndcompress/common.h:1.5
--- src/usr.bin/vndcompress/common.h:1.4	Wed Jan 22 06:15:57 2014
+++ src/usr.bin/vndcompress/common.h	Wed Jan 22 06:17:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: common.h,v 1.4 2014/01/22 06:15:57 riastradh Exp $	*/
+/*	$NetBSD: common.h,v 1.5 2014/01/22 06:17:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@ struct options {
 #define	FLAG_d	0x0002	/* Decompress */
 #define	FLAG_p	0x0004	/* Partial */
 #define	FLAG_r	0x0008	/* Restart */
-#define	FLAG_s	0x0010	/* block Size */
+#define	FLAG_b	0x0010	/* Block size */
 #define	FLAG_R	0x0020	/* abort on Restart failure */
 #define	FLAG_k	0x0040	/* checKpoint blocks */
 #define	FLAG_l	0x0080	/* Length of input */

Index: src/usr.bin/vndcompress/main.c
diff -u src/usr.bin/vndcompress/main.c:1.2 src/usr.bin/vndcompress/main.c:1.3
--- src/usr.bin/vndcompress/main.c:1.2	Wed Jan 22 06:15:57 2014
+++ src/usr.bin/vndcompress/main.c	Wed Jan 22 06:17:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.2 2014/01/22 06:15:57 riastradh Exp $	*/
+/*	$NetBSD: main.c,v 1.3 2014/01/22 06:17:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: main.c,v 1.2 2014/01/22 06:15:57 riastradh Exp $");
+__RCSID("$NetBSD: main.c,v 1.3 2014/01/22 06:17:25 riastradh Exp $");
 
 #include <assert.h>
 #include <err.h>
@@ -60,8 +60,20 @@ main(int argc, char **argv)
 		warnx("unknown program name, defaulting to vndcompress: %s",
 		    getprogname());
 
-	while ((ch = getopt(argc, argv, "cdk:l:p:rRs:w:")) != -1) {
+	while ((ch = getopt(argc, argv, "b:cdk:l:p:rRw:")) != -1) {
 		switch (ch) {
+		case 'b':
+			if (ISSET(O->flags, FLAG_b)) {
+				warnx("-b may be supplied only once");
+				usage();
+			}
+			O->flags |= FLAG_b;
+			__CTASSERT(MIN_BLOCKSIZE <= MAX_BLOCKSIZE);
+			__CTASSERT(MAX_BLOCKSIZE <= LLONG_MAX);
+			O->blocksize = strsuftoll("block size", optarg,
+			    MIN_BLOCKSIZE, MAX_BLOCKSIZE);
+			break;
+
 		case 'c':
 			if (ISSET(O->flags, FLAG_d)) {
 				warnx("-c and -d are mutually exclusive");
@@ -116,18 +128,6 @@ main(int argc, char **argv)
 			O->flags |= FLAG_R;
 			break;
 
-		case 's':
-			if (ISSET(O->flags, FLAG_s)) {
-				warnx("-s may be supplied only once");
-				usage();
-			}
-			O->flags |= FLAG_s;
-			__CTASSERT(MIN_BLOCKSIZE <= MAX_BLOCKSIZE);
-			__CTASSERT(MAX_BLOCKSIZE <= LLONG_MAX);
-			O->blocksize = strsuftoll("block size", optarg,
-			    MIN_BLOCKSIZE, MAX_BLOCKSIZE);
-			break;
-
 		case 'w':
 			if (ISSET(O->flags, FLAG_w)) {
 				warnx("-w may be supplied only once");
@@ -152,8 +152,8 @@ main(int argc, char **argv)
 			usage();
 	} else {
 		assert(operation == &vndcompress);
-		if (ISSET(O->flags, ~(FLAG_c | FLAG_k | FLAG_l | FLAG_p |
-			    FLAG_r | FLAG_s | FLAG_R | FLAG_w)))
+		if (ISSET(O->flags, ~(FLAG_b | FLAG_c | FLAG_k | FLAG_l |
+			    FLAG_p | FLAG_r | FLAG_R | FLAG_w)))
 			usage();
 		if (ISSET(O->flags, FLAG_R) && !ISSET(O->flags, FLAG_r)) {
 			warnx("-R makes no sense without -r");
@@ -169,8 +169,8 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	    "Usage: %s -c [-rR] [-k <checkpoint-blocks>] [-l <length>]\n"
-	    "          [-p <partial-offset>] [-s <blocksize>] [-w <winsize>]\n"
+	    "Usage: %s -c [-rR] [-b <blocksize>] [-k <checkpoint-blocks>]\n"
+	    "          [-l <length>] [-p <partial-offset>] [-w <winsize>]\n"
 	    "          <image> <compressed-image> [<blocksize>]\n"
 	    "       %s -d <compressed-image> <image>\n",
 	    getprogname(), getprogname());

Index: src/usr.bin/vndcompress/vndcompress.c
diff -u src/usr.bin/vndcompress/vndcompress.c:1.20 src/usr.bin/vndcompress/vndcompress.c:1.21
--- src/usr.bin/vndcompress/vndcompress.c:1.20	Wed Jan 22 06:16:32 2014
+++ src/usr.bin/vndcompress/vndcompress.c	Wed Jan 22 06:17:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vndcompress.c,v 1.20 2014/01/22 06:16:32 riastradh Exp $	*/
+/*	$NetBSD: vndcompress.c,v 1.21 2014/01/22 06:17:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: vndcompress.c,v 1.20 2014/01/22 06:16:32 riastradh Exp $");
+__RCSID("$NetBSD: vndcompress.c,v 1.21 2014/01/22 06:17:25 riastradh Exp $");
 
 #include <sys/endian.h>
 
@@ -392,16 +392,16 @@ compress_init(int argc, char **argv, con
 	const char *const image_pathname = argv[0];
 	const char *const cloop2_pathname = argv[1];
 
-	/* Grab the block size either from `-s' or from the last argument.  */
+	/* Grab the block size either from `-b' or from the last argument.  */
 	__CTASSERT(0 < DEV_BSIZE);
 	__CTASSERT((MIN_BLOCKSIZE % DEV_BSIZE) == 0);
 	__CTASSERT(MIN_BLOCKSIZE <= DEF_BLOCKSIZE);
 	__CTASSERT((DEF_BLOCKSIZE % DEV_BSIZE) == 0);
 	__CTASSERT(DEF_BLOCKSIZE <= MAX_BLOCKSIZE);
 	__CTASSERT((MAX_BLOCKSIZE % DEV_BSIZE) == 0);
-	if (ISSET(O->flags, FLAG_s)) {
+	if (ISSET(O->flags, FLAG_b)) {
 		if (argc == 3) {
-			warnx("use -s or the extra argument, not both");
+			warnx("use -b or the extra argument, not both");
 			usage();
 		}
 		S->blocksize = O->blocksize;

Reply via email to