Exemple #1
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");
    }
}
static void write_texman(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,
			 t_linkdata *links)
{
  int i;
  char tmp[256];
  
  fprintf(out,"\\section{\\normindex{%s}}\\label{%s}\n\n",check_tex(program),check_tex(program));
  
  if (nldesc > 0)
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"%s\n",check_tex(desc[i]));

  if (nfile > 0) {
    fprintf(out,"\\vspace{-2ex}\\begin{tabbing}\n");
    fprintf(out,"\n{\\normalsize \\bf Files}\\nopagebreak\\\\\n");
    fprintf(out,"{\\tt ~~~~~~~} \\= {\\tt ~~~~~~~~~~~~~~} \\= "
	    "~~~~~~~~~~~~~~~~~~~~~~ \\= \\nopagebreak\\kill\n");
    for(i=0; (i<nfile); i++)
      fprintf(out,"\\>{\\tt %s} \\'\\> {\\tt %s} \\' %s \\> "
	      "\\parbox[t]{0.55\\linewidth}{%s} \\\\\n",
	      check_tex(fnm[i].opt),check_tex(fnm[i].fns[0]),
	      check_tex(fileopt(fnm[i].flag,tmp,255)),
	      check_tex(ftp2desc(fnm[i].ftp)));
    fprintf(out,"\\end{tabbing}\\vspace{-4ex}\n");
  }
  if (npargs > 0) {
    fprintf(out,"\\vspace{-2ex}\\begin{tabbing}\n");
    fprintf(out,"\n{\\normalsize \\bf Other options}\\nopagebreak\\\\\n");
    fprintf(out,"{\\tt ~~~~~~~~~~} \\= vector \\= "
	    "{\\tt ~~~~~~~} \\= \\nopagebreak\\kill\n");
    for(i=0; (i<npargs); i++) {
      if (strlen(check_tex(pa_val(&(pa[i]),tmp,255))) <= 8)
	fprintf(out,"\\> {\\tt %s} \\'\\> %s \\'\\> {\\tt %s} \\' "
		"\\parbox[t]{0.68\\linewidth}{%s}\\\\\n",
		check_tex(pa[i].option),argtp[pa[i].type],
		check_tex(pa_val(&(pa[i]),tmp,255)),
		check_tex(pa[i].desc));
      else
      	fprintf(out,"\\> {\\tt %s} \\'\\> %s \\'\\>\\\\\n"
		"\\> \\'\\> \\'\\> {\\tt %s} \\' "
		"\\parbox[t]{0.7\\linewidth}{%s}\\\\\n",
		check_tex(pa[i].option),argtp[pa[i].type],
		check_tex(pa_val(&(pa[i]),tmp,255)),
		check_tex(pa[i].desc));
    }
    fprintf(out,"\\end{tabbing}\\vspace{-4ex}\n");
  }
  if (nbug > 0) {
    fprintf(out,"\n");
    fprintf(out,"\\begin{itemize}\n");
    for(i=0; (i<nbug); i++)
      fprintf(out,"\\item %s\n",check_tex(bugs[i]));
    fprintf(out,"\\end{itemize}\n");
  }
