Updates for html doc creation

This commit is contained in:
Michiel Broek 2004-03-24 22:23:21 +00:00
parent da55a193dd
commit 2d0487d87d
16 changed files with 965 additions and 529 deletions

View File

@ -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

View File

@ -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

View File

@ -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, "<A HREF=\"index.html\">Main</A>\n");
fprintf(ip, "<UL>\n");
fprintf(fp, "\n\n");
fread(&archiverhdr, sizeof(archiverhdr), 1, arch);
@ -802,6 +806,31 @@ int archive_doc(FILE *fp, FILE *toc, int page)
j = 0;
}
i++;
sprintf(temp, "archiver_%d.html", i);
if ((wp = open_webdoc(temp, (char *)"Archiver", archiver.comment))) {
fprintf(wp, "<A HREF=\"index.html\">Main</A>&nbsp;<A HREF=\"archivers.html\">Back</A>\n");
fprintf(wp, "<P>\n");
fprintf(wp, "<TABLE width='400' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='50%%'><COL width='50%%'>\n");
fprintf(wp, "<TBODY>\n");
add_webtable(wp, (char *)"Short name", archiver.name);
add_webtable(wp, (char *)"Available", getboolean(archiver.available));
add_webtable(wp, (char *)"Pack files", archiver.farc);
add_webtable(wp, (char *)"Pack mail", archiver.marc);
add_webtable(wp, (char *)"Pack banners", archiver.barc);
add_webtable(wp, (char *)"Test archive", archiver.tarc);
add_webtable(wp, (char *)"Unpack files", archiver.funarc);
add_webtable(wp, (char *)"Unpack mail", archiver.munarc);
add_webtable(wp, (char *)"Get FILE_ID.DIZ", archiver.iunarc);
add_webtable(wp, (char *)"List archive", archiver.varc);
fprintf(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
close_webdoc(wp);
}
fprintf(ip, "<LI><A HREF=\"%s\">%s</A></LI>\n", temp, archiver.comment);
fprintf(fp, " Comment %s\n", archiver.comment);
fprintf(fp, " Short name %s\n", archiver.name);
fprintf(fp, " Available %s\n", getboolean(archiver.available));
@ -818,6 +847,8 @@ int archive_doc(FILE *fp, FILE *toc, int page)
}
fclose(arch);
fprintf(ip, "</UL>\n");
close_webdoc(ip);
return page;
}

View File

@ -92,6 +92,21 @@ void bbs_menu(void)
int bbs_doc(FILE *fp, FILE *toc, int page)
{
FILE *wp;
if ((wp = open_webdoc((char *)"bbs.html", (char *)"BBS Setup", NULL))) {
fprintf(wp, "<A HREF=\"index.html\">Main</A>\n");
fprintf(wp, "<UL>\n");
fprintf(wp, " <LI><A HREF=\"limits.html\">Security Limits</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"language.html\">Language Setup</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"menus.html\">BBS Menus</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"fileareas.html\">File Areas</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"protocols.html\">Transfer Protocols</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"oneliners.html\">Oneliners</A></LI>\n");
fprintf(wp, "</UL>\n");
fclose(wp);
}
page = newpage(fp, page);
addtoc(fp, toc, 8, 0, page, (char *)"BBS setup");

View File

@ -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, "<A HREF=\"index.html\">Main</A>\n");
fprintf(wp, "<P>\n");
fprintf(wp, "<TABLE width='400' border='0' cellspacing='0' cellpadding='2'>\n");
// fprintf(wp, "<COL width='40%%'><COL width='40%%'><COL width='20%%'>\n");
fprintf(wp, "<TBODY>\n");
fprintf(wp, "<TR><TH align='left'>Fidonet</TH><TH align='left'>Internet</TH><TH align='left'>Active</TH></TR>\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, "<TR><TD>%s</TD><TD>%s</TD><TD>%s</TD></TR>\n",
domtrans.ftndom, domtrans.intdom, getboolean(domtrans.Active));
fprintf(fp, " %-30s %-30s %s\n", domtrans.ftndom, domtrans.intdom, getboolean(domtrans.Active));
j++;
}
fprintf(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
close_webdoc(wp);
fclose(no);
return page;
}

