diff --git a/ChangeLog b/ChangeLog index 0020a6b1..40093b16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,14 @@ v0.51.3 22-Mar-2003 mbtask: Signal handler for sigchld set to sig_dfl, test for Fedora. + mbsetup: + Added experimental sitedoc creation in html format. + The advantage of html over the old plain doc is to easy see + crossreferences using hyperlinks. + The html files are created in /opt/mbse/doc/html. + The ~/doc/xref.doc and ~/doc/stat.doc are not created anymore, + there was nothing in it yet. + v0.51.2 06-Mar-2004 - 22-Mar-2003 diff --git a/mbsetup/Makefile b/mbsetup/Makefile index be2c1095..0843f58f 100644 --- a/mbsetup/Makefile +++ b/mbsetup/Makefile @@ -22,7 +22,7 @@ OBJS = grlist.o m_domain.o m_fgroup.o m_lang.o m_marea.o m_new.o m_protocol.o \ m_magic.o m_mgroup.o m_node.o m_task.o m_users.o screen.o m_bbs.o m_ff.o \ m_hatch.o m_mail.o m_modem.o m_ol.o m_tic.o m_virus.o stlist.o m_bbslist.o \ m_route.o -LIBS += ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a +LIBS += ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libdiesel.a OTHER = Makefile ############################################################################# @@ -88,10 +88,10 @@ m_menu.o: ../config.h ../lib/mbselib.h mutil.h screen.h ledit.h m_lang.h m_menu. m_ngroup.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_global.h m_ngroup.h m_service.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_global.h m_service.h m_tty.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_modem.h m_global.h m_tty.h -mutil.o: ../config.h ../lib/mbselib.h screen.h mutil.h +mutil.o: ../config.h ../lib/mbselib.h ../lib/diesel.h screen.h mutil.h m_archive.o: ../config.h ../lib/mbselib.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h m_fdb.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h -m_global.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_fgroup.h m_mgroup.h m_global.h +m_global.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_fgroup.h m_mgroup.h m_limits.h m_global.h m_magic.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h m_mgroup.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h m_node.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_node.h diff --git a/mbsetup/m_archive.c b/mbsetup/m_archive.c index e1f54420..093a8156 100644 --- a/mbsetup/m_archive.c +++ b/mbsetup/m_archive.c @@ -781,8 +781,8 @@ char *PickArchive(char *shdr) int archive_doc(FILE *fp, FILE *toc, int page) { char temp[PATH_MAX]; - FILE *arch; - int j; + FILE *arch, *wp, *ip; + int i, j; sprintf(temp, "%s/etc/archiver.data", getenv("MBSE_ROOT")); if ((arch = fopen(temp, "r")) == NULL) @@ -790,7 +790,11 @@ int archive_doc(FILE *fp, FILE *toc, int page) page = newpage(fp, page); addtoc(fp, toc, 3, 0, page, (char *)"Archiver programs"); - j = 0; + i = j = 0; + + ip = open_webdoc((char *)"archivers.html", (char *)"Archivers", NULL); + fprintf(ip, "Main\n"); + fprintf(ip, "\n"); + close_webdoc(ip); return page; } diff --git a/mbsetup/m_bbs.c b/mbsetup/m_bbs.c index 08543c42..23ed0e1f 100644 --- a/mbsetup/m_bbs.c +++ b/mbsetup/m_bbs.c @@ -92,16 +92,31 @@ void bbs_menu(void) int bbs_doc(FILE *fp, FILE *toc, int page) { - page = newpage(fp, page); - addtoc(fp, toc, 8, 0, page, (char *)"BBS setup"); + FILE *wp; + + if ((wp = open_webdoc((char *)"bbs.html", (char *)"BBS Setup", NULL))) { + fprintf(wp, "Main\n"); + fprintf(wp, "\n"); + fclose(wp); + } - page = bbs_limits_doc(fp, toc, page); - page = bbs_lang_doc(fp, toc, page); - page = bbs_menu_doc(fp, toc, page); - page = bbs_file_doc(fp, toc, page); - page = bbs_prot_doc(fp, toc, page); + page = newpage(fp, page); + addtoc(fp, toc, 8, 0, page, (char *)"BBS setup"); - return page; + page = bbs_limits_doc(fp, toc, page); + page = bbs_lang_doc(fp, toc, page); + page = bbs_menu_doc(fp, toc, page); + page = bbs_file_doc(fp, toc, page); + page = bbs_prot_doc(fp, toc, page); + + return page; } diff --git a/mbsetup/m_domain.c b/mbsetup/m_domain.c index 7cb42224..5bf32ac7 100644 --- a/mbsetup/m_domain.c +++ b/mbsetup/m_domain.c @@ -464,7 +464,7 @@ void InitDomain(void) int domain_doc(FILE *fp, FILE *toc, int page) { char temp[PATH_MAX]; - FILE *no; + FILE *no, *wp; int j; sprintf(temp, "%s/etc/domain.data", getenv("MBSE_ROOT")); @@ -475,6 +475,14 @@ int domain_doc(FILE *fp, FILE *toc, int page) addtoc(fp, toc, 15, 0, page, (char *)"Domain manager"); j = 0; + wp = open_webdoc((char *)"domain.html", (char *)"Domain Translation", NULL); + fprintf(wp, "Main\n"); + fprintf(wp, "