/*   fprintf(out,"\n\\newpage\n"); */
}
Exemple #3
0
void pr_fns(FILE *fp, int nf, const t_filenm tfn[])
{
    int    i, f;
    size_t j;
    char   buf[256], *wbuf, opt_buf[32];
#define OPTLEN 4
#define NAMELEN 14
    fprintf(fp, "%6s %12s  %-12s %s\n", "Option", "Filename", "Type",
            "Description");
    fprintf(fp,
            "------------------------------------------------------------\n");
    for (i = 0; (i < nf); i++)
    {
        for (f = 0; (f < tfn[i].nfiles); f++)
        {
            sprintf(buf, "%4s %14s  %-12s ", (f == 0) ? tfn[i].opt : "",
                    tfn[i].fns[f], (f == 0) ? fileopt(tfn[i].flag, opt_buf, 32)
                    : "");
            if (f < tfn[i].nfiles - 1)
            {
                fprintf(fp, "%s\n", buf);
            }
        }
        if (tfn[i].nfiles > 0)
        {
            strcat(buf, deffile[tfn[i].ftp].descr);
            if ((strlen(tfn[i].opt) > OPTLEN)
                && (strlen(tfn[i].opt) <= ((OPTLEN + NAMELEN)
                                           - strlen(tfn[i].fns[tfn[i].nfiles - 1]))))
            {
                for (j = strlen(tfn[i].opt); j < strlen(buf)
                     - (strlen(tfn[i].opt) - OPTLEN) + 1; j++)
                {
                    buf[j] = buf[j + strlen(tfn[i].opt) - OPTLEN];
                }
            }
            wbuf = wrap_lines(buf, 78, 35, FALSE);
            fprintf(fp, "%s\n", wbuf);
            sfree(wbuf);
        }
    }
    fprintf(fp, "\n");
    fflush(fp);
}
Exemple #4
0
int main(int argc, char *argv[])
{
	int retval = 1;

	set_aumessage_mode(MSG_STDERR, DBG_NO);

	if (argc == 1) {
		usage();
		return 1;
	}
#ifndef DEBUG
	/* Make sure we are root */
	if (geteuid() != 0) {
		fprintf(stderr, "You must be root to run this program.\n");
		return 4;
	}
#endif
	/* Check where the rules are coming from: commandline or file */
	if ((argc == 3) && (strcmp(argv[1], "-R") == 0)) {
		fd = audit_open();
		if (audit_is_enabled(fd) == 2) {
			fprintf(stderr,
				"The audit system is in immutable "
				"mode, no rule changes allowed\n");
			return 0;
		} else if (errno == ECONNREFUSED) {
			fprintf(stderr, "The audit system is disabled\n");
			return 0;
		} else if (fileopt(argv[2]))
			return 1;
		else {
			if (continue_error < 0)
				return 1;
			return 0;
		}
	} else {
		if (reset_vars()) {
			free(rule_new);
			return 1;
		}
		retval = setopt(argc, 0, argv);
		if (retval == -3) {
			free(rule_new);
			return 0;
		}
	}

	if (add != AUDIT_FILTER_UNSET || del != AUDIT_FILTER_UNSET) {
		fd = audit_open();
		if (audit_is_enabled(fd) == 2) {
			fprintf(stderr,
				"The audit system is in immutable "
				"mode, no rule changes allowed\n");
			free(rule_new);
			return 0;
		} else if (errno == ECONNREFUSED) {
			fprintf(stderr, "The audit system is disabled\n");
			free(rule_new);
			return 0;
		}
	}
	retval = handle_request(retval);
	free(rule_new);
	return retval;
}
static void write_nroffman(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,
			   t_linkdata *links)

