From b3d73e7870e9598722ed0fb3e7a2449fcc5ce263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 4 Sep 2017 01:56:01 +0200 Subject: [PATCH] avoid hexcat printing nonprintable characters --- hexcat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hexcat.c b/hexcat.c index 01a9096..93c7373 100755 --- a/hexcat.c +++ b/hexcat.c @@ -32,7 +32,7 @@ int main(void) char c = getchar(); int n = c == 27 ? 33 : 36; if(c==27)printf("\n"); - printf("%2d \e[%dm%c\e[m ", c, n, c); // <- change d to X or x if you want hex + printf("%2d \e[%dm%c\e[m ", c, n, c<32||c>126?'.':c); // <- change d to X or x if you want hex } }