\n"); + fprintf(wp, "\n"); +// fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(fp, "\n"); fprintf(fp, " Fidonet Internet Active\n"); fprintf(fp, " ------------------------------ ------------------------------ ------\n"); @@ -490,10 +498,15 @@ int domain_doc(FILE *fp, FILE *toc, int page) j = 0; } + fprintf(wp, "\n", + domtrans.ftndom, domtrans.intdom, getboolean(domtrans.Active)); fprintf(fp, " %-30s %-30s %s\n", domtrans.ftndom, domtrans.intdom, getboolean(domtrans.Active)); j++; } + fprintf(wp, "\n"); + fprintf(wp, "
FidonetInternetActive
%s%s%s
\n"); + close_webdoc(wp); fclose(no); return page; } diff --git a/mbsetup/m_farea.c b/mbsetup/m_farea.c index 686a8f55..d453038b 100644 --- a/mbsetup/m_farea.c +++ b/mbsetup/m_farea.c @@ -754,60 +754,109 @@ void InitFilearea(void) int bbs_file_doc(FILE *fp, FILE *toc, int page) { - char temp[PATH_MAX]; - FILE *no; - int i = 0, j = 0; + char temp[PATH_MAX]; + FILE *wp, *ip, *no; + int i = 0, j = 0; - sprintf(temp, "%s/etc/fareas.data", getenv("MBSE_ROOT")); - if ((no = fopen(temp, "r")) == NULL) - return page; - - fread(&areahdr, sizeof(areahdr), 1, no); - page = newpage(fp, page); - addtoc(fp, toc, 8, 4, page, (char *)"BBS File areas"); - - while ((fread(&area, areahdr.recsize, 1, no)) == 1) { - - i++; - if (area.Available) { - - if (j == 1) { - page = newpage(fp, page); - j = 0; - } else { - j++; - } - fprintf(fp, "\n\n"); - fprintf(fp, " Area number %d\n", i); - fprintf(fp, " Area name %s\n", area.Name); - fprintf(fp, " Files path %s\n", area.Path); - fprintf(fp, " Download sec. %s\n", get_secstr(area.DLSec)); - fprintf(fp, " Upload security %s\n", get_secstr(area.UPSec)); - fprintf(fp, " List seccurity %s\n", get_secstr(area.LTSec)); - fprintf(fp, " Path to files.bbs %s\n", area.FilesBbs); - fprintf(fp, " Newfiles scan %s\n", getboolean(area.New)); - fprintf(fp, " Check upl. dupes %s\n", getboolean(area.Dupes)); - fprintf(fp, " Files are free %s\n", getboolean(area.Free)); - fprintf(fp, " Allow direct DL %s\n", getboolean(area.DirectDL)); - fprintf(fp, " Allow pwd upl. %s\n", getboolean(area.PwdUP)); - fprintf(fp, " Filefind on %s\n", getboolean(area.FileFind)); - fprintf(fp, " Add files sorted %s\n", getboolean(area.AddAlpha)); - fprintf(fp, " Files in CDROM %s\n", getboolean(area.CDrom)); - fprintf(fp, " Allow filerequst %s\n", getboolean(area.FileReq)); - fprintf(fp, " BBS group %s\n", area.BbsGroup); - fprintf(fp, " Newfiles group %s\n", area.NewGroup); - fprintf(fp, " Minimum age %d\n", area.Age); - fprintf(fp, " Area password %s\n", area.Password); - fprintf(fp, " Kill DL days %d\n", area.DLdays); - fprintf(fp, " Kill FD days %d\n", area.FDdays); - fprintf(fp, " Move to area %d\n", area.MoveArea); - fprintf(fp, " Archiver %s\n", area.Archiver); - fprintf(fp, " Upload area %d\n", area.Upload); - } - } - - fclose(no); + sprintf(temp, "%s/etc/fareas.data", getenv("MBSE_ROOT")); + if ((no = fopen(temp, "r")) == NULL) return page; + + fread(&areahdr, sizeof(areahdr), 1, no); + page = newpage(fp, page); + addtoc(fp, toc, 8, 4, page, (char *)"BBS File areas"); + + ip = open_webdoc((char *)"fileareas.html", (char *)"File Areas", NULL); + fprintf(ip, "Main\n"); + fprintf(ip, "

