From 2bd0f01dd91ea89dbdaa46bb96a87850ee4ad172 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 3 Apr 2004 18:46:54 +0000 Subject: [PATCH] Finished html sitedocs --- ChangeLog | 11 +- Makefile | 10 +- TODO | 5 - mbfido/maketags.c | 139 +++++++++++----------- mbsetup/m_archive.c | 4 +- mbsetup/m_hatch.c | 3 +- mbsetup/m_limits.c | 7 +- mbsetup/m_magic.c | 8 +- mbsetup/m_protocol.c | 97 +++++++++------ mbsetup/m_route.c | 20 +++- mbsetup/m_service.c | 59 ++++++---- mbsetup/m_task.c | 94 ++++++++++----- mbsetup/m_ticarea.c | 273 ++++++++++++++++++++++++++++++++++--------- mbsetup/m_tty.c | 110 +++++++++++------ mbsetup/m_users.c | 95 +++++++++++++++ mbsetup/m_users.h | 5 +- mbsetup/m_virus.c | 80 ++++++++----- mbsetup/mbsetup.c | 21 ++-- mbsetup/mutil.c | 2 +- 19 files changed, 726 insertions(+), 317 deletions(-) diff --git a/ChangeLog b/ChangeLog index acf95db9..9eaaeb6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,20 +6,23 @@ v0.51.3 22-Mar-2003 Removed one setup entry for check for free diskspace, there were two different values for the same purpose. The removed one was not used. + Moved doc directory from /opt/mbse/doc to /opt/mbse/share/doc. mbtask: Signal handler for sigchld set to sig_dfl, test for Fedora. Removed setup for old diskspace parameter. 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. + Added html sitedocs creation. The advantage of html over the + old plain doc is to easy see crossreferences using hyperlinks. + The html files are created in /opt/mbse/share/doc/html. The ~/doc/xref.doc and ~/doc/stat.doc are not created anymore, there was nothing in it yet. Removed setup for the unused free diskspace parameter. + mbfido: + The area tags are now created in /opt/mbse/share/doc/tags. + v0.51.2 06-Mar-2004 - 22-Mar-2003 diff --git a/Makefile b/Makefile index 9476285a..84357309 100644 --- a/Makefile +++ b/Makefile @@ -55,9 +55,13 @@ install: @if [ -f ${PREFIX}/etc/sysinfo.data ] ; then \ chmod 0660 ${PREFIX}/etc/sysinfo.data ; \ fi - @if [ ! -d ${PREFIX}/doc ] ; then \ - mkdir ${PREFIX}/doc ; \ - ${CHOWN} ${OWNER}:${GROUP} ${PREFIX}/doc ; \ + @if [ ! -d ${PREFIX}/share ] ; then \ + mkdir ${PREFIX}/share ; \ + ${CHOWN} ${OWNER}:${GROUP} ${PREFIX}/share ; \ + fi + @if [ ! -d ${PREFIX}/share/doc ] ; then \ + mkdir ${PREFIX}/share/doc ; \ + ${CHOWN} ${OWNER}:${GROUP} ${PREFIX}/share/doc ; \ fi @if [ ! -d ${PREFIX}/fdb ] ; then \ mkdir ${PREFIX}/fdb ; \ diff --git a/TODO b/TODO index 14ea372d..e704744b 100644 --- a/TODO +++ b/TODO @@ -169,8 +169,3 @@ mbsetup: N: When a message area is deleted, delete the rulesfile too. - X: Generate crossreference document: - Fileechos <=> Groups - Fileechos <=> Magic processing - Fileechos <=> Hatch - diff --git a/mbfido/maketags.c b/mbfido/maketags.c index da9243b8..c08f8c0c 100644 --- a/mbfido/maketags.c +++ b/mbfido/maketags.c @@ -36,93 +36,90 @@ void MakeTags(void) { - FILE *fg, *fd, *td, *ad; - char *gname, *dname, *tname, *aname; + FILE *fg, *fd, *td, *ad; + char *gname, *dname, *tname, *aname; - Syslog('+', "Start making tagfiles"); - gname = calloc(128, sizeof(char)); - dname = calloc(128, sizeof(char)); - tname = calloc(128, sizeof(char)); - aname = calloc(128, sizeof(char)); + Syslog('+', "Start making tagfiles"); + gname = calloc(PATH_MAX, sizeof(char)); + dname = calloc(PATH_MAX, sizeof(char)); + tname = calloc(PATH_MAX, sizeof(char)); + aname = calloc(PATH_MAX, sizeof(char)); - sprintf(gname, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); - sprintf(dname, "%s/etc/mareas.data", getenv("MBSE_ROOT")); + sprintf(gname, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); + sprintf(dname, "%s/etc/mareas.data", getenv("MBSE_ROOT")); - if (((fg = fopen(gname, "r")) == NULL) || - ((fd = fopen(dname, "r")) == NULL)) { - WriteError("$Can't open data"); - } else { - fread(&mgrouphdr, sizeof(mgrouphdr), 1, fg); - fread(&msgshdr, sizeof(msgshdr), 1, fd); + if (((fg = fopen(gname, "r")) == NULL) || ((fd = fopen(dname, "r")) == NULL)) { + WriteError("$Can't open data"); + } else { + fread(&mgrouphdr, sizeof(mgrouphdr), 1, fg); + fread(&msgshdr, sizeof(msgshdr), 1, fd); - while ((fread(&mgroup, mgrouphdr.recsize, 1, fg)) == 1) { - if (mgroup.Active) { - sprintf(tname, "%s/doc/%s.msgs.tag", getenv("MBSE_ROOT"), mgroup.Name); - td = fopen(tname, "w"); - sprintf(aname, "%s/doc/%s.msgs.are", getenv("MBSE_ROOT"), mgroup.Name); - ad = fopen(aname, "w"); - fprintf(ad, "; Mail areas in group %s\n", mgroup.Name); - fprintf(ad, ";\n"); + while ((fread(&mgroup, mgrouphdr.recsize, 1, fg)) == 1) { + if (mgroup.Active) { + sprintf(tname, "%s/share/doc/tags/%s.msgs.tag", getenv("MBSE_ROOT"), mgroup.Name); + mkdirs(tname, 0755); + td = fopen(tname, "w"); + sprintf(aname, "%s/share/doc/tags/%s.msgs.are", getenv("MBSE_ROOT"), mgroup.Name); + ad = fopen(aname, "w"); + fprintf(ad, "; Mail areas in group %s\n", mgroup.Name); + fprintf(ad, ";\n"); - fseek(fd, msgshdr.hdrsize, SEEK_SET); - while ((fread(&msgs, msgshdr.recsize, 1, fd)) == 1) { - if (msgs.Active && strlen(msgs.Tag) && - strcmp(mgroup.Name, msgs.Group) == 0) { - fprintf(ad, "%-35s %s\n", msgs.Tag, msgs.Name); - fprintf(td, "%s\n", msgs.Tag); - } + fseek(fd, msgshdr.hdrsize, SEEK_SET); + while ((fread(&msgs, msgshdr.recsize, 1, fd)) == 1) { + if (msgs.Active && strlen(msgs.Tag) && strcmp(mgroup.Name, msgs.Group) == 0) { + fprintf(ad, "%-35s %s\n", msgs.Tag, msgs.Name); + fprintf(td, "%s\n", msgs.Tag); + } - fseek(fd, msgshdr.syssize, SEEK_CUR); - } - fclose(ad); - fclose(td); - } + fseek(fd, msgshdr.syssize, SEEK_CUR); } - fclose(fg); - fclose(fd); + fclose(ad); + fclose(td); + } } + fclose(fg); + fclose(fd); + } - sprintf(gname, "%s/etc/fgroups.data", getenv("MBSE_ROOT")); - sprintf(dname, "%s/etc/tic.data", getenv("MBSE_ROOT")); + sprintf(gname, "%s/etc/fgroups.data", getenv("MBSE_ROOT")); + sprintf(dname, "%s/etc/tic.data", getenv("MBSE_ROOT")); - if (((fg = fopen(gname, "r")) == NULL) || - ((fd = fopen(dname, "r")) == NULL)) { - WriteError("$Can't open data"); - } else { - fread(&fgrouphdr, sizeof(fgrouphdr), 1, fg); - fread(&tichdr, sizeof(tichdr), 1, fd); + if (((fg = fopen(gname, "r")) == NULL) || ((fd = fopen(dname, "r")) == NULL)) { + WriteError("$Can't open data"); + } else { + fread(&fgrouphdr, sizeof(fgrouphdr), 1, fg); + fread(&tichdr, sizeof(tichdr), 1, fd); - while ((fread(&fgroup, fgrouphdr.recsize, 1, fg)) == 1) { - if (fgroup.Active) { - sprintf(tname, "%s/doc/%s.file.tag", getenv("MBSE_ROOT"), fgroup.Name); - td = fopen(tname, "w"); - sprintf(aname, "%s/doc/%s.file.are", getenv("MBSE_ROOT"), fgroup.Name); - ad = fopen(aname, "w"); - fprintf(ad, "; TIC file areas in group %s\n", fgroup.Name); - fprintf(ad, ";\n"); + while ((fread(&fgroup, fgrouphdr.recsize, 1, fg)) == 1) { + if (fgroup.Active) { + sprintf(tname, "%s/share/doc/tags/%s.file.tag", getenv("MBSE_ROOT"), fgroup.Name); + td = fopen(tname, "w"); + sprintf(aname, "%s/share/doc/tags/%s.file.are", getenv("MBSE_ROOT"), fgroup.Name); + ad = fopen(aname, "w"); + fprintf(ad, "; TIC file areas in group %s\n", fgroup.Name); + fprintf(ad, ";\n"); - fseek(fd, tichdr.hdrsize, SEEK_SET); - while ((fread(&tic, tichdr.recsize, 1, fd)) == 1) { - if (tic.Active && strlen(tic.Name) && - strcmp(fgroup.Name, tic.Group) == 0) { - fprintf(ad, "%-21s %s\n", tic.Name, tic.Comment); - fprintf(td, "%s\n", tic.Name); - } + fseek(fd, tichdr.hdrsize, SEEK_SET); + while ((fread(&tic, tichdr.recsize, 1, fd)) == 1) { + if (tic.Active && strlen(tic.Name) && strcmp(fgroup.Name, tic.Group) == 0) { + fprintf(ad, "%-21s %s\n", tic.Name, tic.Comment); + fprintf(td, "%s\n", tic.Name); + } - fseek(fd, tichdr.syssize, SEEK_CUR); - } - fclose(ad); - fclose(td); - } + fseek(fd, tichdr.syssize, SEEK_CUR); } - fclose(fg); - fclose(fd); + fclose(ad); + fclose(td); + } } + fclose(fg); + fclose(fd); + } - free(aname); - free(tname); - free(dname); - free(gname); + free(aname); + free(tname); + free(dname); + free(gname); } diff --git a/mbsetup/m_archive.c b/mbsetup/m_archive.c index 093a8156..d774ea63 100644 --- a/mbsetup/m_archive.c +++ b/mbsetup/m_archive.c @@ -812,8 +812,8 @@ int archive_doc(FILE *fp, FILE *toc, int page) if ((wp = open_webdoc(temp, (char *)"Archiver", archiver.comment))) { fprintf(wp, "Main Back\n"); fprintf(wp, "

\n"); - fprintf(wp, "\n"); - fprintf(wp, "\n"); + fprintf(wp, "
\n"); + fprintf(wp, "\n"); fprintf(wp, "\n"); add_webtable(wp, (char *)"Short name", archiver.name); add_webtable(wp, (char *)"Available", getboolean(archiver.available)); diff --git a/mbsetup/m_hatch.c b/mbsetup/m_hatch.c index 2484e2d3..3568dbb4 100644 --- a/mbsetup/m_hatch.c +++ b/mbsetup/m_hatch.c @@ -594,7 +594,8 @@ int tic_hatch_doc(FILE *fp, FILE *toc, int page) fprintf(wp, "\n"); fprintf(wp, "\n"); add_webtable(wp, (char *)"File specification", hatch.Spec); - add_webtable(wp, (char *)"TIC File area", hatch.Name); + fprintf(wp, "\n", + hatch.Name, hatch.Name); add_webtable(wp, (char *)"Replace file", hatch.Replace); add_webtable(wp, (char *)"Magic filename", hatch.Magic); add_webtable(wp, (char *)"File description", hatch.Desc); diff --git a/mbsetup/m_limits.c b/mbsetup/m_limits.c index 7c459d73..4a2dee95 100644 --- a/mbsetup/m_limits.c +++ b/mbsetup/m_limits.c @@ -539,6 +539,7 @@ int bbs_limits_doc(FILE *fp, FILE *toc, int page) { char temp[PATH_MAX]; FILE *up, *ip, *no; + int nr; sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT")); if ((no = fopen(temp, "r")) == NULL) @@ -584,10 +585,12 @@ int bbs_limits_doc(FILE *fp, FILE *toc, int page) while ((fread(&LIMIT, LIMIThdr.recsize, 1, no)) == 1) { fseek(up, usrconfighdr.hdrsize, SEEK_SET); + nr = 0; while (fread(&usrconfig, usrconfighdr.recsize, 1, up) == 1) { + nr++; if (strlen(usrconfig.sUserName) && (usrconfig.Security.level == LIMIT.Security)) { - fprintf(ip, "\n", - LIMIT.Security, usrconfig.sUserName, usrconfig.sLocation); + fprintf(ip, "\n", + LIMIT.Security, nr, usrconfig.sUserName, usrconfig.sLocation); } } } diff --git a/mbsetup/m_magic.c b/mbsetup/m_magic.c index 91e970b9..ced7c150 100644 --- a/mbsetup/m_magic.c +++ b/mbsetup/m_magic.c @@ -524,7 +524,8 @@ int tic_magic_doc(FILE *fp, FILE *toc, int page) add_webtable(wp, (char *)"Filemask", magic.Mask); add_webtable(wp, (char *)"Magic type", getmagictype(magic.Attrib)); add_webtable(wp, (char *)"Active", getboolean(magic.Active)); - add_webtable(wp, (char *)"TIC Area", magic.From); + fprintf(wp, "\n", + magic.From, magic.From); fprintf(fp, " Filemask %s\n", magic.Mask); fprintf(fp, " Type %s\n", getmagictype(magic.Attrib)); fprintf(fp, " Active %s\n", getboolean(magic.Active)); @@ -532,8 +533,9 @@ int tic_magic_doc(FILE *fp, FILE *toc, int page) switch (magic.Attrib) { case MG_ADOPT: - case MG_MOVE: add_webtable(wp, (char *)"To area", magic.ToArea); - fprintf(fp, " To area %s\n", magic.ToArea); + case MG_MOVE: fprintf(fp, " To area %s\n", magic.ToArea); + fprintf(wp, "\n", + magic.ToArea, magic.ToArea); break; case MG_EXEC: add_webtable(wp, (char *)"Command", magic.Cmd); add_webtable(wp, (char *)"Compile nodelist", getboolean(magic.Compile)); diff --git a/mbsetup/m_protocol.c b/mbsetup/m_protocol.c index 369b83e8..1f303588 100644 --- a/mbsetup/m_protocol.c +++ b/mbsetup/m_protocol.c @@ -523,45 +523,76 @@ char *PickProtocol(int nr) int bbs_prot_doc(FILE *fp, FILE *toc, int page) { - char temp[PATH_MAX]; - FILE *no; - int j; + char temp[PATH_MAX]; + FILE *wp, *ip, *no; + int j; - sprintf(temp, "%s/etc/protocol.data", getenv("MBSE_ROOT")); - if ((no = fopen(temp, "r")) == NULL) - return page; + sprintf(temp, "%s/etc/protocol.data", getenv("MBSE_ROOT")); + if ((no = fopen(temp, "r")) == NULL) + return page; - page = newpage(fp, page); - addtoc(fp, toc, 8, 5, page, (char *)"BBS Transfer protocols"); - j = 0; - fprintf(fp, "\n\n"); - fread(&PROThdr, sizeof(PROThdr), 1, no); + page = newpage(fp, page); + addtoc(fp, toc, 8, 5, page, (char *)"BBS Transfer protocols"); + j = 0; + fprintf(fp, "\n\n"); + fread(&PROThdr, sizeof(PROThdr), 1, no); - while ((fread(&PROT, PROThdr.recsize, 1, no)) == 1) { + ip = open_webdoc((char *)"protocol.html", (char *)"BBS Transfer Protocols", NULL); + fprintf(ip, "Main\n"); + fprintf(ip, "
TIC File area%s
%ld%s%s
%ld%s%s
TIC Area%s
TIC Area%s
\n"); + fprintf(wp, "\n"); + fprintf(wp, "\n"); + add_webtable(wp, (char *)"Selection key", PROT.ProtKey); + add_webtable(wp, (char *)"Protocol name", PROT.ProtName); + add_webtable(wp, (char *)"Upload command", PROT.ProtUp); + add_webtable(wp, (char *)"Download command", PROT.ProtDn); + add_webtable(wp, (char *)"Available", getboolean(PROT.Available)); + add_webtable(wp, (char *)"Batch protocol", getboolean(PROT.Batch)); + add_webtable(wp, (char *)"Bidirectional", getboolean(PROT.Bidir)); + add_webtable(wp, (char *)"User advice", PROT.Advice); + sprintf(temp, "%d%%", PROT.Efficiency); + add_webtable(wp, (char *)"Efficiency", temp); + web_secflags(wp, (char *)"Security level", PROT.Level); + fprintf(wp, "\n"); + fprintf(wp, "
\n"); + close_webdoc(wp); + } + + fprintf(fp, " Selection key %s\n", PROT.ProtKey); + fprintf(fp, " Protocol name %s\n", PROT.ProtName); + fprintf(fp, " Upload command %s\n", PROT.ProtUp); + fprintf(fp, " Download command %s\n", PROT.ProtDn); + fprintf(fp, " Available %s\n", getboolean(PROT.Available)); + fprintf(fp, " Batch protocol %s\n", getboolean(PROT.Batch)); + fprintf(fp, " Bidirectional %s\n", getboolean(PROT.Bidir)); + fprintf(fp, " User advice %s\n", PROT.Advice); + fprintf(fp, " Efficiency %d%%\n", PROT.Efficiency); + fprintf(fp, " Security level %s\n", get_secstr(PROT.Level)); + fprintf(fp, "\n\n"); + + j++; + } + + fprintf(ip, "\n"); + close_webdoc(ip); + + fclose(no); + return page; } diff --git a/mbsetup/m_route.c b/mbsetup/m_route.c index 1238726e..5a4e87d2 100644 --- a/mbsetup/m_route.c +++ b/mbsetup/m_route.c @@ -512,7 +512,7 @@ void InitRoute(void) int route_doc(FILE *fp, FILE *toc, int page) { char *temp; - FILE *no; + FILE *wp, *no; int j; temp = calloc(PATH_MAX, sizeof(char)); @@ -529,6 +529,14 @@ int route_doc(FILE *fp, FILE *toc, int page) fprintf(fp, "\n\n"); fread(&routehdr, sizeof(routehdr), 1, no); + wp = open_webdoc((char *)"route.html", (char *)"Netmail Routing", NULL); + fprintf(wp, "Main\n"); + fprintf(wp, "