View File

@ -755,7 +755,7 @@ void InitFilearea(void)
int bbs_file_doc(FILE *fp, FILE *toc, int page)
{
char temp[PATH_MAX];
FILE *no;
FILE *wp, *ip, *no;
int i = 0, j = 0;
sprintf(temp, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
@ -766,6 +766,10 @@ int bbs_file_doc(FILE *fp, FILE *toc, int page)
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, "<A HREF=\"index.html\">Main</A>\n");
fprintf(ip, "<UL>\n");
while ((fread(&area, areahdr.recsize, 1, no)) == 1) {
i++;
@ -777,6 +781,48 @@ int bbs_file_doc(FILE *fp, FILE *toc, int page)
} else {
j++;
}
sprintf(temp, "filearea_%d.html", i);
fprintf(ip, " <LI><A HREF=\"%s\">%3d %s</A></LI>\n", temp, i, area.Name);
if ((wp = open_webdoc(temp, (char *)"File area", area.Name))) {
fprintf(wp, "<A HREF=\"index.html\">Main</A>&nbsp;<A HREF=\"fileareas.html\">Back</A>\n");
fprintf(wp, "<P>\n");
fprintf(wp, "<TABLE width='400' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='50%%'><COL width='50%%'>\n");
fprintf(wp, "<TBODY>\n");
add_webdigit(wp, (char *)"Area number", i);
add_webtable(wp, (char *)"Area name", area.Name);
add_webtable(wp, (char *)"Files path", area.Path);
web_secflags(wp, (char *)"Download security", area.DLSec);
web_secflags(wp, (char *)"Upload security", area.UPSec);
web_secflags(wp, (char *)"List security", area.LTSec);
add_webtable(wp, (char *)"Path to files.bbs", area.FilesBbs);
add_webtable(wp, (char *)"Newfiles scan", getboolean(area.New));
add_webtable(wp, (char *)"Check upload dupes", getboolean(area.Dupes));
add_webtable(wp, (char *)"Files are free", getboolean(area.Free));
add_webtable(wp, (char *)"Allow direct download", getboolean(area.DirectDL));
add_webtable(wp, (char *)"Allow password uploads", getboolean(area.PwdUP));
add_webtable(wp, (char *)"Filefind on", getboolean(area.FileFind));
add_webtable(wp, (char *)"Add files sorted", getboolean(area.AddAlpha));
add_webtable(wp, (char *)"Files on CDrom", getboolean(area.CDrom));
add_webtable(wp, (char *)"Allow filerequest", getboolean(area.FileReq));
fprintf(wp, "<TR><TH align='left'>BBS (tic) file group</TH><TD><A HREF=\"filegroup_%s.html\">%s</A></TD></TH>\n",
area.BbsGroup, area.BbsGroup);
fprintf(wp, "<TR><TH align='left'>Newfiles announce group</TH><TD><A HREF=\"newfilegroup_%s.html\">%s</A></TD></TH>\n",
area.NewGroup, area.NewGroup);
add_webdigit(wp, (char *)"Minimum age for access", area.Age);
add_webtable(wp, (char *)"Area password", area.Password);
add_webdigit(wp, (char *)"Kill Download days", area.DLdays);
add_webdigit(wp, (char *)"Kill FileDate days", area.FDdays);
add_webdigit(wp, (char *)"Move to area", area.MoveArea);
add_webtable(wp, (char *)"Archiver", area.Archiver);
add_webdigit(wp, (char *)"Upload area", area.Upload);
fprintf(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
close_webdoc(wp);
}
fprintf(fp, "\n\n");
fprintf(fp, " Area number %d\n", i);
fprintf(fp, " Area name %s\n", area.Name);
@ -806,6 +852,9 @@ int bbs_file_doc(FILE *fp, FILE *toc, int page)
}
}
fprintf(ip, "</UL>\n");
close_webdoc(ip);
fclose(no);
return page;
}

