diff options
Diffstat (limited to 'src/sg_sanitize.c')
-rw-r--r-- | src/sg_sanitize.c | 32 |
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; } |