diff --git a/ChangeLog b/ChangeLog index 6747969c..60c16d3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4643,6 +4643,8 @@ v0.33.20 10-Feb-2002 are automatic filled in. Splitted no TCP into no IBN, no IFC and no ITN in global and nodes setup. + When editing a new message area, and the area was made active, + all entered data was erased. mbfido: In AreaMgr and FileMgr changed aka matching for area @@ -4704,6 +4706,11 @@ v0.33.20 10-Feb-2002 When started a second time it doesn't destroy the lockfile anymore. + mbfile: + The mbfile index command now creates the html pages using the + macro templates html.main and html.areas. The files.css file + is no longer needed. + mball: Will not crash anymore when it needs more then 10 minutes to create the allfiles and newfiles lists. @@ -4792,3 +4799,6 @@ v0.33.20 10-Feb-2002 installed destructive, ie. all private changes will be lost with every install. Later this will be a normal install. + rundoor.sh + Called door.bat instead of doors.bat + diff --git a/Makefile b/Makefile index e4ee1e36..2b3ba4be 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ OTHER = AUTHORS ChangeLog COPYING DEBUG CRON.sh FILE_ID.DIZ.in \ INSTALL.in MBSE.FAQ Makefile Makefile.global.in NEWS \ README README.GoldED README.isdn SETUP.sh TODO UPGRADE \ aclocal.m4 \ - checkbasic config.h.in configure configure.in files.css + checkbasic config.h.in configure configure.in TARFILE = ${PACKAGE}-${VERSION}.tar.gz ############################################################################### @@ -133,14 +133,6 @@ install: ${CHOWN} ${OWNER}.${GROUP} ${PREFIX}/ftp/pub/local ; \ chmod 0755 ${PREFIX}/ftp/pub/local ; \ fi - @if [ ! -d ${PREFIX}/ftp/pub/css ] ; then \ - mkdir ${PREFIX}/ftp/pub/css ; \ - ${CHOWN} ${OWNER}.${GROUP} ${PREFIX}/ftp/pub/css ; \ - chmod 0755 ${PREFIX}/ftp/pub/css ; \ - fi - @if [ ! -f ${PREFIX}/ftp/pub/css/files.css ]; then \ - ${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0444 files.css ${PREFIX}/ftp/pub/css ; \ - fi @if [ ! -d ${PREFIX}/var/bso ] ; then \ mkdir ${PREFIX}/var/nodelist ; \ mkdir ${PREFIX}/var/bso ; \ diff --git a/TODO b/TODO index 5fe1dae7..fa82d6c5 100644 --- a/TODO +++ b/TODO @@ -64,8 +64,6 @@ mbcico: N: Implement MD5 crypt in binkp protocol driver. - N: Remove code to make automatic calls after mbtask does this. - mbfile: N: Add a check to see if the magic filenames are (still) valid. diff --git a/examples/templates.tar b/examples/templates.tar index d8b8ff4a..e28e1e52 100644 Binary files a/examples/templates.tar and b/examples/templates.tar differ diff --git a/lib/Makefile b/lib/Makefile index 465f76f7..22a8b27d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -169,7 +169,7 @@ nntp.o: libs.h structs.h users.h records.h clcomm.h mbinet.h pop3.o: libs.h structs.h users.h records.h clcomm.h mbinet.h smtp.o: libs.h structs.h users.h records.h clcomm.h mbinet.h diesel.o: libs.h diesel.h -mbdiesel.o: libs.h structs.h users.h records.h clcomm.h diesel.h +mbdiesel.o: libs.h structs.h users.h records.h common.h clcomm.h diesel.h memwatch.o: ../config.h ../config.h libs.h memwatch.h ftscprod.o: libs.h structs.h common.h # End of generated dependencies diff --git a/lib/diesel.h b/lib/diesel.h index b5b42c2c..4df5777b 100644 --- a/lib/diesel.h +++ b/lib/diesel.h @@ -1,3 +1,5 @@ +/* $Id$ */ + #ifndef _DIESEL_H #define _DIESEL_H @@ -22,7 +24,7 @@ int tracing = TRUE; /* Trace macro evalution */ /* Local variables. */ #define MAXARGS 10 /* Maximum arguments to a macro */ -#define MAXSTR 256 /* Maximum string length */ +#define MAXSTR 2560 /* Maximum string length */ #define MAXDEPTH 32 /* Maximum recursion depth for eval */ #define MACROCHAR '@' /* Macro trigger character */ @@ -48,7 +50,8 @@ int diesel(char *, char *); char *ParseMacro( const char *, int * ); void MacroVars( const char *, const char *, ... ); void MacroClear(void); -FILE *OpenMacro(const char *, int); +void html_massage(char *, char *); +FILE *OpenMacro(const char *, int, int); #endif diff --git a/lib/mbdiesel.c b/lib/mbdiesel.c index c5b2dd74..32077e95 100644 --- a/lib/mbdiesel.c +++ b/lib/mbdiesel.c @@ -50,8 +50,8 @@ void MacroVars( const char *codes, const char *fmt, ...) char vc; double vf; - tmp1=calloc(256,sizeof(char)); - tmp2=calloc(256,sizeof(char)); + tmp1=calloc(MAXSTR, sizeof(char)); + tmp2=calloc(MAXSTR, sizeof(char)); va_start(ap,fmt); for ( j=0; (codes[j] != '\0') && (fmt[j] != '\0') ; j++ ){ @@ -103,7 +103,7 @@ void MacroClear(void) char *ParseMacro( const char *line, int *dieselrc) { - static char res[256]; + static char res[MAXSTR]; char *tmp1, *tmp2, *tmp3, *i; int j, l; char code; @@ -114,9 +114,9 @@ char *ParseMacro( const char *line, int *dieselrc) if ( *line == '#' ) return res; - tmp1 = calloc(256,sizeof(char)); - tmp2 = calloc(256,sizeof(char)); - tmp3 = calloc(256,sizeof(char)); + tmp1 = calloc(MAXSTR, sizeof(char)); + tmp2 = calloc(MAXSTR, sizeof(char)); + tmp3 = calloc(MAXSTR, sizeof(char)); tmp1[0]='\0'; @@ -235,12 +235,139 @@ void Cookie(void) -FILE *OpenMacro(const char *filename, int Language) +/* + * Translate ISO 8859-1 characters to named character entities + */ +void html_massage(char *inbuf, char *outbuf) +{ + char *inptr = inbuf; + char *outptr = outbuf; + + memset(outbuf, 0, sizeof(outbuf)); + + while (*inptr) { + + switch ((unsigned char)*inptr) { + + case '"': sprintf(outptr, """); break; + case '&': sprintf(outptr, "&"); break; + case '<': sprintf(outptr, "<"); break; + case '>': sprintf(outptr, ">"); break; + case 160: sprintf(outptr, " "); break; + case 161: sprintf(outptr, "¡"); break; + case 162: sprintf(outptr, "¢"); break; + case 163: sprintf(outptr, "£"); break; + case 164: sprintf(outptr, "¤"); break; + case 165: sprintf(outptr, "¥"); break; + case 166: sprintf(outptr, "¦"); break; + case 167: sprintf(outptr, "§"); break; + case 168: sprintf(outptr, "¨"); break; + case 169: sprintf(outptr, "©"); break; + case 170: sprintf(outptr, "ª"); break; + case 171: sprintf(outptr, "«"); break; + case 172: sprintf(outptr, "¬"); break; + case 173: sprintf(outptr, "­"); break; + case 174: sprintf(outptr, "®"); break; + case 175: sprintf(outptr, "¯"); break; + case 176: sprintf(outptr, "°"); break; + case 177: sprintf(outptr, "&plumn;"); break; + case 178: sprintf(outptr, "²"); break; + case 179: sprintf(outptr, "³"); break; + case 180: sprintf(outptr, "´"); break; + case 181: sprintf(outptr, "µ"); break; + case 182: sprintf(outptr, "¶"); break; + case 183: sprintf(outptr, "·"); break; + case 184: sprintf(outptr, "¸"); break; + case 185: sprintf(outptr, "&supl;"); break; + case 186: sprintf(outptr, "º"); break; + case 187: sprintf(outptr, "»"); break; + case 188: sprintf(outptr, "¼"); break; + case 189: sprintf(outptr, "½"); break; + case 190: sprintf(outptr, "¾"); break; + case 191: sprintf(outptr, "¿"); break; + case 192: sprintf(outptr, "À"); break; + case 193: sprintf(outptr, "Á"); break; + case 194: sprintf(outptr, "Â"); break; + case 195: sprintf(outptr, "Ã"); break; + case 196: sprintf(outptr, "Ä"); break; + case 197: sprintf(outptr, "Å"); break; + case 198: sprintf(outptr, "Æ"); break; + case 199: sprintf(outptr, "Ç"); break; + case 200: sprintf(outptr, "È"); break; + case 201: sprintf(outptr, "É"); break; + case 202: sprintf(outptr, "Ê"); break; + case 203: sprintf(outptr, "Ë"); break; + case 204: sprintf(outptr, "Ì"); break; + case 205: sprintf(outptr, "Í"); break; + case 206: sprintf(outptr, "Î"); break; + case 207: sprintf(outptr, "Ï"); break; + case 208: sprintf(outptr, "Ð"); break; + case 209: sprintf(outptr, "Ñ"); break; + case 210: sprintf(outptr, "Ò"); break; + case 211: sprintf(outptr, "Ó"); break; + case 212: sprintf(outptr, "Ô"); break; + case 213: sprintf(outptr, "Õ"); break; + case 214: sprintf(outptr, "Ö"); break; + case 215: sprintf(outptr, "×"); break; + case 216: sprintf(outptr, "Ø"); break; + case 217: sprintf(outptr, "Ù"); break; + case 218: sprintf(outptr, "Ú"); break; + case 219: sprintf(outptr, "Û"); break; + case 220: sprintf(outptr, "Ü"); break; + case 221: sprintf(outptr, "Ý"); break; + case 222: sprintf(outptr, "Þ"); break; + case 223: sprintf(outptr, "ß"); break; + case 224: sprintf(outptr, "à"); break; + case 225: sprintf(outptr, "á"); break; + case 226: sprintf(outptr, "â"); break; + case 227: sprintf(outptr, "ã"); break; + case 228: sprintf(outptr, "ä"); break; + case 229: sprintf(outptr, "å"); break; + case 230: sprintf(outptr, "æ"); break; + case 231: sprintf(outptr, "ç"); break; + case 232: sprintf(outptr, "è"); break; + case 233: sprintf(outptr, "é"); break; + case 234: sprintf(outptr, "ê"); break; + case 235: sprintf(outptr, "ë"); break; + case 236: sprintf(outptr, "ì"); break; + case 237: sprintf(outptr, "í"); break; + case 238: sprintf(outptr, "î"); break; + case 239: sprintf(outptr, "ï"); break; + case 240: sprintf(outptr, "ð"); break; + case 241: sprintf(outptr, "ñ"); break; + case 242: sprintf(outptr, "ò"); break; + case 243: sprintf(outptr, "ó"); break; + case 244: sprintf(outptr, "ô"); break; + case 245: sprintf(outptr, "õ"); break; + case 246: sprintf(outptr, "ö"); break; + case 247: sprintf(outptr, "÷"); break; + case 248: sprintf(outptr, "ø"); break; + case 249: sprintf(outptr, "ù"); break; + case 250: sprintf(outptr, "ú"); break; + case 251: sprintf(outptr, "û"); break; + case 252: sprintf(outptr, "ü"); break; + case 253: sprintf(outptr, "ý"); break; + case 254: sprintf(outptr, "þ"); break; + case 255: sprintf(outptr, "ÿ"); break; + default: *outptr++ = *inptr; *outptr = '\0'; break; + } + while (*outptr) + outptr++; + + inptr++; + } + *outptr = '\0'; +} + + + +FILE *OpenMacro(const char *filename, int Language, int htmlmode) { FILE *pLang, *fi = NULL; - char *temp; + char *temp, *aka, linebuf[1024], outbuf[1024]; temp = calloc(PATH_MAX, sizeof(char)); + aka = calloc(81, sizeof(char)); temp[0] = '\0'; if (Language != '\0') { @@ -282,11 +409,33 @@ FILE *OpenMacro(const char *filename, int Language) else { Syslog('d', "OpenMacro(%s, %c): using %s", filename, Language, temp); sprintf(temp, "%s-%s", OsName(), OsCPU()); - MacroVars("HLMNOSTUVYZ", "ssssssssssd", CFG.www_url, CFG.location, CFG.sysdomain, CFG.bbs_name, temp, - CFG.sysop_name, CFG.comment, CFG.sysop, VERSION, aka2str(CFG.aka[0]), 0); + if (CFG.aka[0].point) + sprintf(aka, "%d:%d/%d.%d@%s", CFG.aka[0].zone, CFG.aka[0].net, CFG.aka[0].node, CFG.aka[0].point, CFG.aka[0].domain); + else + sprintf(aka, "%d:%d/%d@%s", CFG.aka[0].zone, CFG.aka[0].net, CFG.aka[0].node, CFG.aka[0].domain); + + if (htmlmode) { + MacroVars("HMOUVYZ", "ssssssd", CFG.www_url, CFG.sysdomain, temp, CFG.sysop, VERSION, aka, 0); + sprintf(linebuf, "%s", CFG.location); + html_massage(linebuf, outbuf); + MacroVars("L", "s", outbuf); + sprintf(linebuf, "%s", CFG.bbs_name); + html_massage(linebuf, outbuf); + MacroVars("N", "s", outbuf); + sprintf(linebuf, "%s", CFG.sysop_name); + html_massage(linebuf, outbuf); + MacroVars("S", "s", outbuf); + sprintf(linebuf, "%s", CFG.comment); + html_massage(linebuf, outbuf); + MacroVars("T", "s", outbuf); + } else { + MacroVars("HLMNOSTUVYZ", "ssssssssssd", CFG.www_url, CFG.location, CFG.sysdomain, CFG.bbs_name, temp, + CFG.sysop_name, CFG.comment, CFG.sysop, VERSION, aka, 0); + } Cookie(); } + free(aka); free(temp); return fi; } diff --git a/mbfido/Makefile b/mbfido/Makefile index 19de8c74..7065ce2e 100644 --- a/mbfido/Makefile +++ b/mbfido/Makefile @@ -47,7 +47,7 @@ MBAFF_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/l ../lib/libdbase.a ../lib/libdiesel.a MBINDEX_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a MBDIFF_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a -MBFILE_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a +MBFILE_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a ../lib/libdiesel.a MBMSG_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a ../lib/libdbase.a OTHER = Makefile README maptabs.tgz paths.h.in TARGET = mbfido mbseq mbaff mbindex mbdiff mbfile mbmsg @@ -166,7 +166,7 @@ utic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/co announce.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h announce.h fflist.o: ../lib/libs.h ../lib/clcomm.h ../lib/msg.h fflist.h ftn2rfc.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbftn.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h rollover.h aliasdb.h postemail.h backalias.h ftn2rfc.h -makestat.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h makestat.h +makestat.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/diesel.h makestat.h mbindex.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbftn.h mbindex.h msgutil.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h msgutil.h postecho.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h @@ -192,7 +192,7 @@ scannews.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../li tosspkt.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h tosspkt.h postnetmail.h postecho.h rollover.h createm.h mbfkill.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfkill.h mbfutil.h mbfutil.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbfile.h -mbfindex.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbfindex.h +mbfindex.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/diesel.h mbfutil.h mbfindex.h mbfcheck.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbfcheck.h mbfpack.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbfpack.h mbflist.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbflist.h diff --git a/mbfido/announce.c b/mbfido/announce.c index a857f4aa..bb140306 100644 --- a/mbfido/announce.c +++ b/mbfido/announce.c @@ -242,7 +242,7 @@ void FinishMsg(int Final, long filepos) temp = calloc(PATH_MAX, sizeof(char)); - if (Final && ((fi = OpenMacro(newfiles.Template, newfiles.Language)) != NULL)) { + if (Final && ((fi = OpenMacro(newfiles.Template, newfiles.Language, FALSE)) != NULL)) { /* * Message footer */ @@ -298,7 +298,7 @@ long Report(gr_list *ta, long filepos) break; } - if ((fi = OpenMacro(newfiles.Template, newfiles.Language)) != NULL) { + if ((fi = OpenMacro(newfiles.Template, newfiles.Language, FALSE)) != NULL) { /* * Area block header */ diff --git a/mbfido/areamgr.c b/mbfido/areamgr.c index 8ac87db6..21a1b463 100644 --- a/mbfido/areamgr.c +++ b/mbfido/areamgr.c @@ -92,7 +92,7 @@ void A_Help(faddr *t, char *replyid) GetRpSubject("areamgr.help",subject); if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject , replyid)) != NULL) { - if ((fi = OpenMacro("areamgr.help", nodes.Language)) != NULL ){ + if ((fi = OpenMacro("areamgr.help", nodes.Language, FALSE)) != NULL ){ MacroVars("sAYP", "ssss", nodes.Sysop, "Areamgr", ascfnode(bestaka_s(t), 0xf), nodes.Apasswd ); MacroRead(fi, fp); fclose(fi); @@ -137,22 +137,22 @@ void A_List(faddr *t, char *replyid, int Notify) case LIST_NOTIFY: Syslog('+', "AreaMgr: Notify to %s", ascfnode(t, 0xff)); sprintf(subject,"AreaMgr Notify"); GetRpSubject("areamgr.notify.list",subject); - fi = OpenMacro("areamgr.notify.list", nodes.Language); + fi = OpenMacro("areamgr.notify.list", nodes.Language, FALSE); break; case LIST_LIST: Syslog('+', "AreaMgr: List"); sprintf(subject,"AreaMgr list"); GetRpSubject("areamgr.list",subject); - fi = OpenMacro("areamgr.list", nodes.Language); + fi = OpenMacro("areamgr.list", nodes.Language, FALSE); break; case LIST_QUERY: Syslog('+', "AreaMgr: Query"); sprintf(subject,"AreaMgr Query"); GetRpSubject("areamgr.query",subject); - fi = OpenMacro("areamgr.query", nodes.Language); + fi = OpenMacro("areamgr.query", nodes.Language, FALSE); break; case LIST_UNLINK: Syslog('+', "AreaMgr: Unlinked"); sprintf(subject,"AreaMgr: Unlinked areas"); GetRpSubject("areamgr.unlink",subject); - fi = OpenMacro("areamgr.unlink", nodes.Language); + fi = OpenMacro("areamgr.unlink", nodes.Language, FALSE); break; } @@ -321,12 +321,12 @@ void A_Flow(faddr *t, char *replyid, int Notify) Syslog('+', "AreaMgr: Flow report to %s", ascfnode(t, 0xff)); sprintf(subject,"AreaMgr Notify Flow Report"); GetRpSubject("areamgr.notify.flow",subject); - fi = OpenMacro("areamgr.notify.flow", nodes.Language); + fi = OpenMacro("areamgr.notify.flow", nodes.Language, FALSE); }else{ Syslog('+', "AreaMgr: Flow report"); sprintf(subject,"AreaMgr Flow Report"); GetRpSubject("areamgr.flow",subject); - fi = OpenMacro("areamgr.flow", nodes.Language); + fi = OpenMacro("areamgr.flow", nodes.Language, FALSE); } if (fi == 0) { @@ -489,7 +489,7 @@ void A_Status(faddr *t, char *replyid) ); GetRpSubject("areamgr.status",subject); - if ((fi = OpenMacro("areamgr.status", nodes.Language)) == NULL ){ + if ((fi = OpenMacro("areamgr.status", nodes.Language, FALSE)) == NULL ){ MacroClear(); free(subject); return; diff --git a/mbfido/filefind.c b/mbfido/filefind.c index 3dd1d81f..4814a5fb 100644 --- a/mbfido/filefind.c +++ b/mbfido/filefind.c @@ -210,7 +210,7 @@ void FinishReply(int Reported, int Total, long filepos) temp = calloc(PATH_MAX, sizeof(char)); - if ((fi = OpenMacro(scanmgr.template, scanmgr.Language)) != NULL) { + if ((fi = OpenMacro(scanmgr.template, scanmgr.Language, FALSE)) != NULL) { MacroVars("CD", "dd", Reported, Total); fseek(fi, filepos, SEEK_SET); Msg_Macro(fi); @@ -373,7 +373,7 @@ void ScanFiles(ff_list *tmp) fflush(stdout); } - if (((filepos = StartReply(tmp)) != -1) && ((fi = OpenMacro(scanmgr.template, scanmgr.Language)) != NULL)) { + if (((filepos = StartReply(tmp)) != -1) && ((fi = OpenMacro(scanmgr.template, scanmgr.Language, FALSE)) != NULL)) { areanr = 0; sprintf(temp, "%s/etc/fareas.data", getenv("MBSE_ROOT")); diff --git a/mbfido/filemgr.c b/mbfido/filemgr.c index 2a57cb6e..7e3930d8 100644 --- a/mbfido/filemgr.c +++ b/mbfido/filemgr.c @@ -86,7 +86,7 @@ void F_Help(faddr *t, char *replyid) GetRpSubject("filemgr.help",subject); if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid)) != NULL) { - if ((fi = OpenMacro("filemgr.help", nodes.Language)) != NULL ){ + if ((fi = OpenMacro("filemgr.help", nodes.Language, FALSE)) != NULL ){ MacroVars("sAYP", "ssss", nodes.Sysop, (char *)"Filemgr", ascfnode(bestaka_s(t), 0xf), nodes.Fpasswd ); MacroRead(fi, fp); MacroClear(); @@ -128,22 +128,22 @@ void F_List(faddr *t, char *replyid, int Notify) case LIST_NOTIFY: Syslog('+', "FileMgr: Notify to %s", ascfnode(t, 0xff)); sprintf(subject,"FileMgr Notify"); GetRpSubject("filemgr.notify.list",subject); - fi=OpenMacro("filemgr.notify.list", nodes.Language); + fi=OpenMacro("filemgr.notify.list", nodes.Language, FALSE); break; case LIST_LIST: Syslog('+', "FileMgr: List"); sprintf(subject,"FileMgr list"); GetRpSubject("filemgr.list",subject); - fi=OpenMacro("filemgr.list", nodes.Language); + fi=OpenMacro("filemgr.list", nodes.Language, FALSE); break; case LIST_QUERY: Syslog('+', "FileMgr: Query"); sprintf(subject,"FileMgr Query"); GetRpSubject("filemgr.query",subject); - fi=OpenMacro("filemgr.query", nodes.Language); + fi=OpenMacro("filemgr.query", nodes.Language, FALSE); break; default: Syslog('+', "FileMgr: Unlinked"); sprintf(subject,"FileMgr: Unlinked areas"); GetRpSubject("filemgr.unlink",subject); - fi=OpenMacro("filemgr.unlink", nodes.Language); + fi=OpenMacro("filemgr.unlink", nodes.Language, FALSE); break; } @@ -318,7 +318,7 @@ void F_Status(faddr *t, char *replyid) ); GetRpSubject("filemgr.status",subject); - if ((fi = OpenMacro("filemgr.status", nodes.Language)) == NULL ) { + if ((fi = OpenMacro("filemgr.status", nodes.Language, FALSE)) == NULL ) { free(subject); MacroClear(); return; diff --git a/mbfido/forward.c b/mbfido/forward.c index 07a144b5..d6840fff 100644 --- a/mbfido/forward.c +++ b/mbfido/forward.c @@ -135,7 +135,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl) */ if (nodes.Message) { if ((net = SendMgrMail(fido2faddr(Node), CFG.ct_KeepMgr, TRUE, (char *)"Filemgr", subject, NULL)) != NULL) { - if ((fi = OpenMacro("forward.tic", nodes.Language)) != NULL) { + if ((fi = OpenMacro("forward.tic", nodes.Language, FALSE)) != NULL) { MacroVars("abcdfghijmns", "ssdssddsssss", TIC.TicIn.Area, tic.Comment, TIC.FileCost, fgroup.Comment, TIC.TicIn.FullName, TIC.FileSize, TIC.FileSize / 1024, TIC.TicIn.Crc, TIC.TicIn.Origin, " ", TIC.TicIn.Desc, nodes.Sysop); diff --git a/mbfido/makestat.c b/mbfido/makestat.c index 33f5d639..8fb8b42a 100644 --- a/mbfido/makestat.c +++ b/mbfido/makestat.c @@ -34,135 +34,11 @@ #include "../lib/records.h" #include "../lib/common.h" #include "../lib/clcomm.h" +#include "../lib/diesel.h" #include "makestat.h" -/* - * Translate ISO 8859-1 characters to named character entities - */ -void html_massage(char *, char *); -void html_massage(char *inbuf, char *outbuf) -{ - char *inptr = inbuf; - char *outptr = outbuf; - - memset(outbuf, 0, sizeof(outbuf)); - - while (*inptr) { - - switch ((unsigned char)*inptr) { - case '"': sprintf(outptr, """); break; - case '&': sprintf(outptr, "&"); break; - case '<': sprintf(outptr, "<"); break; - case '>': sprintf(outptr, ">"); break; - case 160: sprintf(outptr, " "); break; - case 161: sprintf(outptr, "¡"); break; - case 162: sprintf(outptr, "¢"); break; - case 163: sprintf(outptr, "£"); break; - case 164: sprintf(outptr, "¤"); break; - case 165: sprintf(outptr, "¥"); break; - case 166: sprintf(outptr, "¦"); break; - case 167: sprintf(outptr, "§"); break; - case 168: sprintf(outptr, "¨"); break; - case 169: sprintf(outptr, "©"); break; - case 170: sprintf(outptr, "ª"); break; - case 171: sprintf(outptr, "«"); break; - case 172: sprintf(outptr, "¬"); break; - case 173: sprintf(outptr, "­"); break; - case 174: sprintf(outptr, "®"); break; - case 175: sprintf(outptr, "¯"); break; - case 176: sprintf(outptr, "°"); break; - case 177: sprintf(outptr, "&plumn;"); break; - case 178: sprintf(outptr, "²"); break; - case 179: sprintf(outptr, "³"); break; - case 180: sprintf(outptr, "´"); break; - case 181: sprintf(outptr, "µ"); break; - case 182: sprintf(outptr, "¶"); break; - case 183: sprintf(outptr, "·"); break; - case 184: sprintf(outptr, "¸"); break; - case 185: sprintf(outptr, "&supl;"); break; - case 186: sprintf(outptr, "º"); break; - case 187: sprintf(outptr, "»"); break; - case 188: sprintf(outptr, "¼"); break; - case 189: sprintf(outptr, "½"); break; - case 190: sprintf(outptr, "¾"); break; - case 191: sprintf(outptr, "¿"); break; - case 192: sprintf(outptr, "À"); break; - case 193: sprintf(outptr, "Á"); break; - case 194: sprintf(outptr, "Â"); break; - case 195: sprintf(outptr, "Ã"); break; - case 196: sprintf(outptr, "Ä"); break; - case 197: sprintf(outptr, "Å"); break; - case 198: sprintf(outptr, "Æ"); break; - case 199: sprintf(outptr, "Ç"); break; - case 200: sprintf(outptr, "È"); break; - case 201: sprintf(outptr, "É"); break; - case 202: sprintf(outptr, "Ê"); break; - case 203: sprintf(outptr, "Ë"); break; - case 204: sprintf(outptr, "Ì"); break; - case 205: sprintf(outptr, "Í"); break; - case 206: sprintf(outptr, "Î"); break; - case 207: sprintf(outptr, "Ï"); break; - case 208: sprintf(outptr, "Ð"); break; - case 209: sprintf(outptr, "Ñ"); break; - case 210: sprintf(outptr, "Ò"); break; - case 211: sprintf(outptr, "Ó"); break; - case 212: sprintf(outptr, "Ô"); break; - case 213: sprintf(outptr, "Õ"); break; - case 214: sprintf(outptr, "Ö"); break; - case 215: sprintf(outptr, "×"); break; - case 216: sprintf(outptr, "Ø"); break; - case 217: sprintf(outptr, "Ù"); break; - case 218: sprintf(outptr, "Ú"); break; - case 219: sprintf(outptr, "Û"); break; - case 220: sprintf(outptr, "Ü"); break; - case 221: sprintf(outptr, "Ý"); break; - case 222: sprintf(outptr, "Þ"); break; - case 223: sprintf(outptr, "ß"); break; - case 224: sprintf(outptr, "à"); break; - case 225: sprintf(outptr, "á"); break; - case 226: sprintf(outptr, "â"); break; - case 227: sprintf(outptr, "ã"); break; - case 228: sprintf(outptr, "ä"); break; - case 229: sprintf(outptr, "å"); break; - case 230: sprintf(outptr, "æ"); break; - case 231: sprintf(outptr, "ç"); break; - case 232: sprintf(outptr, "è"); break; - case 233: sprintf(outptr, "é"); break; - case 234: sprintf(outptr, "ê"); break; - case 235: sprintf(outptr, "ë"); break; - case 236: sprintf(outptr, "ì"); break; - case 237: sprintf(outptr, "í"); break; - case 238: sprintf(outptr, "î"); break; - case 239: sprintf(outptr, "ï"); break; - case 240: sprintf(outptr, "ð"); break; - case 241: sprintf(outptr, "ñ"); break; - case 242: sprintf(outptr, "ò"); break; - case 243: sprintf(outptr, "ó"); break; - case 244: sprintf(outptr, "ô"); break; - case 245: sprintf(outptr, "õ"); break; - case 246: sprintf(outptr, "ö"); break; - case 247: sprintf(outptr, "÷"); break; - case 248: sprintf(outptr, "ø"); break; - case 249: sprintf(outptr, "ù"); break; - case 250: sprintf(outptr, "ú"); break; - case 251: sprintf(outptr, "û"); break; - case 252: sprintf(outptr, "ü"); break; - case 253: sprintf(outptr, "ý"); break; - case 254: sprintf(outptr, "þ"); break; - case 255: sprintf(outptr, "ÿ"); break; - default: *outptr++ = *inptr; *outptr = '\0'; break; - } - while (*outptr) - outptr++; - - inptr++; - } - *outptr = '\0'; -} - - FILE *newpage(char *, char *); FILE *newpage(char *Name, char *Title) diff --git a/mbfido/mbfindex.c b/mbfido/mbfindex.c index 4e6ed877..ee866af8 100644 --- a/mbfido/mbfindex.c +++ b/mbfido/mbfindex.c @@ -35,6 +35,7 @@ #include "../lib/common.h" #include "../lib/clcomm.h" #include "../lib/dbcfg.h" +#include "../lib/diesel.h" #include "mbfutil.h" #include "mbfindex.h" @@ -42,6 +43,7 @@ extern int do_quiet; /* Supress screen output */ int lastfile; /* Last file number */ +long gfilepos = 0; /* Global file position */ typedef struct _Index { @@ -131,128 +133,43 @@ int comp_index(Findex **fap1, Findex **fap2) -/* - * Translate ISO 8859-1 characters to named character entities - */ -void html_massage(char *, char *); -void html_massage(char *inbuf, char *outbuf) +void MacroRead(FILE *fi, FILE *fp) { - char *inptr = inbuf; - char *outptr = outbuf; + char *line, *temp; + int res, i; - memset(outbuf, 0, sizeof(outbuf)); + line = calloc(MAXSTR, sizeof(char)); + temp = calloc(MAXSTR, sizeof(char)); - while (*inptr) { - - switch ((unsigned char)*inptr) { - case '"': sprintf(outptr, """); break; - case '&': sprintf(outptr, "&"); break; - case '<': sprintf(outptr, "<"); break; - case '>': sprintf(outptr, ">"); break; - case 160: sprintf(outptr, " "); break; - case 161: sprintf(outptr, "¡"); break; - case 162: sprintf(outptr, "¢"); break; - case 163: sprintf(outptr, "£"); break; - case 164: sprintf(outptr, "¤"); break; - case 165: sprintf(outptr, "¥"); break; - case 166: sprintf(outptr, "¦"); break; - case 167: sprintf(outptr, "§"); break; - case 168: sprintf(outptr, "¨"); break; - case 169: sprintf(outptr, "©"); break; - case 170: sprintf(outptr, "ª"); break; - case 171: sprintf(outptr, "«"); break; - case 172: sprintf(outptr, "¬"); break; - case 173: sprintf(outptr, "­"); break; - case 174: sprintf(outptr, "®"); break; - case 175: sprintf(outptr, "¯"); break; - case 176: sprintf(outptr, "°"); break; - case 177: sprintf(outptr, "&plumn;"); break; - case 178: sprintf(outptr, "²"); break; - case 179: sprintf(outptr, "³"); break; - case 180: sprintf(outptr, "´"); break; - case 181: sprintf(outptr, "µ"); break; - case 182: sprintf(outptr, "¶"); break; - case 183: sprintf(outptr, "·"); break; - case 184: sprintf(outptr, "¸"); break; - case 185: sprintf(outptr, "&supl;"); break; - case 186: sprintf(outptr, "º"); break; - case 187: sprintf(outptr, "»"); break; - case 188: sprintf(outptr, "¼"); break; - case 189: sprintf(outptr, "½"); break; - case 190: sprintf(outptr, "¾"); break; - case 191: sprintf(outptr, "¿"); break; - case 192: sprintf(outptr, "À"); break; - case 193: sprintf(outptr, "Á"); break; - case 194: sprintf(outptr, "Â"); break; - case 195: sprintf(outptr, "Ã"); break; - case 196: sprintf(outptr, "Ä"); break; - case 197: sprintf(outptr, "Å"); break; - case 198: sprintf(outptr, "Æ"); break; - case 199: sprintf(outptr, "Ç"); break; - case 200: sprintf(outptr, "È"); break; - case 201: sprintf(outptr, "É"); break; - case 202: sprintf(outptr, "Ê"); break; - case 203: sprintf(outptr, "Ë"); break; - case 204: sprintf(outptr, "Ì"); break; - case 205: sprintf(outptr, "Í"); break; - case 206: sprintf(outptr, "Î"); break; - case 207: sprintf(outptr, "Ï"); break; - case 208: sprintf(outptr, "Ð"); break; - case 209: sprintf(outptr, "Ñ"); break; - case 210: sprintf(outptr, "Ò"); break; - case 211: sprintf(outptr, "Ó"); break; - case 212: sprintf(outptr, "Ô"); break; - case 213: sprintf(outptr, "Õ"); break; - case 214: sprintf(outptr, "Ö"); break; - case 215: sprintf(outptr, "×"); break; - case 216: sprintf(outptr, "Ø"); break; - case 217: sprintf(outptr, "Ù"); break; - case 218: sprintf(outptr, "Ú"); break; - case 219: sprintf(outptr, "Û"); break; - case 220: sprintf(outptr, "Ü"); break; - case 221: sprintf(outptr, "Ý"); break; - case 222: sprintf(outptr, "Þ"); break; - case 223: sprintf(outptr, "ß"); break; - case 224: sprintf(outptr, "à"); break; - case 225: sprintf(outptr, "á"); break; - case 226: sprintf(outptr, "â"); break; - case 227: sprintf(outptr, "ã"); break; - case 228: sprintf(outptr, "ä"); break; - case 229: sprintf(outptr, "å"); break; - case 230: sprintf(outptr, "æ"); break; - case 231: sprintf(outptr, "ç"); break; - case 232: sprintf(outptr, "è"); break; - case 233: sprintf(outptr, "é"); break; - case 234: sprintf(outptr, "ê"); break; - case 235: sprintf(outptr, "ë"); break; - case 236: sprintf(outptr, "ì"); break; - case 237: sprintf(outptr, "í"); break; - case 238: sprintf(outptr, "î"); break; - case 239: sprintf(outptr, "ï"); break; - case 240: sprintf(outptr, "ð"); break; - case 241: sprintf(outptr, "ñ"); break; - case 242: sprintf(outptr, "ò"); break; - case 243: sprintf(outptr, "ó"); break; - case 244: sprintf(outptr, "ô"); break; - case 245: sprintf(outptr, "õ"); break; - case 246: sprintf(outptr, "ö"); break; - case 247: sprintf(outptr, "÷"); break; - case 248: sprintf(outptr, "ø"); break; - case 249: sprintf(outptr, "ù"); break; - case 250: sprintf(outptr, "ú"); break; - case 251: sprintf(outptr, "û"); break; - case 252: sprintf(outptr, "ü"); break; - case 253: sprintf(outptr, "ý"); break; - case 254: sprintf(outptr, "þ"); break; - case 255: sprintf(outptr, "ÿ"); break; - default: *outptr++ = *inptr; *outptr = '\0'; break; - } - while (*outptr) - outptr++; - - inptr++; + while ((fgets(line, MAXSTR-2, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) { + /* + * Skip comment lines + */ + if (line[0] != '#') { + Striplf(line); + if (strlen(line) == 0) { + /* + * Empty lines are just written + */ + fputc('\n', fp); + } else { + strncpy(temp, ParseMacro(line,&res), MAXSTR-1); + if (res) + Syslog('!', "Macro error line: \"%s\"", line); + /* + * Only output if something was evaluated + */ + if (strlen(temp)) { + for (i = 0; i < strlen(temp); i++) + fputc(temp[i], fp); + fputc('\n', fp); + } + } } - *outptr = '\0'; + } + free(line); + free(temp); + gfilepos = ftell(fi); } @@ -273,41 +190,42 @@ char *rfcdate(time_t now) +/* + * Create the macro's for the navigation bar. + */ void pagelink(FILE *, char *, int, int); void pagelink(FILE *fa, char *Path, int inArea, int Current) { - char nr[20]; - - fprintf(fa, "
\n"); + char temp[256], nr[25]; if ((Current >= CFG.www_files_page) && (inArea >= CFG.www_files_page)) { - if (((Current / CFG.www_files_page) - 1) > 0) - sprintf(nr, "%d", (Current / CFG.www_files_page) -1); - else - nr[0] = '\0'; - fprintf(fa, "\"%s\"%s \n", - CFG.www_url, CFG.www_link2ftp, Path+strlen(CFG.ftp_base), nr, - CFG.www_icon_prev, CFG.www_name_prev, CFG.www_name_prev); - } - - fprintf(fa, "\"%s\"%s \n", - CFG.www_url, CFG.www_icon_home, CFG.www_name_home, CFG.www_name_home); - fprintf(fa, "\"%s\"%s\n", - CFG.www_url, CFG.www_link2ftp, CFG.www_icon_back, CFG.www_name_back, CFG.www_name_back); + if (((Current / CFG.www_files_page) - 1) > 0) { + sprintf(nr, "%d", (Current / CFG.www_files_page) -1); + } else { + nr[0] = '\0'; + } + sprintf(temp, "%s/%s%s/index%s.html", CFG.www_url, CFG.www_link2ftp, Path+strlen(CFG.ftp_base), nr); + MacroVars("c", "s", temp); + } else { + MacroVars("c", "s", ""); + } if ((Current < (inArea - CFG.www_files_page)) && (inArea >= CFG.www_files_page)) { - fprintf(fa, " \"%s\"%s\n", - CFG.www_url, CFG.www_link2ftp, Path+strlen(CFG.ftp_base), (Current / CFG.www_files_page) + 1, - CFG.www_icon_next, CFG.www_name_next, CFG.www_name_next); - } - - fprintf(fa, "

\n"); + sprintf(temp, "%s/%s%s/index%d.html", CFG.www_url, CFG.www_link2ftp, Path+strlen(CFG.ftp_base), + (Current / CFG.www_files_page) + 1); + MacroVars("d", "s", temp); + } else { + MacroVars("d", "s", ""); + } } -FILE *newpage(char *, char *, time_t, int, int); -FILE *newpage(char *Path, char *Name, time_t later, int inArea, int Current) +/* + * Start a new file areas page + */ +FILE *newpage(char *, char *, time_t, int, int, FILE *); +FILE *newpage(char *Path, char *Name, time_t later, int inArea, int Current, FILE *fi) { char linebuf[1024], outbuf[1024]; static FILE* fa; @@ -322,21 +240,9 @@ FILE *newpage(char *Path, char *Name, time_t later, int inArea, int Current) } else { sprintf(linebuf, "%s", Name); html_massage(linebuf, outbuf); - fprintf(fa, "\n"); - fprintf(fa, "\n"); - fprintf(fa, "\n", VERSION); - fprintf(fa, "\n", rfcdate(later)); - fprintf(fa, "\n"); - fprintf(fa, "\n", CFG.www_charset); - fprintf(fa, "\n", CFG.www_author, outbuf); - fprintf(fa, "%s\n", outbuf); - fprintf(fa, "\n", CFG.www_url, CFG.www_link2ftp); - fprintf(fa, "\n\n\n"); + MacroVars("ab", "ss", rfcdate(later), outbuf); pagelink(fa, Path, inArea, Current); - fprintf(fa, "

File index of %s

\n", outbuf); - fprintf(fa, "\n"); - fprintf(fa, "\n"); + MacroRead(fi, fa); return fa; } return NULL; @@ -344,8 +250,11 @@ FILE *newpage(char *Path, char *Name, time_t later, int inArea, int Current) -void closepage(FILE *, char *, int, int); -void closepage(FILE *fa, char *Path, int inArea, int Current) +/* + * Finish a files area page + */ +void closepage(FILE *, char *, int, int, FILE *); +void closepage(FILE *fa, char *Path, int inArea, int Current, FILE *fi) { char *temp1, *temp2; @@ -354,9 +263,7 @@ void closepage(FILE *fa, char *Path, int inArea, int Current) temp1 = calloc(PATH_MAX, sizeof(char)); temp2 = calloc(PATH_MAX, sizeof(char)); - fprintf(fa, "
Nr.FilenameDateSizeDownloadsDescription

\n"); - pagelink(fa, Path, inArea, lastfile); - fprintf(fa, "\n"); + MacroRead(fi, fa); fclose(fa); if (lastfile) { sprintf(temp1, "%s/index%d.html", Path, lastfile / CFG.www_files_page); @@ -380,17 +287,18 @@ void closepage(FILE *fa, char *Path, int inArea, int Current) */ void Index(void) { - FILE *pAreas, *pFile, *pIndex, *fa, *fm, *fp; + FILE *pAreas, *pFile, *pIndex, *fa, *fb = NULL, *fm, *fp, *fi = NULL; unsigned long i, iAreas, iAreasNew = 0, record, KSize = 0L, aSize = 0; - int iTotal = 0, AreaNr = 0, j, z, x = 0, Areas = 0; + int iTotal = 0, AreaNr = 0, j, k, z, x = 0, Areas = 0; int Total = 0, aTotal = 0, inArea = 0, filenr; int fbAreas = 0, fbFiles = 0; char *sAreas, *fAreas, *newdir = NULL, *sIndex, *fn, *temp; - char linebuf[1024], outbuf[1024]; + char linebuf[1024], outbuf[1024], desc[1500]; time_t last = 0L, later; Findex *fdx = NULL; Findex *tmp; struct FILEIndex idx; + long fileptr = 0, fileptr1 = 0; sAreas = calloc(PATH_MAX, sizeof(char)); fAreas = calloc(PATH_MAX, sizeof(char)); @@ -436,6 +344,14 @@ void Index(void) Syslog('+', "FTP/HTML not defined, skipping html pages creation"); } + if (fm) { + if ((fi = OpenMacro("html.main", 'E', TRUE)) == NULL) { + Syslog('+', "Can't open macro file, skipping html pages creation"); + fclose(fm); + unlink(fn); + } + } + if (fm) { /* * Because these web pages are dynamic, ie. they change everytime you @@ -445,22 +361,9 @@ void Index(void) * also have an author name, this is the bbs name, and a content * description for search engines. Automatic advertising. */ - sprintf(linebuf, "File areas at %s", CFG.bbs_name); - html_massage(linebuf, outbuf); - fprintf(fm, "\n"); - fprintf(fm, "\n"); - fprintf(fm, "\n", VERSION); - fprintf(fm, "\n", rfcdate(later)); - fprintf(fm, "\n"); - fprintf(fm, "\n", CFG.www_charset); - fprintf(fm, "\n", CFG.www_author, outbuf); - fprintf(fm, "%s\n", outbuf); - fprintf(fm, "\n", CFG.www_url, CFG.www_link2ftp); - fprintf(fm, "\n\n\n"); - fprintf(fm, "

%s

\n", outbuf); - fprintf(fm, "\n"); - fprintf(fm, "\n"); + MacroVars("acd", "sdd", rfcdate(later), 0, 0); + MacroRead(fi, fm); + fileptr = ftell(fi); } for (i = 1; i <= iAreas; i++) { @@ -576,7 +479,12 @@ void Index(void) aSize = 0L; aTotal = 0; last = 0L; - fa = newpage(area.Path, area.Name, later, inArea, aTotal); + if ((fb = OpenMacro("html.areas", 'E', TRUE)) == NULL) { + fa = NULL; + } else { + fa = newpage(area.Path, area.Name, later, inArea, aTotal, fb); + fileptr1 = gfilepos; + } while (fread(&file, sizeof(file), 1, pFile) == 1) { if ((!file.Deleted) && (!file.Missing)) { /* @@ -601,7 +509,7 @@ void Index(void) } } - fprintf(fa, "", aTotal); + MacroVars("e", "d", aTotal); /* * Check if this is a .gif or .jpg file, if so then * check if a thumbnail file exists. If not try to @@ -619,44 +527,47 @@ void Index(void) chmod(outbuf, 0644); } } - fprintf(fa, ""); + sprintf(linebuf, "%s/%s%s/.%s", CFG.www_url, CFG.www_link2ftp, + area.Path+strlen(CFG.ftp_base), file.LName); + MacroVars("fghi", "dsss", 1, outbuf, file.LName, linebuf); } else { - fprintf(fa, "", - CFG.www_url, CFG.www_link2ftp, - area.Path+strlen(CFG.ftp_base), file.LName, file.LName); + sprintf(outbuf, "%s/%s%s/%s", CFG.www_url, CFG.www_link2ftp, + area.Path+strlen(CFG.ftp_base), file.LName); + MacroVars("fghi", "dsss", 0, outbuf, file.LName, ""); } - fprintf(fa, "", StrDateDMY(file.FileDate)); - fprintf(fa, "", - (long)(file.Size / 1024)); - fprintf(fa, "", - file.TimesDL + file.TimesFTP + file.TimesReq); - fprintf(fa, "\n"); + MacroVars("m", "s", desc); + fseek(fb, fileptr1, SEEK_SET); + MacroRead(fb, fa); aSize += file.Size; if (file.FileDate > last) last = file.FileDate; if ((aTotal % CFG.www_files_page) == 0) { - closepage(fa, area.Path, inArea, aTotal); - fa = newpage(area.Path, area.Name, later, inArea, aTotal); + closepage(fa, area.Path, inArea, aTotal, fb); + fseek(fb, 0, SEEK_SET); + fa = newpage(area.Path, area.Name, later, inArea, aTotal, fb); } } /* if (!file.deleted) */ } KSize += aSize / 1024; - closepage(fa, area.Path, inArea, aTotal); + closepage(fa, area.Path, inArea, aTotal, fb); + fclose(fb); fclose(fp); chmod(temp, 0644); @@ -674,17 +585,18 @@ void Index(void) Syslog('+', "Removed obsolete %s", linebuf); } - fprintf(fm, "", - AreaNr, CFG.www_url, CFG.www_link2ftp, area.Path+strlen(CFG.ftp_base), area.Name); - fprintf(fm, "", aTotal); + sprintf(linebuf, "%s/%s%s/index.html", CFG.www_url, CFG.www_link2ftp, area.Path+strlen(CFG.ftp_base)); if (aSize > 1048576) - fprintf(fm, "", aSize / 1048576); + sprintf(outbuf, "%ld Mb.", aSize / 1048576); else - fprintf(fm, "", aSize / 1024); + sprintf(outbuf, "%ld Kb.", aSize / 1024); + MacroVars("efghi", "dssds", AreaNr, linebuf, area.Name, aTotal, outbuf); if (last == 0L) - fprintf(fm, "\n"); + MacroVars("j", "s", " "); else - fprintf(fm, "\n", StrDateDMY(last)); + MacroVars("j", "s", StrDateDMY(last)); + fseek(fi, fileptr, SEEK_SET); + MacroRead(fi, fm); } } fclose(pFile); @@ -693,12 +605,10 @@ void Index(void) } if (fm) { - fprintf(fm, "\n", - Total, KSize / 1024); - fprintf(fm, "
AreaDescriptionFilesTotal sizeLast added
%d", - CFG.www_url, CFG.www_link2ftp, + sprintf(outbuf, "%s/%s%s/%s", CFG.www_url, CFG.www_link2ftp, area.Path+strlen(CFG.ftp_base), file.LName); - fprintf(fa, "\"%s\"", - CFG.www_url, CFG.www_link2ftp, - area.Path+strlen(CFG.ftp_base), file.LName, file.LName); - fprintf(fa, "%s%s%lu Kb.%8ld
");
+			    sprintf(outbuf, "%lu Kb.", (long)(file.Size / 1024));
+			    MacroVars("jkl", "ssd", StrDateDMY(file.FileDate), outbuf, file.TimesDL+file.TimesFTP+file.TimesReq);
+			    memset(&desc, 0, sizeof(desc));
+			    k = 0;
 			    for (j = 0; j < 25; j++)
 				if (strlen(file.Desc[j])) {
-				    if (j)
-					fprintf(fa, "\n");
+				    if (j) {
+					sprintf(desc+k, "\n");
+					k += 1;
+				    }
 				    sprintf(linebuf, "%s", strkconv(file.Desc[j], CHRS_DEFAULT_FTN, CHRS_DEFAULT_RFC));
 				    html_massage(linebuf, outbuf);
-				    fprintf(fa, "%s", outbuf);
+				    sprintf(desc+k, "%s", outbuf);
+				    k += strlen(outbuf);
 				}
-			    fprintf(fa, "
%d%s%d%ld Mb.%ld Kb. 
%s
 Total%d%ld Mb. 

\n"); - fprintf(fm, "\"%s\"%s\n", - CFG.www_icon_home, CFG.www_name_home, CFG.www_name_home); - fprintf(fm, "\n"); + sprintf(linebuf, "%ld Mb.", KSize / 1024); + MacroVars("cd", "ds", Total, linebuf); + MacroRead(fi, fm); + fclose(fi); fclose(fm); sprintf(linebuf, "%s/index.html", CFG.ftp_base); rename(fn, linebuf); diff --git a/mbfido/mgrutil.c b/mbfido/mgrutil.c index 6213762d..794e3434 100644 --- a/mbfido/mgrutil.c +++ b/mbfido/mgrutil.c @@ -93,7 +93,7 @@ void WriteMailGroups(FILE *fp, faddr *f) faddr *g; fpos_t fileptr; - if ((fi = OpenMacro("areamgr.group", nodes.Language)) == NULL) + if ((fi = OpenMacro("areamgr.group", nodes.Language, FALSE)) == NULL) return; MacroRead(fi, fp); @@ -150,7 +150,7 @@ void WriteFileGroups(FILE *fp, faddr *f) faddr *g; fpos_t fileptr; - if ((fi = OpenMacro("filemgr.group", nodes.Language)) == NULL) + if ((fi = OpenMacro("filemgr.group", nodes.Language, FALSE)) == NULL) return; MacroRead(fi, fp); @@ -414,7 +414,7 @@ void GetRpSubject(const char *report, char* subject) int res; temp = calloc(256,sizeof(char)); - if ((fi=OpenMacro(report, nodes.Language))!=NULL){ + if ((fi=OpenMacro(report, nodes.Language, FALSE))!=NULL){ while ( fgets(temp, 254, fi) != NULL ) if (temp[0] != '#') ParseMacro(temp,&res); @@ -439,7 +439,7 @@ int MsgResult(const char * report, FILE *fo) temp = calloc(256,sizeof(char)); resp = calloc(256,sizeof(char)); - if ((fi = OpenMacro(report, nodes.Language)) != NULL){ + if ((fi = OpenMacro(report, nodes.Language, FALSE)) != NULL){ while ( fgets(temp, 254, fi) != NULL ){ if (temp[0] != '#') { strncpy(resp, ParseMacro(temp, &res), 80); diff --git a/mbfido/msgutil.c b/mbfido/msgutil.c index de158207..719e9019 100644 --- a/mbfido/msgutil.c +++ b/mbfido/msgutil.c @@ -148,7 +148,7 @@ long Msg_Top(char *template, int language, fidoaddr aka) temp = calloc(PATH_MAX, sizeof(char)); - if ((fi = OpenMacro(template, language))) { + if ((fi = OpenMacro(template, language, FALSE))) { /* * First override default aka with current aka, then display header. */ diff --git a/mbsetup/m_marea.c b/mbsetup/m_marea.c index 5675b415..b660bfdc 100644 --- a/mbsetup/m_marea.c +++ b/mbsetup/m_marea.c @@ -1199,18 +1199,8 @@ int EditMsgRec(int Area) changed = TRUE; } } - if (!msgs.Active && Active) { - InitMsgRec(); + if (!msgs.Active && Active) msgs.Active = TRUE; - /* - * Clear connections, just in case from older mbse versions - * might have left garbage here. - */ - fseek(tfil, 0, SEEK_SET); - memset(&System, 0, sizeof(System)); - for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) - fwrite(&System, sizeof(System), 1, tfil); - } SetScreen(); break; case 15:E_INT( 13,52, msgs.DaysOld, "Maximum ^days^ to keep mail in this area") diff --git a/script/rundoor.sh b/script/rundoor.sh index db82f5d6..65be765e 100644 --- a/script/rundoor.sh +++ b/script/rundoor.sh @@ -11,7 +11,7 @@ # by Redy Rodriguez and Michiel Broek. # DOOR=`basename $0` -COMMANDO="\"door $DOOR $*\r\"" +COMMANDO="\"doors $DOOR $*\r\"" /usr/bin/sudo /opt/mbse/bin/bbsdoor.sh $DOOR $1 /usr/bin/sudo /opt/dosemu/bin/dosemu.bin \