View File

@ -433,8 +433,8 @@ void InitFilefind(void)
int ff_doc(FILE *fp, FILE *toc, int page)
{
char temp[PATH_MAX];
FILE *no;
int j;
FILE *wp, *ip, *no;
int i = 0, j;
sprintf(temp, "%s/etc/scanmgr.data", getenv("MBSE_ROOT"));
if ((no = fopen(temp, "r")) == NULL)
@ -447,14 +447,44 @@ int ff_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, "\n\n");
fread(&scanmgrhdr, sizeof(scanmgrhdr), 1, no);
ip = open_webdoc((char *)"filefind.html", (char *)"Filefind Areas", NULL);
fprintf(ip, "<A HREF=\"index.html\">Main</A>\n");
fprintf(ip, "<UL>\n");
while ((fread(&scanmgr, scanmgrhdr.recsize, 1, no)) == 1) {
i++;
if (j == 4) {
page = newpage(fp, page);
fprintf(fp, "\n");
j = 0;
}
sprintf(temp, "filefind_%d.html", i);
fprintf(ip, " <LI><A HREF=\"%s\">%3d %s</A></LI>\n", temp, i, scanmgr.Comment);
if ((wp = open_webdoc(temp, (char *)"Filefind Area", scanmgr.Comment))) {
fprintf(wp, "<A HREF=\"index.html\">Main</A>&nbsp;<A HREF=\"filefind.html\">Back</A>\n");
fprintf(wp, "<P>\n");
fprintf(wp, "<TABLE width='600' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
fprintf(wp, "<TBODY>\n");
add_webtable(wp, (char *)"Area comment", scanmgr.Comment);
add_webtable(wp, (char *)"Origin line", scanmgr.Origin);
add_webtable(wp, (char *)"Aka to use", aka2str(scanmgr.Aka));
add_webtable(wp, (char *)"Scan msg board", scanmgr.ScanBoard);
add_webtable(wp, (char *)"Reply msg board", scanmgr.ReplBoard);
sprintf(temp, "%c", scanmgr.Language);
add_webtable(wp, (char *)"Language", temp);
add_webtable(wp, (char *)"Template file", scanmgr.template);
add_webtable(wp, (char *)"Active", getboolean(scanmgr.Active));
add_webtable(wp, (char *)"Netmail reply", getboolean(scanmgr.NetReply));
add_webtable(wp, (char *)"Allow Hi-ASCII", getboolean(scanmgr.HiAscii));
add_webdigit(wp, (char *)"Keyword length", scanmgr.keywordlen);
fprintf(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
close_webdoc(wp);
}
fprintf(fp, " Area comment %s\n", scanmgr.Comment);
fprintf(fp, " Origin line %s\n", scanmgr.Origin);
fprintf(fp, " Aka to use %s\n", aka2str(scanmgr.Aka));
@ -470,6 +500,9 @@ int ff_doc(FILE *fp, FILE *toc, int page)
j++;
}
fprintf(ip, "</UL>\n");
close_webdoc(ip);
fclose(no);
return page;
}

View File

@ -683,7 +683,7 @@ char *PickFGroup(char *shdr)
int tic_group_doc(FILE *fp, FILE *toc, int page)
{
char *temp;
FILE *no;
FILE *wp, *ip, *no;
int First = TRUE;;
temp = calloc(PATH_MAX, sizeof(char));
@ -692,12 +692,15 @@ int tic_group_doc(FILE *fp, FILE *toc, int page)
free(temp);
return page;
}
free(temp);
fread(&fgrouphdr, sizeof(fgrouphdr), 1, no);
fseek(no, 0, SEEK_SET);
fread(&fgrouphdr, fgrouphdr.hdrsize, 1, no);
ip = open_webdoc((char *)"filegroup.html", (char *)"File Groups", NULL);
fprintf(ip, "<A HREF=\"index.html\">Main</A>\n");
fprintf(ip, "<UL>\n");
while ((fread(&fgroup, fgrouphdr.recsize, 1, no)) == 1) {
if (First) {
addtoc(fp, toc, 10, 1, page, (char *)"File processing groups");
@ -708,6 +711,56 @@ int tic_group_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, "\n\n");
}
sprintf(temp, "filegroup_%s.html", fgroup.Name);
fprintf(ip, " <LI><A HREF=\"%s\">%s</A> %s</LI>\n", temp, fgroup.Name, fgroup.Comment);
if ((wp = open_webdoc(temp, (char *)"File group", fgroup.Comment))) {
fprintf(wp, "<A HREF=\"index.html\">Main</A>&nbsp;<A HREF=\"filegroup.html\">Back</A>\n");
fprintf(wp, "<P>\n");
fprintf(wp, "<TABLE width='400' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='50%%'><COL width='50%%'>\n");
fprintf(wp, "<TBODY>\n");
add_webtable(wp, (char *)"Group name", fgroup.Name);
add_webtable(wp, (char *)"Comment", fgroup.Comment);
add_webtable(wp, (char *)"Active", getboolean(fgroup.Active));
add_webtable(wp, (char *)"Use Aka", aka2str(fgroup.UseAka));
add_webtable(wp, (char *)"Uplink Aka", aka2str(fgroup.UpLink));
add_webtable(wp, (char *)"Areas file", fgroup.AreaFile);
sprintf(temp, "%ld", fgroup.StartArea);
add_webtable(wp, (char *)"Start autocreate BBS area", temp);
add_webtable(wp, (char *)"Banner file", fgroup.Banner);
add_webtable(wp, (char *)"Default archiver", fgroup.Convert);
add_webtable(wp, (char *)"Area file in Filegate format", getboolean(fgroup.FileGate));
add_webtable(wp, (char *)"Auto change areas", getboolean(fgroup.AutoChange));
add_webtable(wp, (char *)"User (downlink) change areas", getboolean(fgroup.UserChange));
add_webtable(wp, (char *)"Allow replace", getboolean(fgroup.Replace));
add_webtable(wp, (char *)"Dupe checking", getboolean(fgroup.DupCheck));
add_webtable(wp, (char *)"Secure processing", getboolean(fgroup.Secure));
add_webtable(wp, (char *)"Touch file dates", getboolean(fgroup.Touch));
add_webtable(wp, (char *)"Virus scan", getboolean(fgroup.VirScan));
add_webtable(wp, (char *)"Announce", getboolean(fgroup.Announce));
add_webtable(wp, (char *)"Allow update magics", getboolean(fgroup.UpdMagic));
add_webtable(wp, (char *)"Extract FILE_ID.DIZ", getboolean(fgroup.FileId));
add_webtable(wp, (char *)"Convert all archives", getboolean(fgroup.ConvertAll));
add_webtable(wp, (char *)"Send original file", getboolean(fgroup.SendOrg));
add_webtable(wp, (char *)"Base path for new areas", fgroup.BasePath);
web_secflags(wp, (char *)"Download security", fgroup.DLSec);
web_secflags(wp, (char *)"Upload security", fgroup.UPSec);
web_secflags(wp, (char *)"List security", fgroup.LTSec);
add_webtable(wp, (char *)"Default tic security", getflag(fgroup.LinkSec.flags, fgroup.LinkSec.notflags));
fprintf(wp, "<TR><TH align='left'>BBS (tic) file group</TH><TD><A HREF=\"filegroup_%s.html\">%s</A></TD></TH>\n",
fgroup.BbsGroup, fgroup.BbsGroup);
fprintf(wp, "<TR><TH align='left'>Newfiles announce group</TH><TD><A HREF=\"newfilegroup_%s.html\">%s</A></TD></TH>\n",
fgroup.AnnGroup, fgroup.AnnGroup);
sprintf(temp, "%d", fgroup.Upload);
add_webtable(wp, (char *)"Upload area", temp);
add_webtable(wp, (char *)"Start date", ctime(&fgroup.StartDate));
add_webtable(wp, (char *)"Last active date", ctime(&fgroup.LastDate));
fprintf(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
close_webdoc(wp);
}
fprintf(fp, " Group name %s\n", fgroup.Name);
fprintf(fp, " Comment %s\n", fgroup.Comment);
fprintf(fp, " Active %s\n", getboolean(fgroup.Active));
@ -736,13 +789,17 @@ int tic_group_doc(FILE *fp, FILE *toc, int page)
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, " Newfiles 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));
}
fprintf(ip, "</UL>\n");
close_webdoc(ip);
fclose(no);
free(temp);
return page;
}

