Commit 42778dbf authored by rswindell's avatar rswindell
Browse files

Treat DEL char (ASCII 127) same as BKSP (ASCII 8).

parent b0f5def4
...@@ -66,7 +66,8 @@ char sbbs_t::getkey(long mode) ...@@ -66,7 +66,8 @@ char sbbs_t::getkey(long mode)
if(sys_status&SS_ABORT) { if(sys_status&SS_ABORT) {
if(mode&K_SPIN) /* back space once if on spinning cursor */ if(mode&K_SPIN) /* back space once if on spinning cursor */
bputs("\b \b"); bputs("\b \b");
return(0); } return(0);
}
#if 0 // moved to inkey() on AUG-29-2001 #if 0 // moved to inkey() on AUG-29-2001
if(sys_status&SS_SYSPAGE) { if(sys_status&SS_SYSPAGE) {
...@@ -212,8 +213,10 @@ char sbbs_t::getkey(long mode) ...@@ -212,8 +213,10 @@ char sbbs_t::getkey(long mode)
default: default:
if(!(cfg.node_misc&NM_WINOS2)) if(!(cfg.node_misc&NM_WINOS2))
mswait(DELAY_SPIN); mswait(DELAY_SPIN);
break; } break;
break; } }
break;
}
ch=inkey(mode); ch=inkey(mode);
if(sys_status&SS_ABORT) if(sys_status&SS_ABORT)
...@@ -236,13 +239,15 @@ char sbbs_t::getkey(long mode) ...@@ -236,13 +239,15 @@ char sbbs_t::getkey(long mode)
while((coldkey=inkey(mode))==0 && online && !(sys_status&SS_ABORT)) while((coldkey=inkey(mode))==0 && online && !(sys_status&SS_ABORT))
mswait(1); mswait(1);
bputs("\b \b"); bputs("\b \b");
if(coldkey==BS) if(coldkey==BS || coldkey==DEL)
continue; continue;
if(coldkey>SP) if(coldkey>SP)
ungetkey(coldkey); } ungetkey(coldkey);
}
if(mode&K_UPPER) if(mode&K_UPPER)
return(toupper(ch)); return(toupper(ch));
return(ch); } return(ch);
}
if(sys_status&SS_USERON && !(sys_status&SS_LCHAT)) gettimeleft(); if(sys_status&SS_USERON && !(sys_status&SS_LCHAT)) gettimeleft();
else if(online && else if(online &&
((cfg.node_dollars_per_call && now-answertime>SEC_BILLING) ((cfg.node_dollars_per_call && now-answertime>SEC_BILLING)
...@@ -250,7 +255,8 @@ char sbbs_t::getkey(long mode) ...@@ -250,7 +255,8 @@ char sbbs_t::getkey(long mode)
console&=~(CON_R_ECHOX|CON_L_ECHOX); console&=~(CON_R_ECHOX|CON_L_ECHOX);
console|=(CON_R_ECHO|CON_L_ECHO); console|=(CON_R_ECHO|CON_L_ECHO);
bputs(text[TakenTooLongToLogon]); bputs(text[TakenTooLongToLogon]);
hangup(); } hangup();
}
if(sys_status&SS_USERON && online && (timeleft/60)<(5-timeleft_warn) if(sys_status&SS_USERON && online && (timeleft/60)<(5-timeleft_warn)
&& !SYSOP && !(sys_status&SS_LCHAT)) { && !SYSOP && !(sys_status&SS_LCHAT)) {
timeleft_warn=5-(timeleft/60); timeleft_warn=5-(timeleft/60);
...@@ -258,7 +264,8 @@ char sbbs_t::getkey(long mode) ...@@ -258,7 +264,8 @@ char sbbs_t::getkey(long mode)
attr(LIGHTGRAY); attr(LIGHTGRAY);
bprintf(text[OnlyXminutesLeft] bprintf(text[OnlyXminutesLeft]
,((ushort)timeleft/60)+1,(timeleft/60) ? "s" : nulstr); ,((ushort)timeleft/60)+1,(timeleft/60) ? "s" : nulstr);
RESTORELINE; } RESTORELINE;
}
if(now!=last_telnet_cmd && now-timeout>=60 && !((now-timeout)%60)) { if(now!=last_telnet_cmd && now-timeout>=60 && !((now-timeout)%60)) {
// Let's make sure the socket is up // Let's make sure the socket is up
...@@ -313,14 +320,17 @@ void sbbs_t::mnemonics(char *str) ...@@ -313,14 +320,17 @@ void sbbs_t::mnemonics(char *str)
if(!strchr(str,'~')) { if(!strchr(str,'~')) {
mnestr=str; mnestr=str;
bputs(str); bputs(str);
return; } return;
}
ctrl_a_codes=strchr(str,1); ctrl_a_codes=strchr(str,1);
if(!ctrl_a_codes) { if(!ctrl_a_codes) {
if(str[0]=='@' && str[strlen(str)-1]=='@' && !strchr(str,SP)) { if(str[0]=='@' && str[strlen(str)-1]=='@' && !strchr(str,SP)) {
mnestr=str; mnestr=str;
bputs(str); bputs(str);
return; } return;
attr(cfg.color[clr_mnelow]); } }
attr(cfg.color[clr_mnelow]);
}
l=0L; l=0L;
while(str[l]) { while(str[l]) {
if(str[l]=='~' && str[l+1]!=0) { if(str[l]=='~' && str[l+1]!=0) {
...@@ -334,14 +344,17 @@ void sbbs_t::mnemonics(char *str) ...@@ -334,14 +344,17 @@ void sbbs_t::mnemonics(char *str)
if(!(useron.misc&ANSI)) if(!(useron.misc&ANSI))
outchar(')'); outchar(')');
if(!ctrl_a_codes) if(!ctrl_a_codes)
attr(cfg.color[clr_mnelow]); } attr(cfg.color[clr_mnelow]);
}
else { else {
if(str[l]==CTRL_A /* ctrl-a */ if(str[l]==CTRL_A /* ctrl-a */
&& str[l+1]!=0) { /* valid */ && str[l+1]!=0) { /* valid */
ctrl_a(str[++l]); /* skip the ctrl-a */ ctrl_a(str[++l]); /* skip the ctrl-a */
l++; } /* skip the attribute code */ l++; /* skip the attribute code */
else } else
outchar(str[l++]); } } outchar(str[l++]);
}
}
if(!ctrl_a_codes) if(!ctrl_a_codes)
attr(cfg.color[clr_mnecmd]); attr(cfg.color[clr_mnecmd]);
} }
...@@ -359,7 +372,8 @@ bool sbbs_t::yesno(char *str) ...@@ -359,7 +372,8 @@ bool sbbs_t::yesno(char *str)
SYNC; SYNC;
if(useron.misc&WIP) { if(useron.misc&WIP) {
strip_ctrl(question); strip_ctrl(question);
menu("yesno"); } menu("yesno");
}
else else
bprintf(text[YesNoQuestion],str); bprintf(text[YesNoQuestion],str);
while(online) { while(online) {
...@@ -371,12 +385,15 @@ bool sbbs_t::yesno(char *str) ...@@ -371,12 +385,15 @@ bool sbbs_t::yesno(char *str)
if(bputs(text[Yes])) if(bputs(text[Yes]))
CRLF; CRLF;
lncntr=0; lncntr=0;
return(true); } return(true);
}
if(ch==text[YN][1]) { if(ch==text[YN][1]) {
if(bputs(text[No])) if(bputs(text[No]))
CRLF; CRLF;
lncntr=0; lncntr=0;
return(false); } } return(false);
}
}
return(true); return(true);
} }
...@@ -393,7 +410,8 @@ bool sbbs_t::noyes(char *str) ...@@ -393,7 +410,8 @@ bool sbbs_t::noyes(char *str)
SYNC; SYNC;
if(useron.misc&WIP) { if(useron.misc&WIP) {
strip_ctrl(question); strip_ctrl(question);
menu("noyes"); } menu("noyes");
}
else else
bprintf(text[NoYesQuestion],str); bprintf(text[NoYesQuestion],str);
while(online) { while(online) {
...@@ -405,12 +423,15 @@ bool sbbs_t::noyes(char *str) ...@@ -405,12 +423,15 @@ bool sbbs_t::noyes(char *str)
if(bputs(text[No])) if(bputs(text[No]))
CRLF; CRLF;
lncntr=0; lncntr=0;
return(true); } return(true);
}
if(ch==text[YN][0]) { if(ch==text[YN][0]) {
if(bputs(text[Yes])) if(bputs(text[Yes]))
CRLF; CRLF;
lncntr=0; lncntr=0;
return(false); } } return(false);
}
}
return(true); return(true);
} }
...@@ -436,35 +457,43 @@ long sbbs_t::getkeys(char *keys, ulong max) ...@@ -436,35 +457,43 @@ long sbbs_t::getkeys(char *keys, ulong max)
attr(LIGHTGRAY); attr(LIGHTGRAY);
CRLF; CRLF;
lncntr=0; lncntr=0;
return(-1); } return(-1);
}
if(ch && !n && (strchr(str,ch))) { /* return character if in string */ if(ch && !n && (strchr(str,ch))) { /* return character if in string */
outchar(ch); outchar(ch);
if(useron.misc&COLDKEYS && ch>SP) { if(useron.misc&COLDKEYS && ch>SP) {
while(online && !(sys_status&SS_ABORT)) { while(online && !(sys_status&SS_ABORT)) {
c=getkey(0); c=getkey(0);
if(c==CR || c==BS) if(c==CR || c==BS || c==DEL)
break; } break;
}
if(sys_status&SS_ABORT) { if(sys_status&SS_ABORT) {
CRLF; CRLF;
return(-1); } return(-1);
if(c==BS) { }
if(c==BS || c==DEL) {
bputs("\b \b"); bputs("\b \b");
continue; } } continue;
}
}
attr(LIGHTGRAY); attr(LIGHTGRAY);
CRLF; CRLF;
lncntr=0; lncntr=0;
return(ch); } return(ch);
}
if(ch==CR && max) { /* return 0 if no number */ if(ch==CR && max) { /* return 0 if no number */
attr(LIGHTGRAY); attr(LIGHTGRAY);
CRLF; CRLF;
lncntr=0; lncntr=0;
if(n) if(n)
return(i|0x80000000L); /* return number plus high bit */ return(i|0x80000000L); /* return number plus high bit */
return(0); } return(0);
if(ch==BS && n) { }
if((ch==BS || ch==DEL) && n) {
bputs("\b \b"); bputs("\b \b");
i/=10; i/=10;
n--; } n--;
}
else if(max && isdigit(ch) && (i*10)+(ch&0xf)<=max && (ch!='0' || n)) { else if(max && isdigit(ch) && (i*10)+(ch&0xf)<=max && (ch!='0' || n)) {
i*=10; i*=10;
n++; n++;
...@@ -474,7 +503,10 @@ long sbbs_t::getkeys(char *keys, ulong max) ...@@ -474,7 +503,10 @@ long sbbs_t::getkeys(char *keys, ulong max)
attr(LIGHTGRAY); attr(LIGHTGRAY);
CRLF; CRLF;
lncntr=0; lncntr=0;
return(i|0x80000000L); } } } return(i|0x80000000L);
}
}
}
return(-1); return(-1);
} }
......
...@@ -481,7 +481,7 @@ long sbbs_t::getnum(ulong max) ...@@ -481,7 +481,7 @@ long sbbs_t::getnum(ulong max)
outchar('Q'); outchar('Q');
if(useron.misc&COLDKEYS) if(useron.misc&COLDKEYS)
ch=getkey(K_UPPER); ch=getkey(K_UPPER);
if(ch==BS) { if(ch==BS || ch==DEL) {
bputs("\b \b"); bputs("\b \b");
continue; } continue; }
CRLF; CRLF;
...@@ -495,7 +495,7 @@ long sbbs_t::getnum(ulong max) ...@@ -495,7 +495,7 @@ long sbbs_t::getnum(ulong max)
CRLF; CRLF;
lncntr=0; lncntr=0;
return(i); } return(i); }
else if(ch==BS && n) { else if((ch==BS || ch==DEL) && n) {
bputs("\b \b"); bputs("\b \b");
i/=10; i/=10;
n--; } n--; }
......
...@@ -452,7 +452,7 @@ uint sbbs_t::gettmplt(char *strout,char *templt, long mode) ...@@ -452,7 +452,7 @@ uint sbbs_t::gettmplt(char *strout,char *templt, long mode)
bputs(str); bputs(str);
c=strlen(str); } c=strlen(str); }
while((ch=getkey(mode))!=CR && online && !(sys_status&SS_ABORT)) { while((ch=getkey(mode))!=CR && online && !(sys_status&SS_ABORT)) {
if(ch==BS) { if(ch==BS || ch==DEL) {
if(!c) if(!c)
continue; continue;
for(ch=1,c--;c;c--,ch++) for(ch=1,c--;c;c--,ch++)
......
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