Fix behavior of JIS0201 SHIFT-OUT and SHIFT-IN

By Micah Cowan: "the meanings of the SHIFT-OUT (0x0E) and SHIFT-IN
(0x0F) seem to be reversed: SHIFT-OUT is intended to invoke G0 into GL,
and SHIFT-IN to invoke G1 into GR; however, the command

  $ printf 'Hell\x0Er' | figlet

appears to cause figlet to interpret the final "r" as... an "r", whereas

  $ printf 'Hell\x0Fr' | figlet

causes figlet to interpret the final "r" to be interpreted as SMALL
LETTER o WITH GRAVE ACCENT. I would expect exactly the opposite results.
A quick look at iso2022() seems to verify that character code 14 is
invoking G0 to GL, rather than G1."

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
Micah Cowan 2011-01-10 17:07:59 -02:00 committed by Claudio Matsuoka
parent fd06fbe143
commit 634ec7e6c8

View File

@ -1658,12 +1658,12 @@ inchr iso2022()
if (ch == 27) ch = Agetchar() + 0x100; /* ESC x */
if (ch == 0x100 + '$') ch = Agetchar() + 0x200; /* ESC $ x */
switch (ch) {
case 14: /* invoke G0 into GL */
gl = 0;
return iso2022();
case 15: /* invoke G1 into GL */
case 14: /* invoke G1 into GL */
gl = 1;
return iso2022();
case 15: /* invoke G0 into GL */
gl = 0;
return iso2022();
case 142: case 'N' + 0x100: /* invoke G2 into GL for next char */
save_gl = gl; save_gr = gr;
gl = gr = 2;