autoopts_back

man2html - AutoOpts Simple Client

Main
AutoGen
Pages

Home
Announce
FAQ
docs
XML Defs
testimonials
downloads

Automated
Options

AutoOpts
Comparison
Man example
Redistribute
Licensing
local use
using getopt

GCC's
Fixincludes

fixincludes

Automated
FSM

description
example
usagefsm

Addons
addon

Project GNU
Home Page

Automated
XDR

xdr project

i

Man2html is an AutoOpts "Hello, world!" example that does something. It is yet another program to convert man page display text into html code. See the usage text or its own man page for more details. It is being released in conjunction with AutoGen for several reasons:

An AutoOpts example
This is a very simple example showing how to use AutoOpts for local-only builds.

The Perl man2html is broken
Unfortunately, it seems to have bugs and drops sections of output.

Output form
Most man2html programs presume they are producing the entire page. This one does not, so the output can be formatted to fit within a frame or HTML table entry (as in this page).

The "local only build" usage is actually very simple. Here is the full Makefile for this project:

  
  CVSSRC  = Makefile man2html.c opts.def README
  SRC     = opts.c man2html.c
  OBJ     = $(SRC:.c=.o)
  DOCS    = man2html.1 man2html.html
  
  CFLAGS  = -g `autoopts-config cflags`
  LDFLAGS = `autoopts-config libs`
  
  default : man2html
  all     : man2html $(DOCS)
  
  opts.h : opts.c
  opts.c : opts.def
      autogen opts.def
  
  $(OBJ) : opts.h
  
  man2html : man2html.o opts.o
      $(CC) -o $@ man2html.o opts.o $(LDFLAGS)
  
  clobber :
      rm -rf $(OBJ) opts.? man2html *~ $(DOCS) man2html-*
  
  man2html.1 : opts.def
      autogen -T agman-cmd.tpl -b man2html opts.def
  
  man2html.html : man2html.1 man2html
      nroff -man man2html.1 | ./man2html -u > $@
  
  dist :
      ver=`sed -n 's/^version *=//p' opts.def` ; \
      ver=`eval echo $$ver` ; \
      rm -rf man2html-$$ver ; mkdir man2html-$$ver ; \
      cp $(CVSSRC) man2html-$$ver/. ; \
      tar cvf - man2html-$$ver | gzip --best > man2html-$$ver.tar.gz ; \
      rm -rf man2html-$$ver

man2html Man Page Converter

Here is the AutoGen-erated usage text:

man2html - convert nroff output to html - Ver. 2.0
USAGE:  man2html [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ <input-file> ]
  Flg Arg Option-Name    Description
   -u no  blank-lines    Remove multiple blank lines
   -f KWd form           HTML form type (default:  html PAGE)
      no  bs-warning     Warn on unprocessed backspaces
   -p no  pea            omit attribution
   -h Str header         regex for identifying page headers
				- disabled as '--no-header'
				- enabled by default
      Str section-flag   section option flag for 'man(1)'
   -v opt version        Output version information and exit
   -? no  help           Display usage information and exit
   -! no  more-help      Extended usage information passed thru pager

Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.

The input may come from standard input, or be specified on the command
line.  If it is specified on the command line but cannot be found
directly, then the ``man(1)'' command will be invoked using this name.

The valid "form" option keywords are:
  page xhtml body pre
  or an integer from 0 through 3

Makes the following conversions:
 * backspace/overstrikes to bold.
 * backspace/underbar (either order) to italic.
 * bar/backspace/dash to `+' (also handle bold rendering)
 * bar/backspace/equals to `*' (also handle bold rendering)
 * plus/backspace/o to `o'
 * maps HTML special characters: '<', '>' and '&' to
   '&lt;', '&gt;' and '&amp;', respectively.

If a man page name is specified and the name contains a suffix,
the suffix will be stripped from the name and passed to ``man(1)''
as a separate argument.  An attempt is made when ``man2html'' is
built to determine if this argument should be introduced with a ``-s''
or ``-S'' option marker, or by itself as the initial argument.

All text preceeding the ``NAME'' section marker is stripped.

Please send bug reports to:  <autogen-bugs@sf.net>

Man Page for man2html

Here is its own generated man page:

NAME

       man2html - convert nroff output to html

SYNOPSIS

       man2html [-flags] [-flag [value]] [--option-name[[=| ]value]] [ <input-
       file> ]

       The input may come from standard input, or be specified on the  command
       line.   If  it  is  specified  on  the command line but cannot be found
       directly, then the man(1) command will be invoked using this name.

DESCRIPTION

       Makes the following conversions:
        * backspace/overstrikes to bold.
        * backspace/underbar (either order) to italic.
        * bar/backspace/dash to `+' (also handle bold rendering)
        * bar/backspace/equals to `*' (also handle bold rendering)
        * plus/backspace/o to `o'
        * maps HTML special characters: '<', '>' and '&' to
          '&lt;', '&gt;' and '&amp;', respectively.

       If a man page name is specified and the name  contains  a  suffix,  the
       suffix  will  be stripped from the name and passed to man(1) as a sepa-
       rate argument.  An attempt is made when man2html is built to  determine
       if this argument should be introduced with a -s or -S option marker, or
       by itself as the initial argument.

       All text preceeding the NAME section marker is stripped.

