Properly handle namedict in od(1)
I added the [127]-index but forgot that this increases the length, breaking a later check.
This commit is contained in:
parent
0d6d1dc02f
commit
365f392d3c
3
od.c
3
od.c
|
@ -36,7 +36,6 @@ printchar(FILE *f, unsigned char c)
|
||||||
"so", "si", "dle", "dc1", "dc2", "dc3", "dc4",
|
"so", "si", "dle", "dc1", "dc2", "dc3", "dc4",
|
||||||
"nak", "syn", "etb", "can", "em", "sub", "esc",
|
"nak", "syn", "etb", "can", "em", "sub", "esc",
|
||||||
"fs", "gs", "rs", "us", "sp",
|
"fs", "gs", "rs", "us", "sp",
|
||||||
[127] = "del"
|
|
||||||
};
|
};
|
||||||
const char *escdict[] = {
|
const char *escdict[] = {
|
||||||
['\0'] = "\\0", ['\a'] = "\\a",
|
['\0'] = "\\0", ['\a'] = "\\a",
|
||||||
|
@ -56,7 +55,7 @@ printchar(FILE *f, unsigned char c)
|
||||||
case 'a':
|
case 'a':
|
||||||
c &= ~128; /* clear high bit as required by standard */
|
c &= ~128; /* clear high bit as required by standard */
|
||||||
if (c < LEN(namedict) || c == 127) {
|
if (c < LEN(namedict) || c == 127) {
|
||||||
fprintf(f, "%3s ", namedict[c]);
|
fprintf(f, "%3s ", (c == 127) ? "del" : namedict[c]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user