Exemplo n.º 1
0
static void write_wikiman(FILE *out,
                          const char *program,
                          int nldesc, const char **desc,
                          int nfile, t_filenm *fnm,
                          int npargs, t_pargs *pa,
                          int nbug, const char **bugs, gmx_bool bHeader,
                          t_linkdata *links)
{
    int   i;
    char  buf[256], link[10];
    char *tmp, *tmp2;
    fprintf(out, "<page>\n<title>Manual:%s_%s</title>\n", program,
            VERSION);
    fprintf(out, "<revision>\n");
    fprintf(out, "<timestamp>%s</timestamp>\n", mydate(buf, 255, TRUE));
    fprintf(out, "<text xml:space=\"preserve\">\n");
    if (nldesc > 0)
    {
        fprintf(out, "== Description ==\n");
        print_tty_formatted(out, nldesc, desc, 0, links, program, TRUE);
        fprintf(out, "\n");
    }
    if (nbug > 0)
    {
        fprintf(out, "== Known Problems ==\n");
        for (i = 0; i < nbug; i++)
        {
            snew(tmp, strlen(bugs[i])+3);
            strcpy(tmp, "* ");
            strcpy(tmp+2, bugs[i]);
            fprintf(out, "%s\n", NWR(tmp));
            sfree(tmp);
        }
    }
    if (nfile > 0)
    {
        fprintf(out, "\n== Files ==\n");
        pr_html_files(out, nfile, fnm, program, links, TRUE);
    }
    if (npargs > 0)
    {
        fprintf(out, "\n== Options ==\n");
        fprintf(out, " %-12s %-6s %-6s  %-s\n",
                "Option", "Type", "Value", "Description");
        fprintf(out, " ------------------------------------------------------\n");
        for (i = 0; (i < npargs); i++)
        {
            tmp = NWR(pargs_print_line(&pa[i], TRUE));
            fprintf(out, "%s", tmp);
            sfree(tmp);
        }
    }
    fprintf(out, "[[category:Manual_Pages_%s|%s]]\n", VERSION, program);
    fprintf(out, "</text>\n");
    fprintf(out, "</revision>\n");
    fprintf(out, "</page>\n\n");
}
Exemplo n.º 2
0
static void pr_html_files(FILE *out, int nfile, t_filenm fnm[],
                          const char *program, t_linkdata *links, gmx_bool bWiki)
{
    int  i;
    char link[10], tmp[255];

    if (bWiki)
    {
        fprintf(out, " %-10s %-12s %-12s %-s\n"
                " -----------------------------------------------------\n",
                "Option", "Filename", "Type", "Description");
    }
    else
    {
        fprintf(out,
                "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2>\n"
                "<TR>"
                "<TH>option</TH>"
                "<TH>filename</TH>"
                "<TH>type</TH>"
                "<TH>description</TH>"
                "</TR>\n");
    }

    for (i = 0; (i < nfile); i++)
    {
        strcpy(link, ftp2ext(fnm[i].ftp));
        if (strcmp(link, "???") == 0)
        {
            strcpy(link, "files");
        }
        if (bWiki)
        {
            fprintf(out, " %-10s %-16s %-12s %-s\n",
                    fnm[i].opt,
                    NWR(fnm[i].fns[0]),
                    fileopt(fnm[i].flag, tmp, 255),
                    NWR(ftp2desc(fnm[i].ftp)));
        }
        else
        {
            fprintf(out,
                    "<TR>"
                    "<TD ALIGN=RIGHT> <b><tt>%s</tt></b> </TD>"
                    "<TD ALIGN=RIGHT> <tt><a href=\"%s.html\">%12s</a></tt> </TD>"
                    "<TD> %s </TD>"
                    "<TD> %s </TD>"
                    "</TR>\n",
                    fnm[i].opt, link, fnm[i].fns[0], fileopt(fnm[i].flag, tmp, 255),
                    NSR(ftp2desc(fnm[i].ftp)));
        }
    }
    if (!bWiki)
    {
        fprintf(out, "</TABLE>\n");
    }
}
Exemplo n.º 3
0
void
print_tty_formatted(FILE *out, int nldesc, const char **desc,int indent,
                    t_linkdata *links,const char *program,gmx_bool bWiki)
{
  char *buf;
  char *temp;
  int buflen,i,j;

  buflen = 80*nldesc;
  snew(buf,buflen);
  for(i=0; (i<nldesc); i++) {
    if ((strlen(buf)>0) && 
	(buf[strlen(buf)-1] !=' ') && (buf[strlen(buf)-1] !='\n'))
      strcat(buf," ");
    if (bWiki)
      temp=NWR(desc[i]);
    else
      temp=check_tty(desc[i]);
    if (strlen(buf) + strlen(temp) >= (size_t)(buflen-2)) {
      buflen += strlen(temp);
      srenew(buf,buflen);
    }
    strcat(buf,temp);
    sfree(temp);
  }
  /* Make lines of at most 79 characters */
  temp = wrap_lines(buf,78,indent,FALSE);
  fprintf(out,"%s\n",temp);
  sfree(temp);
  sfree(buf);
}