Skip to content
Snippets Groups Projects
Commit d5e889cb authored by deuce's avatar deuce
Browse files

Hard-code a copy of text.dat to make upgrade easier for everyone.

While you can't run with a missing text.dat yet, you should be able
to run with a zero-byte one.
parent 986fb768
No related branches found
No related tags found
No related merge requests found
...@@ -1104,7 +1104,7 @@ int sbbs_t::exec(csi_t *csi) ...@@ -1104,7 +1104,7 @@ int sbbs_t::exec(csi_t *csi)
errormsg(WHERE,ERR_OPEN,str,O_RDONLY); errormsg(WHERE,ERR_OPEN,str,O_RDONLY);
break; } break; }
for(i=0;i<TOTAL_TEXT && !feof(stream);i++) { for(i=0;i<TOTAL_TEXT && !feof(stream);i++) {
if((text[i]=readtext((long *)NULL,stream))==NULL) { if((text[i]=readtext((long *)NULL,stream,l))==NULL) {
i--; i--;
continue; } continue; }
if(!strcmp(text[i],text_sav[i])) { /* If identical */ if(!strcmp(text[i],text_sav[i])) { /* If identical */
......
...@@ -1268,7 +1268,7 @@ js_load_text(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) ...@@ -1268,7 +1268,7 @@ js_load_text(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return(JS_TRUE); return(JS_TRUE);
} }
for(i=0;i<TOTAL_TEXT && !feof(stream);i++) { for(i=0;i<TOTAL_TEXT && !feof(stream);i++) {
if((sbbs->text[i]=readtext((long *)NULL,stream))==NULL) { if((sbbs->text[i]=readtext((long *)NULL,stream,i))==NULL) {
i--; i--;
continue; continue;
} }
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
static void prep_cfg(scfg_t* cfg); static void prep_cfg(scfg_t* cfg);
static void free_attr_cfg(scfg_t* cfg); static void free_attr_cfg(scfg_t* cfg);
char * readtext(long *line, FILE *stream);
int lprintf(int level, const char *fmt, ...); /* log output */ int lprintf(int level, const char *fmt, ...); /* log output */
/****************************************************************************/ /****************************************************************************/
...@@ -90,6 +89,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error) ...@@ -90,6 +89,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error)
if(read_attr_cfg(cfg, error)==FALSE) if(read_attr_cfg(cfg, error)==FALSE)
return(FALSE); return(FALSE);
#ifdef SBBS
if(text!=NULL) { if(text!=NULL) {
/* Free existing text if allocated */ /* Free existing text if allocated */
...@@ -102,7 +102,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error) ...@@ -102,7 +102,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error)
return(FALSE); return(FALSE);
} }
for(i=0;i<TOTAL_TEXT && !feof(instream) && !ferror(instream);i++) for(i=0;i<TOTAL_TEXT && !feof(instream) && !ferror(instream);i++)
if((text[i]=readtext(&line,instream))==NULL) { if((text[i]=readtext(&line,instream,i))==NULL) {
i--; i--;
break; break;
} }
...@@ -115,6 +115,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error) ...@@ -115,6 +115,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error)
return(FALSE); return(FALSE);
} }
} }
#endif
/* Override com-port settings */ /* Override com-port settings */
cfg->com_base=0xf; /* All nodes use FOSSIL */ cfg->com_base=0xf; /* All nodes use FOSSIL */
...@@ -308,116 +309,6 @@ BOOL md(char *inpath) ...@@ -308,116 +309,6 @@ BOOL md(char *inpath)
return(TRUE); return(TRUE);
} }
/****************************************************************************/
/* Reads special TEXT.DAT printf style text lines, splicing multiple lines, */
/* replacing escaped characters, and allocating the memory */
/****************************************************************************/
char *readtext(long *line,FILE *stream)
{
char buf[2048],str[2048],tmp[256],*p,*p2;
int i,j,k;
if(!fgets(buf,256,stream))
return(NULL);
if(line)
(*line)++;
if(buf[0]=='#')
return(NULL);
p=strrchr(buf,'"');
if(!p) {
if(line) {
lprintf(LOG_ERR,"No quotation marks in line %d of text.dat",*line);
return(NULL);
}
return(NULL);
}
if(*(p+1)=='\\') /* merge multiple lines */
while(strlen(buf)<2000) {
if(!fgets(str,255,stream))
return(NULL);
if(line)
(*line)++;
p2=strchr(str,'"');
if(!p2)
continue;
strcpy(p,p2+1);
p=strrchr(p,'"');
if(p && *(p+1)=='\\')
continue;
break;
}
*(p)=0;
k=strlen(buf);
for(i=1,j=0;i<k;j++) {
if(buf[i]=='\\') { /* escape */
i++;
if(isdigit(buf[i])) {
str[j]=atoi(buf+i); /* decimal, NOT octal */
if(isdigit(buf[++i])) /* skip up to 3 digits */
if(isdigit(buf[++i]))
i++;
continue;
}
switch(buf[i++]) {
case '\\':
str[j]='\\';
break;
case '?':
str[j]='?';
break;
case 'x':
tmp[0]=buf[i++]; /* skip next character */
tmp[1]=0;
if(isxdigit(buf[i])) { /* if another hex digit, skip too */
tmp[1]=buf[i++];
tmp[2]=0;
}
str[j]=(char)ahtoul(tmp);
break;
case '\'':
str[j]='\'';
break;
case '"':
str[j]='"';
break;
case 'r':
str[j]=CR;
break;
case 'n':
str[j]=LF;
break;
case 't':
str[j]=TAB;
break;
case 'b':
str[j]=BS;
break;
case 'a':
str[j]=BEL;
break;
case 'f':
str[j]=FF;
break;
case 'v':
str[j]=11; /* VT */
break;
default:
str[j]=buf[i];
break;
}
continue;
}
str[j]=buf[i++];
}
str[j]=0;
if((p=(char *)calloc(1,j+2))==NULL) { /* +1 for terminator, +1 for YNQX line */
lprintf(LOG_CRIT,"Error allocating %u bytes of memory from text.dat",j);
return(NULL);
}
strcpy(p,str);
return(p);
}
/****************************************************************************/ /****************************************************************************/
/* Reads in ATTR.CFG and initializes the associated variables */ /* Reads in ATTR.CFG and initializes the associated variables */
/****************************************************************************/ /****************************************************************************/
......
...@@ -82,6 +82,7 @@ OBJS = $(MTOBJODIR)$(DIRSEP)ansiterm$(OFILE) \ ...@@ -82,6 +82,7 @@ OBJS = $(MTOBJODIR)$(DIRSEP)ansiterm$(OFILE) \
$(MTOBJODIR)$(DIRSEP)qwktomsg$(OFILE)\ $(MTOBJODIR)$(DIRSEP)qwktomsg$(OFILE)\
$(MTOBJODIR)$(DIRSEP)readmail$(OFILE)\ $(MTOBJODIR)$(DIRSEP)readmail$(OFILE)\
$(MTOBJODIR)$(DIRSEP)readmsgs$(OFILE)\ $(MTOBJODIR)$(DIRSEP)readmsgs$(OFILE)\
$(MTOBJODIR)$(DIRSEP)readtext$(OFILE)\
$(MTOBJODIR)$(DIRSEP)ringbuf$(OFILE)\ $(MTOBJODIR)$(DIRSEP)ringbuf$(OFILE)\
$(MTOBJODIR)$(DIRSEP)scandirs$(OFILE)\ $(MTOBJODIR)$(DIRSEP)scandirs$(OFILE)\
$(MTOBJODIR)$(DIRSEP)scansubs$(OFILE)\ $(MTOBJODIR)$(DIRSEP)scansubs$(OFILE)\
...@@ -94,6 +95,7 @@ OBJS = $(MTOBJODIR)$(DIRSEP)ansiterm$(OFILE) \ ...@@ -94,6 +95,7 @@ OBJS = $(MTOBJODIR)$(DIRSEP)ansiterm$(OFILE) \
$(MTOBJODIR)$(DIRSEP)str_util$(OFILE)\ $(MTOBJODIR)$(DIRSEP)str_util$(OFILE)\
$(MTOBJODIR)$(DIRSEP)telgate$(OFILE)\ $(MTOBJODIR)$(DIRSEP)telgate$(OFILE)\
$(MTOBJODIR)$(DIRSEP)telnet$(OFILE)\ $(MTOBJODIR)$(DIRSEP)telnet$(OFILE)\
$(MTOBJODIR)$(DIRSEP)text_defaults$(OFILE)\
$(MTOBJODIR)$(DIRSEP)text_sec$(OFILE)\ $(MTOBJODIR)$(DIRSEP)text_sec$(OFILE)\
$(MTOBJODIR)$(DIRSEP)tmp_xfer$(OFILE)\ $(MTOBJODIR)$(DIRSEP)tmp_xfer$(OFILE)\
$(MTOBJODIR)$(DIRSEP)un_qwk$(OFILE)\ $(MTOBJODIR)$(DIRSEP)un_qwk$(OFILE)\
......
...@@ -1102,7 +1102,7 @@ BOOL md(char *path); ...@@ -1102,7 +1102,7 @@ BOOL md(char *path);
int close_socket(SOCKET); int close_socket(SOCKET);
u_long resolve_ip(char *addr); u_long resolve_ip(char *addr);
char * readtext(long *line, FILE *stream); char * readtext(long *line, FILE *stream, long dflt);
/* ver.cpp */ /* ver.cpp */
char* socklib_version(char* str, char* winsock_ver); char* socklib_version(char* str, char* winsock_ver);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
/****************************************************************************/ /****************************************************************************/
/* Macros for elements of the array of pointers (text[]) to static text */ /* Macros for elements of the array of pointers (text[]) to static text */
/* Should correlate with CTRL\TEXT.DAT */ /* Auto-generated from CTRL\TEXT.DAT */
/****************************************************************************/ /****************************************************************************/
#ifndef _TEXT_H #ifndef _TEXT_H
...@@ -587,7 +587,7 @@ enum { ...@@ -587,7 +587,7 @@ enum {
,NodeJoinedPrivateChat ,NodeJoinedPrivateChat
,NodeLeftPrivateChat ,NodeLeftPrivateChat
,NoOneHasLoggedOnToday ,NoOneHasLoggedOnToday
,Unused544 /* was LastFewCallers */ ,Unused544 /* Was LastFewCallers */
,LastFewCallersFmt ,LastFewCallersFmt
,CallersToday ,CallersToday
,DoYouMeanThisUserQ ,DoYouMeanThisUserQ
...@@ -763,7 +763,7 @@ enum { ...@@ -763,7 +763,7 @@ enum {
,NodeActionPrivateChat ,NodeActionPrivateChat
,NodeActionPaging ,NodeActionPaging
,NodeActionRetrieving ,NodeActionRetrieving
,YN ,YN /* (Yes/No/Quit/Password chars) */
,ViewSignatureQ ,ViewSignatureQ
,DeleteSignatureQ ,DeleteSignatureQ
,CreateEditSignatureQ ,CreateEditSignatureQ
...@@ -773,7 +773,7 @@ enum { ...@@ -773,7 +773,7 @@ enum {
,CommandShellHeading ,CommandShellHeading
,ArchiveTypeHeading ,ArchiveTypeHeading
,TOTAL_TEXT ,TOTAL_TEXT
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment