Example #1
0
int main(int argc, char **argv) {
	int i;
	FILE *file;
	Doc *doc;
	for (i = 1; i < argc; i++) {
		file = fopen(argv[i], "r");
		if (!file) {
			perror(argv[i]);
			return -1;
		}
		doc = new_doc(file);
		printdoc(doc);
	}
	return 0;
}
Example #2
0
void site_docs(void)
{
    FILE    *fp, *hp, *toc;
    char    temp[PATH_MAX], temp1[PATH_MAX];
    int	    page = 0, line = 0;

    if (config_read() == -1)
	return;

    snprintf(temp, PATH_MAX, "%s/share/doc/site.doc", getenv("FTND_ROOT"));
    mkdirs(temp, 0755);
    if ((fp = fopen(temp, "w")) == NULL)
	return;

    snprintf(temp1, PATH_MAX, "%s/tmp/toc.tmp", getenv("FTND_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);
    ftnd_mvprintw( 5, 6, "21.  CREATING SITEDOCS");
    set_color(CYAN, BLACK);
    ftnd_mvprintw( 7,11, (char *)"Erasing directory         %s/share/doc/html", getenv("FTND_ROOT"));
    fflush(stdout);

    snprintf(temp, PATH_MAX, "-r -f %s/share/doc/html", getenv("FTND_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><A HREF=\"virscan.html\">Virus Scanners</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"modem.html\">Modem Types</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"ttyinfo.html\">TTY Lines Info</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"nodes.html\">Fidonet Nodes</A></LI>\n");
	fprintf(hp, " <LI>BBS: <A HREF=\"limits.html\">Security Limits</A></LI>\n");
	fprintf(hp, " <LI>BBS: <A HREF=\"language.html\">Language Setup</A></LI>\n");
	fprintf(hp, " <LI>BBS: <A HREF=\"menus.html\">BBS Menus</A></LI>\n");
	fprintf(hp, " <LI>BBS: <A HREF=\"fileareas.html\">File Areas</A></LI>\n");
	fprintf(hp, " <LI>BBS: <A HREF=\"protocol.html\">Transfer Protocols</A></LI>\n");
	fprintf(hp, " <LI>BBS: <A HREF=\"oneliners.html\">Oneliners</A></LI>\n");
	fprintf(hp, " <LI>Mail: <A HREF=\"msggroup.html\">Echomail Groups</A></LI>\n");
	fprintf(hp, " <LI>Mail: <A HREF=\"msgareas.html\">Echomail Areas</A></LI>\n");
	fprintf(hp, " <LI>TIC: <A HREF=\"filegroup.html\">FileEcho Groups</A></LI>\n");
	fprintf(hp, " <LI>TIC: <A HREF=\"ticareas.html\">Fileecho Areas</A></LI>\n");
	fprintf(hp, " <LI>TIC: <A HREF=\"hatch.html\">Hatch Manager</A></LI>\n");
	fprintf(hp, " <LI>TIC: <A HREF=\"magic.html\">Magic Files</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"newgroup.html\">Newfiles Groups</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"newfiles.html\">Newfiles Reports</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"filefind.html\">Filefind Setup</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"users.html\">BBS Users</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"service.html\">Mail Service Manager</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"domain.html\">Domain translation</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"task.html\">Task Manager</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"route.html\">Network Routing</A></LI>\n");
	fprintf(hp, " <LI><A HREF=\"ibcsrv.html\">Internet BBS Chat</A></LI>\n");
        fprintf(hp, "</UL>\n");
        close_webdoc(hp);
    } else {
        Syslog('+', "Can't create html documentation");
    }

    ftnd_mvprintw(8,11, (char *)"Creating site documents");
    fflush(stdout);
    horiz = 35;
    page = global_doc(fp, toc, page);
    dotter();
    page = fido_doc(fp, toc, page);
    dotter();
    page = archive_doc(fp, toc, page);
    dotter();
    page = virus_doc(fp, toc, page);
    dotter();
    page = modem_doc(fp, toc, page);
    dotter();
    page = tty_doc(fp, toc, page);
    dotter();
    page = node_doc(fp, toc, page);
    dotter();
    page = bbs_doc(fp, toc, page);
    dotter();
    page = mail_doc(fp, toc, page);
    dotter();
    page = tic_doc(fp, toc, page);
    dotter();
    page = newf_group_doc(fp, toc, page);
    dotter();
    page = new_doc(fp, toc, page);
    dotter();
    page = ff_doc(fp, toc, page);
    dotter();
    page = service_doc(fp, toc, page);
    dotter();
    page = domain_doc(fp, toc, page);
    dotter();
    page = task_doc(fp, toc, page);
    dotter();
    page = route_doc(fp, toc, page);
    dotter();
    page = ibc_doc(fp, toc, page);
    dotter();
    users_doc();
    dotter();
    ol_doc();
    clrtoeol();
    ftnd_mvprintw( 8,11, (char *)"Created site documents in %s/share/doc", getenv("FTND_ROOT"));
    fflush(stdout);

    /*
     * Append table of contents
     */
    page = newpage(fp, page);
    addtoc(fp, toc, 21, 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
     */
    snprintf(temp, PATH_MAX, "%s/doc/xref.doc", getenv("FTND_ROOT"));
    unlink(temp);
    snprintf(temp, PATH_MAX, "%s/doc/stat.doc", getenv("FTND_ROOT"));
    unlink(temp);

    center_addstr(LINES -4, (char *)"Press any key");
    readkey(LINES -4, COLS / 2 + 8, LIGHTGRAY, BLACK);
    return;
}