aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-07-06 16:48:38 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2018-07-06 16:48:38 +0000
commit8b85eae099c9a554538b7051b0a047ddd0528554 (patch)
tree403772d5c315c866f0f8aa2cb1bdafa93b008ad8 /examples
parent3ef8550a26c95c97f9fdc4ef249a5767fd573e7a (diff)
downloadsg3_utils-8b85eae099c9a554538b7051b0a047ddd0528554.tar.gz
sg_pr2serr.h: add sg_scnpr() [like lk scnprintf()]; rescan-scsi-bus.sh code_manpage cleanup
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@780 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile4
-rw-r--r--examples/sg_sat_chk_power.c10
2 files changed, 8 insertions, 6 deletions
diff --git a/examples/Makefile b/examples/Makefile
index 0416a7f8..9c1f64e9 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -29,8 +29,8 @@ MAN_PREF = man8
LARGE_FILE_FLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-##CPPFLAGS = -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS)
-CPPFLAGS = -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -DDEBUG
+CPPFLAGS = -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS)
+# CPPFLAGS = -iquote ../include -D_REENTRANT $(LARGE_FILE_FLAGS) -DDEBUG
CFLAGS = -g -O2 -W -Wall
# CFLAGS = -g -O2 -Wall -DSG_KERNEL_INCLUDES
diff --git a/examples/sg_sat_chk_power.c b/examples/sg_sat_chk_power.c
index 6bf2c979..b5ea18ae 100644
--- a/examples/sg_sat_chk_power.c
+++ b/examples/sg_sat_chk_power.c
@@ -37,7 +37,9 @@
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
+
#include "sg_lib.h"
+#include "sg_pr2serr.h"
#include "sg_io_linux.h"
/* This program performs a ATA PASS-THROUGH (16) SCSI command in order
@@ -57,7 +59,7 @@
#define EBUFF_SZ 256
-static const char * version_str = "1.06 20180220";
+static const char * version_str = "1.07 20180706";
#if 0
@@ -77,19 +79,19 @@ sg_sat_decode_fixed_sense(const uint8_t * sp, int slen, char * bp,
(SPC_SK_RECOVERED_ERROR != (0xf & sp[2])) ||
(0 != sp[12]) || (ASCQ_ATA_PT_INFO_AVAILABLE != sp[13]))
return 0;
- n = snprintf(bp, max_blen, "error=0x%x, status=0x%x, device=0x%x, "
+ n = sg_scnpr(bp, max_blen, "error=0x%x, status=0x%x, device=0x%x, "
"sector_count(7:0)=0x%x%c\n", sp[3], sp[4], sp[5], sp[6],
((0x40 & sp[8]) ? '+' : ' '));
if (n >= max_blen)
return max_blen - 1;
- n += snprintf(bp + n, max_blen - n, "extend=%d, log_index=0x%x, "
+ n += sg_scnpr(bp + n, max_blen - n, "extend=%d, log_index=0x%x, "
"lba_high,mid,low(7:0)=0x%x,0x%x,0x%x%c\n",
(!!(0x80 & sp[8])), (0xf & sp[8]), sp[9], sp[10], sp[11],
((0x20 & sp[8]) ? '+' : ' '));
if (n >= max_blen)
return max_blen - 1;
if (verbose)
- n += snprintf(bp + n, max_blen - n, " sector_count_upper_nonzero="
+ n += sg_scnpr(bp + n, max_blen - n, " sector_count_upper_nonzero="
"%d, lba_upper_nonzero=%d\n", !!(0x40 & sp[8]),
!!(0x20 & sp[8]));
return (n >= max_blen) ? max_blen - 1 : n;