View File

@ -511,7 +511,7 @@ void gold_akamatch(FILE *fp)
int fido_doc(FILE *fp, FILE *toc, int page)
{
char temp[PATH_MAX];
FILE *fido;
FILE *wp, *ip, *fido;
int i, j;
sprintf(temp, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
@ -524,6 +524,11 @@ int fido_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, "\n\n");
fread(&fidonethdr, sizeof(fidonethdr), 1, fido);
ip = open_webdoc((char *)"fidonet.html", (char *)"Fidonet networks", NULL);
fprintf(ip, "<A HREF=\"index.html\">Main</A>\n");
fprintf(ip, "<UL>\n");
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
if (j == 6) {
@ -532,6 +537,35 @@ int fido_doc(FILE *fp, FILE *toc, int page)
j = 0;
}
sprintf(temp, "fidonet_%d.html", fidonet.zone[0]);
fprintf(ip, " <LI><A HREF=\"%s\">Zone %d</A> %s</LI>\n", temp, fidonet.zone[0], fidonet.comment);
if ((wp = open_webdoc(temp, (char *)"Fidonet network", fidonet.comment))) {
fprintf(wp, "<A HREF=\"index.html\">Main</A>&nbsp;<A HREF=\"fidonet.html\">Back</A>\n");
fprintf(wp, "<P>\n");
fprintf(wp, "<TABLE width='400' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='50%%'><COL width='50%%'>\n");
fprintf(wp, "<TBODY>\n");
add_webtable(wp, (char *)"Comment", fidonet.comment);
add_webtable(wp, (char *)"Domain", fidonet.domain);
add_webtable(wp, (char *)"Available", getboolean(fidonet.available));
add_webtable(wp, (char *)"Nodelist", fidonet.nodelist);
for (i = 0; i < 6; i++)
if (strlen(fidonet.seclist[i].nodelist) || fidonet.seclist[i].zone) {
sprintf(temp, "%d %-8s %d:%d/%d", i+1, fidonet.seclist[i].nodelist, fidonet.seclist[i].zone,
fidonet.seclist[i].net, fidonet.seclist[i].node);
add_webtable(wp, (char *)"Merge list", temp);
}
sprintf(temp, "%d", fidonet.zone[0]);
for (i = 1; i < 6; i++)
if (fidonet.zone[i])
sprintf(temp, "%s %d", temp, fidonet.zone[i]);
add_webtable(wp, (char *)"Zone(s)", temp);
fprintf(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
close_webdoc(wp);
}
fprintf(fp, " Comment %s\n", fidonet.comment);
fprintf(fp, " Domain %s\n", fidonet.domain);
fprintf(fp, " Available %s\n", getboolean(fidonet.available));
@ -550,6 +584,9 @@ int fido_doc(FILE *fp, FILE *toc, int page)
j++;
}
fprintf(ip, "</UL>\n");
close_webdoc(ip);
fclose(fido);
return page;
}

