blob: 42f73260ef11253b89a1716540993b2d8530c645 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* ascii.c - display ascii table
*
* Copyright 2017 Rob Landley <rob@landley.net>
*
* Technically 7-bit ASCII is ANSI X3.4-1986, a standard available as
* INCITS 4-1986[R2012] on ansi.org, but they charge for it.
USE_ASCII(NEWTOY(ascii, 0, TOYFLAG_USR|TOYFLAG_BIN))
config ASCII
bool "ascii"
default y
help
usage: ascii
Display ascii character set.
*/
#include "toys.h"
void ascii_main(void)
{
char *low="NULSOHSTXETXEOTENQACKBELBS HT LF VT FF CR SO SI DLEDC1DC2DC3DC4"
"NAKSYNETBCANEM SUBESCFS GS RS US ";
int x, y;
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 (x=0; x<8; x++) {
int i = x*16+y;
if (i>95 && i<100) putchar(' ');
printf("% 3d %02X ", i, i);
if (i<32 || i==127) printf("%.3s ", (i==127) ? "DEL" : low+3*i);
else printf("%c ", i);
}
xputc('\n');
}
}
|