aboutsummaryrefslogtreecommitdiff
path: root/src/sg_sanitize.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-06-29 09:46:13 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2018-06-29 09:46:13 +0000
commit3ef8550a26c95c97f9fdc4ef249a5767fd573e7a (patch)
treeae1e82f2ff36a06a02184a3eeb19cffe217fcb2f /src/sg_sanitize.c
parent11f6f1f439415e57696f473b1475f190018741c7 (diff)
downloadsg3_utils-3ef8550a26c95c97f9fdc4ef249a5767fd573e7a.tar.gz
sg_opcode: support MLU, Multiple Logical Units (18-045r1); sg_lib: sg_simple_inquiry_pt(); ./configure: option --enable-debug added for testing
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@779 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_sanitize.c')
-rw-r--r--src/sg_sanitize.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/sg_sanitize.c b/src/sg_sanitize.c
index 87a3087d..b45462fb 100644
--- a/src/sg_sanitize.c
+++ b/src/sg_sanitize.c
@@ -31,7 +31,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.10 20180523";
+static const char * version_str = "1.11 20180628";
/* Not all environments support the Unix sleep() */
#if defined(MSC_VER) || defined(__MINGW32__)
@@ -100,6 +100,8 @@ struct opts_t {
bool invert;
bool overwrite;
bool quick;
+ bool verbose_given;
+ bool version_given;
bool wait;
bool znr;
int count;
@@ -536,11 +538,12 @@ main(int argc, char * argv[])
}
break;
case 'v':
+ op->verbose_given = true;
++op->verbose;
break;
case 'V':
- pr2serr(ME "version: %s\n", version_str);
- return 0;
+ op->version_given = true;
+ break;
case 'w':
op->wait = true;
break;
@@ -568,8 +571,29 @@ main(int argc, char * argv[])
return SG_LIB_SYNTAX_ERROR;
}
}
+#ifdef DEBUG
+ pr2serr("In DEBUG mode, ");
+ if (op->verbose_given && op->version_given) {
+ pr2serr("but override: '-vV' given, zero verbose and continue\n");
+ op->verbose_given = false;
+ op->version_given = false;
+ op->verbose = 0;
+ } else if (! op->verbose_given) {
+ pr2serr("set '-vv'\n");
+ op->verbose = 2;
+ } else
+ pr2serr("keep verbose=%d\n", op->verbose);
+#else
+ if (op->verbose_given && op->version_given)
+ pr2serr("Not in DEBUG mode, so '-vV' has no special action\n");
+#endif
+ if (op->version_given) {
+ pr2serr(ME "version: %s\n", version_str);
+ return 0;
+ }
+
if (NULL == device_name) {
- pr2serr("missing device name!\n");
+ pr2serr("Missing device name!\n\n");
usage();
return SG_LIB_SYNTAX_ERROR;
}