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 949b7fac authored by deuce's avatar deuce

Kill the SP macro in preperation for supporting XCurses

parent 24e86dd8
......@@ -86,16 +86,16 @@ void prep_desc(uchar *str)
int i,j;
for(i=j=0;str[i] && j < sizeof(tmp)-1;i++) {
if(j && str[i]==SP && tmp[j-1]==SP && (mode&KEEP_SPACE))
if(j && str[i]==' ' && tmp[j-1]==' ' && (mode&KEEP_SPACE))
tmp[j++]=str[i];
else if(j && str[i]<=SP && tmp[j-1]==SP)
else if(j && str[i]<=' ' && tmp[j-1]==' ')
continue;
else if(i && !isalnum(str[i]) && str[i]==str[i-1])
continue;
else if(str[i]>=SP)
else if(str[i]>=' ')
tmp[j++]=str[i];
else if(str[i]==TAB || (str[i]==CR && str[i+1]==LF))
tmp[j++]=SP;
tmp[j++]=' ';
}
tmp[j]=0;
strcpy(str,tmp);
......@@ -277,7 +277,7 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
memset(ext,0,513);
read(file,ext,512);
for(i=512;i;i--)
if(ext[i-1]>SP)
if(ext[i-1]>' ')
break;
ext[i]=0;
if(mode&ASCII_ONLY)
......@@ -289,7 +289,7 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
if(isalpha(tmpext[i]))
break;
sprintf(f.desc,"%.*s",LEN_FDESC,tmpext+i);
for(i=0;f.desc[i]>=SP && i<LEN_FDESC;i++)
for(i=0;f.desc[i]>=' ' && i<LEN_FDESC;i++)
;
f.desc[i]=0; }
close(file);
......@@ -350,7 +350,7 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
nextline[0]=0;
fgets(nextline,255,stream);
truncsp(curline);
if(curline[0]<=SP || (mode&ASCII_ONLY && (uchar)curline[0]>=0x7e))
if(curline[0]<=' ' || (mode&ASCII_ONLY && (uchar)curline[0]>=0x7e))
continue;
printf("%s\n",curline);
strcpy(fname,curline);
......@@ -358,7 +358,7 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
p=strchr(fname,'.');
if(!p || p==fname || p>fname+8) /* no dot or invalid dot location */
continue;
p=strchr(p,SP);
p=strchr(p,' ');
if(p) *p=0;
else /* no space after filename? */
continue;
......@@ -372,7 +372,7 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
continue;
for(i=0;i<12;i++)
if(f.name[i]<SP || (mode&ASCII_ONLY && (uchar)f.name[i]>0x7e))
if(f.name[i]<' ' || (mode&ASCII_ONLY && (uchar)f.name[i]>0x7e))
break;
if(i<12) /* Ctrl chars or EX-ASCII in filename? */
......@@ -407,20 +407,20 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
if(dskip && strlen(curline)>=dskip) p=curline+dskip;
else {
p++;
while(*p==SP) p++;
while(*p==' ') p++;
}
SAFECOPY(tmp,p);
prep_desc(tmp);
sprintf(f.desc+strlen(f.desc),"%.*s",(int)(LEN_FDESC-strlen(f.desc)),tmp);
if(nextline[0]==SP || strlen(p)>LEN_FDESC) { /* ext desc */
if(nextline[0]==' ' || strlen(p)>LEN_FDESC) { /* ext desc */
if(!(mode&NO_EXTEND)) {
memset(ext,0,513);
f.misc|=FM_EXTDESC;
sprintf(ext,"%s\r\n",p);
}
if(nextline[0]==SP) {
if(nextline[0]==' ') {
strcpy(str,nextline); /* tack on to end of desc */
p=str+dskip;
while(*p && *p<=' ') p++;
......@@ -436,14 +436,14 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
}
while(!feof(stream) && !ferror(stream) && strlen(ext)<512) {
if(nextline[0]!=SP)
if(nextline[0]!=' ')
break;
truncsp(nextline);
printf("%s\n",nextline);
if(!(mode&NO_EXTEND)) {
f.misc|=FM_EXTDESC;
p=nextline+dskip;
while(*p==SP) p++;
while(*p==' ') p++;
strcat(ext,p);
strcat(ext,"\r\n");
}
......@@ -480,7 +480,7 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
memset(ext,0,513);
read(file,ext,512);
for(i=512;i;i--)
if(ext[i-1]>SP)
if(ext[i-1]>' ')
break;
ext[i]=0;
if(mode&ASCII_ONLY)
......@@ -492,7 +492,7 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
if(isalpha(tmpext[i]))
break;
sprintf(f.desc,"%.*s",LEN_FDESC,tmpext+i);
for(i=0;f.desc[i]>=SP && i<LEN_FDESC;i++)
for(i=0;f.desc[i]>=' ' && i<LEN_FDESC;i++)
;
f.desc[i]=0;
}
......@@ -597,7 +597,7 @@ void synclist(char *inpath, int dirnum)
if(!fgets(str,1000,stream))
break;
truncsp(str);
p=strchr(str,SP);
p=strchr(str,' ');
if(p) *p=0;
if(!stricmp(str,fname))
found=1;
......@@ -891,7 +891,7 @@ int main(int argc, char **argv)
read(file,ext,512);
if(!(mode&KEEP_DESC)) {
sprintf(f.desc,"%.*s",LEN_FDESC,ext);
for(i=0;f.desc[i]>=SP && i<LEN_FDESC;i++)
for(i=0;f.desc[i]>=' ' && i<LEN_FDESC;i++)
;
f.desc[i]=0;
}
......
......@@ -51,7 +51,7 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg)
uint i,j,n,artype=AR_LEVEL,not=0,equal=0;
for(i=j=0;str[i];i++) {
if(str[i]==SP)
if(str[i]==' ')
continue;
if(str[i]=='(') {
......@@ -479,7 +479,7 @@ uchar* arstr(ushort* count, char* str, scfg_t* cfg)
if(artype==AR_SUBCODE || artype==AR_DIRCODE || artype==AR_SHELL) {
for(n=0;n<8
&& str[i]
&& str[i]!=SP
&& str[i]!=' '
&& str[i]!='('
&& str[i]!=')'
&& str[i]!='='
......
......@@ -59,7 +59,7 @@ int sbbs_t::show_atcode(char *instr)
tp=strchr(str+1,'@');
if(!tp) /* no terminating @ */
return(0);
sp=strchr(str+1,SP);
sp=strchr(str+1,' ');
if(sp && sp<tp) /* space before terminating @ */
return(0);
len=(tp-str)+1;
......@@ -325,7 +325,7 @@ char* sbbs_t::atcode(char* sp, char* str)
if(!strcmp(sp,"FIRST")) {
strcpy(str,useron.alias);
tp=strchr(str,SP);
tp=strchr(str,' ');
if(tp) *tp=0;
return(str);
}
......@@ -359,7 +359,7 @@ char* sbbs_t::atcode(char* sp, char* str)
char* p=strchr(useron.location,',');
if(p) {
p++;
if(*p==SP)
if(*p==' ')
p++;
return(p);
}
......@@ -809,7 +809,7 @@ char* sbbs_t::atcode(char* sp, char* str)
}
if(!strcmp(sp,"LAST")) {
tp=strrchr(useron.alias,SP);
tp=strrchr(useron.alias,' ');
if(tp) tp++;
else tp=useron.alias;
return(tp);
......@@ -817,20 +817,20 @@ char* sbbs_t::atcode(char* sp, char* str)
if(!strcmp(sp,"REAL")) {
strcpy(str,useron.name);
tp=strchr(str,SP);
tp=strchr(str,' ');
if(tp) *tp=0;
return(str);
}
if(!strcmp(sp,"FIRSTREAL")) {
strcpy(str,useron.name);
tp=strchr(str,SP);
tp=strchr(str,' ');
if(tp) *tp=0;
return(str);
}
if(!strcmp(sp,"LASTREAL")) {
tp=strrchr(useron.name,SP);
tp=strrchr(useron.name,' ');
if(tp) tp++;
else tp=useron.name;
return(tp);
......
This diff is collapsed.
......@@ -71,7 +71,7 @@ void sbbs_t::batchmenu()
ASYNC;
bputs(text[BatchMenuPrompt]);
ch=(char)getkeys("BCDLQRU?\r",0);
if(ch>SP)
if(ch>' ')
logch(ch,0);
switch(ch) {
case '?':
......
......@@ -570,7 +570,7 @@ void sbbs_t::chatsection()
while(online) {
no_rip_menu=0;
ch=(char)getkeys("ACDJPQST?\r",0);
if(ch>SP)
if(ch>' ')
logch(ch,0);
switch(ch) {
case 'S':
......@@ -883,9 +883,9 @@ void sbbs_t::privchat(bool local)
GOTOXY(1,13);
remote_y=1;
bprintf(local ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':SP
,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp)
,thisnode.misc&NODE_NMSG ? 'M':SP);
,thisnode.misc&NODE_NMSG ? 'M':' ');
CRLF;
local_y=14; }
......@@ -909,13 +909,13 @@ void sbbs_t::privchat(bool local)
localbuf[localline][localchar]=0; } }
else if(ch==TAB) {
if(echo)
outchar(SP);
localbuf[localline][localchar]=SP;
outchar(' ');
localbuf[localline][localchar]=' ';
localchar++;
while(localchar<78 && localchar%8) {
if(echo)
outchar(SP);
localbuf[localline][localchar++]=SP; } }
outchar(' ');
localbuf[localline][localchar++]=' '; } }
else if(ch==CTRL_R) {
if(sys_status&SS_SPLITP) {
CLS;
......@@ -931,9 +931,9 @@ void sbbs_t::privchat(bool local)
ANSI_SAVE();
GOTOXY(1,13);
bprintf(local ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':SP
,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp)
,thisnode.misc&NODE_NMSG ? 'M':SP);
,thisnode.misc&NODE_NMSG ? 'M':' ');
CRLF;
attr(cfg.color[clr_chatlocal]);
localbuf[localline][localchar]=0;
......@@ -946,13 +946,13 @@ void sbbs_t::privchat(bool local)
}
continue;
}
else if(ch>=SP || ch==CR) {
else if(ch>=' ' || ch==CR) {
if(ch!=CR) {
if(echo)
outchar(ch);
localbuf[localline][localchar]=ch; }
if(ch==CR || (localchar>68 && ch==SP) || ++localchar>78) {
if(ch==CR || (localchar>68 && ch==' ') || ++localchar>78) {
localbuf[localline][localchar]=0;
localchar=0;
......@@ -960,9 +960,9 @@ void sbbs_t::privchat(bool local)
if(sys_status&SS_SPLITP && local_y==24) {
GOTOXY(1,13);
bprintf(local ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':SP
,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp)
,thisnode.misc&NODE_NMSG ? 'M':SP);
,thisnode.misc&NODE_NMSG ? 'M':' ');
attr(cfg.color[clr_chatlocal]);
for(x=13,y=0;x<rows;x++,y++) {
rprintf("\x1b[%d;1H\x1b[K",x+1);
......@@ -1028,18 +1028,18 @@ void sbbs_t::privchat(bool local)
remotechar--;
remotebuf[remoteline][remotechar]=0; } }
else if(ch==TAB) {
outchar(SP);
remotebuf[remoteline][remotechar]=SP;
outchar(' ');
remotebuf[remoteline][remotechar]=' ';
remotechar++;
while(remotechar<78 && remotechar%8) {
outchar(SP);
remotebuf[remoteline][remotechar++]=SP; } }
else if(ch>=SP || ch==CR) {
outchar(' ');
remotebuf[remoteline][remotechar++]=' '; } }
else if(ch>=' ' || ch==CR) {
if(ch!=CR) {
outchar(ch);
remotebuf[remoteline][remotechar]=ch; }
if(ch==CR || (remotechar>68 && ch==SP) || ++remotechar>78) {
if(ch==CR || (remotechar>68 && ch==' ') || ++remotechar>78) {
remotebuf[remoteline][remotechar]=0;
remotechar=0;
......@@ -1047,9 +1047,9 @@ void sbbs_t::privchat(bool local)
if(sys_status&SS_SPLITP && remote_y==12) {
CRLF;
bprintf(local ? local_sep : sep
,thisnode.misc&NODE_MSGW ? 'T':SP
,thisnode.misc&NODE_MSGW ? 'T':' '
,sectostr(timeleft,tmp)
,thisnode.misc&NODE_NMSG ? 'M':SP);
,thisnode.misc&NODE_NMSG ? 'M':' ');
attr(cfg.color[clr_chatremote]);
for(i=0;i<12;i++) {
bprintf("\x1b[%d;1H\x1b[K",i+1);
......@@ -1483,14 +1483,14 @@ void sbbs_t::guruchat(char* line, char* gurubuf, int gurunum, char* last_answer)
/* multi-line answer */
if(*ptr=='\\' && (*(ptr+1)==CR || *(ptr+1)==LF)) {
ptr++; /* skip \ */
while(*ptr && *ptr<SP) ptr++; /* skip [CR]LF */
while(*ptr && *ptr<' ') ptr++; /* skip [CR]LF */
answer[answers][i++]=CR;
answer[answers][i++]=LF; } }
answer[answers][i]=0;
if(!strlen(answer[answers]) || answer[answers][0]=='(') {
ptr-=strlen(answer[answers]);
break; }
while(*ptr && *ptr<SP) ptr++; /* skip [CR]LF */
while(*ptr && *ptr<' ') ptr++; /* skip [CR]LF */
answers++; }
if(answers==100)
while(*ptr && *ptr!='(' && ptr<gurubuf+len)
......@@ -1650,7 +1650,7 @@ void sbbs_t::guruchat(char* line, char* gurubuf, int gurunum, char* last_answer)
mswait(25+sbbs_random(50));
else
mswait(25+sbbs_random(150));
if(theanswer[i]==SP)
if(theanswer[i]==' ')
mswait(sbbs_random(50));
} }
else {
......
......@@ -94,7 +94,7 @@ void truncsp(char *str)
uint c;
c=strlen(str);
while(c && (uchar)str[c-1]<=SP) c--;
while(c && (uchar)str[c-1]<=' ') c--;
if(str[c]!=0)
str[c]=0;
}
......@@ -107,7 +107,7 @@ char* DLLCALL strip_ctrl(char *str)
for(i=j=0;str[i] && j<sizeof(tmp)-1;i++) {
if(str[i]==CTRL_A && str[i+1]!=0)
i++;
else if((uchar)str[i]>=SP)
else if((uchar)str[i]>=' ')
tmp[j++]=str[i];
}
if(i!=j) {
......
......@@ -58,7 +58,7 @@ void sbbs_t::redrwstr(char *strin, int i, int l, long mode)
cursor_left(l-i);
} else {
while(c<cols-1) { /* clear to end of line */
outchar(SP);
outchar(' ');
c++;
}
while(c>l) { /* back space to end of string */
......
......@@ -197,7 +197,7 @@ void sbbs_t::outchar(char ch)
#endif
#if 0
if(console&CON_L_ECHO) {
if(console&CON_L_ECHOX && (uchar)ch>SP)
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) {
......@@ -209,7 +209,7 @@ void sbbs_t::outchar(char ch)
#endif
if(online==ON_REMOTE && console&CON_R_ECHO) {
if(console&CON_R_ECHOX && (uchar)ch>SP) {
if(console&CON_R_ECHOX && (uchar)ch>' ') {
ch=text[YN][3];
if(text[YN][2]==0 || ch==0) ch='X';
}
......@@ -268,7 +268,7 @@ void sbbs_t::center(char *instr)
truncsp(str);
j=bstrlen(str);
for(i=0;i<(80-j)/2;i++)
outchar(SP);
outchar(' ');
bputs(str);
CRLF;
}
......@@ -282,7 +282,7 @@ void sbbs_t::clearline(void)
rputs("\x1b[K");
else {
for(i=0;i<cols-1;i++)
outchar(SP);
outchar(' ');
outchar(CR);
}
}
......@@ -330,7 +330,7 @@ void sbbs_t::cursor_right(int count)
rputs("\x1b[C");
} else {
for(int i=0;i<count;i++)
outchar(SP);
outchar(' ');
}
}
......@@ -357,7 +357,7 @@ void sbbs_t::cleartoeol(void)
else {
i=j=lclwx(); /* commented out */
while(i++<79)
outchar(SP);
outchar(' ');
while(j++<79)
outchar(BS);
}
......
......@@ -1775,7 +1775,7 @@ int sbbs_t::exec(csi_t *csi)
ungetkey(csi->str[i]);
return(0);
case CS_PRINTKEY:
if((csi->cmd&0x7f)>=SP)
if((csi->cmd&0x7f)>=' ')
outchar(csi->cmd&0x7f);
return(0);
case CS_PRINTSTR:
......
......@@ -61,9 +61,9 @@ int sbbs_t::exec_file(csi_t *csi)
for(i=0;i<usrlibs && !msgabort();i++) {
if(i==curlib)
outchar('*');
else outchar(SP);
if(i<9) outchar(SP);
if(i<99) outchar(SP);
else outchar(' ');
if(i<9) outchar(' ');
if(i<99) outchar(' ');
bprintf(text[CfgLibLstFmt]
,i+1,cfg.lib[usrlib[i]]->lname); } }
sprintf(str,text[JoinWhichLib],curlib+1);
......@@ -84,12 +84,12 @@ int sbbs_t::exec_file(csi_t *csi)
bprintf(text[DirLstHdr], cfg.lib[usrlib[j]]->lname);
for(i=0;i<usrdirs[j] && !msgabort();i++) {
if(i==curdir[j]) outchar('*');
else outchar(SP);
else outchar(' ');
sprintf(str,text[DirLstFmt],i+1
,cfg.dir[usrdir[j][i]]->lname,nulstr
,getfiles(&cfg,usrdir[j][i]));
if(i<9) outchar(SP);
if(i<99) outchar(SP);
if(i<9) outchar(' ');
if(i<99) outchar(' ');
bputs(str); } }
sprintf(str,text[JoinWhichDir],curdir[j]+1);
mnemonics(str);
......@@ -191,8 +191,8 @@ int sbbs_t::exec_file(csi_t *csi)
for(i=0;i<usrlibs && !msgabort();i++) {
if(i==curlib)
outchar('*');
else outchar(SP);
if(i<9) outchar(SP);
else outchar(' ');
if(i<9) outchar(' ');
bprintf(text[LibLstFmt],i+1
,cfg.lib[usrlib[i]]->lname,nulstr,usrdirs[i]); }
return(0);
......@@ -208,12 +208,12 @@ int sbbs_t::exec_file(csi_t *csi)
bprintf(text[DirLstHdr],cfg.lib[usrlib[curlib]]->lname);
for(i=0;i<usrdirs[curlib] && !msgabort();i++) {
if(i==curdir[curlib]) outchar('*');
else outchar(SP);
else outchar(' ');
sprintf(str,text[DirLstFmt],i+1
,cfg.dir[usrdir[curlib][i]]->lname,nulstr
,getfiles(&cfg,usrdir[curlib][i]));
if(i<9) outchar(SP);
if(i<99) outchar(SP);
if(i<9) outchar(' ');
if(i<99) outchar(' ');
bputs(str); }
return(0);
......
......@@ -59,9 +59,9 @@ int sbbs_t::exec_msg(csi_t *csi)
for(i=0;i<usrgrps && !msgabort();i++) {
if(i==curgrp)
outchar('*');
else outchar(SP);
if(i<9) outchar(SP);
if(i<99) outchar(SP);
else outchar(' ');
if(i<9) outchar(' ');
if(i<99) outchar(' ');
bprintf(text[CfgGrpLstFmt]
,i+1, cfg.grp[usrgrp[i]]->lname); } }
sprintf(str,text[JoinWhichGrp],curgrp+1);
......@@ -82,12 +82,12 @@ int sbbs_t::exec_msg(csi_t *csi)
bprintf(text[SubLstHdr], cfg.grp[usrgrp[j]]->lname);
for(i=0;i<usrsubs[j] && !msgabort();i++) {
if(i==cursub[j]) outchar('*');
else outchar(SP);
else outchar(' ');
sprintf(str,text[SubLstFmt],i+1
,cfg.sub[usrsub[j][i]]->lname,nulstr
,getposts(&cfg,usrsub[j][i]));
if(i<9) outchar(SP);
if(i<99) outchar(SP);
if(i<9) outchar(' ');
if(i<99) outchar(' ');
bputs(str); } }
sprintf(str,text[JoinWhichSub],cursub[j]+1);
mnemonics(str);
......@@ -200,8 +200,8 @@ int sbbs_t::exec_msg(csi_t *csi)
for(i=0;i<usrgrps && !msgabort();i++) {
if(i==curgrp)
outchar('*');
else outchar(SP);
if(i<9) outchar(SP);
else outchar(' ');
if(i<9) outchar(' ');
bprintf(text[GrpLstFmt],i+1
,cfg.grp[usrgrp[i]]->lname,nulstr,usrsubs[i]); }
return(0);
......@@ -217,12 +217,12 @@ int sbbs_t::exec_msg(csi_t *csi)
bprintf(text[SubLstHdr],cfg.grp[usrgrp[curgrp]]->lname);
for(i=0;i<usrsubs[curgrp] && !msgabort();i++) {
if(i==cursub[curgrp]) outchar('*');
else outchar(SP);
else outchar(' ');
sprintf(str,text[SubLstFmt],i+1
,cfg.sub[usrsub[curgrp][i]]->lname,nulstr
,getposts(&cfg,usrsub[curgrp][i]));
if(i<9) outchar(SP);
if(i<99) outchar(SP);
if(i<9) outchar(' ');
if(i<99) outchar(' ');
bputs(str); }
return(0);
......
......@@ -270,25 +270,25 @@ bool sbbs_t::netmail(char *into, char *title, long mode)
if((SYSOP || useron.exempt&FLAG('F'))
&& !strnicmp(p,"CR:",3)) { /* Crash over-ride by sysop */
p+=3; /* skip CR: */
if(*p==SP) p++; /* skip extra space if it exists */
if(*p==' ') p++; /* skip extra space if it exists */
hdr.attr|=FIDO_CRASH; }
if((SYSOP || useron.exempt&FLAG('F'))
&& !strnicmp(p,"FR:",3)) { /* File request */
p+=3; /* skip FR: */
if(*p==SP) p++;
if(*p==' ') p++;
hdr.attr|=FIDO_FREQ; }
if((SYSOP || useron.exempt&FLAG('F'))
&& !strnicmp(p,"RR:",3)) { /* Return receipt request */
p+=3; /* skip RR: */