From 183d2e86be3c36738a869699cb3b79137c308717 Mon Sep 17 00:00:00 2001 From: skbeh <60107333+skbeh@users.noreply.github.com> Date: Mon, 30 Aug 2021 13:24:18 +0800 Subject: [PATCH] Fix compile warning about format strings --- pigs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pigs.c b/pigs.c index 928afa3..70fcb44 100644 --- a/pigs.c +++ b/pigs.c @@ -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]); }