Skip to content
Snippets Groups Projects
Commit 0779dae1 authored by deuce's avatar deuce
Browse files

Handle ANSI strings (Application Program String, Device Control String,

Privacy Message, Operating System Command, Start Of String) in outcom.
parent 61f1d7de
Branches
Tags
No related merge requests found
...@@ -179,6 +179,17 @@ void sbbs_t::outchar(char ch) ...@@ -179,6 +179,17 @@ void sbbs_t::outchar(char ch)
{ {
int i; int i;
/*
* outchar_esc values:
* 0: No sequence
* 1: ESC
* 2: CSI
* 3: Final byte
* 4: APS, DCS, PM, or OSC
* 5: SOS
* 6: ESC inside of SOS
*/
if(console&CON_ECHO_OFF) if(console&CON_ECHO_OFF)
return; return;
if(ch==ESC) if(ch==ESC)
...@@ -186,6 +197,10 @@ void sbbs_t::outchar(char ch) ...@@ -186,6 +197,10 @@ void sbbs_t::outchar(char ch)
else if(outchar_esc==1) { else if(outchar_esc==1) {
if(ch=='[') if(ch=='[')
outchar_esc++; outchar_esc++;
else if(ch=='_' || ch=='P' || ch == '^' || ch == ']')
outchar_esc=4;
else if(ch=='X')
outchar_esc=5;
else else
outchar_esc=0; outchar_esc=0;
} }
...@@ -193,6 +208,24 @@ void sbbs_t::outchar(char ch) ...@@ -193,6 +208,24 @@ void sbbs_t::outchar(char ch)
if(ch>='@' && ch<='~') if(ch>='@' && ch<='~')
outchar_esc++; outchar_esc++;
} }
else if(outchar_esc==4) { // APS, DCS, PM, or OSC
if (ch == ESC)
outchar_esc = 1;
if (!((ch >= 0x08 && ch <= 0x0d) || (ch >= 0x20 && ch <= 0x7e)))
outchar_esc = 0;
}
else if(outchar_esc==5) { // SOS
if (ch == ESC)
outchar_esc++;
}
else if(outchar_esc==6) { // ESC inside SOS
if (ch == '\\')
outchar_esc = 1;
else if (ch == 'X')
outchar_esc = 0;
else
outchar_esc = 5;
}
else else
outchar_esc=0; outchar_esc=0;
if(term_supports(NO_EXASCII) && ch&0x80) if(term_supports(NO_EXASCII) && ch&0x80)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment