diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2022-06-27 18:26:54 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2022-06-27 18:26:54 +0000 |
commit | 30842a3103045e471ec8169f09135bb6766e5e1d (patch) | |
tree | a37d6d0bc773726fff04c163457d3bb22e6efa71 /src/sg_rep_zones.c | |
parent | 2e225c87784735360e9619766efe06782179a86a (diff) | |
download | sg3_utils-30842a3103045e471ec8169f09135bb6766e5e1d.tar.gz |
more JSON work: sense data and vpd device id, start on sg_vpd
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@956 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_rep_zones.c')
-rw-r--r-- | src/sg_rep_zones.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/sg_rep_zones.c b/src/sg_rep_zones.c index a8d4cbc9..8fc733ff 100644 --- a/src/sg_rep_zones.c +++ b/src/sg_rep_zones.c @@ -40,7 +40,7 @@ * Based on zbc2r12.pdf */ -static const char * version_str = "1.39 20220616"; +static const char * version_str = "1.40 20220625"; #define MY_NAME "sg_rep_zones" @@ -188,8 +188,7 @@ usage(int h) " --inhex=FN|-i FN decode contents of FN, ignore DEVICE\n" " --json[=JO]|-j[JO] output in JSON instead of human " "readable text.\n" - " Optional argument JO see sg3_utils " - "manpage\n" + " Use --json=? for JSON help\n" " --locator=LBA|-l LBA similar to --start= option\n" " --maxlen=LEN|-m LEN max response length (allocation " "length in cdb)\n" @@ -1216,8 +1215,15 @@ main(int argc, char * argv[]) break; case 'j': if (! sgj_init_state(&op->json_st, optarg)) { - pr2serr("bad argument to --json= option, unrecognized " - "character '%c'\n", op->json_st.first_bad_char); + int bad_char = op->json_st.first_bad_char; + char e[1500]; + + if (bad_char) { + pr2serr("bad argument to --json= option, unrecognized " + "character '%c'\n\n", bad_char); + } + sg_json_usage(0, e, sizeof(e)); + pr2serr("%s", e); return SG_LIB_SYNTAX_ERROR; } break; @@ -1512,7 +1518,7 @@ the_end: ret = (ret >= 0) ? ret : SG_LIB_CAT_OTHER; if (as_json) { if (0 == op->do_hex) - sgj_pr2file(&op->json_st, NULL, ret, stdout); + sgj_pr2file(jsp, NULL, ret, stdout); sgj_finish(jsp); } return ret; |