aboutsummaryrefslogtreecommitdiff
path: root/src/sg_persist.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_persist.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_persist.c')
-rw-r--r--src/sg_persist.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/sg_persist.c b/src/sg_persist.c
index 919aad6f..f582d32e 100644
--- a/src/sg_persist.c
+++ b/src/sg_persist.c
@@ -66,6 +66,8 @@ struct opts_t {
bool readonly;
bool readwrite_force;/* set when '-yy' given. Ooverrides environment
variable SG_PERSIST_IN_RDONLY and opens RW */
+ bool verbose_given;
+ bool version_given;
int hex;
int num_transportids;
int prin_sa;
@@ -1094,11 +1096,12 @@ main(int argc, char * argv[])
op->param_unreg = true;
break;
case 'v':
+ op->verbose_given = true;
++op->verbose;
break;
case 'V':
- pr2serr("version: %s\n", version_str);
- return 0;
+ op->version_given = true;
+ break;
case 'X':
if (0 != build_transportid(optarg, op)) {
pr2serr("bad argument to '--transport-id'\n");
@@ -1152,6 +1155,27 @@ main(int argc, char * argv[])
usage(help);
return 0;
}
+#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("version: %s\n", version_str);
+ return 0;
+ }
if (NULL == device_name) {
pr2serr("No device name given\n");