OPTIONS

       -u, --blank-lines
              Remove multiple blank lines.

              Man pages often have many blank lines.  This is fine for  print-
              ing on paper, but inconvenient for viewing on a web page.

       -f type, --form=type
              HTML  form type (default:  html PAGE).  This option takes a key-
              word as its argument.  The argument sets  an  enumeration  value
              that  can  be  tested by comparing them against the option value
              macro.  The available keywords are:
                  page  xhtml body  pre
                  or their numeric equivalent.

              The default type for this option is:
                   page

              Several possible output formats are supported.  Which you choose
              will depend upon how you wish to use the output.

              page The output will be a fully formed HTML page.  This is the
              default.

              xhtml The output will be a fully formed XHTML page.

              body The output is the body portion of an HTML page.  The header
              portion and the ``<html>''/``</html>'' enclosing tags will need
              to be provided.

              pre The output will be surrounded only with ``<pre>'' and
              ``</pre>'' tags.  This can then be placed in tables, frames or
              other constructs.

       --bs-warning
              Warn on unprocessed backspaces.

              Specify this option to detect unprocessed backspace characters.

       -p, --pea
              omit attribution.

              Specify this option to omit man2html attribution.

       -h regex, --header=regex, --no-header
              regex for identifying header/footer lines.  The no-header form
              will disable the option.  This option is enabled by default.
              The default regex for this option is:

              Different platforms emit differently formatted headers and foot-
              ers.  The default is to skip lines that contain the phrase, Last
              change or begin with 24 consecutive spaces.

       --section-flag=string
              section option flag for 'man(1)'.  The default string for this
              option is:
                   S

              If the man(1) page name passed as an argument has a section suf-
              fix, man2html will run man internally.  It will pass this suffix
              either as a plain command argument or as an argument to this
              man(1) page option.  Different platforms use different flags.

       -?, --help
              Display usage information and exit.

       -!, --more-help
              Pass the extended usage information through a pager.

       -v [{v|c|n --version [{v|c|n}]}]
              Output version of program and exit.  The default mode is `v', a
              simple version.  The `c' mode will print copyright information
              and `n' will print the full copyright notice.

EXIT STATUS

       One of the following exit values will be returned:

       0  (EXIT_SUCCESS)
              Successful program execution.

       1  (EXIT_FAILURE)
              The operation failed or the command syntax was not valid.

       70  (EX_SOFTWARE)
              libopts had an internal operational error.  Please report it to
              autogen-users@lists.sourceforge.net.  Thank you.

AUTHORS

       Bruce Korb

COPYRIGHT

       Copyright (C) 2002 Bruce Korb all rights reserved.  This program is
       released under the terms of the Modified Berkeley Software Distribution
       License.

BUGS

       Please send bug reports to: autogen-bugs@sf.net

NOTES

       This manual page was AutoGen-erated from the man2html option defini-
       tions.

2.0 30 Aug 2014 man2html(1)

This man page was converted to HTML by man2html

top  Viewable With Any Browser  Valid XHTML 1.0!


AutoGen, AutoOpts, columns, getdefs, AutoFSM, AutoXDR and these web pages copyright (c) 1999-2012 Bruce Korb, all rights reserved.

Return to GNU's home page.

Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.

Please send comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.

This article, Copyright © 2000-2002 by Bruce Korb

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. Last modified: Sat Aug 30 11:01:48 PDT 2014