Fix compile warning about format strings

This commit is contained in:
skbeh 2021-08-30 13:24:18 +08:00
parent eec9367e46
commit 183d2e86be
1 changed files with 4 additions and 4 deletions

8
pigs.c
View File

@ -196,13 +196,13 @@ void print_result(int sock, int rv, cmdCmd_t cmd)
{
ch = response_buf[i];
if (printFlags & PRINT_HEX) printf(" %hhx", ch);
if (printFlags & PRINT_HEX) printf(" %x", ch);
else if (printFlags & PRINT_ASCII)
{
if (isprint(ch) || (ch == '\n') || (ch == '\r'))
printf("%c", ch);
else printf("\\x%02hhx", ch);
else printf("\\x%02x", ch);
}
else printf(" %hhu", response_buf[i]);
}
@ -249,13 +249,13 @@ void print_result(int sock, int rv, cmdCmd_t cmd)
{
ch = response_buf[i];
if (printFlags & PRINT_HEX) printf(" %hhx", ch);
if (printFlags & PRINT_HEX) printf(" %x", ch);
else if (printFlags & PRINT_ASCII)
{
if (isprint(ch) || (ch == '\n') || (ch == '\r'))
printf("%c", ch);
else printf("\\x%02hhx", ch);
else printf("\\x%02x", ch);
}
else printf(" %hhu", response_buf[i]);
}