Nicer output. Refactor code a little.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2712 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2004-10-08 18:40:03 +00:00
1 parent 0a044108ac
commit f9fe027586
1 file changed
+6 -8
+6 -8
View File
@@ -207,15 +207,13 @@ int main(int argc, char *argv[])
} else
if (res != value) {
e1++;
if (size == I2C_SMBUS_WORD_DATA)
fprintf(stderr, "Warning - data mismatch - wrote "
"0x%04x, read back 0x%04x\n", value, res);
else
fprintf(stderr, "Warning - data mismatch - wrote "
"0x%02x, read back 0x%02x\n", value, res);
fprintf(stderr, "Warning - data mismatch - wrote "
"0x%0*x, read back 0x%0*x\n",
size == I2C_SMBUS_WORD_DATA ? 4 : 2, value,
size == I2C_SMBUS_WORD_DATA ? 4 : 2, res);
} else {
fprintf(stderr, "Value 0x%x written, readback matched\n",
value);
fprintf(stderr, "Value 0x%0*x written, readback matched\n",
size == I2C_SMBUS_WORD_DATA ? 4 : 2, value);
}
exit(e1);