View File

@ -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,12 +1596,29 @@ int PickAka(char *msg, int openit)
void web_secflags(FILE *fp, char *name, securityrec sec)
{
int i;
fprintf(fp, "<TR><TH align='left'>%s</TH><TD>%d (%s)</TD></TR>\n", name, sec.level, get_limit_name(sec.level));
for (i = 0; i < 32; i++) {
if ((sec.flags >> i) & 1) {
fprintf(fp, "<TR><TH>&nbsp;</TH><TD>.and. bit %d (%s)</TD></TR>\n", i, CFG.fname[i]);
} else if ((sec.notflags >> i) & 1) {
fprintf(fp, "<TR><TH>&nbsp;</TH><TD>.and not. bit %d (%s)</TD></TR>\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;
char *p, temp[1024];
FILE *wp;
if (config_read())
return page;
@ -1609,31 +1627,90 @@ int global_doc(FILE *fp, FILE *toc, int 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, "<A HREF=\"index.html\">Main</A>\n");
fprintf(wp, "<UL>\n");
fprintf(wp, " <LI><A HREF=\"#_host\">Host System Information</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"#_akas\">System fidonet addresses</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"#_reginfo\">Registration information</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"#_filenames\">Global filenames</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"#_pathnames\">Pathnames</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"#_global\">Global settings</A></LI>\n");
fprintf(wp, " <LI><A HREF=\"#_security\">Users flag descriptions</A></LI>\n");
fprintf(wp, "</UL>\n");
fprintf(wp, "<HR>\n");
fprintf(wp, "<A NAME=\"_host\"></A><H3>Host System Information</H3>\n");
fprintf(wp, "<TABLE width='600' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
fprintf(wp, "<TBODY>\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
add_webtable(wp, (char *)"Domain name", utsbuf.domainname);
fprintf(fp, " Domain name %s\n", utsbuf.domainname);
#else
#ifdef __linux__
add_webtable(wp, (char *)"Domain name", utsbuf.__domainname);
fprintf(fp, " Domain name %s\n", utsbuf.__domainname);
#endif
#endif
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, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
fprintf(wp, "<A HREF=\"#_top\">Top</A>\n");
fprintf(wp, "<HR>\n");
fprintf(wp, "<A NAME=\"_akas\"></A><H3>System fidonet addresses</H3>\n");
fprintf(wp, "<TABLE width='600' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
fprintf(wp, "<TBODY>\n");
addtoc(fp, toc, 1, 2, page, (char *)"System fidonet addresses");
for (i = 0; i < 40; i++)
if (CFG.akavalid[i])
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(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
fprintf(wp, "<A HREF=\"#_top\">Top</A>\n");
fprintf(wp, "<HR>\n");
page = newpage(fp, page);
fprintf(wp, "<A NAME=\"_reginfo\"></A><H3>Registration information</H3>\n");
fprintf(wp, "<TABLE width='600' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
fprintf(wp, "<TBODY>\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, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
fprintf(wp, "<A HREF=\"#_top\">Top</A>\n");
fprintf(wp, "<HR>\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);
@ -1646,6 +1723,22 @@ int global_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Origin line %s\n", CFG.origin);
fprintf(fp, " Start unix name %s\n", CFG.startname);
fprintf(wp, "<A NAME=\"_filenames\"></A><H3>Global filenames</H3>\n");
fprintf(wp, "<TABLE width='600' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
fprintf(wp, "<TBODY>\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, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
fprintf(wp, "<A HREF=\"#_top\">Top</A>\n");
fprintf(wp, "<HR>\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);
@ -1656,6 +1749,33 @@ int global_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Chat logfile %s\n", CFG.chat_log);
fprintf(fp, " Welcome logo %s\n", CFG.welcome_logo);
fprintf(wp, "<A NAME=\"_pathnames\"></A><H3>Pathnames</H3>\n");
fprintf(wp, "<TABLE width='600' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
fprintf(wp, "<TBODY>\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, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
fprintf(wp, "<A HREF=\"#_top\">Top</A>\n");
fprintf(wp, "<HR>\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);
@ -1677,9 +1797,44 @@ int global_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Area lists %s\n", CFG.alists_path);
fprintf(fp, " External editor %s\n", CFG.externaleditor);
fprintf(wp, "<A NAME=\"_global\"></A><H3>Global settings</H3>\n");
fprintf(wp, "<TABLE width='600' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
fprintf(wp, "<TBODY>\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, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
fprintf(wp, "<A HREF=\"#_top\">Top</A>\n");
fprintf(wp, "<HR>\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));
@ -1711,6 +1866,18 @@ int global_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Child priority %d\n", CFG.priority);
fprintf(fp, " Sync on execute %s\n", getboolean(CFG.do_sync));
fprintf(wp, "<A NAME=\"_security\"></A><H3>Users flag descriptions</H3>\n");
fprintf(wp, "<TABLE width='600' border='0' cellspacing='0' cellpadding='2'>\n");
fprintf(wp, "<COL width='30%%'><COL width='70%%'>\n");
fprintf(wp, "<TBODY>\n");
for (i = 0; i < 32; i++) {
sprintf(temp, "Bit %d", i+1);
add_webtable(wp, temp, CFG.fname[i]);
}
fprintf(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n");
fprintf(wp, "<A HREF=\"#_top\">Top</A>\n");
fprintf(wp, "<HR>\n");
page = newpage(fp, page);
addtoc(fp, toc, 1, 7, page, (char *)"Users flag descriptions");
fprintf(fp, " 1 1 2 2 3 3\n");
@ -1897,6 +2064,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " %s\n", CFG.aname[31 - i]);
}
close_webdoc(wp);
return page;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -188,7 +188,7 @@ void soft_info(void)
void site_docs(void);
void site_docs(void)
{
FILE *fp, *toc;
FILE *fp, *hp, *toc;
char temp[PATH_MAX], temp1[PATH_MAX];
int page = 0, line = 0;
@ -209,12 +209,61 @@ void site_docs(void)
working(1, 0, 0);
IsDoing("Making Sitedocs");
Syslog('+', "Start creating sitedocs");
set_color(WHITE, BLACK);
mvprintw( 5, 6, "17. CREATING SITEDOCS");
mvprintw( 5, 6, "21. CREATING SITEDOCS");
set_color(CYAN, BLACK);
mvprintw( 7,11, (char *)"Create document in file %s", temp);
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, "<UL>\n");
fprintf(hp, " <LI><A HREF=\"global.html\">Global Configuration</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"fidonet.html\">Fido Networks</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"archivers.html\">Archivers</A></LI>\n");
fprintf(hp, " <LI>Virus Scaners</LI>\n");
fprintf(hp, " <LI>Modem Types</LI>\n");
fprintf(hp, " <LI>TTY Lines Info</LI>\n");
fprintf(hp, " <LI>Fidonet Nodes</LI>\n");
fprintf(hp, " <LI><A HREF=\"bbs.html\">BBS Setup</A></LI>\n");
fprintf(hp, " <UL>\n");
fprintf(hp, " <LI><A HREF=\"limits.html\">Security Limits</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"language.html\">Language Setup</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"menus.html\">BBS Menus</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"fileareas.html\">File Areas</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"protocols.html\">Transfer Protocols</A></LI>\n");
fprintf(hp, " <LI><A HREF=\"oneliners.html\">Oneliners</A></LI>\n");
fprintf(hp, " </UL>\n");
fprintf(hp, " <LI>Mail Setup</LI>\n");
fprintf(hp, " <UL>\n");
fprintf(hp, " <LI>Echomail Groups</LI>\n");
fprintf(hp, " <LI>Echomail Areas</LI>\n");
fprintf(hp, " </UL>\n");
fprintf(hp, " <LI>File Echo's Setup</LI>\n");
fprintf(hp, " <UL>\n");
fprintf(hp, " <LI><A HREF=\"filegroup.html\">FileEcho Groups</A></LI>\n");
fprintf(hp, " <LI>Fileecho Areas</LI>\n");
fprintf(hp, " <LI>Hatch Manager</LI>\n");
fprintf(hp, " <LI>Magic Files</LI>\n");
fprintf(hp, " </UL>\n");
fprintf(hp, " <LI>Newfiles Groups</LI>\n");
fprintf(hp, " <LI>Newfiles Reports</LI>\n");
fprintf(hp, " <LI><A HREF=\"filefind.html\">Filefind Setup</A></LI>\n");
fprintf(hp, " <LI>BBS Users</LI>\n");
fprintf(hp, " <LI>Mail Services</LI>\n");
fprintf(hp, " <LI><A HREF=\"domain.html\">Domain translation</A></LI>\n");
fprintf(hp, " <LI>Task Manager</LI>\n");
fprintf(hp, " <LI>Network Routing</LI>\n");
fprintf(hp, "</UL>\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);
@ -258,87 +307,13 @@ void site_docs(void)
Syslog('+', "Sitedocs created");
page = line = 0;
/*
* Remove obsolete documents
*/
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;
unlink(temp);
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");
unlink(temp);
center_addstr(LINES -4, (char *)"Press any key");
readkey(LINES -4, COLS / 2 + 8, LIGHTGRAY, BLACK);

View File

@ -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, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
fprintf(fp, "<HTML>\n");
fprintf(fp, "<HEAD>\n");
fprintf(fp, "<META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");
fprintf(fp, "<META NAME=\"Language\" content=\"en\">\n");
if (title2)
fprintf(fp, "<TITLE>%s: %s</TITLE>\n", title, title2);
else
fprintf(fp, "<TITLE>%s</TITLE>\n", title);
fprintf(fp, "<STYLE type=\"text/css\">\n");
fprintf(fp, "BODY { font: 12pt sans-serif,helvetica,arial; }\n");
fprintf(fp, "H1 { color: red; font: 16pt sans-serif,helvetica,arial; font-weight: bold }\n");
fprintf(fp, "H2 { color: red; font: 14pt sans-serif,helvetica,arial; font-weight: bold }\n");
fprintf(fp, "H3 { position: relative; left: 60px; }\n");
fprintf(fp, "H5 { color: black; font: 10pt sans-serif,helvetica,arial; }\n");
fprintf(fp, "A:link { color: blue }\n");
fprintf(fp, "A:visited { color: blue }\n");
fprintf(fp, "A:active { color: red }\n");
fprintf(fp, "TH { font-weight: bold; }\n");
fprintf(fp, "PRE { font-size: 10pt; color: blue; font-family: fixed; }\n");
fprintf(fp, "</STYLE>\n");
fprintf(fp, "</HEAD>\n");
fprintf(fp, "<BODY bgcolor=\"#DDDDAA\" link=\"blue\" alink=\"red\" vlink=\"blue\">\n");
fprintf(fp, "<A NAME=\"_top\"></A>\n");
fprintf(fp, "<BLOCKQUOTE>\n");
if (title2)
fprintf(fp, "<DIV Align=\"center\"><H1>%s: %s</H1></DIV>\n", title, title2);
else
fprintf(fp, "<DIV Align=\"center\"><H1>%s</H1></DIV>\n", title);
now = time(NULL);
p = ctime(&now);
Striplf(p);
fprintf(fp, "<DIV align=\"right\"><H5>Created %s</H5></DIV>\n", p);
}
free(temp);
return fp;
}
void close_webdoc(FILE *fp)
{
fprintf(fp, "</BLOCKQUOTE>\n");
fprintf(fp, "</BODY>\n");
fprintf(fp, "</HTML>\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, "&nbsp;");
fprintf(fp, "<TR><TH align='left'>%s</TH><TD>%s</TD></TR>\n", left, right);
}
void add_webdigit(FILE *fp, char *hstr, int digit)
{
char left[1024];
html_massage(hstr, left);
fprintf(fp, "<TR><TH align='left'>%s</TH><TD>%d</TD></TR>\n", left, digit);
}

View File

@ -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