From b6bc9ee42522285a70bcb1a4b81f052cc1c08bf6 Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Wed, 19 Sep 2007 13:48:40 +0000 Subject: sg_stpg work, device_name simplification, restore sg_read_buffer to build git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@103 6180dd3e-e324-4e3e-922d-17de1ae2f315 --- src/sg_rmsn.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/sg_rmsn.c') diff --git a/src/sg_rmsn.c b/src/sg_rmsn.c index 375672bc..9f2bb79c 100644 --- a/src/sg_rmsn.c +++ b/src/sg_rmsn.c @@ -48,7 +48,7 @@ * to the given SCSI device. */ -static char * version_str = "1.06 20070714"; +static char * version_str = "1.07 20070918"; #define ME "sg_rmsn: " @@ -84,10 +84,9 @@ int main(int argc, char * argv[]) unsigned char * ucp = NULL; int raw = 0; int verbose = 0; - char device_name[512]; + const char * device_name = NULL; int ret = 0; - memset(device_name, 0, sizeof device_name); while (1) { int option_index = 0; @@ -117,9 +116,8 @@ int main(int argc, char * argv[]) } } if (optind < argc) { - if ('\0' == device_name[0]) { - strncpy(device_name, argv[optind], sizeof(device_name) - 1); - device_name[sizeof(device_name) - 1] = '\0'; + if (NULL == device_name) { + device_name = argv[optind]; ++optind; } if (optind < argc) { @@ -131,7 +129,7 @@ int main(int argc, char * argv[]) } } - if (0 == device_name[0]) { + if (NULL == device_name) { fprintf(stderr, "missing device name!\n"); usage(); return SG_LIB_SYNTAX_ERROR; -- cgit v1.2.3