From 3ef8550a26c95c97f9fdc4ef249a5767fd573e7a Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Fri, 29 Jun 2018 09:46:13 +0000 Subject: 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 --- src/sg_persist.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/sg_persist.c') 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"); -- cgit v1.2.3