--- sbbs/src/sbbs3/con_out.cpp 2018/04/24 16:41:23 1.1.1.1 +++ sbbs/src/sbbs3/con_out.cpp 2018/04/24 16:42:36 1.1.1.2 @@ -2,13 +2,13 @@ /* Synchronet console output routines */ -/* $Id: con_out.cpp,v 1.1.1.1 2018/04/24 16:41:23 root Exp $ */ +/* $Id: con_out.cpp,v 1.1.1.2 2018/04/24 16:42:36 root Exp $ */ /**************************************************************************** * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -43,35 +43,11 @@ #include "sbbs.h" -/***************************************************/ -/* Seven bit table for EXASCII to ASCII conversion */ -/***************************************************/ -static const char *sbtbl="CUeaaaaceeeiiiAAEaAooouuyOUcLYRfaiounNao?--24!<>" - "###||||++||++++++--|-+||++--|-+----++++++++##[]#" - "abrpEout*ono%0ENE+>ESC[2J) */ +/* Performs Telnet IAC escaping */ +/* Performs column counting, line counting, and auto-pausing */ +/* Performs saveline buffering (for restoreline) */ /****************************************************************************/ void sbbs_t::outchar(char ch) { @@ -205,13 +192,13 @@ void sbbs_t::outchar(char ch) outchar_esc=0; } else if(outchar_esc==2) { - if((ch>='@' && ch<='Z') || (ch>='a' && ch<='z')) + if(ch>='@' && ch<='~') outchar_esc++; } else outchar_esc=0; if(term_supports(NO_EXASCII) && ch&0x80) - ch=sbtbl[(uchar)ch^0x80]; /* seven bit table */ + ch=exascii_to_ascii_char(ch); /* seven bit table */ if(ch==FF && lncntr>1 && !tos) { lncntr=0; CRLF; @@ -219,26 +206,8 @@ void sbbs_t::outchar(char ch) pause(); while(lncntr && online && !(sys_status&SS_ABORT)) pause(); - sys_status&=~SS_ABORT; - } - } -#if 0 - if(sys_status&SS_CAP /* Writes to Capture File */ - && (sys_status&SS_ANSCAP || (ch!=ESC /* && !lclaes() */))) - fwrite(&ch,1,1,capfile); -#endif -#if 0 - if(console&CON_L_ECHO) { - if(console&CON_L_ECHOX && (uchar)ch>=' ') - putch(password_char); - else if(cfg.node_misc&NM_NOBEEP && ch==BEL); /* Do nothing if beep */ - else if(ch==BEL) { - sbbs_beep(2000,110); - nosound(); } - else putch(ch); } -#endif if(online==ON_REMOTE && console&CON_R_ECHO) { if(console&CON_R_ECHOX && (uchar)ch>=' ' && !outchar_esc) { @@ -269,14 +238,26 @@ void sbbs_t::outchar(char ch) } } } - if(ch==LF) { + if(!outchar_esc) { + if((uchar)ch>=' ') + column++; + else if(ch=='\r') + column=0; + else if(ch=='\b') { + if(column) + column--; + } + } + if(ch==LF || column>=cols) { lncntr++; lbuflen=0; tos=0; + column=0; } else if(ch==FF) { lncntr=0; lbuflen=0; tos=1; + column=0; } else { if(!lbuflen) latr=curatr; @@ -309,16 +290,9 @@ void sbbs_t::center(char *instr) void sbbs_t::clearline(void) { - int i; - - outchar(CR); - if(term_supports(ANSI)) - rputs("\x1b[K"); - else { - for(i=0;i count) + column-=count; + else + column=0; } void sbbs_t::cleartoeol(void) { + int i,j; + if(term_supports(ANSI)) rputs("\x1b[K"); -#if 0 else { - i=j=lclwx(); /* commented out */ - while(i++<79) - outchar(' '); - while(j++<79) - outchar(BS); + i=j=column; + while(++i