Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit afea03bb authored by rswindell's avatar rswindell

Auto-detect SyncTERM/CTerm version upon answering terminal connections.

Over-hauled the ANSI detection a bit too.
parent 957bd1d4
......@@ -275,6 +275,7 @@ bool sbbs_t::answer()
rioctl(IOFI); /* flush input buffer */
putcom( "\r\n" /* locate cursor at column 1 */
"\x1b[s" /* save cursor position (necessary for HyperTerm auto-ANSI) */
"\x1b[0c" /* Request CTerm version */
"\x1b[255B" /* locate cursor as far down as possible */
"\x1b[255C" /* locate cursor as far right as possible */
"\b_" /* need a printable at this location to actually move cursor */
......@@ -316,24 +317,11 @@ bool sbbs_t::answer()
str[l]=0;
if(l) {
truncsp(str);
c_escape_str(str,tmp,sizeof(tmp)-1,TRUE);
lprintf(LOG_DEBUG,"Node %d received terminal auto-detection response: '%s'"
,cfg.node_num,tmp);
if(str[0]==ESC && str[1]=='[' && str[l-1]=='R') {
int x,y;
if(terminal[0]==0)
SAFECOPY(terminal,"ANSI");
autoterm|=(ANSI|COLOR);
if(sscanf(str+2,"%u;%u",&y,&x)==2) {
lprintf(LOG_DEBUG,"Node %d received ANSI cursor position report: %ux%u"
,cfg.node_num, x, y);
/* Sanity check the coordinates in the response: */
if(x>=40 && x<=255) cols=x;
if(y>=10 && y<=255) rows=y;
}
}
truncsp(str);
if(strstr(str,"RIPSCRIP")) {
if(terminal[0]==0)
SAFECOPY(terminal,"RIP");
......@@ -348,6 +336,30 @@ bool sbbs_t::answer()
autoterm|=HTML;
}
#endif
char* tokenizer = NULL;
char* p = strtok_r(str, "\x1b", &tokenizer);
while(p != NULL) {
int x,y;
if(terminal[0]==0)
SAFECOPY(terminal,"ANSI");
autoterm|=(ANSI|COLOR);
if(sscanf(p, "[%u;%uR", &y, &x) == 2) {
lprintf(LOG_DEBUG,"Node %d received ANSI cursor position report: %ux%u"
,cfg.node_num, x, y);
/* Sanity check the coordinates in the response: */
if(x>=40 && x<=255) cols=x;
if(y>=10 && y<=255) rows=y;
} else if(sscanf(p, "[=67;84;101;114;109;%u;%u", &x, &y) == 2 && *lastchar(p) == 'c') {
lprintf(LOG_INFO,"Node %d received CTerm version report: %u.%u"
,cfg.node_num, x, y);
cterm_version = (x*1000) + y;
if(cterm_version >= 1061)
autoterm |= CTERM_FONTS;
}
p = strtok_r(NULL, "\x1b", &tokenizer);
}
}
else if(terminal[0]==0)
SAFECOPY(terminal,"DUMB");
......
......@@ -4031,6 +4031,7 @@ void sbbs_t::reset_logon_vars(void)
cols=80;
lncntr=0;
autoterm=0;
cterm_version = 0;
lbuflen=0;
slcnt=0;
altul=0;
......
......@@ -452,7 +452,8 @@ public:
long cols; /* Current number of Columns for User */
long column; /* Current column counter (for line counter) */
long lastlinelen; /* The previously displayed line length */
long autoterm; /* Autodetected terminal type */
long autoterm; /* Auto-detected terminal type */
long cterm_version; /* (MajorVer*1000) + MinorVer */
char slbuf[SAVE_LINES][LINE_BUFSIZE+1]; /* Saved for redisplay */
char slatr[SAVE_LINES]; /* Starting attribute of each line */
char slcuratr[SAVE_LINES]; /* Ending attribute of each line */
......
......@@ -483,6 +483,10 @@ typedef enum { /* Values for xtrn_t.event */
#define CON_LEFTARROW (1<<15) /* Left arrow hit, exiting from getstr() */
#define CON_INSERT (1<<16) /* Insert mode, for getstr() */
#define CON_DELETELINE (1<<17) /* Deleted line, exiting from getstr() */
#define CON_NORM_FONT (1<<18) /* Alt normal font set activated */
#define CON_HIGH_FONT (1<<19) /* Alt high-intensity font activated */
#define CON_BLINK_FONT (1<<20) /* Alt blink attribute font activated */
#define CON_HBLINK_FONT (1<<21) /* Alt high-blink attribute font activated */
/* Number of milliseconds */
#define DELAY_AUTOHG 1500 /* Delay for auto-hangup (xfer) */
......@@ -646,10 +650,11 @@ typedef enum { /* Values for xtrn_t.event */
#define AUTOHANG (1L<<20) /* Auto-hang-up after transfer */
#define WIP (1L<<21) /* Supports WIP terminal emulation */
#define AUTOLOGON (1L<<22) /* AutoLogon via IP */
#define HTML (1L<<23) /* Using Deuce's HTML terminal */
#define HTML (1L<<23) /* Using Zuul/HTML terminal */
#define NOPAUSESPIN (1L<<24) /* No spinning cursor at pause prompt */
#define CTERM_FONTS (1L<<25) /* Loadable fonts are supported */
#define TERM_FLAGS (ANSI|COLOR|NO_EXASCII|RIP|WIP|HTML)
#define TERM_FLAGS (ANSI|COLOR|NO_EXASCII|RIP|WIP|HTML|CTERM_FONTS)
/* Special terminal key mappings */
#define TERM_KEY_HOME CTRL_B
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment