Commit 55345134 authored by deuce's avatar deuce
Browse files

Normalize terminal types across protocols.

Note that conn_pty does not support PETSCII or ATASCII as the terminal
type since it sets TERMCAP, and I don't have a termcap entry for either of
those.
parent 384ad892
......@@ -22,6 +22,7 @@ Added support for cached font assets
Support for XTerm and TundraDraw/PabloDraw 24-bit color modes
Some PETSCII keyboard changes
Add support for DECRQSS
Terminal type is now sent as "syncterm", "PETSCII", or "ATASCII"
Version 1.0
-----------
......
......@@ -1982,3 +1982,17 @@ get_emulation(struct bbslist *bbs)
return CTERM_EMULATION_ANSI_BBS;
}
}
const char *
get_emulation_str(cterm_emulation_t emu)
{
switch (emu) {
case CTERM_EMULATION_ANSI_BBS:
return "syncterm";
case CTERM_EMULATION_PETASCII:
return "PETSCII";
case CTERM_EMULATION_ATASCII:
return "ATASCII";
}
}
......@@ -106,5 +106,6 @@ void add_bbs(char *listpath, struct bbslist *bbs);
int edit_list(struct bbslist **list, struct bbslist *item,char *listpath,int isdefault);
int get_rate_num(int rate);
cterm_emulation_t get_emulation(struct bbslist *bbs);
const char *get_emulation_str(cterm_emulation_t emu);
#endif
......@@ -156,12 +156,16 @@ int rlogin_connect(struct bbslist *bbs)
conn_send(ruser,strlen(ruser)+1,1000);
if(bbs->bpsrate) {
char sbuf[30];
sprintf(sbuf, "ansi-bbs/%d", bbs->bpsrate);
sprintf(sbuf, "%s/%d", get_emulation_str(get_emulation(bbs)), bbs->bpsrate);
conn_send(sbuf, strlen(sbuf)+1,1000);
}
else {
char sbuf[30];
sprintf(sbuf, "%s/115200", get_emulation_str(get_emulation(bbs)));
conn_send(sbuf, strlen(sbuf)+1,1000);
}
else
conn_send("ansi-bbs/115200",16,1000);
}
_beginthread(rlogin_output_thread, 0, NULL);
......
......@@ -147,6 +147,7 @@ int ssh_connect(struct bbslist *bbs)
char username[MAX_USER_LEN+1];
int rows,cols;
struct text_info ti;
const char *term;
init_uifc(TRUE, TRUE);
pthread_mutex_init(&ssh_mutex, NULL);
......@@ -236,7 +237,8 @@ int ssh_connect(struct bbslist *bbs)
uifc.pop(NULL);
uifc.pop("Setting Terminal Type");
status=cl.SetAttributeString(ssh_session, CRYPT_SESSINFO_SSH_TERMINAL, "syncterm", 8);
term = get_emulation_str(get_emulation(bbs));
status=cl.SetAttributeString(ssh_session, CRYPT_SESSINFO_SSH_TERMINAL, term, strlen(term));
/* Horrible way to determine the screen size */
textmode(screen_to_ciolib(bbs->screen_mode));
......
......@@ -158,24 +158,12 @@ BYTE* telnet_interpret(BYTE* inbuf, int inlen, BYTE* outbuf, int *outlen, cterm_
/* sub-option terminated */
if(option==TELNET_TERM_TYPE && telnet_cmd[3]==TELNET_TERM_SEND) {
char buf[32];
const char *termtype;
switch(emu) {
case CTERM_EMULATION_PETASCII:
termtype = "PETSCII";
break;
case CTERM_EMULATION_ATASCII:
termtype = "ATASCII";
break;
default:
termtype = "ANSI";
break;
}
int len=sprintf(buf,"%c%c%c%c%s%c%c"
,TELNET_IAC,TELNET_SB
,TELNET_TERM_TYPE,TELNET_TERM_IS
,termtype
,get_emulation_str(emu)
,TELNET_IAC,TELNET_SE);
lprintf(LOG_INFO,"TX: Terminal Type is %s", termtype);
lprintf(LOG_INFO,"TX: Terminal Type is %s", get_emulation_str(emu));
putcom(buf,len);
request_telnet_opt(TELNET_WILL, TELNET_NEGOTIATE_WINDOW_SIZE);
}
......
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