Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions aha.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,8 @@ int main(int argc,char* args[])
struct State oldstate;
int c;
int negative = 0; //No negative image
int special_char = 0; //No special characters
int special_char[2] = {0, 1}; //No special characters
int shift=0;
int line=0;
int momline=0;
int newline=-1;
Expand Down Expand Up @@ -741,7 +742,7 @@ int main(int argc,char* args[])
{
case 0: // 0 - Reset all
state = default_state;
negative=0; special_char=0;
negative=0; special_char[0]=0; special_char[1]=1; shift=0;
break;

case 1: // 1 - Enable Bold
Expand Down Expand Up @@ -1113,16 +1114,17 @@ int main(int argc,char* args[])
c = getNextChar(fp);
}
else
if ( c == '(' ) //Some VT100 ESC sequences, which should be ignored
if ( c == '(' || c == ')' ) //Some VT100 ESC sequences, which should be ignored
{
int slot = c == '(' ? 0 : 1;
//Reading (and ignoring!) one character should work for "(B"
//(US ASCII character set), "(A" (UK ASCII character set) and
//"(0" (Graphic). This whole "standard" is fucked up. Really...
c = getNextChar(fp);
if (c == '0') //we do not ignore ESC(0 ;)
special_char=1;
special_char[slot]=1;
else
special_char=0;
special_char[slot]=0;
}
}
else
Expand All @@ -1138,6 +1140,14 @@ int main(int argc,char* args[])
if (c==13 && opts.ignore_cr)
{
}
else if (c==14) // SO
{
shift=1;
}
else if (c==15) // SI
{
shift=0;
}
else if (c!=8)
{
line++;
Expand Down Expand Up @@ -1172,7 +1182,7 @@ int main(int argc,char* args[])
momline++;
line=0;
default:
if (special_char)
if (special_char[shift])
printf("%s",ansi_vt220_character_set[((int)c+32) & 255]);
else
printf("%c",c);
Expand Down