{
  int i;
  char tmp[256];
  
  
  fprintf(out,".TH %s 1 \"%s\" \"\" \"GROMACS suite, %s\"\n",program,mydate(tmp,255,FALSE),GromacsVersion());
  fprintf(out,".SH NAME\n");
  fprintf(out,"%s\n",program);
  fprintf(out,".B %s\n",GromacsVersion());
  
  fprintf(out,".SH SYNOPSIS\n");
  fprintf(out,"\\f3%s\\fP\n",program);

  /* command line arguments */
  if (nfile > 0) {
    for(i=0; (i<nfile); i++)
      fprintf(out,".BI \"%s\" \" %s \"\n",check_nroff(fnm[i].opt),
	      check_nroff(fnm[i].fns[0]));
  }
  if (npargs > 0) {
    for(i=0; (i<npargs); i++)
      if (pa[i].type == etBOOL)
	fprintf(out,".BI \"\\-[no]%s\" \"\"\n",check_nroff(pa[i].option+1));
      else
	fprintf(out,".BI \"%s\" \" %s \"\n",check_nroff(pa[i].option),
		check_nroff(argtp[pa[i].type]));
  }
  
  /* description */
  if (nldesc > 0) {
    fprintf(out,".SH DESCRIPTION\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"\\&%s\n",check_nroff(desc[i]));
  }

  /* FILES */
  if (nfile > 0) {
    fprintf(out,".SH FILES\n");
    for(i=0; (i<nfile); i++)
      fprintf(out,".BI \"%s\" \" %s\" \n.B %s\n %s \n\n",
	      check_nroff(fnm[i].opt),
              check_nroff(fnm[i].fns[0]),
              check_nroff(fileopt(fnm[i].flag,tmp,255)),
	      check_nroff(ftp2desc(fnm[i].ftp)));
  }
  
  /* other options */
  fprintf(out,".SH OTHER OPTIONS\n");
  if ( npargs > 0 ) {
    for(i=0; (i<npargs); i++) {
      if (pa[i].type == etBOOL)
	fprintf(out,".BI \"\\-[no]%s\"  \"%s\"\n %s\n\n",
		check_nroff(pa[i].option+1),
		check_nroff(pa_val(&(pa[i]),tmp,255)),
                check_nroff(pa[i].desc));
      else
	fprintf(out,".BI \"%s\"  \" %s\" \" %s\" \n %s\n\n",
		check_nroff(pa[i].option),
                check_nroff(argtp[pa[i].type]),
		check_nroff(pa_val(&(pa[i]),tmp,255)),
                check_nroff(pa[i].desc));
    }
  }

  if (nbug > 0) {
    fprintf(out,".SH KNOWN PROBLEMS\n");
    for(i=0; (i<nbug); i++)
      fprintf(out,"\\- %s\n\n",check_nroff(bugs[i]));
  }

  fprintf(out,".SH SEE ALSO\n.BR gromacs(7)\n\n");
  fprintf(out,"More information about \\fBGROMACS\\fR is available at <\\fIhttp://www.gromacs.org/\\fR>.\n");

}
Exemple #6
0
static void write_htmlman(FILE *out,
			  char *program,
			  int nldesc,char **desc,
			  int nfile,t_filenm *fnm,
			  int npargs,t_pargs *pa,
			  int nbug,char **bugs)
{
  int i;
  char link[10];
  
#define NSR(s) check_html(s,program)
  
  fprintf(out,"<HTML>\n<HEAD>\n<TITLE>%s</TITLE>\n",program);
  fprintf(out,"<LINK rel=stylesheet href=\"style.css\" type=\"text/css\">\n");
  fprintf(out,"<BODY text=\"#000000\" bgcolor=\"#FFFFFF\" link=\"#0000FF\" vlink=\"#990000\" alink=\"#FF0000\">\n");
  fprintf(out,"<TABLE WIDTH=\"98%%\" NOBORDER >\n<TR><TD WIDTH=400>\n");
  fprintf(out,"<TABLE WIDTH=400 NOBORDER>\n<TD WIDTH=116>\n");
  fprintf(out,"<a href=\"http://www.gromacs.org/\">"
	  "<img SRC=\"../images/gmxlogo_small.jpg\""
	  "BORDER=0 height=133 width=116></a></td>\n");
  fprintf(out,"<td ALIGN=LEFT VALIGN=TOP WIDTH=280>"
	  "<br><h2>%s</h2>",program);
  fprintf(out,"<font size=-1><A HREF=\"../online.html\">Main Table of Contents</A></font><br>");
  fprintf(out,"<br></td>\n</TABLE></TD><TD WIDTH=\"*\" ALIGN=RIGHT VALIGN=BOTTOM><p><B>%s<br>\n",GromacsVersion());
  fprintf(out,"%s</B></td></tr></TABLE>\n<HR>\n",mydate());
  
  if (nldesc > 0) {
    fprintf(out,"<H3>Description</H3>\n<p>\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"%s\n",NSR(desc[i]));
  }
  if (nfile > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<H3>Files</H3>\n");
    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");
      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].fn,fileopt(fnm[i].flag),
	      NSR(ftp2desc(fnm[i].ftp)));
    }
    fprintf(out,"</TABLE>\n");
  }
  if (npargs > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<H3>Other options</H3>\n");
    fprintf(out,
	    "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2>\n"
	    "<TR>"
	    "<TH>option</TH>"
	    "<TH>type</TH>"
	    "<TH>default</TH>"
	    "<TH>description</TH>"
	    "</TR>\n");
    for(i=0; (i<npargs); i++)
      fprintf(out,
	      "<TR>"
	      "<TD ALIGN=RIGHT> <b><tt>%s%s</tt></b> </TD>"
	      "<TD ALIGN=RIGHT> %s </TD>"
	      "<TD ALIGN=RIGHT> <tt>%s</tt> </TD>"
	      "<TD> %s </TD>"
	      "</TD>\n",
	      (pa[i].type == etBOOL)?"-[no]":"-",pa[i].option+1,
	      argtp[pa[i].type],pa_val(&(pa[i])),NSR(pa[i].desc));
    fprintf(out,"</TABLE>\n");
  }
  if (nbug > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<UL>\n");
    for(i=0; (i<nbug); i++)
      fprintf(out,"<LI>%s\n",NSR(bugs[i]));
    fprintf(out,"</UL>\n");
  }
  fprintf(out,"<P>\n");
  fprintf(out,"<hr>\n<div ALIGN=RIGHT>\n");
  fprintf(out,"<font size=\"-1\"><a href=\"http://www.gromacs.org\">"
	  "http://www.gromacs.org</a></font><br>\n");
  fprintf(out,"</div>\n");
  fprintf(out,"</BODY>\n");
}
Exemple #7
0
static void write_nroffman(FILE *out,
			   char *program,
			   int nldesc,char **desc,
			   int nfile,t_filenm *fnm,
			   int npargs,t_pargs *pa,
			   int nbug,char **bugs)