\n"); + close_webdoc(ip); + + fclose(no); + return page; } diff --git a/mbsetup/m_ff.c b/mbsetup/m_ff.c index 1b7871a7..c0b5f018 100644 --- a/mbsetup/m_ff.c +++ b/mbsetup/m_ff.c @@ -432,46 +432,79 @@ void InitFilefind(void) int ff_doc(FILE *fp, FILE *toc, int page) { - char temp[PATH_MAX]; - FILE *no; - int j; + char temp[PATH_MAX]; + FILE *wp, *ip, *no; + int i = 0, j; - sprintf(temp, "%s/etc/scanmgr.data", getenv("MBSE_ROOT")); - if ((no = fopen(temp, "r")) == NULL) - return page; + sprintf(temp, "%s/etc/scanmgr.data", getenv("MBSE_ROOT")); + if ((no = fopen(temp, "r")) == NULL) + return page; - page = newpage(fp, page); - addtoc(fp, toc, 13, 0, page, (char *)"Filefind areas"); - j = 0; + page = newpage(fp, page); + addtoc(fp, toc, 13, 0, page, (char *)"Filefind areas"); + j = 0; - fprintf(fp, "\n\n"); - fread(&scanmgrhdr, sizeof(scanmgrhdr), 1, no); + fprintf(fp, "\n\n"); + fread(&scanmgrhdr, sizeof(scanmgrhdr), 1, no); - while ((fread(&scanmgr, scanmgrhdr.recsize, 1, no)) == 1) { + ip = open_webdoc((char *)"filefind.html", (char *)"Filefind Areas", NULL); + fprintf(ip, "Main\n"); + fprintf(ip, "\n"); + close_webdoc(ip); + + fclose(no); + return page; } diff --git a/mbsetup/m_fgroup.c b/mbsetup/m_fgroup.c index 9b8dd228..5672579c 100644 --- a/mbsetup/m_fgroup.c +++ b/mbsetup/m_fgroup.c @@ -682,68 +682,125 @@ char *PickFGroup(char *shdr) int tic_group_doc(FILE *fp, FILE *toc, int page) { - char *temp; - FILE *no; - int First = TRUE;; + char *temp; + FILE *wp, *ip, *no; + int First = TRUE;; - temp = calloc(PATH_MAX, sizeof(char)); - sprintf(temp, "%s/etc/fgroups.data", getenv("MBSE_ROOT")); - if ((no = fopen(temp, "r")) == NULL) { - free(temp); - return page; - } + temp = calloc(PATH_MAX, sizeof(char)); + sprintf(temp, "%s/etc/fgroups.data", getenv("MBSE_ROOT")); + if ((no = fopen(temp, "r")) == NULL) { free(temp); + return page; + } - fread(&fgrouphdr, sizeof(fgrouphdr), 1, no); - fseek(no, 0, SEEK_SET); - fread(&fgrouphdr, fgrouphdr.hdrsize, 1, no); + fread(&fgrouphdr, sizeof(fgrouphdr), 1, no); + fseek(no, 0, SEEK_SET); + fread(&fgrouphdr, fgrouphdr.hdrsize, 1, no); - while ((fread(&fgroup, fgrouphdr.recsize, 1, no)) == 1) { - if (First) { - addtoc(fp, toc, 10, 1, page, (char *)"File processing groups"); - First = FALSE; - fprintf(fp, "\n"); - } else { - page = newpage(fp, page); - fprintf(fp, "\n\n"); - } - - fprintf(fp, " Group name %s\n", fgroup.Name); - fprintf(fp, " Comment %s\n", fgroup.Comment); - fprintf(fp, " Active %s\n", getboolean(fgroup.Active)); - fprintf(fp, " Use Aka %s\n", aka2str(fgroup.UseAka)); - fprintf(fp, " Uplink %s\n", aka2str(fgroup.UpLink)); - fprintf(fp, " Areas file %s\n", fgroup.AreaFile); - fprintf(fp, " Start area %ld\n", fgroup.StartArea); - fprintf(fp, " Banner file %s\n", fgroup.Banner); - fprintf(fp, " Def. archiver %s\n", fgroup.Convert); - fprintf(fp, " Filegate fmt %s\n", getboolean(fgroup.FileGate)); - fprintf(fp, " Auto change %s\n", getboolean(fgroup.AutoChange)); - fprintf(fp, " User change %s\n", getboolean(fgroup.UserChange)); - fprintf(fp, " Allow replace %s\n", getboolean(fgroup.Replace)); - fprintf(fp, " Dupe checking %s\n", getboolean(fgroup.DupCheck)); - fprintf(fp, " Secure %s\n", getboolean(fgroup.Secure)); - fprintf(fp, " Touch dates %s\n", getboolean(fgroup.Touch)); - fprintf(fp, " Virus scan %s\n", getboolean(fgroup.VirScan)); - fprintf(fp, " Announce %s\n", getboolean(fgroup.Announce)); - fprintf(fp, " Update magics %s\n", getboolean(fgroup.UpdMagic)); - fprintf(fp, " FILE_ID.DIZ %s\n", getboolean(fgroup.FileId)); - fprintf(fp, " Convert all %s\n", getboolean(fgroup.ConvertAll)); - fprintf(fp, " Send original %s\n", getboolean(fgroup.SendOrg)); - fprintf(fp, " Base path %s\n", fgroup.BasePath); - fprintf(fp, " Download sec. %s\n", get_secstr(fgroup.DLSec)); - fprintf(fp, " Upload sec. %s\n", get_secstr(fgroup.UPSec)); - fprintf(fp, " List security %s\n", get_secstr(fgroup.LTSec)); - fprintf(fp, " Def. tic sec. %s\n", getflag(fgroup.LinkSec.flags, fgroup.LinkSec.notflags)); - fprintf(fp, " BBS group %s\n", fgroup.BbsGroup); - fprintf(fp, " Announce group %s\n", fgroup.AnnGroup); - fprintf(fp, " Upload area %d\n", fgroup.Upload); - fprintf(fp, " Start date %s", ctime(&fgroup.StartDate)); - fprintf(fp, " Last date %s\n", ctime(&fgroup.LastDate)); + ip = open_webdoc((char *)"filegroup.html", (char *)"File Groups", NULL); + fprintf(ip, "Main\n"); + fprintf(ip, "\n"); + close_webdoc(ip); + + fclose(no); + free(temp); + return page; } diff --git a/mbsetup/m_fido.c b/mbsetup/m_fido.c index 00b4b130..8cbb8ee6 100644 --- a/mbsetup/m_fido.c +++ b/mbsetup/m_fido.c @@ -510,48 +510,85 @@ void gold_akamatch(FILE *fp) int fido_doc(FILE *fp, FILE *toc, int page) { - char temp[PATH_MAX]; - FILE *fido; - int i, j; + char temp[PATH_MAX]; + FILE *wp, *ip, *fido; + int i, j; - sprintf(temp, "%s/etc/fidonet.data", getenv("MBSE_ROOT")); - if ((fido = fopen(temp, "r")) == NULL) - return page; + sprintf(temp, "%s/etc/fidonet.data", getenv("MBSE_ROOT")); + if ((fido = fopen(temp, "r")) == NULL) + return page; - page = newpage(fp, page); - addtoc(fp, toc, 2, 0, page, (char *)"Fidonet networks"); - j = 0; + page = newpage(fp, page); + addtoc(fp, toc, 2, 0, page, (char *)"Fidonet networks"); + j = 0; - fprintf(fp, "\n\n"); - fread(&fidonethdr, sizeof(fidonethdr), 1, fido); - while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) { + fprintf(fp, "\n\n"); + fread(&fidonethdr, sizeof(fidonethdr), 1, fido); - if (j == 6) { - page = newpage(fp, page); - fprintf(fp, "\n"); - j = 0; - } + ip = open_webdoc((char *)"fidonet.html", (char *)"Fidonet networks", NULL); + fprintf(ip, "Main\n"); + fprintf(ip, "\n"); + close_webdoc(ip); + + fclose(fido); + return page; } diff --git a/mbsetup/m_global.c b/mbsetup/m_global.c index 7e389438..53f186c5 100644 --- a/mbsetup/m_global.c +++ b/mbsetup/m_global.c @@ -39,6 +39,7 @@ #include "m_new.h" #include "m_fgroup.h" #include "m_mgroup.h" +#include "m_limits.h" #include "m_global.h" @@ -1595,137 +1596,303 @@ int PickAka(char *msg, int openit) +void web_secflags(FILE *fp, char *name, securityrec sec) +{ + int i; + + fprintf(fp, "%s%d (%s)\n", name, sec.level, get_limit_name(sec.level)); + for (i = 0; i < 32; i++) { + if ((sec.flags >> i) & 1) { + fprintf(fp, " .and. bit %d (%s)\n", i, CFG.fname[i]); + } else if ((sec.notflags >> i) & 1) { + fprintf(fp, " .and not. bit %d (%s)\n", i, CFG.fname[i]); + } + } +} + + + int global_doc(FILE *fp, FILE *toc, int page) { - int i, j; - struct utsname utsbuf; - time_t now; - char *p; + int i, j; + struct utsname utsbuf; + time_t now; + char *p, temp[1024]; + FILE *wp; + + if (config_read()) + return page; - if (config_read()) - return page; + page = newpage(fp, page); + addtoc(fp, toc, 1, 0, page, (char *)"Global system setup"); + addtoc(fp, toc, 1, 1, page, (char *)"Host system information"); - page = newpage(fp, page); - addtoc(fp, toc, 1, 0, page, (char *)"Global system setup"); - addtoc(fp, toc, 1, 1, page, (char *)"Host system information"); + wp = open_webdoc((char *)"global.html", (char *)"Global Configuration", NULL); + fprintf(wp, "Main\n"); + fprintf(wp, "\n"); + fprintf(wp, "
\n"); - memset(&utsbuf, 0, sizeof(utsbuf)); - if (uname(&utsbuf) == 0) { - fprintf(fp, " Node name %s\n", utsbuf.nodename); + fprintf(wp, "

Host System Information

