aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2017-02-18 12:51:35 -0600
committerRob Landley <rob@landley.net>2017-02-18 12:51:35 -0600
commitac22dfa9c751ca15c2cd90b6a702ebd960b202ee (patch)
tree287774ce4f5e4b3092ad64e2b41f3d2ac22b9341 /toys
parent18cd02cc3e6529bcd3c8bcdf005e78925a320e35 (diff)
downloadtoybox-ac22dfa9c751ca15c2cd90b6a702ebd960b202ee.tar.gz
Ascii only showed 15 rows instead of 16 and spacing was wrong for 96-100.
Diffstat (limited to 'toys')
-rw-r--r--toys/other/ascii.c7
1 files 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');
}