From ac22dfa9c751ca15c2cd90b6a702ebd960b202ee Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 18 Feb 2017 12:51:35 -0600 Subject: Ascii only showed 15 rows instead of 16 and spacing was wrong for 96-100. --- toys/other/ascii.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/toys/other/ascii.c b/toys/other/ascii.c index 4d33ae61..6689191c 100644 --- a/toys/other/ascii.c +++ b/toys/other/ascii.c @@ -26,13 +26,14 @@ void ascii_main(void) for (x = 0; x<8; x++) printf("Dec Hex%*c", 2+2*(x<2)+(x>4), ' '); xputc('\n'); - for (y=0; y<15; y++) { + for (y=0; y<=15; y++) { for (x=0; x<8; x++) { int i = x*16+y; + if (i>95 && i<100) putchar(' '); printf("% 3d %02X ", i, i); - if (i<32) printf("%.3s ", low+3*i); - else printf("%*c ", 2*(i>95 && i<100), i); + if (i<32 || i==127) printf("%.3s ", (i==127) ? "DEL" : low+3*i); + else printf("%c ", i); } xputc('\n'); } -- cgit v1.2.3