{
  int i;
  
  fprintf(out,".TH %s 1 \"%s\"\n",program,mydate());
  fprintf(out,".SH NAME\n");
  fprintf(out,"%s\n",program);
  fprintf(out,".B %s\n",GromacsVersion());
  
  fprintf(out,".SH SYNOPSIS\n");
  fprintf(out,"\\f3%s\\fP\n",program);

  /* command line arguments */
  if (nfile > 0) {
    for(i=0; (i<nfile); i++)
      fprintf(out,".BI \"%s\" \" %s \"\n",fnm[i].opt,
	      fnm[i].fn);
  }
  if (npargs > 0) {
    for(i=0; (i<npargs); i++)
      if (pa[i].type == etBOOL)
	fprintf(out,".BI \"-[no]%s\" \"\"\n",pa[i].option+1);
      else
	fprintf(out,".BI \"%s\" \" %s \"\n",pa[i].option,
		argtp[pa[i].type]);
  }
  
  /* description */
  if (nldesc > 0) {
    fprintf(out,".SH DESCRIPTION\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"%s\n",check_nroff(desc[i]));
  }

  /* FILES */
  if (nfile > 0) {
    fprintf(out,".SH FILES\n");
    for(i=0; (i<nfile); i++)
      fprintf(out,".BI \"%s\" \" %s\" \n.B %s\n %s \n\n",
	      fnm[i].opt,fnm[i].fn,fileopt(fnm[i].flag),
	      check_nroff(ftp2desc(fnm[i].ftp)));
  }
  
  /* other options */
  fprintf(out,".SH OTHER OPTIONS\n");
  if ( npargs > 0 ) {
    for(i=0; (i<npargs); i++) {
      if (pa[i].type == etBOOL)
	fprintf(out,".BI \"-[no]%s\"  \"%s\"\n %s\n\n",
		check_nroff(pa[i].option+1),
		pa_val(&(pa[i])),check_nroff(pa[i].desc));
      else
	fprintf(out,".BI \"%s\"  \" %s\" \" %s\" \n %s\n\n",
		check_nroff(pa[i].option),argtp[pa[i].type],
		pa_val(&(pa[i])),check_nroff(pa[i].desc));
    }
  }

  if (nbug > 0) {
    for(i=0; (i<nbug); i++)
      fprintf(out,"\\- %s\n\n",check_nroff(bugs[i]));
  }

}