diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2017-10-09 23:49:50 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2017-10-09 23:49:50 +0000 |
commit | b2e59f46a39f19ffc18be02fad71df68974a8d0b (patch) | |
tree | 83b037b8108830c5f04d93fa50d19bbda5fb6ea1 /src/sg_rmsn.c | |
parent | dc469cf010ce1c840d6a1790cc4179ea0f5912dd (diff) | |
download | sg3_utils-b2e59f46a39f19ffc18be02fad71df68974a8d0b.tar.gz |
convert lots of two valued 'int's to bool; add sg_ll_inquiry_v2() sg_ll_write_buffer_v2() sg_get_sfs_name() and sg_decode_transportid_str()
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@719 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_rmsn.c')
-rw-r--r-- | src/sg_rmsn.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/sg_rmsn.c b/src/sg_rmsn.c index ef0d7089..4d87b0fe 100644 --- a/src/sg_rmsn.c +++ b/src/sg_rmsn.c @@ -9,6 +9,8 @@ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> +#include <stdarg.h> +#include <stdbool.h> #include <string.h> #include <getopt.h> @@ -28,17 +30,17 @@ * to the given SCSI device. */ -static const char * version_str = "1.13 20170917"; +static const char * version_str = "1.14 20171006"; #define SERIAL_NUM_SANITY_LEN (16 * 1024) static struct option long_options[] = { - {"help", 0, 0, 'h'}, - {"raw", 0, 0, 'r'}, - {"readonly", 0, 0, 'R'}, - {"verbose", 0, 0, 'v'}, - {"version", 0, 0, 'V'}, + {"help", no_argument, 0, 'h'}, + {"raw", no_argument, 0, 'r'}, + {"readonly", no_argument, 0, 'R'}, + {"verbose", no_argument, 0, 'v'}, + {"version", no_argument, 0, 'V'}, {0, 0, 0, 0}, }; @@ -60,14 +62,14 @@ static void usage() int main(int argc, char * argv[]) { + bool raw = false; + bool readonly = false; int sg_fd, res, c, sn_len, n; + int ret = 0; + int verbose = 0; unsigned char rmsn_buff[4]; unsigned char * bp = NULL; - int raw = 0; - int readonly = 0; - int verbose = 0; const char * device_name = NULL; - int ret = 0; while (1) { int option_index = 0; @@ -83,10 +85,10 @@ int main(int argc, char * argv[]) usage(); return 0; case 'r': - ++raw; + raw = true; break; case 'R': - ++readonly; + readonly = true; break; case 'v': ++verbose; |