chiark / gitweb /
Make --both the default
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 21 Feb 2013 15:46:00 +0000 (15:46 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 21 Feb 2013 17:57:52 +0000 (17:57 +0000)
This does away with the NONE mode and the corresponding usage error.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
vbig.1
vbig.cc

diff --git a/vbig.1 b/vbig.1
index e6f230d80e8779572917a89c981d9a5141140e0d..be514251908488409289c2f831330e7b6ff516b8 100644 (file)
--- a/vbig.1
+++ b/vbig.1
@@ -19,7 +19,7 @@
 .SH NAME
 vbig \- create or verify a large but pseudo-random file
 .SH SYNOPSIS
-\fBvbig \fR[\fB--seed \fRSEED\fR] \fB--both\fR|\fB--create\fR|\fB--verify\fR \fIPATH \fR[\fISIZE\fR]
+\fBvbig \fR[\fB--seed \fRSEED\fR] [\fB--both\fR|\fB--create\fR|\fB--verify\fR] \fIPATH \fR[\fISIZE\fR]
 .br
 \fBvbig --help
 .br
@@ -45,6 +45,7 @@ Optional.
 Selects both mode.
 \fIPATH\fR will be filled with \fISIZE\fR psuedo-random bytes and
 then read to check that it contains the data just written.
+This is the default.
 .TP
 .B --create\fR, \fB-c
 Selects create mode.
diff --git a/vbig.cc b/vbig.cc
index 47f314db82ea55ead29b5c710185ffd645473baa..53ef6a575c5c69e2346df0db0a196a474f87e4eb 100644 (file)
--- a/vbig.cc
+++ b/vbig.cc
@@ -61,7 +61,6 @@ static void help(void) {
 
 // Possible modes of operation
 enum mode_type {
-  NONE,
   VERIFY,
   CREATE,
   BOTH
@@ -118,7 +117,7 @@ static bool flush = false;
 static long long size;
 
 int main(int argc, char **argv) {
-  mode_type mode = NONE;
+  mode_type mode = BOTH;
   int n;
   while((n = getopt_long(argc, argv, "+s:vcefhV", opts, 0)) >= 0) {
     switch(n) {
@@ -136,8 +135,6 @@ int main(int argc, char **argv) {
   }
   argc -= optind;
   argv += optind;
-  if(mode == NONE)
-    fatal(0, "must specify one of --verify or --create");
   if(argc > 2)
     fatal(0, "excess arguments");
   if(argc == 1 && mode == BOTH)