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

Commits (1)
  • Rob Swindell's avatar
    Add text.dat lines for "All" and the List key ('L'), used in quoting · 064b602f
    Rob Swindell authored
    The internal line editor's quoting feature add some hard-coded strings ("Done" and "All") and the (L)ist key was hard-coded. Use the text.dat string (new and pre-existing) for these now.
    
    Also, use the new sbbs_t *_key() methods for referencing the configured key bindings (via text.dat) for these common key-stroke commands.
    Convert the text.dat strings for keys (e.g. YNQP) to uppercase always as well.
    064b602f
......@@ -724,7 +724,7 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode, bool
if(strcmp(sp, "CONTINUE") == 0) {
char ch = getkey(K_UPPER);
if(ch == text[YNQP][1] || ch == text[YNQP][2])
if(ch == no_key() || ch == quit_key())
sys_status|=SS_ABORT;
return(nulstr);
}
......@@ -779,17 +779,17 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode, bool
}
if(strcmp(sp, "YESCHAR") == 0) { // PCBoard
safe_snprintf(str, maxlen, "%c", text[YNQP][0]);
safe_snprintf(str, maxlen, "%c", yes_key());
return str;
}
if(strcmp(sp, "NOCHAR") == 0) { // PCBoard
safe_snprintf(str, maxlen, "%c", text[YNQP][1]);
safe_snprintf(str, maxlen, "%c", no_key());
return str;
}
if(strcmp(sp, "QUITCHAR") == 0) {
safe_snprintf(str, maxlen, "%c", text[YNQP][2]);
safe_snprintf(str, maxlen, "%c", quit_key());
return str;
}
......
......@@ -56,11 +56,11 @@ void sbbs_t::batchmenu()
}
ASYNC;
bputs(text[BatchMenuPrompt]);
SAFEPRINTF(keys,"CDLRU?\r%c", text[YNQP][2]);
SAFEPRINTF(keys,"CDLRU?\r%c", quit_key());
ch=(char)getkeys(keys,0);
if(ch>' ')
logch(ch,0);
if(ch==text[YNQP][2] || ch=='\r') { /* Quit */
if(ch==quit_key() || ch=='\r') { /* Quit */
lncntr=0;
done=1;
break;
......@@ -170,14 +170,14 @@ void sbbs_t::batchmenu()
break;
ASYNC;
mnemonics(text[ProtocolOrQuit]);
SAFEPRINTF(str,"%c",text[YNQP][2]);
SAFEPRINTF(str,"%c",quit_key());
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->batulcmd[0] && chk_ar(cfg.prot[i]->ar,&useron,&client)) {
sprintf(tmp,"%c",cfg.prot[i]->mnemonic);
SAFECAT(str,tmp);
}
ch=(char)getkeys(str,0);
if(ch==text[YNQP][2])
if(ch==quit_key())
break;
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->batulcmd[0] && cfg.prot[i]->mnemonic==ch
......@@ -289,7 +289,7 @@ BOOL sbbs_t::start_batch_download()
xfer_prot_menu(XFER_BATCH_DOWNLOAD);
ASYNC;
mnemonics(text[ProtocolOrQuit]);
SAFEPRINTF(str,"%c",text[YNQP][2]);
SAFEPRINTF(str,"%c",quit_key());
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->batdlcmd[0] && chk_ar(cfg.prot[i]->ar,&useron,&client)) {
sprintf(tmp,"%c",cfg.prot[i]->mnemonic);
......@@ -297,7 +297,7 @@ BOOL sbbs_t::start_batch_download()
}
ungetkey(useron.prot);
ch=(char)getkeys(str,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT)
if(ch==quit_key() || sys_status&SS_ABORT)
return(FALSE);
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->batdlcmd[0] && cfg.prot[i]->mnemonic==ch
......
......@@ -53,7 +53,7 @@ uint sbbs_t::finduser(const char* name, bool silent_failure)
errormsg(WHERE,ERR_OPEN,path,O_RDONLY);
return(0);
}
SAFEPRINTF(ynq,"%.3s",text[YNQP]);
SAFEPRINTF3(ynq, "%c%c%c", yes_key(), no_key(), quit_key());
length=(long)filelength(file);
while(pass<3) {
fseek(stream,0L,SEEK_SET); /* seek to beginning for each pass */
......@@ -77,11 +77,11 @@ uint sbbs_t::finduser(const char* name, bool silent_failure)
fclose(stream);
return(0);
}
if(c==text[YNQP][0]) {
if(c==yes_key()) {
fclose(stream);
return((l/(LEN_ALIAS+2))+1);
}
if(c==text[YNQP][2]) {
if(c==quit_key()) {
fclose(stream);
sys_status |= SS_ABORT;
return(0);
......
......@@ -368,14 +368,14 @@ bool sbbs_t::sendfile(char* fname, char prot, const char* desc, bool autohang)
else {
xfer_prot_menu(XFER_DOWNLOAD);
mnemonics(text[ProtocolOrQuit]);
sprintf(keys,"%c",text[YNQP][2]);
sprintf(keys,"%c",quit_key());
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->dlcmd[0] && chk_ar(cfg.prot[i]->ar,&useron,&client))
sprintf(keys+strlen(keys),"%c",cfg.prot[i]->mnemonic);
ch=(char)getkeys(keys,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT)
if(ch==quit_key() || sys_status&SS_ABORT)
return false;
}
for(i=0;i<cfg.total_prots;i++)
......
......@@ -144,14 +144,14 @@ bool sbbs_t::email(int usernumber, const char *top, const char *subj, long mode,
}
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
sprintf(str,"%c",text[YNQP][2]);
sprintf(str,"%c",quit_key());
for(x=0;x<cfg.total_prots;x++)
if(cfg.prot[x]->ulcmd[0] && chk_ar(cfg.prot[x]->ar,&useron,&client)) {
sprintf(tmp,"%c",cfg.prot[x]->mnemonic);
SAFECAT(str,tmp);
}
ch=(char)getkeys(str,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT) {
if(ch==quit_key() || sys_status&SS_ABORT) {
bputs(text[Aborted]);
(void)remove(msgpath);
return(false);
......
......@@ -276,10 +276,10 @@ bool sbbs_t::yesno(const char *str, long mode)
bprintf(mode, text[YesNoQuestion], str);
while(online) {
if(sys_status&SS_ABORT)
ch=text[YNQP][1];
ch=no_key();
else
ch=getkey(K_UPPER|K_COLD);
if(ch==text[YNQP][0] || ch==CR) {
if(ch==yes_key() || ch==CR) {
if(bputs(text[Yes], mode) && !(mode&P_NOCRLF))
CRLF;
if(!(mode&P_SAVEATR))
......@@ -287,7 +287,7 @@ bool sbbs_t::yesno(const char *str, long mode)
lncntr=0;
return(true);
}
if(ch==text[YNQP][1]) {
if(ch==no_key()) {
if(bputs(text[No], mode) && !(mode&P_NOCRLF))
CRLF;
if(!(mode&P_SAVEATR))
......@@ -314,10 +314,10 @@ bool sbbs_t::noyes(const char *str, long mode)
bprintf(mode, text[NoYesQuestion], str);
while(online) {
if(sys_status&SS_ABORT)
ch=text[YNQP][1];
ch=no_key();
else
ch=getkey(K_UPPER|K_COLD);
if(ch==text[YNQP][1] || ch==CR) {
if(ch==no_key() || ch==CR) {
if(bputs(text[No], mode) && !(mode&P_NOCRLF))
CRLF;
if(!(mode&P_SAVEATR))
......@@ -325,7 +325,7 @@ bool sbbs_t::noyes(const char *str, long mode)
lncntr=0;
return(true);
}
if(ch==text[YNQP][0]) {
if(ch==yes_key()) {
if(bputs(text[Yes], mode) && !(mode&P_NOCRLF))
CRLF;
if(!(mode&P_SAVEATR))
......@@ -458,7 +458,7 @@ void sbbs_t::pause()
clear_hotspots();
pause_hotspot = NULL;
}
if(ch==text[YNQP][1] || ch==text[YNQP][2])
if(ch==no_key() || ch==quit_key())
sys_status|=SS_ABORT;
else if(ch==LF) // down arrow == display one more line
lncntr=rows-2;
......
......@@ -645,8 +645,8 @@ long sbbs_t::getnum(ulong max, ulong dflt)
ch=getkey(K_UPPER);
if(ch>0x7f)
continue;
if(ch==text[YNQP][2]) {
outchar(text[YNQP][2]);
if(ch==quit_key()) {
outchar(quit_key());
if(useron.misc&COLDKEYS)
ch=getkey(K_UPPER);
if(ch==BS || ch==DEL) {
......
......@@ -466,7 +466,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, ulong* row, uint total
pause();
return(2);
}
if(ch==text[YNQP][2] || sys_status&SS_ABORT)
if(ch==quit_key() || sys_status&SS_ABORT)
return(-1);
if(ch=='S')
return(0);
......@@ -961,7 +961,7 @@ int sbbs_t::listfileinfo(uint dirnum, const char *filespec, long mode)
xfer_prot_menu(XFER_DOWNLOAD);
SYNC;
mnemonics(text[ProtocolBatchQuitOrNext]);
SAFEPRINTF(str,"B%cN\r",text[YNQP][2]);
SAFEPRINTF(str,"B%cN\r",quit_key());
if(m > 1)
SAFECAT(str, "\b-");
for(i=0;i<cfg.total_prots;i++)
......@@ -971,7 +971,7 @@ int sbbs_t::listfileinfo(uint dirnum, const char *filespec, long mode)
}
// ungetkey(useron.prot);
ch=(char)getkeys(str,0);
if(ch==text[YNQP][2]) {
if(ch==quit_key()) {
found=-1;
done=1;
}
......
......@@ -224,14 +224,14 @@ bool sbbs_t::netmail(const char *into, const char *title, long mode, smb_t* resm
{ /* Remote */
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
sprintf(str,"%c",text[YNQP][2]);
sprintf(str,"%c",quit_key());
for(x=0;x<cfg.total_prots;x++)
if(cfg.prot[x]->ulcmd[0] && chk_ar(cfg.prot[x]->ar,&useron,&client)) {
sprintf(tmp,"%c",cfg.prot[x]->mnemonic);
strcat(str,tmp);
}
ch=(char)getkeys(str,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT) {
if(ch==quit_key() || sys_status&SS_ABORT) {
bputs(text[Aborted]);
return(false);
}
......@@ -1053,14 +1053,14 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode, smb_t* resm
{ /* Remote */
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
SAFEPRINTF(str,"%c",text[YNQP][2]);
SAFEPRINTF(str,"%c",quit_key());
for(x=0;x<cfg.total_prots;x++)
if(cfg.prot[x]->ulcmd[0] && chk_ar(cfg.prot[x]->ar,&useron,&client)) {
SAFEPRINTF(tmp,"%c",cfg.prot[x]->mnemonic);
SAFECAT(str,tmp);
}
ch=(char)getkeys(str,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT) {
if(ch==quit_key() || sys_status&SS_ABORT) {
bputs(text[Aborted]);
strListFree(&rcpt_list);
remove(msgpath);
......
......@@ -400,11 +400,11 @@ void sbbs_t::qwk_sec()
action=NODE_TQWK;
ASYNC;
bputs(text[QWKPrompt]);
sprintf(str,"?UDCSP\r%c",text[YNQP][2]);
sprintf(str,"?UDCSP\r%c",quit_key());
ch=(char)getkeys(str,0);
if(ch>' ')
logch(ch,0);
if(sys_status&SS_ABORT || ch==text[YNQP][2] || ch==CR || !online)
if(sys_status&SS_ABORT || ch==quit_key() || ch==CR || !online)
break;
if(ch=='?') {
if((useron.misc&(WIP|RIP|HTML) || !(useron.misc&EXPERT))
......@@ -602,7 +602,7 @@ void sbbs_t::qwk_sec()
/***************/
xfer_prot_menu(XFER_DOWNLOAD);
mnemonics(text[ProtocolOrQuit]);
sprintf(tmp2,"%c",text[YNQP][2]);
sprintf(tmp2,"%c",quit_key());
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->dlcmd[0] && chk_ar(cfg.prot[i]->ar,&useron,&client)) {
sprintf(tmp,"%c",cfg.prot[i]->mnemonic);
......@@ -610,7 +610,7 @@ void sbbs_t::qwk_sec()
}
ungetkey(useron.prot);
ch=(char)getkeys(tmp2,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT || !online) {
if(ch==quit_key() || sys_status&SS_ABORT || !online) {
for(i=0;i<cfg.total_subs;i++)
subscan[i].ptr=sav_ptr[i]; /* re-load saved pointers */
last_ns_time=ns_time;
......@@ -658,14 +658,14 @@ void sbbs_t::qwk_sec()
/******************/
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
sprintf(tmp2,"%c",text[YNQP][2]);
sprintf(tmp2,"%c",quit_key());
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->ulcmd[0] && chk_ar(cfg.prot[i]->ar,&useron,&client)) {
sprintf(tmp,"%c",cfg.prot[i]->mnemonic);
strcat(tmp2,tmp);
}
ch=(char)getkeys(tmp2,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT || !online)
if(ch==quit_key() || sys_status&SS_ABORT || !online)
continue;
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->ulcmd[0] && cfg.prot[i]->mnemonic==ch
......
......@@ -523,10 +523,11 @@ public:
/*********************************/
char *text[TOTAL_TEXT]; /* Text from ctrl\text.dat */
char *text_sav[TOTAL_TEXT]; /* Text from ctrl\text.dat */
char yes_key(void) { return text[YNQP][0]; }
char no_key(void) { return text[YNQP][1]; }
char quit_key(void) { return text[YNQP][2]; }
char all_key(void) { return text[AllKey][0]; }
char yes_key(void) { return toupper(text[YNQP][0]); }
char no_key(void) { return toupper(text[YNQP][1]); }
char quit_key(void) { return toupper(text[YNQP][2]); }
char all_key(void) { return toupper(text[AllKey][0]); }
char list_key(void) { return toupper(text[ListKey][0]); }
char dszlog[127]; /* DSZLOG environment variable */
int keybuftop,keybufbot; /* Keyboard input buffer pointers (for ungetkey) */
......
......@@ -864,6 +864,8 @@ enum {
,DirLibKeys
,SubGroupKeys
,AllKey
,All
,ListKey
,TOTAL_TEXT
};
......
......@@ -1401,4 +1401,6 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x44\x4c" // 851 DirLibKeys
,"\x53\x47" // 852 SubGroupKeys
,"\x41" // 853 AllKey
,"\x41\x6c\x6c" // 854 All
,"\x4c" // 855 ListKey
};
......@@ -448,7 +448,7 @@ bool sbbs_t::upload(uint dirnum)
} else {
xfer_prot_menu(XFER_UPLOAD);
SYNC;
SAFEPRINTF(keys,"%c",text[YNQP][2]);
SAFEPRINTF(keys,"%c",quit_key());
if(dirnum==cfg.user_dir || !cfg.max_batup) /* no batch user to user xfers */
mnemonics(text[ProtocolOrQuit]);
else {
......@@ -461,7 +461,7 @@ bool sbbs_t::upload(uint dirnum)
strcat(keys,tmp);
}
ch=(char)getkeys(keys,0);
if(ch==text[YNQP][2] || (sys_status&SS_ABORT))
if(ch==quit_key() || (sys_status&SS_ABORT))
result = false;
else if(ch=='B') {
if(batup_total() >= cfg.max_batup)
......@@ -574,14 +574,14 @@ bool sbbs_t::recvfile(char *fname, char prot, bool autohang)
else {
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
SAFEPRINTF(keys,"%c",text[YNQP][2]);
SAFEPRINTF(keys,"%c",quit_key());
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->ulcmd[0] && chk_ar(cfg.prot[i]->ar,&useron,&client))
sprintf(keys+strlen(keys),"%c",cfg.prot[i]->mnemonic);
ch=(char)getkeys(keys,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT)
if(ch==quit_key() || sys_status&SS_ABORT)
return(false);
}
for(i=0;i<cfg.total_prots;i++)
......
......@@ -1161,14 +1161,14 @@ void sbbs_t::maindflts(user_t* user)
xfer_prot_menu(XFER_DOWNLOAD);
SYNC;
mnemonics(text[ProtocolOrQuit]);
sprintf(str,"%c",text[YNQP][2]);
sprintf(str,"%c",quit_key());
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->dlcmd[0] && chk_ar(cfg.prot[i]->ar,&useron,&client)) {
SAFEPRINTF(tmp,"%c",cfg.prot[i]->mnemonic);
strcat(str,tmp);
}
ch=(char)getkeys(str,0);
if(ch==text[YNQP][2] || sys_status&SS_ABORT) {
if(ch==quit_key() || sys_status&SS_ABORT) {
ch=' ';
putuserrec(&cfg,user->number,U_PROT,1,&ch);
}
......
......@@ -383,7 +383,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
l=(long)ftell(stream); /* l now points to start of message */
while(online) {
SAFEPRINTF(str,text[QuoteLinesPrompt],linesquoted ? "Done":"All");
SAFEPRINTF(str,text[QuoteLinesPrompt],linesquoted ? text[Done] : text[All]);
mnemonics(str);
i=getstr(quote,10,K_UPPER);
if(sys_status&SS_ABORT) {
......@@ -394,7 +394,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
}
if(!i && linesquoted)
break;
if(!i || quote[0]=='A') { /* Quote all */
if(!i || quote[0]==all_key()) { /* Quote all */
fseek(stream,l,SEEK_SET);
while(!feof(stream) && !ferror(stream)) {
if(!fgets(str,sizeof(str),stream))
......@@ -406,7 +406,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode,
}
break;
}
if(quote[0]=='L') {
if(quote[0]==list_key()) {
fseek(stream,l,SEEK_SET);
i=1;
CRLF;
......