コード例 #1
0
ファイル: wman.c プロジェクト: Chadi-akel/cere
void write_man(FILE *out,char *mantp,
	       char *program,
	       int nldesc,char **desc,
	       int nfile,t_filenm *fnm,
	       int npargs,t_pargs *pa,
	       int nbug,char **bugs,bool bHidden)
{
  char    *pr;
  int     i,npar;
  t_pargs *par;
 
  /* Don't write hidden options to completions, it just
   * makes the options more complicated for normal users
   */

  if (bHidden) {
    npar=npargs;
    par=pa;
  }
  else {
    snew(par,npargs);
    npar=0;
    for(i=0;i<npargs;i++)
      if (!is_hidden(&pa[i])) {
	par[npar]=pa[i];
	npar++;
      }
  }
  
  if ((pr=strrchr(program,'/')) == NULL)
    pr=program;
  else
    pr+=1;
  if (strcmp(mantp,"tex")==0)
    write_texman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs);
  if (strcmp(mantp,"nroff")==0)
    write_nroffman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs);
  if (strcmp(mantp,"ascii")==0)
    write_ttyman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs,TRUE);
  if (strcmp(mantp,"help")==0)
    write_ttyman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs,FALSE);
  if (strcmp(mantp,"html")==0)
    write_htmlman(out,pr,nldesc,desc,nfile,fnm,npar,par,nbug,bugs);
  if (strcmp(mantp,"completion-zsh")==0)
    write_zshcompl(out,nfile,fnm,npar,par);
  if (strcmp(mantp,"completion-bash")==0)
    write_bashcompl(out,nfile,fnm,npar,par);
  if (strcmp(mantp,"completion-csh")==0)
    write_cshcompl(out,nfile,fnm,npar,par);

  if (!bHidden)
    sfree(par);
}
コード例 #2
0
ファイル: wman.c プロジェクト: yhalcyon/Gromacs
void write_man(FILE *out, const char *mantp,
               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 bHidden)
{
    const char *pr;
    int         i, npar;
    t_pargs    *par;

    t_linkdata *links;

    links = init_linkdata();

    /* Don't write hidden options to completions, it just
     * makes the options more complicated for normal users
     */

    if (bHidden)
    {
        npar = npargs;
        par  = pa;
    }
    else
    {
        snew(par, npargs);
        npar = 0;
        for (i = 0; i < npargs; i++)
        {
            if (!is_hidden(&pa[i]))
            {
                par[npar] = pa[i];
                npar++;
            }
        }
    }

    if ((pr = strrchr(program, DIR_SEPARATOR)) == NULL)
    {
        pr = program;
    }
    else
    {
        pr += 1;
    }
    if (strcmp(mantp, "tex") == 0)
    {
        write_texman(out, pr, nldesc, desc, nfile, fnm, npar, par, nbug, bugs, links);
    }
    if (strcmp(mantp, "nroff") == 0)
    {
        write_nroffman(out, pr, nldesc, desc, nfile, fnm, npar, par, nbug, bugs, links);
    }
    if (strcmp(mantp, "ascii") == 0)
    {
        write_ttyman(out, pr, nldesc, desc, nfile, fnm, npar, par, nbug, bugs, TRUE, links);
    }
    if (strcmp(mantp, "wiki") == 0)
    {
        write_wikiman(out, pr, nldesc, desc, nfile, fnm, npar, par, nbug, bugs, TRUE, links);
    }
    if (strcmp(mantp, "help") == 0)
    {
        write_ttyman(out, pr, nldesc, desc, nfile, fnm, npar, par, nbug, bugs, FALSE, links);
    }
    if (strcmp(mantp, "html") == 0)
    {
        write_htmlman(out, pr, nldesc, desc, nfile, fnm, npar, par, nbug, bugs, links);
    }
    if (strcmp(mantp, "py") == 0)
    {
        write_py(out, pr, nldesc, desc, nfile, fnm, npar, par, nbug, bugs, links);
    }
    if (strcmp(mantp, "xml") == 0)
    {
        write_xmlman(out, pr, nldesc, desc, nfile, fnm, npargs, pa, nbug, bugs, links);
    }
    if (strcmp(mantp, "completion-zsh") == 0)
    {
        write_zshcompl(out, nfile, fnm, npar, par);
    }
    if (strcmp(mantp, "completion-bash") == 0)
    {
        write_bashcompl(out, nfile, fnm, npar, par);
    }
    if (strcmp(mantp, "completion-csh") == 0)
    {
        write_cshcompl(out, nfile, fnm, npar, par);
    }

    if (!bHidden)
    {
        sfree(par);
    }

    finish_linkdata(links);
}