\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + memset(&utsbuf, 0, sizeof(utsbuf)); + if (uname(&utsbuf) == 0) { + add_webtable(wp, (char *)"Node name", utsbuf.nodename); + fprintf(fp, " Node name %s\n", utsbuf.nodename); #ifdef __USE_GNU - fprintf(fp, " Domain name %s\n", utsbuf.domainname); + add_webtable(wp, (char *)"Domain name", utsbuf.domainname); + fprintf(fp, " Domain name %s\n", utsbuf.domainname); #else #ifdef __linux__ - fprintf(fp, " Domain name %s\n", utsbuf.__domainname); + add_webtable(wp, (char *)"Domain name", utsbuf.__domainname); + fprintf(fp, " Domain name %s\n", utsbuf.__domainname); #endif #endif - fprintf(fp, " Operating system %s %s\n", utsbuf.sysname, utsbuf.release); - fprintf(fp, " Kernel version %s\n", utsbuf.version); - fprintf(fp, " Machine type %s\n", utsbuf.machine); + sprintf(temp, "%s %s", utsbuf.sysname, utsbuf.release); + add_webtable(wp, (char *)"Operating system", temp); + fprintf(fp, " Operating system %s %s\n", utsbuf.sysname, utsbuf.release); + add_webtable(wp, (char *)"Kernel version", utsbuf.version); + fprintf(fp, " Kernel version %s\n", utsbuf.version); + add_webtable(wp, (char *)"Machine type", utsbuf.machine); + fprintf(fp, " Machine type %s\n", utsbuf.machine); + } + add_webtable(wp, (char *)"MBSE_ROOT", getenv("MBSE_ROOT")); + fprintf(fp, " MBSE_ROOT %s\n", getenv("MBSE_ROOT")); + now = time(NULL); + add_webtable(wp, (char *)"Date created", ctime(&now)); + fprintf(fp, " Date created %s", ctime(&now)); + fprintf(wp, "\n"); + fprintf(wp, "
\n"); + fprintf(wp, "Top\n"); + fprintf(wp, "
\n"); + + fprintf(wp, "

System fidonet addresses

\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + addtoc(fp, toc, 1, 2, page, (char *)"System fidonet addresses"); + for (i = 0; i < 40; i++) { + if (CFG.akavalid[i]) { + fprintf(fp, " Aka %2d %s\n", i+1, aka2str(CFG.aka[i])); + sprintf(temp, "Aka %d", i+1); + add_webtable(wp, temp, aka2str(CFG.aka[i])); } - fprintf(fp, " MBSE_ROOT %s\n", getenv("MBSE_ROOT")); - now = time(NULL); - fprintf(fp, " Date created %s", ctime(&now)); + } + fprintf(wp, "\n"); + fprintf(wp, "
\n"); + fprintf(wp, "Top\n"); + fprintf(wp, "
\n"); + page = newpage(fp, page); - addtoc(fp, toc, 1, 2, page, (char *)"System fidonet addresses"); - for (i = 0; i < 40; i++) - if (CFG.akavalid[i]) - fprintf(fp, " Aka %2d %s\n", i+1, aka2str(CFG.aka[i])); + fprintf(wp, "

Registration information

\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + add_webtable(wp, (char *)"System name", CFG.bbs_name); + add_webtable(wp, (char *)"Domain name", CFG.sysdomain); + add_webtable(wp, (char *)"Sysop unix name", CFG.sysop); + add_webtable(wp, (char *)"Sysop fido name", CFG.sysop_name); + add_webtable(wp, (char *)"System location", CFG.location); + add_webtable(wp, (char *)"QWK/Bluewave id", CFG.bbsid); + add_webtable(wp, (char *)"Omen id", CFG.bbsid2); + add_webtable(wp, (char *)"Comment", CFG.comment); + add_webtable(wp, (char *)"Origin line", CFG.origin); + add_webtable(wp, (char *)"Start unix name", CFG.startname); + fprintf(wp, "\n"); + fprintf(wp, "
\n"); + fprintf(wp, "Top\n"); + fprintf(wp, "
\n"); + addtoc(fp, toc, 1, 3, page, (char *)"Registration information"); + fprintf(fp, " System name %s\n", CFG.bbs_name); + fprintf(fp, " Domain name %s\n", CFG.sysdomain); + fprintf(fp, " Sysop unix name %s\n", CFG.sysop); + fprintf(fp, " Sysop fido name %s\n", CFG.sysop_name); + fprintf(fp, " System location %s\n", CFG.location); + fprintf(fp, " QWK/Bluewave id %s\n", CFG.bbsid); + fprintf(fp, " Omen id %s\n", CFG.bbsid2); + fprintf(fp, " Comment %s\n", CFG.comment); + fprintf(fp, " Origin line %s\n", CFG.origin); + fprintf(fp, " Start unix name %s\n", CFG.startname); - page = newpage(fp, page); + fprintf(wp, "

Global filenames

\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + add_webtable(wp, (char *)"System logfile", CFG.logfile); + add_webtable(wp, (char *)"Error logfile", CFG.error_log); + add_webtable(wp, (char *)"Debug logfile", CFG.debuglog); + add_webtable(wp, (char *)"Manager logfile", CFG.mgrlog); + add_webtable(wp, (char *)"Default menu", CFG.default_menu); + add_webtable(wp, (char *)"Default language", CFG.current_language); + add_webtable(wp, (char *)"Chat logfile", CFG.chat_log); + add_webtable(wp, (char *)"Welcome logo", CFG.welcome_logo); + fprintf(wp, "\n"); + fprintf(wp, "
\n"); + fprintf(wp, "Top\n"); + fprintf(wp, "
\n"); + addtoc(fp, toc, 1, 4, page, (char *)"Global filenames"); + fprintf(fp, " System logfile %s\n", CFG.logfile); + fprintf(fp, " Error logfile %s\n", CFG.error_log); + fprintf(fp, " Debug logfile %s\n", CFG.debuglog); + fprintf(fp, " Manager logfile %s\n", CFG.mgrlog); + fprintf(fp, " Default menu %s\n", CFG.default_menu); + fprintf(fp, " Default language %s\n", CFG.current_language); + fprintf(fp, " Chat logfile %s\n", CFG.chat_log); + fprintf(fp, " Welcome logo %s\n", CFG.welcome_logo); - addtoc(fp, toc, 1, 3, page, (char *)"Registration information"); - fprintf(fp, " System name %s\n", CFG.bbs_name); - fprintf(fp, " Domain name %s\n", CFG.sysdomain); - fprintf(fp, " Sysop unix name %s\n", CFG.sysop); - fprintf(fp, " Sysop fido name %s\n", CFG.sysop_name); - fprintf(fp, " System location %s\n", CFG.location); - fprintf(fp, " QWK/Bluewave id %s\n", CFG.bbsid); - fprintf(fp, " Omen id %s\n", CFG.bbsid2); - fprintf(fp, " Comment %s\n", CFG.comment); - fprintf(fp, " Origin line %s\n", CFG.origin); - fprintf(fp, " Start unix name %s\n", CFG.startname); + fprintf(wp, "

Pathnames

\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + add_webtable(wp, (char *)"Menufiles", CFG.bbs_menus); + add_webtable(wp, (char *)"Textfiles", CFG.bbs_txtfiles); + add_webtable(wp, (char *)"Macro templates", CFG.bbs_macros); + add_webtable(wp, (char *)"Users homedirs", CFG.bbs_usersdir); + add_webtable(wp, (char *)"Nodelists", CFG.nodelists); + add_webtable(wp, (char *)"Unsafe inbound", CFG.inbound); + add_webtable(wp, (char *)"Known inbound", CFG.pinbound); + add_webtable(wp, (char *)"Outbound", CFG.outbound); + add_webtable(wp, (char *)"Outbound queue", CFG.out_queue); + add_webtable(wp, (char *)"*.msgs path", CFG.msgs_path); + add_webtable(wp, (char *)"Bad TIC's", CFG.badtic); + add_webtable(wp, (char *)"TIC queue", CFG.ticout); + add_webtable(wp, (char *)"Magic filerequests", CFG.req_magic); + add_webtable(wp, (char *)"DOS path", CFG.dospath); + add_webtable(wp, (char *)"Unix path", CFG.uxpath); + add_webtable(wp, (char *)"Leave case as is", getboolean(CFG.leavecase)); + add_webtable(wp, (char *)"FTP base path", CFG.ftp_base); + add_webtable(wp, (char *)"Area lists", CFG.alists_path); + add_webtable(wp, (char *)"External editor", CFG.externaleditor); + fprintf(wp, "\n"); + fprintf(wp, "
\n"); + fprintf(wp, "Top\n"); + fprintf(wp, "
\n"); + addtoc(fp, toc, 1, 5, page, (char *)"Pathnames"); + fprintf(fp, " Menufiles %s\n", CFG.bbs_menus); + fprintf(fp, " Textfiles %s\n", CFG.bbs_txtfiles); + fprintf(fp, " Macros %s\n", CFG.bbs_macros); + fprintf(fp, " Users homedirs %s\n", CFG.bbs_usersdir); + fprintf(fp, " Nodelists %s\n", CFG.nodelists); + fprintf(fp, " Unsafe inbound %s\n", CFG.inbound); + fprintf(fp, " Known inbound %s\n", CFG.pinbound); + fprintf(fp, " Outbound %s\n", CFG.outbound); + fprintf(fp, " Out queue %s\n", CFG.out_queue); + fprintf(fp, " *.msgs path %s\n", CFG.msgs_path); + fprintf(fp, " Bad TIC's %s\n", CFG.badtic); + fprintf(fp, " TIC queue %s\n", CFG.ticout); + fprintf(fp, " Magic filereq. %s\n", CFG.req_magic); + fprintf(fp, " DOS path %s\n", CFG.dospath); + fprintf(fp, " Unix path %s\n", CFG.uxpath); + fprintf(fp, " Leave case as is %s\n", getboolean(CFG.leavecase)); + fprintf(fp, " FTP base path %s\n", CFG.ftp_base); + fprintf(fp, " Area lists %s\n", CFG.alists_path); + fprintf(fp, " External editor %s\n", CFG.externaleditor); - addtoc(fp, toc, 1, 4, page, (char *)"Global filenames"); - fprintf(fp, " System logfile %s\n", CFG.logfile); - fprintf(fp, " Error logfile %s\n", CFG.error_log); - fprintf(fp, " Debug logfile %s\n", CFG.debuglog); - fprintf(fp, " Manager logfile %s\n", CFG.mgrlog); - fprintf(fp, " Default menu %s\n", CFG.default_menu); - fprintf(fp, " Default language %s\n", CFG.current_language); - fprintf(fp, " Chat logfile %s\n", CFG.chat_log); - fprintf(fp, " Welcome logo %s\n", CFG.welcome_logo); + fprintf(wp, "

Global settings

\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + add_webtable(wp, (char *)"Show new message areas", getboolean(CFG.NewAreas)); + add_webtable(wp, (char *)"Exclude sysop from lists", getboolean(CFG.exclude_sysop)); + add_webtable(wp, (char *)"Show connect info", getboolean(CFG.iConnectString)); + add_webtable(wp, (char *)"Ask protocols", getboolean(CFG.iAskFileProtocols)); + add_webdigit(wp, (char *)"Sysop security level", CFG.sysop_access); + add_webdigit(wp, (char *)"Minimum password length", CFG.password_length); + add_webtable(wp, (char *)"BBS loglevel", getloglevel(CFG.bbs_loglevel)); + add_webtable(wp, (char *)"Util loglevel", getloglevel(CFG.util_loglevel)); + sprintf(temp, "%c", CFG.iPasswd_Char); + add_webtable(wp, (char *)"Password char", temp); + add_webdigit(wp, (char *)"Idle timeout in minutes", CFG.idleout); + add_webdigit(wp, (char *)"Login enters", CFG.iCRLoginCount); + add_webdigit(wp, (char *)"Homedir quota in MByte", CFG.iQuota); + add_webdigit(wp, (char *)"Minimum location length", CFG.CityLen); + add_webdigit(wp, (char *)"OLR Max. messages", CFG.OLR_MaxMsgs); + add_webdigit(wp, (char *)"OLR Newfile days", CFG.OLR_NewFileLimit); + add_webdigit(wp, (char *)"OLR Max. filerequests", CFG.OLR_MaxReq); + add_webtable(wp, (char *)"Slowdown utilities", getboolean(CFG.slow_util)); + add_webdigit(wp, (char *)"CrashMail security level", CFG.iCrashLevel); + add_webdigit(wp, (char *)"FileAttach security level", CFG.iAttachLevel); + add_webdigit(wp, (char *)"Free diskspace in MBytes", CFG.freespace); + if (CFG.max_logins) + sprintf(temp, "%d", CFG.max_logins); + else + sprintf(temp, "Unlimited"); + add_webtable(wp, (char *)"Simultaneous logins", temp); + add_webdigit(wp, (char *)"Child priority", CFG.priority); + add_webtable(wp, (char *)"Sync on execute", getboolean(CFG.do_sync)); + fprintf(wp, "\n"); + fprintf(wp, "
\n"); + fprintf(wp, "Top\n"); + fprintf(wp, "
\n"); + page = newpage(fp, page); + addtoc(fp, toc, 1, 6, page, (char *)"Global settings"); + fprintf(fp, " Show new msgarea %s\n", getboolean(CFG.NewAreas)); + fprintf(fp, " Exclude sysop %s\n", getboolean(CFG.exclude_sysop)); + fprintf(fp, " Show connect %s\n", getboolean(CFG.iConnectString)); + fprintf(fp, " Ask protocols %s\n", getboolean(CFG.iAskFileProtocols)); + fprintf(fp, " Sysop level %d\n", CFG.sysop_access); + fprintf(fp, " Password length %d\n", CFG.password_length); + p = getloglevel(CFG.bbs_loglevel); + fprintf(fp, " BBS loglevel %s\n", p); + free(p); + p = getloglevel(CFG.util_loglevel); + fprintf(fp, " Util loglevel %s\n", p); + free(p); + fprintf(fp, " Password char %c\n", CFG.iPasswd_Char); + fprintf(fp, " Idle timeout %d mins\n", CFG.idleout); + fprintf(fp, " Login enters %d\n", CFG.iCRLoginCount); + fprintf(fp, " Homedir quota %d MB.\n", CFG.iQuota); + fprintf(fp, " Location length %d\n", CFG.CityLen); + fprintf(fp, " OLR Max. msgs. %d\n", CFG.OLR_MaxMsgs); + fprintf(fp, " OLR Newfile days %d\n", CFG.OLR_NewFileLimit); + fprintf(fp, " OLR Max Freq's %d\n", CFG.OLR_MaxReq); + fprintf(fp, " Slow utilities %s\n", getboolean(CFG.slow_util)); + fprintf(fp, " CrashMail level %d\n", CFG.iCrashLevel); + fprintf(fp, " FileAttach level %d\n", CFG.iAttachLevel); + fprintf(fp, " Free diskspace %d MB.\n", CFG.freespace); + if (CFG.max_logins) + fprintf(fp, " Simult. logins %d\n", CFG.max_logins); + else + fprintf(fp, " Simult. logins unlimited\n"); + fprintf(fp, " Child priority %d\n", CFG.priority); + fprintf(fp, " Sync on execute %s\n", getboolean(CFG.do_sync)); - addtoc(fp, toc, 1, 5, page, (char *)"Pathnames"); - fprintf(fp, " Menufiles %s\n", CFG.bbs_menus); - fprintf(fp, " Textfiles %s\n", CFG.bbs_txtfiles); - fprintf(fp, " Macros %s\n", CFG.bbs_macros); - fprintf(fp, " Users homedirs %s\n", CFG.bbs_usersdir); - fprintf(fp, " Nodelists %s\n", CFG.nodelists); - fprintf(fp, " Unsafe inbound %s\n", CFG.inbound); - fprintf(fp, " Known inbound %s\n", CFG.pinbound); - fprintf(fp, " Outbound %s\n", CFG.outbound); - fprintf(fp, " Out queue %s\n", CFG.out_queue); - fprintf(fp, " *.msgs path %s\n", CFG.msgs_path); - fprintf(fp, " Bad TIC's %s\n", CFG.badtic); - fprintf(fp, " TIC queue %s\n", CFG.ticout); - fprintf(fp, " Magic filereq. %s\n", CFG.req_magic); - fprintf(fp, " DOS path %s\n", CFG.dospath); - fprintf(fp, " Unix path %s\n", CFG.uxpath); - fprintf(fp, " Leave case as is %s\n", getboolean(CFG.leavecase)); - fprintf(fp, " FTP base path %s\n", CFG.ftp_base); - fprintf(fp, " Area lists %s\n", CFG.alists_path); - fprintf(fp, " External editor %s\n", CFG.externaleditor); - - page = newpage(fp, page); - addtoc(fp, toc, 1, 6, page, (char *)"Global settings"); - - fprintf(fp, " Show new msgarea %s\n", getboolean(CFG.NewAreas)); - fprintf(fp, " Exclude sysop %s\n", getboolean(CFG.exclude_sysop)); - fprintf(fp, " Show connect %s\n", getboolean(CFG.iConnectString)); - fprintf(fp, " Ask protocols %s\n", getboolean(CFG.iAskFileProtocols)); - fprintf(fp, " Sysop level %d\n", CFG.sysop_access); - fprintf(fp, " Password length %d\n", CFG.password_length); - p = getloglevel(CFG.bbs_loglevel); - fprintf(fp, " BBS loglevel %s\n", p); - free(p); - p = getloglevel(CFG.util_loglevel); - fprintf(fp, " Util loglevel %s\n", p); - free(p); - fprintf(fp, " Password char %c\n", CFG.iPasswd_Char); - fprintf(fp, " Idle timeout %d mins\n", CFG.idleout); - fprintf(fp, " Login enters %d\n", CFG.iCRLoginCount); - fprintf(fp, " Homedir quota %d MB.\n", CFG.iQuota); - fprintf(fp, " Location length %d\n", CFG.CityLen); - fprintf(fp, " OLR Max. msgs. %d\n", CFG.OLR_MaxMsgs); - fprintf(fp, " OLR Newfile days %d\n", CFG.OLR_NewFileLimit); - fprintf(fp, " OLR Max Freq's %d\n", CFG.OLR_MaxReq); - fprintf(fp, " Slow utilities %s\n", getboolean(CFG.slow_util)); - fprintf(fp, " CrashMail level %d\n", CFG.iCrashLevel); - fprintf(fp, " FileAttach level %d\n", CFG.iAttachLevel); - fprintf(fp, " Free diskspace %d MB.\n", CFG.freespace); - if (CFG.max_logins) - fprintf(fp, " Simult. logins %d\n", CFG.max_logins); - else - fprintf(fp, " Simult. logins unlimited\n"); - fprintf(fp, " Child priority %d\n", CFG.priority); - fprintf(fp, " Sync on execute %s\n", getboolean(CFG.do_sync)); - - page = newpage(fp, page); - addtoc(fp, toc, 1, 7, page, (char *)"Users flag descriptions"); - fprintf(fp, " 1 1 2 2 3 3\n"); - fprintf(fp, " 1 5 0 5 0 5 0 2\n"); - fprintf(fp, " --------------------------------\n"); - fprintf(fp, " ||||||||||||||||||||||||||||||||\n"); - for (i = 0; i < 32; i++) { - fprintf(fp, " "); - for (j = 0; j < (31 - i); j++) - fprintf(fp, "|"); - fprintf(fp, "+"); - for (j = (32 - i); j < 32; j++) - fprintf(fp, "-"); - fprintf(fp, " %s\n", CFG.fname[31 - i]); - } + fprintf(wp, "

Users flag descriptions

\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + for (i = 0; i < 32; i++) { + sprintf(temp, "Bit %d", i+1); + add_webtable(wp, temp, CFG.fname[i]); + } + fprintf(wp, "\n"); + fprintf(wp, "
\n"); + fprintf(wp, "Top\n"); + fprintf(wp, "
\n"); + page = newpage(fp, page); + addtoc(fp, toc, 1, 7, page, (char *)"Users flag descriptions"); + fprintf(fp, " 1 1 2 2 3 3\n"); + fprintf(fp, " 1 5 0 5 0 5 0 2\n"); + fprintf(fp, " --------------------------------\n"); + fprintf(fp, " ||||||||||||||||||||||||||||||||\n"); + for (i = 0; i < 32; i++) { + fprintf(fp, " "); + for (j = 0; j < (31 - i); j++) + fprintf(fp, "|"); + fprintf(fp, "+"); + for (j = (32 - i); j < 32; j++) + fprintf(fp, "-"); + fprintf(fp, " %s\n", CFG.fname[31 - i]); + } page = newpage(fp, page); addtoc(fp, toc, 1, 8, page, (char *)"New users defaults"); @@ -1897,7 +2064,8 @@ int global_doc(FILE *fp, FILE *toc, int page) fprintf(fp, " %s\n", CFG.aname[31 - i]); } - return page; + close_webdoc(wp); + return page; } diff --git a/mbsetup/m_global.h b/mbsetup/m_global.h index c5028904..c518a58a 100644 --- a/mbsetup/m_global.h +++ b/mbsetup/m_global.h @@ -1,8 +1,8 @@ -/* m_global.h */ - #ifndef _GLOBAL_H #define _GLOBAL_H +/* $Id$ */ + void config_check(char *path); int config_open(void); void config_close(void); @@ -10,7 +10,7 @@ int config_read(void); int config_write(void); void global_menu(void); int PickAka(char *, int); +void web_secflags(FILE *, char *, securityrec); int global_doc(FILE *, FILE *, int); #endif - diff --git a/mbsetup/m_limits.c b/mbsetup/m_limits.c index 40d6b5ab..bbbf4704 100644 --- a/mbsetup/m_limits.c +++ b/mbsetup/m_limits.c @@ -510,6 +510,31 @@ char *PickLimits(int nr) +char *get_limit_name(int level) +{ + static char buf[41]; + char temp[PATH_MAX]; + FILE *fp; + + sprintf(buf, "N/A"); + sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT")); + if ((fp = fopen(temp, "r")) == NULL) + return buf; + + fread(&LIMIThdr, sizeof(LIMIThdr), 1, fp); + + while ((fread(&LIMIT, LIMIThdr.recsize, 1, fp)) == 1) { + if (level == LIMIT.Security) { + sprintf(buf, "%s", LIMIT.Description); + break; + } + } + fclose(fp); + return buf; +} + + + int bbs_limits_doc(FILE *fp, FILE *toc, int page) { char temp[PATH_MAX]; @@ -537,67 +562,3 @@ int bbs_limits_doc(FILE *fp, FILE *toc, int page) return page; } - - -int limit_users_doc(FILE *fp, FILE *toc, int page) -{ - char temp[PATH_MAX]; - FILE *no, *us; - int line = 0, j; - - sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT")); - if ((no = fopen(temp, "r")) == NULL) - return page; - - sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); - if ((us = fopen(temp, "r")) == NULL) { - fclose(no); - return page; - } - - page = newpage(fp, page); - addtoc(fp, toc, 1, 0, page, (char *)"Access limits and users"); - - fread(&LIMIThdr, sizeof(LIMIThdr), 1, no); - fread(&usrconfighdr, sizeof(usrconfighdr), 1, us); - - while (fread(&LIMIT, LIMIThdr.recsize, 1, no) == 1) { - if (LIMIT.Available) { - if (line > 52) { - page = newpage(fp, page); - line = 0; - } - fprintf(fp, "\n\n"); - fprintf(fp, " Level %ld - %s\n\n", LIMIT.Security, LIMIT.Description); - line += 4; - j = 2; - fseek(us, usrconfighdr.hdrsize, SEEK_SET); - - while (fread(&usrconfig, usrconfighdr.recsize, 1, us) == 1) { - if ((!usrconfig.Deleted) && strlen(usrconfig.sUserName) && - (usrconfig.Security.level == LIMIT.Security)) { - if (j == 2) { - j = 0; - fprintf(fp, " %-35s", usrconfig.sUserName); - } else { - fprintf(fp, " %s\n", usrconfig.sUserName); - line++; - if (line > 56) { - page = newpage(fp, page); - line = 0; - } - } - j++; - } - } - if (j != 2) - fprintf(fp, "\n"); - } - } - - fclose(us); - fclose(no); - return page; -} - - diff --git a/mbsetup/m_limits.h b/mbsetup/m_limits.h index ca2b2678..f1cf8d11 100644 --- a/mbsetup/m_limits.h +++ b/mbsetup/m_limits.h @@ -1,14 +1,13 @@ #ifndef _LIMITSS_H #define _LIMITSS_H +/* $Id$ */ int CountLimits(void); void EditLimits(void); void InitLimits(void); char *PickLimits(int); +char *get_limit_name(int); int bbs_limits_doc(FILE *, FILE *, int); -int limit_users_doc(FILE *, FILE *, int); - #endif - diff --git a/mbsetup/mbsetup.c b/mbsetup/mbsetup.c index 76cb3559..47a4c9b0 100644 --- a/mbsetup/mbsetup.c +++ b/mbsetup/mbsetup.c @@ -188,161 +188,136 @@ void soft_info(void) void site_docs(void); void site_docs(void) { - FILE *fp, *toc; - char temp[PATH_MAX], temp1[PATH_MAX]; - int page = 0, line = 0; + FILE *fp, *hp, *toc; + char temp[PATH_MAX], temp1[PATH_MAX]; + int page = 0, line = 0; - if (config_read() == -1) - return; - - sprintf(temp, "%s/doc/site.doc", getenv("MBSE_ROOT")); - if ((fp = fopen(temp, "w")) == NULL) - return; - - sprintf(temp1, "%s/tmp/toc.tmp", getenv("MBSE_ROOT")); - if ((toc = fopen(temp1, "w+")) == NULL) { - fclose(fp); - return; - } - - clr_index(); - working(1, 0, 0); - IsDoing("Making Sitedocs"); - Syslog('+', "Start creating sitedocs"); - set_color(WHITE, BLACK); - mvprintw( 5, 6, "17. CREATING SITEDOCS"); - set_color(CYAN, BLACK); - mvprintw( 7,11, (char *)"Create document in file %s", temp); - fflush(stdout); - - page = global_doc(fp, toc, page); - page = fido_doc(fp, toc, page); - page = archive_doc(fp, toc, page); - page = virus_doc(fp, toc, page); - page = modem_doc(fp, toc, page); - page = tty_doc(fp, toc, page); - page = node_doc(fp, toc, page); - page = bbs_doc(fp, toc, page); - page = mail_doc(fp, toc, page); - page = tic_doc(fp, toc, page); - page = newf_group_doc(fp, toc, page); - page = new_doc(fp, toc, page); - page = ff_doc(fp, toc, page); - page = service_doc(fp, toc, page); - page = domain_doc(fp, toc, page); - page = task_doc(fp, toc, page); - page = route_doc(fp, toc, page); - - /* - * Append table of contents - */ - page = newpage(fp, page); - addtoc(fp, toc, 17, 0, page, (char *)"Table of contents"); - fprintf(fp, "\n\n"); - line = 4; - rewind(toc); - - while (fgets(temp, 256, toc) != NULL) { - fprintf(fp, "%s", temp); - line++; - if (line == 56) { - page = newpage(fp, page); - line = 0; - } - } - - fprintf(fp, "\f"); - fclose(fp); - fclose(toc); - unlink(temp1); - - Syslog('+', "Sitedocs created"); - - page = line = 0; - sprintf(temp, "%s/doc/xref.doc", getenv("MBSE_ROOT")); - if ((fp = fopen(temp, "w")) == NULL) - return; - - sprintf(temp1, "%s/tmp/toc.tmp", getenv("MBSE_ROOT")); - if ((toc = fopen(temp1, "w+")) == NULL) { - fclose(fp); - return; - } - - Syslog('+', "Start creating crossreference"); - mvprintw( 8,11, (char *)"Create document in file %s", temp); - fflush(stdout); - - page = limit_users_doc(fp, toc, page); - - /* - * Append table of contents - */ - page = newpage(fp, page); - addtoc(fp, toc, 99, 0, page, (char *)"Table of contents"); - fprintf(fp, "\n\n"); - line = 4; - rewind(toc); - - while (fgets(temp, 256, toc) != NULL) { - fprintf(fp, "%s", temp); - line++; - if (line == 56) { - page = newpage(fp, page); - line = 0; - } - } - - fprintf(fp, "\f"); - fclose(fp); - fclose(toc); - unlink(temp1); - - Syslog('+', "Crossreference created"); - - page = line = 0; - sprintf(temp, "%s/doc/stat.doc", getenv("MBSE_ROOT")); - if ((fp = fopen(temp, "w")) == NULL) - return; - - sprintf(temp1, "%s/tmp/toc.tmp", getenv("MBSE_ROOT")); - if ((toc = fopen(temp1, "w+")) == NULL) { - fclose(fp); - return; - } - - Syslog('+', "Start creating statistics"); - mvprintw( 9,11, (char *)"Create document in file %s", temp); - fflush(stdout); - - /* - * Append table of contents - */ - page = newpage(fp, page); - addtoc(fp, toc, 99, 0, page, (char *)"Table of contents"); - fprintf(fp, "\n\n"); - line = 4; - rewind(toc); - - while (fgets(temp, 256, toc) != NULL) { - fprintf(fp, "%s", temp); - line++; - if (line == 56) { - page = newpage(fp, page); - line = 0; - } - } - - fprintf(fp, "\f"); - fclose(fp); - fclose(toc); - unlink(temp1); - - Syslog('+', "Statistics created"); - - center_addstr(LINES -4, (char *)"Press any key"); - readkey(LINES -4, COLS / 2 + 8, LIGHTGRAY, BLACK); + if (config_read() == -1) return; + + sprintf(temp, "%s/doc/site.doc", getenv("MBSE_ROOT")); + if ((fp = fopen(temp, "w")) == NULL) + return; + + sprintf(temp1, "%s/tmp/toc.tmp", getenv("MBSE_ROOT")); + if ((toc = fopen(temp1, "w+")) == NULL) { + fclose(fp); + return; + } + + clr_index(); + working(1, 0, 0); + IsDoing("Making Sitedocs"); + Syslog('+', "Start creating sitedocs"); + + set_color(WHITE, BLACK); + mvprintw( 5, 6, "21. CREATING SITEDOCS"); + set_color(CYAN, BLACK); + mvprintw( 7,11, (char *)"Erasing directory %s/doc/html", getenv("MBSE_ROOT")); + fflush(stdout); + + sprintf(temp, "-r -f %s/doc/html", getenv("MBSE_ROOT")); + execute_pth((char *)"rm", temp, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"); + + if ((hp = open_webdoc((char *)"index.html", (char *)"BBS Site Documentation", NULL))) { + fprintf(hp, "\n"); + close_webdoc(hp); + } else { + Syslog('+', "Can't create html documentation"); + } + + mvprintw( 8,11, (char *)"Create document in file %s/doc/site.doc", getenv("MBSE_ROOT")); + page = global_doc(fp, toc, page); + page = fido_doc(fp, toc, page); + page = archive_doc(fp, toc, page); + page = virus_doc(fp, toc, page); + page = modem_doc(fp, toc, page); + page = tty_doc(fp, toc, page); + page = node_doc(fp, toc, page); + page = bbs_doc(fp, toc, page); + page = mail_doc(fp, toc, page); + page = tic_doc(fp, toc, page); + page = newf_group_doc(fp, toc, page); + page = new_doc(fp, toc, page); + page = ff_doc(fp, toc, page); + page = service_doc(fp, toc, page); + page = domain_doc(fp, toc, page); + page = task_doc(fp, toc, page); + page = route_doc(fp, toc, page); + + /* + * Append table of contents + */ + page = newpage(fp, page); + addtoc(fp, toc, 17, 0, page, (char *)"Table of contents"); + fprintf(fp, "\n\n"); + line = 4; + rewind(toc); + + while (fgets(temp, 256, toc) != NULL) { + fprintf(fp, "%s", temp); + line++; + if (line == 56) { + page = newpage(fp, page); + line = 0; + } + } + + fprintf(fp, "\f"); + fclose(fp); + fclose(toc); + unlink(temp1); + + Syslog('+', "Sitedocs created"); + + /* + * Remove obsolete documents + */ + sprintf(temp, "%s/doc/xref.doc", getenv("MBSE_ROOT")); + unlink(temp); + sprintf(temp, "%s/doc/stat.doc", getenv("MBSE_ROOT")); + unlink(temp); + + center_addstr(LINES -4, (char *)"Press any key"); + readkey(LINES -4, COLS / 2 + 8, LIGHTGRAY, BLACK); + return; } diff --git a/mbsetup/mutil.c b/mbsetup/mutil.c index 198024f2..e7b06d76 100644 --- a/mbsetup/mutil.c +++ b/mbsetup/mutil.c @@ -30,6 +30,7 @@ #include "../config.h" #include "../lib/mbselib.h" +#include "../lib/diesel.h" #include "screen.h" #include "mutil.h" @@ -142,3 +143,88 @@ void disk_reset(void) } + +FILE *open_webdoc(char *filename, char *title, char *title2) +{ + char *p, *temp; + FILE *fp; + time_t now; + + temp = calloc(PATH_MAX, sizeof(char)); + sprintf(temp, "%s/doc/html/%s", getenv("MBSE_ROOT"), filename); + mkdirs(temp, 0755); + + if ((fp = fopen(temp, "w+")) == NULL) { + WriteError("$Can't create %s", temp); + } else { + fprintf(fp, "\n"); + fprintf(fp, "\n"); + fprintf(fp, "\n"); + fprintf(fp, "\n"); + fprintf(fp, "\n"); + if (title2) + fprintf(fp, "%s: %s\n", title, title2); + else + fprintf(fp, "%s\n", title); + fprintf(fp, "\n"); + fprintf(fp, "\n"); + fprintf(fp, "\n"); + fprintf(fp, "\n"); + fprintf(fp, "
\n"); + if (title2) + fprintf(fp, "

%s: %s

\n", title, title2); + else + fprintf(fp, "

%s

\n", title); + now = time(NULL); + p = ctime(&now); + Striplf(p); + fprintf(fp, "
Created %s
\n", p); + } + + free(temp); + return fp; +} + + +void close_webdoc(FILE *fp) +{ + fprintf(fp, "
\n"); + fprintf(fp, "\n"); + fprintf(fp, "\n"); + fclose(fp); +} + + +void add_webtable(FILE *fp, char *hstr, char *dstr) +{ + char left[1024], right[1024]; + + html_massage(hstr, left); + if (strlen(dstr)) + html_massage(dstr, right); + else + sprintf(right, " "); + fprintf(fp, "%s%s\n", left, right); +} + + + +void add_webdigit(FILE *fp, char *hstr, int digit) +{ + char left[1024]; + + html_massage(hstr, left); + fprintf(fp, "%s%d\n", left, digit); +} + diff --git a/mbsetup/mutil.h b/mbsetup/mutil.h index 85747335..bcd29ebd 100644 --- a/mbsetup/mutil.h +++ b/mbsetup/mutil.h @@ -8,5 +8,9 @@ unsigned char testkey(int, int); int newpage(FILE *, int); void addtoc(FILE *, FILE *, int, int, int, char *); void disk_reset(void); +FILE *open_webdoc(char *, char *, char *); +void close_webdoc(FILE *); +void add_webtable(FILE *, char *, char *); +void add_webdigit(FILE *, char *, int); #endif