aboutsummaryrefslogtreecommitdiff
path: root/src/sg_raw.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_raw.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_raw.c')
-rw-r--r--src/sg_raw.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/sg_raw.c b/src/sg_raw.c
index 5c5cc039..92c22875 100644
--- a/src/sg_raw.c
+++ b/src/sg_raw.c
@@ -37,7 +37,7 @@
#include "sg_pr2serr.h"
#include "sg_unaligned.h"
-#define SG_RAW_VERSION "0.4.26 (2018-05-19)"
+#define SG_RAW_VERSION "0.4.27 (2018-06-27)"
#define DEFAULT_TIMEOUT 20
#define MIN_SCSI_CDBSZ 6
@@ -76,7 +76,8 @@ struct opts_t {
bool do_enumerate;
bool no_sense;
bool do_help;
- bool do_version;
+ bool verbose_given;
+ bool version_given;
int cdb_length;
int datain_len;
int dataout_len;
@@ -423,10 +424,11 @@ parse_cmd_line(struct opts_t * op, int argc, char *argv[])
op->timeout = n;
break;
case 'v':
+ op->verbose_given = true;
++op->verbose;
break;
case 'V':
- op->do_version = true;
+ op->version_given = true;
break;
case 'w': /* -r and -R already in use, this is --raw */
++op->raw;
@@ -437,7 +439,7 @@ parse_cmd_line(struct opts_t * op, int argc, char *argv[])
}
if (optind >= argc) {
- pr2serr("No device specified\n");
+ pr2serr("No device specified\n\n");
return SG_LIB_SYNTAX_ERROR;
}
op->device_name = argv[optind];
@@ -670,15 +672,33 @@ main(int argc, char *argv[])
memset(op, 0, sizeof(opts));
op->timeout = DEFAULT_TIMEOUT;
ret = parse_cmd_line(op, argc, argv);
+#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) {
+ pr_version();
+ goto done;
+ }
+
if (ret != 0) {
usage();
goto done;
} else if (op->do_help) {
usage();
goto done;
- } else if (op->do_version) {
- pr_version();
- goto done;
} else if (op->do_enumerate)
goto done;