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 87233cf2 authored by deuce's avatar deuce

Add backspace() function to the sbbs_t which temporarily disables

CON_R_ECHOX and CON_L_ECHOX, then sends "\b \b"

Replace all instances of [br]puts("\b \b") with call to backspace()

This fixes once and for all the "spaces entered at password prompt are
echoed as spaces" problem.

Har.

PR:42->closed
parent 66d86798
......@@ -906,7 +906,7 @@ void sbbs_t::privchat(bool local)
if(ch==BS || ch==DEL) {
if(localchar) {
if(echo)
bputs("\b \b");
backspace();
localchar--;
localbuf[localline][localchar]=0; } }
else if(ch==TAB) {
......@@ -1022,11 +1022,11 @@ void sbbs_t::privchat(bool local)
}
attr(cfg.color[clr_chatremote]);
if(sys_status&SS_SPLITP && !remote_activity)
bputs("\b \b"); /* Delete fake cursor */
backspace(); /* Delete fake cursor */
remote_activity=1;
if(ch==BS || ch==DEL) {
if(remotechar) {
bputs("\b \b");
backspace();
remotechar--;
remotebuf[remoteline][remotechar]=0; } }
else if(ch==TAB) {
......@@ -1644,7 +1644,7 @@ void sbbs_t::guruchat(char* line, char* gurubuf, int gurunum, char* last_answer)
if(sbbs_random(100)) {
mswait(100+sbbs_random(300));
while(c) {
bputs("\b \b");
backspace();
mswait(50+sbbs_random(50));
c--; } } }
outchar(theanswer[i]);
......
......@@ -159,6 +159,21 @@ int sbbs_t::rprintf(char *fmt, ...)
return(rputs(sbuf));
}
/****************************************************************************/
/* Outputs destructive backspace locally and remotely (if applicable), */
/****************************************************************************/
void sbbs_t::backspace(void)
{
int oldconsole;
oldconsole=console;
console &= ~(CON_R_ECHOX|CON_L_ECHOX);
outchar('\b');
outchar(' ');
outchar('\b');
console=oldconsole;
}
/****************************************************************************/
/* Outputs character locally and remotely (if applicable), preforming echo */
/* translations (X's and r0dent emulation) if applicable. */
......@@ -197,7 +212,7 @@ void sbbs_t::outchar(char ch)
#endif
#if 0
if(console&CON_L_ECHO) {
if(console&CON_L_ECHOX && (uchar)ch>' ')
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) {
......@@ -211,7 +226,7 @@ void sbbs_t::outchar(char ch)
if(online==ON_REMOTE && console&CON_R_ECHO) {
/* TODO: If this replaces spaces, destructive backspace won't work */
/* if it doesn't, a space is displayed as a space */
if(console&CON_R_ECHOX && (uchar)ch>' ') {
if(console&CON_R_ECHOX && (uchar)ch>=' ') {
ch=text[YN][3];
if(text[YN][2]==0 || ch==0) ch='X';
}
......
......@@ -64,7 +64,7 @@ char sbbs_t::getkey(long mode)
do {
if(sys_status&SS_ABORT) {
if(mode&K_SPIN) /* back space once if on spinning cursor */
bputs("\b \b");
backspace();
return(0);
}
......@@ -219,7 +219,7 @@ char sbbs_t::getkey(long mode)
if(mode&K_NOEXASC && ch&0x80)
continue;
if(mode&K_SPIN)
bputs("\b \b");
backspace();
if(mode&K_COLD && ch>' ' && useron.misc&COLDKEYS) {
if(mode&K_UPPER)
outchar(toupper(ch));
......@@ -227,7 +227,7 @@ char sbbs_t::getkey(long mode)
outchar(ch);
while((coldkey=inkey(mode,1000))==0 && online && !(sys_status&SS_ABORT))
;
bputs("\b \b");
backspace();
if(coldkey==BS || coldkey==DEL)
continue;
if(coldkey>' ')
......@@ -461,7 +461,7 @@ long sbbs_t::getkeys(char *keys, ulong max)
return(-1);
}
if(c==BS || c==DEL) {
bputs("\b \b");
backspace();
continue;
}
}
......@@ -479,7 +479,7 @@ long sbbs_t::getkeys(char *keys, ulong max)
return(0);
}
if((ch==BS || ch==DEL) && n) {
bputs("\b \b");
backspace();
i/=10;
n--;
}
......@@ -527,7 +527,7 @@ void sbbs_t::pause()
lncntr=rows-2;
if(text[Pause][0]!='@')
for(i=0;i<j;i++)
bputs("\b \b");
backspace();
getnodedat(cfg.node_num,&thisnode,0);
nodesync();
attr(tempattrs);
......
......@@ -93,7 +93,7 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
attr(atr);
if(isprint(ch) || ch==DEL) {
for(i=0;i<l;i++)
bputs("\b \b");
backspace();
i=l=0;
}
else {
......@@ -267,7 +267,7 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
cursor_left((l-i)+1);
}
else if(!(mode&K_NOECHO))
bputs("\b \b");
backspace();
break;
case CTRL_I: /* Ctrl-I/TAB */
if(!(i%EDIT_TABSIZE)) {
......@@ -376,13 +376,13 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
i--;
l--;
if(!(mode&K_NOECHO))
bputs("\b \b");
backspace();
}
while(i && str1[i-1]!=' ') {
i--;
l--;
if(!(mode&K_NOECHO))
bputs("\b \b");
backspace();
}
}
break;
......@@ -409,7 +409,7 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
}
while(l) {
l--;
bputs("\b \b");
backspace();
}
}
}
......@@ -468,7 +468,7 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
i--;
l--;
if(!(mode&K_NOECHO))
bputs("\b \b");
backspace();
}
break;
}
......@@ -509,7 +509,7 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, long mode)
wordwrap[z]=0;
if(!(mode&K_NOECHO))
while(z--) {
rputs("\b \b");
backspace();
i--;
}
strrev(wordwrap);
......@@ -595,7 +595,7 @@ long sbbs_t::getnum(ulong max)
if(useron.misc&COLDKEYS)
ch=getkey(K_UPPER);
if(ch==BS || ch==DEL) {
bputs("\b \b");
backspace();
continue;
}
CRLF;
......@@ -613,7 +613,7 @@ long sbbs_t::getnum(ulong max)
return(i);
}
else if((ch==BS || ch==DEL) && n) {
bputs("\b \b");
backspace();
i/=10;
n--;
}
......
......@@ -94,7 +94,7 @@ char sbbs_t::handle_ctrlkey(char ch, long mode)
if(ch==CTRL_C) { /* Ctrl-C Abort */
sys_status|=SS_ABORT;
if(mode&K_SPIN) /* back space once if on spinning cursor */
bputs("\b \b");
backspace();
return(0);
}
if(ch==CTRL_Z && !(mode&K_MSG)
......
......@@ -480,6 +480,7 @@ public:
int rputs(char *str); /* BBS raw puts function */
int bprintf(char *fmt, ...); /* BBS printf function */
int rprintf(char *fmt, ...); /* BBS raw printf function */
void backspace(void); /* Output a destructive backspace via outchar */
void outchar(char ch); /* Output a char - check echo and emu. */
void center(char *str);
void clearline(void);
......
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