From f49cd332404a662128bd8b77bc28a9eab95e9fc3 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Wed, 20 Nov 2013 23:55:41 -0500 Subject: [PATCH] Add option to display bool hex character --- src/hexfile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hexfile.c b/src/hexfile.c index ef828b8..57540bc 100644 --- a/src/hexfile.c +++ b/src/hexfile.c @@ -40,10 +40,14 @@ void int2asciihex(int val, char *str, int width) { - if (width == 2) + if (width == 1) + sprintf(str , "%.1X", (u_int8_t) val); + else if (width == 2) sprintf(str , "%.2X", (u_int8_t) val); else if (width == 4) sprintf(str , "%.4X", (u_int16_t) val); + else + sprintf(str , "Err"); } /* Convert ASCII hex string to integer. */ -- 2.20.1