groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff-commit] groff/contrib/groffer ChangeLog TODO groffer.ma...


From: Bernd Warken
Subject: [Groff-commit] groff/contrib/groffer ChangeLog TODO groffer.ma...
Date: Sat, 16 Sep 2006 16:06:23 +0000

CVSROOT:        /cvsroot/groff
Module name:    groff
Changes by:     Bernd Warken <bwarken>  06/09/16 16:06:23

Modified files:
        contrib/groffer: ChangeLog TODO groffer.man groffer2.sh 
                         version.sh 

Log message:
        Update groffer 0.9.26

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/groffer/ChangeLog?cvsroot=groff&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/groffer/TODO?cvsroot=groff&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/groffer/groffer.man?cvsroot=groff&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/groffer/groffer2.sh?cvsroot=groff&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/groffer/version.sh?cvsroot=groff&r1=1.2&r2=1.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/contrib/groffer/ChangeLog,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- ChangeLog   11 Sep 2006 16:06:18 -0000      1.38
+++ ChangeLog   16 Sep 2006 16:06:23 -0000      1.39
@@ -1,4 +1,67 @@
-2006-11-08  Bernd Warken
+2006-09-16  Bernd Warken
+       ________________________________________________________________
+       * release of groffer 0.9.26
+
+       ### Simplification of main_set_mode()
+
+       * groffer2.sh:
+       - _get_first_prog() of main_set_mode(): Rewrite this function
+       such that it does not have an output, but set the variables
+       $_DISPLAY_PROG and $_DISPLAY_ARGS.
+       - _check_prog_on_list() of main_set_mode(): Rename and rewrite
+       _check_X_prog().  Suitable for being called for $_VIEWER_<mode>_X
+       and $_VIEWER_<mode>_TTY.  No output, but set the variables
+       $_DISPLAY_PROG and $_DISPLAY_ARGS.
+       - _obj_set_vars() of main_set_mode(): Remove this function.  It is
+       no longer necessary because its variables are set by the other
+       functions.
+       - _get_prog_args() of main_set_mode(): New function that
+       simplifies the loop in main_set_mode() and handles both
+       $_VIEWER_<mode>_X and $_VIEWER_<mode>_TTY.
+       - _process_mode() of main_set_mode(): Remove this function.
+       - main_set_mode(): Remove case for calling _process_mode().  In
+       the loop, use _get_prog_args() for simplification.
+       - main_parse_args(): Make --<mode>-viewer equivalent to
+       --<mode>-viewer-tty to make _process_mode() unnecessary.
+       - $_VIEWER_BACKGROUND: Start with `no'.
+
+       ### Extend the documentation
+
+       * groffer2.sh:
+       - Environment Variables: Add information on the naming of
+       variables in functions.
+       - $_ADDOPTS_POST, $_ADDOPTS_X: Remove these unused variables.
+       - apropos_setup(), apropos_setup (), base_name(), dir_name(),
+       echo1(), echo2(), func_check(), func_pop(), func_push(),
+       is_greater_than(), list_append(), list_from_split(),
+       _manpath_add_sys() of manpath_add_lang_sys(), rm_tree(),
+       special_filespec(), special_setup(), tmp_create(), to_tmp_line(),
+       usage(), version(), where_is_prog(), main_set_mode():
+       Fix and extend the description.  Many other function descriptions
+       were just fixed without being mentioned.
+       - landmark 7: man_*(): Add information on the search of `man'
+       pages.
+
+       * groffer.man:
+       - GNU `man' option overview: Add --location, --no-location, and
+       --where.
+       - GNU `man' options: Add the GNU `man' long options that are
+       accepted by `groffer', but just ignored.
+       - MAN PAGE SEARCHING: Correct and extend this section.
+       
+       * TODO:
+       - Remove entry on function headers.
+       - Remove entry on GNU `man' options.
+       - Remove entry on search algorithm for `man' pages.
+
+       ### Other fixes
+
+       * groffer2.sh:
+       - man_get(): On `man' page search with given name and section
+       handle also files with extension when no files without extension
+       are found.
+
+2006-09-11  Bernd Warken
        ________________________________________________________________
        * release of groffer 0.9.25
 
@@ -1933,7 +1996,7 @@
        ________________________________________________________________
        License
 
-       Copyright (C) 2001,2002,2003,2004,2005
+       Copyright (C) 2001,2002,2003,2004,2005,2006
        Free Software Foundation, Inc.
        Written by Bernd Warken
 

Index: TODO
===================================================================
RCS file: /cvsroot/groff/groff/contrib/groffer/TODO,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- TODO        14 Sep 2005 01:11:28 -0000      1.16
+++ TODO        16 Sep 2006 16:06:23 -0000      1.17
@@ -15,19 +15,13 @@
 - Revise option handling of `grog'.
 
 Documentation:
-- Improve the documentation of the search algorithm for `man' pages in
-  both the `groffer' scripts and the `man' page `groffer.man'.
-- In `groffer.man', add more documentation for parts that were taken
-  over from GNU `man'.
-- The documentation in the headers for some function definitions in
-  `groffer2.sh' needs to be updated.
 
 
 ####### License
 
-Last update: 14 Sep 2005
+Last update: 14 Sep 2006
 
-Copyright (C) 2003,2004,2005 Free Software Foundation, Inc.
+Copyright (C) 2003,2004,2005,2006 Free Software Foundation, Inc.
 Written by Bernd Warken
 
 This file is part of `groffer', which is part of `groff'.

Index: groffer.man
===================================================================
RCS file: /cvsroot/groff/groff/contrib/groffer/groffer.man,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- groffer.man 11 Sep 2006 16:06:18 -0000      1.31
+++ groffer.man 16 Sep 2006 16:06:23 -0000      1.32
@@ -15,7 +15,7 @@
 Source file position:  <groff_source_top>/contrib/groffer/groffer.man
 Installed position:    $prefix/share/man/man1/groffer.1
 
-Last update: 05 Sep 2006
+Last update: 16 Sep 2006
 
 Source file position: <groff-source>/contrib/groffer/groffer.man
 ..
@@ -845,10 +845,10 @@
 .Opt_[alt] -- apropos\-data
 .Opt_[alt] -- apropos\-devel
 .Opt_[alt] -- apropos\-progs
-.Opt_[alt] -- whatis
 .Opt_[alt] -- man
 .Opt_[alt] -- no-man
 .Opt_[alt] -- no-special
+.Opt_[alt] -- whatis
 .
 .
 .TP
@@ -861,7 +861,9 @@
 .Opt_[alt] -- extension suffix
 .Opt_[alt] -- locale language
 .Opt_[alt] -- local-file
+.Opt_[alt] -- location -- where
 .Opt_[alt] -- manpath dir1:dir2:\*[Ellipsis]
+.Opt_[alt] -- no-location
 .Opt_[alt] -- pager program
 .Opt_[alt] -- sections sec1:sec2:\*[Ellipsis]
 .Opt_[alt] -- systems sys1,sys2,\*[Ellipsis]
@@ -1508,7 +1510,7 @@
 .
 .
 .\" --------------------------------------------------------------------
-.SH "Options related to groff"
+.SS "Options related to groff"
 .\" --------------------------------------------------------------------
 .
 All short options of
@@ -1681,20 +1683,23 @@
 .
 Each
 .I \%filespec
-argument is taken for search as it is; section specific parts are not
-handled, such that
+argument is taken for search as it is;
+.I section
+specific parts are not handled, such that
 .B 7 groff
 searches for the two arguments
 .B 7
 and
-.B groff
+.BR groff ,
 with a large result; for the
 .I \%filespec
 .B groff.7
 nothing will be found.
 .
-The language locale is handled only when the called programs do support
-this; the GNU
+The
+.I language
+locale is handled only when the called programs do support this; the
+GNU
 .B apropos
 and
 .B man \-k
@@ -1705,7 +1710,7 @@
 program by the following concepts:
 .RS
 .Topic
-construct a
+Construct a
 .I \%groff
 frame similar to a
 .I \%man\~page
@@ -1716,7 +1721,7 @@
 .I \%filespec
 argument is searched on its own.
 .Topic
-the restriction by
+The restriction by
 .Opt_long sections
 is handled as well,
 .Topic
@@ -1729,9 +1734,11 @@
 .B \%apropos
 descriptions for data documents, these are the
 .BR \%man (7)
-sections 4, 5, and 7.
+.IR sections\~4 ", " 5 ", and " 7 .
 .
-Direct section declarations are ignored, wildcards are accepted.
+Direct
+.I section
+declarations are ignored, wildcards are accepted.
 .
 .
 .Opt_def -- apropos\-devel
@@ -1739,9 +1746,11 @@
 .B \%apropos
 descriptions for development documents, these are the
 .BR man (7)
-sections 2, 3, and 9.
+.IR sections\~2 ", " 3 ", and " 9 .
 .
-Direct section declarations are ignored, wildcards are accepted.
+Direct
+.I section
+declarations are ignored, wildcards are accepted.
 .
 .
 .Opt_def -- apropos\-progs
@@ -1749,9 +1758,11 @@
 .B \%apropos
 descriptions for documents on programs, these are the
 .BR \%man (7)
-sections 1, 6, and 8.
+.IR sections\~1 ", " 6 ", and " 8 .
 .
-Direct section declarations are ignored, wildcards are accepted.
+Direct
+.I section
+declarations are ignored, wildcards are accepted.
 .
 .
 .Opt_def -- whatis
@@ -1771,7 +1782,7 @@
 .Topic
 local files are handled as well,
 .Topic
-the language and system locale is supported,
+the \fIlanguage\fP and \fIsystem\fP locale is supported,
 .Topic
 the display is framed by a
 .I groff
@@ -1783,7 +1794,7 @@
 .
 .
 .P
-The following two options were added to
+The following options were added to
 .B \%groffer
 for choosing whether the file name arguments are interpreted as names
 for local files or as a search pattern for
@@ -1839,6 +1850,14 @@
 .BR \%groffer ,
 so most of them are just ignored.
 .
+These ignored
+.B man
+options are
+.Opt_long catman ,
+.Opt_long troff ,
+and
+.Opt_long update .
+.
 .
 .P
 In the following, the
@@ -1849,15 +1868,14 @@
 .
 .
 .P
-The full set of long and short options of the \f[CR]GNU\f[]
+If your system has \f[CR]GNU\f[]
+.B man
+installed the full set of long and short options of the \f[CR]GNU\f[]
 .B man
 program can be passed via the environment variable
 .Env_var \%$MANOPT ;
 see
-.BR \%man (1)
-if your system has \f[CR]GNU\f[]
-.B man
-installed.
+.BR \%man (1).
 .
 .
 .Opt_def -- all
@@ -1878,7 +1896,9 @@
 .
 .
 .Opt_def -- ditroff
-Eqivalent to
+Produce
+.IR "groff intermediate output" .
+This is equivalent to
 .B \%groffer
 .Opt_short Z .
 .
@@ -2095,7 +2115,7 @@
 .
 .
 .\" --------------------------------------------------------------------
-.SH "Options for Development"
+.SS "Options for Development"
 .\" --------------------------------------------------------------------
 .
 .Opt_def -- debug
@@ -2747,12 +2767,13 @@
 The default behavior of
 .B \%groffer
 is to first test whether a file parameter represents a local file; if
-it is not an existing file name, it is assumed to represent a name of
-a
+it is not an existing file name, it is assumed to represent the name
+of a
 .IR \%man\~page .
-.
-This behavior can be modified by the following options.
-.
+The following options can be used to determine whether the arguments
+should be handled as file name or
+.I \%man\~page
+arguments.
 .
 .TP
 .Opt_long man
@@ -2777,148 +2798,230 @@
 error, but processing is continued.
 .
 .
-.P
+.\" --------------------------------------------------------------------
+.SS "Search Algoritm"
+.\" --------------------------------------------------------------------
+.
+Let us now assume that a
+.I \%man\~page
+should be searched.
+.
 The
 .B \%groffer
 program provides a search facility for
 .IR \%man\~pages .
 .
 All long options, all environment variables, and most of the
-functionality of the \f[CR]GNU\f[]
+functionality of the \f[CR]GNU\fP
 .BR \%man (1)
 program were implemented.
 .
-This inludes the extended file names of
-.IR \%man\~pages ,
-for example, the
-.I \%man\~page
-of
-.B \%groff
-in man\~section 7 may be stored under
-.File_name /usr/share/man/man7/groff.7.gz ,
-where
-.File_name /usr/share/man/
-is part of the man\~path, the subdirectory
-.I \%man7
-and the file extension
-.I .7
-refer to the man\~section 7;
-.I \%.gz
-shows the compression of the file.
+The search algorithm shall determine which file is displayed for a given
+.IR \%man\~page .
+The process can be modified by options and environment variables.
 .
 .
 .P
-The
-.I cat\~pages
-(preformatted
-.IR \%man\~pages )
-are intentionally excluded from the search because
+The only
+.I man
+action that is omitted in
 .B \%groffer
-is a
-.I roff
-program that wants to format by its own.
+are the preformatted
+.IR \%man\~pages ,
+also called
+.IR cat\~pages .
 .
 With the excellent performance of the actual computers, the
 preformatted
 .I \%man\~pages
 aren't necessary any longer.
 .
+Additionally,
+.B \%groffer
+is a
+.I roff
+program; it wants to read
+.I roff
+source files and format them itself.
 .
-.P
-The algorithm for retrieving
-\I \%man\~pages
-uses five search methods.
 .
-They are successively tried until a method works.
+.P
+The algorithm for retrieving the file for a
+.I \%man\~page
+needs first a set of directories.
 .
+This set starts with the so-called
+.I man\~path
+that is modified later on by adding names of
+.I operating system
+and
+.IR language .
 .
-.Topic
-The search path can be manually specified by using the option
-.Opt_long manpath .
-An empty argument disables the
+This arising set is used for adding the section directories which
+contain the
 .I \%man\~page
-searching.
+files.
 .
-This overwrites the other methods.
 .
+.P
+The
+.I man\~path
+is a list of directories that are separated by colon.
+.
+It is generated by the following methods.
 .
 .Topic
-If this is not available the environment variable
+The environment variable
 .Env_var \%$MANPATH
-is searched.
-.
+can be set.
 .
 .Topic
-If this is empty, the program tries to read it from the environment
-variable
+It can be read from the arguments of the environment variable
 .Env_var \%$MANOPT .
 .
+.Topic
+The
+.I man\~path
+can be manually specified by using the option
+.Opt_long manpath .
+An empty argument disables the
+.I \%man\~page
+searching.
+.
+.Topic
+When no
+.I man\~path
+was set the
+.BR \%manpath (1)
+program is tried to determine one.
 .
 .Topic
 If this does not work a reasonable default path from
 .Env_var $PATH
-is searched for
-.IR \%man\~pages .
+is determined.
 .
 .
+.P
+We now have a starting set of directories.
+.
+The first way to change this set is by adding names of
+.I operating
+.IR systems .
+.
+This assumes that
+.I \%man\~pages
+for several
+.I operating systems
+are installed.
+.
+This is not always true.
+.
+The names of such
+.I operating systems
+can be provided by 3 methods.
+.
 .Topic
-If this does not work, the
-.BR \%manpath (1)
-program for determining a path of
-.I man
-directories is tried.
+The environment variable
+.Env_var \%$SYSTEM
+has the lowest precedence.
+.
+.Topic
+This can be overridden by an option in
+.Env_var \%$MANOPT .
+.
+.Topic
+This again is overridden by the command line option
+.Opt_long systems .
 .
 .
 .P
-After this, the path elements for the language (locale) and operating
-system specific
-.I \%man\~pages
-are added to the
-.IR man\~path ;
-their sequence is determined automatically.
+Several names of
+.I operating systems
+can be given by appending their names, separated by a comma.
 .
-For example, both
-.File_name /usr/share/man/linux/fr
-and
-.File_name /usr/share/man/fr/linux
-for french linux
-.I \%man\~pages
-are found.
 .
-The language and operating system names are determined from both
-environment variables and command line options.
+.P
+The
+.I man\~path
+is changed by appending each
+.I system
+name as subdirectory at the end of each directory of the set.
+.
+No directory of the
+.I man\~path
+set is kept.
+.
+But if no
+.I system
+name is specified the
+.I man\~path
+is left unchanged.
 .
 .
 .P
-The locale (language) is determined like in \f[CR]GNU\f[]
-.BR man ,
-that is from highest to lowest precedence:
-.Topic
-.Opt_long locale
+After this, the actual set of directories can be changed by
+.I language
+information.
+.
+This assumes that there exist
+.I man\~pages
+in different languages.
+.
+The wanted
+.I language
+can be chosen by several methods.
 .
 .Topic
-.Env_var \%$GROFFER_OPT
+Enviroment variable
+.Env_var $LANG .
 .
 .Topic
-.Env_var \%$MANOPT
+This is overridden by
+.Env_var \%$LC_MESSAGES .
 .
 .Topic
-.Env_var $LCALL
+This is overridden by
+.Env_var $LC_ALL .
 .
 .Topic
-.Env_var \%$LC_MESSAGES
+This can be overridden by providing an option in
+.Env_var \%$MANOPT .
 .
 .Topic
-.Env_var $LANG .
+All these environment variables are overridden by the command line
+option
+.Opt_long locale .
 .
 .
 .P
-The language locale is usually specified in the
-\%\f[CR]POSIX\~1003.1\f[] based format:
+The
+.I default language
+can be specified by specifying one of the pseudo-language parameters
+\f[CR]C\fP or \f[CR]\%POSIX\fP.
+.
+This is like deleting a formerly given
+.I language
+information.
+.
+The
+.I \%man\~pages
+in the
+.I default language
+are usually in English.
+.
+.
+.P
+Of course, the
+.I language
+name is determined by
+.BR man .
+In \f[CR]GNU\fP
+.BR man ,
+it is specified in the \%\f[CR]POSIX\~1003.1\fP based format:
 .P
 .nh
-\f[I]<language>\f[][\f[CB]_\f[]\f[I]<territory>\f[][\f[CB].\f[]\
-\f[I]<character-set>\f[][\f[CB],\f[]\f[I]<version>\f[]]]],
+\f[I]<language>\f[][\f[CB]_\f[]\f[I]<territory>\f[][\f[CB].\fP\
+\f[I]<character-set>\f[][\f[CB],\fP\f[I]<version>\fP]]],
 .hy
 .P
 but the two-letter code in
@@ -2927,87 +3030,197 @@
 .hy
 is sufficient for most purposes.
 .
+If for a complicated
+.I language
+formulation no
+.I \%man\~pages
+are found
+.B \%groffer
+searches the country part consisting of these first two characters as
+well.
+.
 .
 .P
-If no
-.I \%man\~pages
-for a complicated locale are found the country part consisting of the
-first two characters (without the `\f[CB]_\f[]', `\f[CB].\f[]', and
-`\f[CB],\f[]' parts) of the locale is searched as well.
+The actual directory set is copied thrice.
+.
+The
+.I language
+name is appended as subdirectory to each directory in the first copy
+of the actual directory set (this is only done when a language
+information is given).
+.
+Then the 2-letter abbreviation of the
+.I language
+name is appended as subdirectories to the second copy of the directory
+set (this is only done when the given language name has more than 2
+letters).
+.
+The third copy of the directory set is kept unchanged (if no
+.I language
+information is given this is the kept directory set).
+.
+These maximally 3 copies are appended to get the new directory set.
 .
 .
 .P
-If still not found the corresponding
+We now have a complete set of directories to work with.
+.
+In each of these directories, the
+.I man
+files are separated in
+.IR sections .
+.
+The name of a
+.I section
+is represented by a single character, a digit between
+.I 1
+and
+.IR 9 ,
+or the character
+.I o
+or
+.IR n ,
+in this order.
+.
+.
+.P
+For each available
+.IR section ,
+a subdirectory
+.File_name man \fI<section>\fP
+exists containing all
+.I man
+files for this
+.IR section ,
+where
+.I <section>
+is a single character as described before.
+.
+Each
+.I man
+file in a
+.I section
+directory has the form
+.IR \%\f[CB]man\fP<section>\f[CB]/\fP<name>\f[CB].\fP<section>\
+[<extension>][\f[CB].\fP<compression>] ,
+where
+.I \%<extension>
+and
+.I \%<compression>
+are optional.
+.
+.I \%<name>
+is the name of the
 .I \%man\~page
-in the default language is used instead.
+that is also specified as filespec argument on the command line.
 .
-As usual, this default can be specified by one of \f[CR]C\f[] or
-\f[CR]\%POSIX\f[].
 .
+.P
 The
-.I \%man\~pages
-in the default language are usually in English.
+.I extension
+is an addition to the section.
+.
+This postfix acts like a subsection.
+.
+An
+.I extension
+occurs only in the file name, not in name of the
+.I section
+subdirectory.
+.
+It can be specified on the command line.
 .
 .
 .P
-Several operating systems can be given by appending their names,
-separated by a comma.
+On the other hand, the
+.I compression
+is just an information on how the file is compressed.
 .
-This is then specified by the environment variable
-.Env_var \%$SYSTEM
-or by the command line option
-.Opt_long systems .
-The precedence is similar to the locale case above from highest to
-lowest precedence:
+This is not important for the user, such that it cannot be specified
+on the command line.
+.
+.
+.P
+There are 4 methods to specify a
+.I section
+on the command line:
 .
-Topic
-.Opt_long systems
+.Topic
+Environment variable
+.Env_var \%$MANSECT
 .
 .Topic
-.Env_var \%$GROFFER_OPT
+Command line option
+.Opt_long sections
 .
 .Topic
-.Env_var \%$MANOPT
+Appendix to the
+.I name
+argument in the form
+.I <name>.<section>
 .
 .Topic
-.Env_var \%$SYSTEM .
+Preargument before the
+.I name
+argument in the form
+.I <section> <name>
 .
 .
 .P
-When searching for
-.I \%man\~pages
-this
-.I man\~path
-with the additional language and system specific directories is used.
+It is also possible to specify several
+.I sections
+by appending the single characters separated by colons.
 .
+One can imagine that this means to restrict the
+.I \%man\~page
+search to only some
+.IR sections .
 .
-.P
-The search can further be restricted by limiting it to certain
-sections.
+The multiple
+.I sections
+are only possible for
+.Env_var \%$MANSECT
+and
+.Opt_long sections .
 .
-A single section can be specified within each
-.I \%filespec
-argument, several sections as a colon-separated list in command line
-option
-.Opt_long sections
-or environment variable
-.Env_var \%$MANSECT .
 .
-When no section was specified a set of standard sections is searched
-until a suitable
-.I \%man\~page
-was found.
+.P
+If no
+.I section
+is specified all
+.I sections
+are searched one after the other in the given order, starting with
+.IR section\~1 ,
+until a suitable file is found.
 .
 .
 .P
-Finally, the search can be restricted to a so-called
-.IR extension .
-This is a postfix that acts like a subsection.
+There are 4 methods to specify an
+.I extension
+on the command line.
+.
+But it is not necessary to provide the whole extension name, some
+abbreviation is good enough in most cases.
+.
+.Topic
+Environment variable
+.Env_var \%$EXTENSION
 .
-It can be specified by
+.Topic
+Command line option
 .Opt_long extension
-or environment variable
-.Env_var \%$EXTENSION .
+.
+.Topic
+Appendix to the
+.I <name>.<section>
+argument in the form
+.I <name>.<section><extension>
+.
+.Topic
+Preargument before the
+.I name
+argument in the form
+.I <section><extension> <name>
 .
 .
 .P
@@ -3018,6 +3231,152 @@
 .
 .
 .\" --------------------------------------------------------------------
+.SS "Examples of man files"
+.\" --------------------------------------------------------------------
+.
+.TP
+.File_name /usr/share/man/man1/groff.1
+This is an uncompressed file for the
+.I \%man\~page
+\f[CR]groff\fP in
+.IR section\~1 .
+.
+It can be called by
+.Shell_cmd "groffer\~groff"
+No
+.I section
+is specified here, so all
+.I sections
+should be searched, but as
+.I section\~1
+is searched first this file will be found first.
+.
+The file name is composed of the following components.
+.File_name /usr/share/man
+must be part of the
+.IR \%man\~path ;
+the subdirectory
+.File_name man1/
+and the part
+.File_name .1
+stand for the
+.IR section ;
+.File_name groff
+is the name of the
+.IR \%man\~page .
+.
+.
+.TP
+.File_name /usr/local/share/man/man7/groff.7.gz
+The file name is composed of the following components.
+.File_name /usr/local/share/man
+must be part of the
+.IR \%man\~path ;
+the subdirectory
+.File_name man7/
+and the part
+.File_name .7
+stand for the
+.IR section ;
+.File_name groff
+is the name of the
+.IR \%man\~page ;
+the final part
+.File_name .gz
+stands for a compression with
+.BR gzip (1).
+As the
+.I section
+is not the first one it must be specified as well.
+.
+This can be done by one of the following commands.
+.Shell_cmd "groffer\~groff.7"
+.Shell_cmd "groffer\~7\~groff"
+.Shell_cmd "groffer\~\-\-sections=7\~groff"
+.
+.
+.TP
+.File_name /usr/local/man/man1/ctags.1emacs21.bz2
+Here
+.File_name /usr/local/man
+must be in
+.IR \%man\~path ;
+the subdirectory
+.File_name man1/
+and the file name part
+.File_name .1
+stand for
+.IR section\~1 ;
+the name of the
+.I \%man\~page
+is
+.File_name ctags ;
+the section has an extension
+.File_name emacs21 ;
+and the file is compressed as
+.File_name .bz2
+with
+.BR bzip2 (1).
+The file can be viewed with one of the following commands
+.Shell_cmd "groffer\~ctags.1e"
+.Shell_cmd "groffer\~1e\~ctags"
+.Shell_cmd "groffer\~\-\-extension=e\~\-\-sections=1\~ctags"
+where \f[CR]e\fP works as an abbreviation for the extension
+\f[CR]emacs21\fP.
+.
+.
+.TP
+.File_name /usr/man/linux/de/man7/man.7.Z
+The directory
+.File_name /usr/man
+is now part of the
+.IR \%man\~path ;
+then there is a subdirectory for an
+.I operating system
+name
+.File_name linux/ ;
+next comes  a subdirectory
+.File_name de/
+for the German
+.IR language ;
+the
+.I section
+names
+.File_name man7
+and
+.File_name .7
+are known so far;
+.File_name man
+is the name of the
+.IR \%man\~page ;
+and
+.File_name .Z
+signifies the compression that can be handled by
+.BR gzip (1).
+We want now show how to provide several values for some options.
+.
+That is possible for
+.I sections
+and
+.I operating system
+names.
+.
+So we use as
+.I sections\~5
+and
+.I 7
+and as
+.I system
+names
+.I linux
+and
+.IR aix .
+The command is then
+.Shell_cmd groffer\~\-\-locale=de\~\-\-sections=5:7\~\-\-systems=linux,aix\~man
+.Shell_cmd LANG=de\~MANSECT=5:7\~SYSTEM=linux,aix\~groffer\~man
+.
+.
+.\" --------------------------------------------------------------------
 .SH DECOMPRESSION
 .\" --------------------------------------------------------------------
 .
@@ -3030,7 +3389,7 @@
 .BR \%bzip2 (1)
 it is decompressed on-the-fly.
 .
-This includes the \f[CR]GNU\f[]
+This includes the \f[CR]GNU\fP
 .BR \%.gz ,
 .BR \%.bz2 ,
 and the traditional
@@ -3052,7 +3411,7 @@
 .
 All environment variables of
 .BR \%groff (@MAN1EXT@)
-and \f[CR]GNU\f[]
+and \f[CR]GNU\fP
 .BR \%man (1)
 and some standard system variables are honored.
 .
@@ -3096,7 +3455,7 @@
 .
 .TP
 .Env_var \%$DISPLAY
-If this variable is set this indicates that the \%\f[CR]X\~Window\f[]
+If this variable is set this indicates that the \%\f[CR]X\~Window\fP
 system is running.
 .
 Testing this variable decides on whether graphical or text output is
@@ -3105,7 +3464,7 @@
 This variable should not be changed by the user carelessly, but it can
 be used to start the graphical
 .B \%groffer
-on a remote \%\f[CR]X\~Window\f[] terminal.
+on a remote \%\f[CR]X\~Window\fP terminal.
 .
 For example, depending on your system,
 .B \%groffer
@@ -3144,7 +3503,7 @@
 see
 .BR \%setlocale (3).
 .
-The locale values \f[CR]C\f[] and \%\f[CR]POSIX\f[]
+The locale values \f[CR]C\fP and \%\f[CR]POSIX\fP
 stand for the default, i.e. the
 .I \%man\~page
 directories without a language prefix.
@@ -3396,7 +3755,7 @@
 program for some
 .IR \%mode .
 Such a function can be fed into a corresponding
-.Opt_long \f[I]mode\f[]\-viewer
+.Opt_long \f[I]mode\fP\-viewer
 option.
 .
 .Topic
@@ -3496,7 +3855,7 @@
 .
 That allows to start
 .B \%groffer
-in the standard \%\f[CR]X\~Window\f[] display, even when the program
+in the standard \%\f[CR]X\~Window\fP display, even when the program
 is called from a text console.
 .
 .
@@ -3532,9 +3891,9 @@
 .File_name /usr/local/share/doc/groff ,
 using the standard viewer
 .B \%gxditview
-as graphical viewer when in \%\f[CR]X\~Window\f[], or the
+as graphical viewer when in \%\f[CR]X\~Window\fP, or the
 .BR \%less (1)
-pager program when not in \%\f[CR]X\~Window\f[].
+pager program when not in \%\f[CR]X\~Window\fP.
 .
 .
 .TP
@@ -3689,7 +4048,7 @@
 .TP+
 .Shell_cmd+ "groffer --x --bg red --fg yellow --geometry 200x100 -"
 .
-Display the word \f[CB]WOW!\f[] in a small window in constant-width
+Display the word \f[CB]WOW!\fP in a small window in constant-width
 bold font, using color yellow on red background.
 .
 .
@@ -3733,11 +4092,11 @@
 .
 .P
 Both scripts are compatible with both
-\f[CR]GNU\f[] and \%\f[CR]POSIX\f[].
+\f[CR]GNU\fP and \%\f[CR]POSIX\fP.
 .
-\%\f[CR]POSIX\f[] compatibility refers to
-\%\f[CR]IEEE\~P1003.2/D11.2\f[] of September 1991, a very early
-version of the \%\f[CR]POSIX\f[] standard that is still freely
+\%\f[CR]POSIX\fP compatibility refers to
+\%\f[CR]IEEE\~P1003.2/D11.2\fP of September 1991, a very early
+version of the \%\f[CR]POSIX\fP standard that is still freely
 available in the internet at
 .URL http://\:www.funet.fi/\:pub/\:doc/\:posix/\:p1003.2/\:d11.2/\:all \
 "\%POSIX\~P1003.2\~draft\~11.2" .
@@ -3746,7 +4105,7 @@
 .P
 Only a restricted set of shell language elements and shell builtins is
 used to achieve even compatibility with some Bourne shells that are
-not fully \%\f[CR]POSIX\f[] compatible.
+not fully \%\f[CR]POSIX\fP compatible.
 .
 The
 .B \%groffer
@@ -3781,9 +4140,9 @@
 The
 .B \%groffer
 program provides its own parser for command line arguments that is
-compatible to both \%\f[CR]POSIX\f[]
+compatible to both \%\f[CR]POSIX\fP
 .BR \%getopts (1)
-and \%\f[CR]GNU\f[]
+and \%\f[CR]GNU\fP
 .BR \%getopt (1).
 It can handle option arguments and file names containing white space
 and a large set of special characters.
@@ -3845,7 +4204,7 @@
 .I \%filespec
 parameters follows the GNU principle.
 .
-That does not fulfill the strange option behavior of \%\f[CR]POSIX\f[]
+That does not fulfill the strange option behavior of \%\f[CR]POSIX\fP
 that ends option processing as soon as the first non-option argument
 has been reached.
 .

Index: groffer2.sh
===================================================================
RCS file: /cvsroot/groff/groff/contrib/groffer/groffer2.sh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- groffer2.sh 11 Sep 2006 16:06:18 -0000      1.6
+++ groffer2.sh 16 Sep 2006 16:06:23 -0000      1.7
@@ -12,7 +12,7 @@
 # Free Software Foundation, Inc.
 # Written by Bernd Warken
 
-# Last update: 11 Sep 2006
+# Last update: 14 Sep 2006
 
 # This file is part of `groffer', which is part of `groff'.
 
@@ -151,6 +151,7 @@
 
 ########################################################################
 # test for compression.
+#
 export _HAS_COMPRESSION;
 export _HAS_BZIP;
 if test _"$(echo 'test' | gzip -c -d -f - 2>${_NULL_DEV})"_ = _test_
@@ -359,16 +360,22 @@
 # underscore letter.  Global variables to this file are written in
 # upper case letters, e.g. $_GLOBAL_VARIABLE; temporary variables
 # start with an underline and use only lower case letters and
-# underlines, e.g.  $_local_variable .
+# underlines, e.g.  $_local_variable.
 
 #   [A-Z]*     system variables,      e.g. $MANPATH
 #   _[A-Z_]*   global file variables, e.g. $_MAN_PATH
 #   _[a-z_]*   temporary variables,   e.g. $_manpath
 
 # Due to incompatibilities of the `ash' shell, the name of loop
-# variables in `for' must be single character
+# variables in `for' must be a single character.
 #   [a-z]      local loop variables,   e.g. $i
 
+# In functions, other writings are used for variables.  As some shells
+# do not support the `local' command a unique prefix in lower case is
+# constructed for each function, most are the abbreviation of the
+# function name.  All variable names start with this prefix.
+#   ${prefix}_[a-z_]*  variable name in a function, e.g. $msm_modes
+
 
 ########################################################################
 # read-only variables (global to this file)
@@ -520,7 +527,7 @@
 'default' 'do-nothing' 'dvi' 'groff' 'help' 'intermediate-output' 'html' \
 'man' 'no-location' 'no-man' 'no-special' 'pdf' 'ps' 'rv' 'source' \
 'text' 'text-device' 'tty' 'tty-device' \
-'version' 'whatis' 'where' 'www' 'x' 'X'";
+'version' 'whatis' 'www' 'x' 'X'";
 
 _OPTS_GROFFER_LONG_ARG="\
 'default-modes' 'device' 'dvi-viewer' 'dvi-viewer-tty' 'extension' 'fg' \
@@ -555,7 +562,7 @@
 _OPTS_MAN_SHORT_ARG="";
 
 _OPTS_MAN_LONG_NA="'all' 'ascii' 'catman' 'ditroff' \
-'local-file' 'location' 'troff' 'update'";
+'local-file' 'location' 'troff' 'update' 'where'";
 
 _OPTS_MAN_LONG_ARG="'locale' 'manpath' \
 'pager' 'preprocessor' 'prompt' 'sections' 'systems' 'troff-device'";
@@ -592,8 +599,6 @@
 
 export _ALL_PARAMS;            # All options and file name parameters
 export _ADDOPTS_GROFF;         # Transp. options for groff (`eval').
-export _ADDOPTS_POST;          # Transp. options postproc (`eval').
-export _ADDOPTS_X;             # Transp. options X postproc (`eval').
 export _APROPOS_PROG;          # Program to run apropos.
 export _APROPOS_SECTIONS;      # Sections for different --apropos-*.
 export _DISPLAY_MODE;          # Display mode.
@@ -662,15 +667,10 @@
 export _OPT_TEXT_DEVICE;       # set device for tty mode.
 export _OPT_V;                 # groff option -V.
 export _OPT_VIEWER_DVI;                # viewer program for dvi mode
-export _OPT_VIEWER_DVI_TTY;    # viewer program for dvi mode not in X
 export _OPT_VIEWER_HTML;       # viewer program for html mode
-export _OPT_VIEWER_HTML_TTY;   # viewer program for html mode not in X
 export _OPT_VIEWER_PDF;                # viewer program for pdf mode
-export _OPT_VIEWER_PDF_TTY;    # viewer program for pdf mode not in X
 export _OPT_VIEWER_PS;         # viewer program for ps mode
-export _OPT_VIEWER_PS_TTY;     # viewer program for ps mode not in X
 export _OPT_VIEWER_X;          # viewer program for x mode
-export _OPT_VIEWER_X_TTY;      # viewer program for x mode not in X
 export _OPT_WHATIS;            # print the man description
 export _OPT_XRM;               # specify X resource.
 export _OPT_Z;                 # groff option -Z.
@@ -722,8 +722,6 @@
   fi;
 
   _ADDOPTS_GROFF='';
-  _ADDOPTS_POST='';
-  _ADDOPTS_X='';
   _APROPOS_PROG='';
   _APROPOS_SECTIONS='';
   _DISPLAY_ARGS='';
@@ -788,15 +786,10 @@
   _OPT_VIEWER_PS='';
   _OPT_VIEWER_HTML='';
   _OPT_VIEWER_X='';
-  _OPT_VIEWER_DVI_TTY='';
-  _OPT_VIEWER_PDF_TTY='';
-  _OPT_VIEWER_PS_TTY='';
-  _OPT_VIEWER_HTML_TTY='';
-  _OPT_VIEWER_X_TTY='';
   _OPT_WHATIS='no';
   _OPT_XRM='';
   _OPT_Z='no';
-  _VIEWER_BACKGROUND='yes';
+  _VIEWER_BACKGROUND='no';
 }
 
 reset;
@@ -814,7 +807,7 @@
 ##############
 # echo1 (<text>*)
 #
-# Output to stdout.
+# Output to stdout with final line break.
 #
 # Arguments : arbitrary text including `-'.
 #
@@ -829,9 +822,9 @@
 ##############
 # echo2 (<text>*)
 #
-# Output to stderr.
+# Output to stderr with final line break.
 #
-# Arguments : arbitrary text.
+# Arguments : arbitrary text including `-'.
 #
 echo2()
 {
@@ -876,7 +869,7 @@
 #############
 # diag (text>*)
 #
-# Output a diagnostic message to stderr
+# Output a diagnostic message to stderr.
 #
 diag()
 {
@@ -910,7 +903,7 @@
 # error_user (<text>*)
 #
 # Print an error message to standard error; exit with an error condition.
-# The error is supposed to be produce by the user.  So the funtion stack
+# The error is supposed to be produced by the user.  So the funtion stack
 # is omitted.
 #
 error_user()
@@ -965,7 +958,7 @@
 ########################################################################
 # apropos_filespec ()
 #
-# Setup for the --apropos* options
+# Compose temporary file for filspec.
 #
 # Globals:  in: $_OPT_APROPOS, $_SPECIAL_SETUP
 #          out: $_SPECIAL_FILESPEC
@@ -1028,7 +1021,7 @@
 ########################################################################
 # apropos_setup ()
 #
-# Setup for the --apropos* options
+# Setup for the --apropos* options, just 2 global variables are set.
 #
 # Globals:  in: $_OPT_APROPOS
 #          out: $_SPECIAL_SETUP, $_APROPOS_PROG
@@ -1068,8 +1061,9 @@
 # base_name (<path>)
 #
 # Get the file name part of <path>, i.e. delete everything up to last
-# `/' from the beginning of <path>.  Remove final slashes, too, to get a
-# non-empty output.
+# `/' from the beginning of <path>.  Remove final slashes, too, to get
+# a non-empty output.  The output is constructed according the shell
+# program `basename'.
 #
 # Arguments : 1
 # Output    : the file name part (without slashes)
@@ -1106,14 +1100,13 @@
   esac;
   eval ${_UNSET} bn_name;
   eval "${return_ok}";
-}
+} # base_name()
 
 
 ########################################################################
 # cat_z (<file>)
 #
 # Decompress if possible or just print <file> to standard output.
-#
 # gzip, bzip2, and .Z decompression is supported.
 #
 # Arguments: 1, a file name.
@@ -1142,14 +1135,14 @@
     fi;
     gzip -c -d -f "$1" 2>${_NULL_DEV};
     eval "${return_ok}";
-  }
-else
+  } # cat_z()
+else                           # no compression
   cat_z()
   {
     func_check cat_z = 1 "$@";
     cat "$1";
     eval "${return_ok}";
-  }
+  } # cat_z()
 fi;
 
 
@@ -1176,7 +1169,8 @@
 #######################################################################
 # dir_name (<name>)
 #
-# Get the directory name of <name>
+# Get the directory name of <name>.  The output is constructed
+# according to the shell program `dirname'.
 #
 # Arguments : 1
 # Output    : the directory part of <name>
@@ -1226,7 +1220,7 @@
     dir_name_chop "$1"/"$2";
   fi;
   eval "${return_ok}";
-}
+} # dir_name_append()
 
 
 ########################################################################
@@ -1256,18 +1250,26 @@
   esac;
   eval ${_UNSET} dc_res;
   eval "${return_ok}";
-}
+} # dir_name_chop()
 
 
 ########################################################################
 # do_nothing ()
 #
-# Dummy function.
+# Dummy function that does nothing.
 #
 do_nothing()
 {
   eval return "${_OK}";
-}
+} # do_nothing()
+
+
+########################################################################
+# echo1 (<text>*)
+#
+# Print to standard output with final line break.
+#
+# defined above
 
 
 ########################################################################
@@ -1278,6 +1280,7 @@
 # defined above
 
 
+
 ########################################################################
 # error (<text>*)
 #
@@ -1300,7 +1303,9 @@
   #############
   # func_check (<func_name> <rel_op> <nr_args> "$@")
   #
-  # Check number of arguments and register to _FUNC_STACK.
+  # This is called at the first line of each function.  It checks the
+  # number of arguments of function <func_name> and registers the
+  # function call to _FUNC_STACK.
   #
   # Arguments: >=3
   #   <func_name>: name of the calling function.
@@ -1330,6 +1335,7 @@
       error "func_check(): third argument must be a digit.";
       ;;
     esac;
+### func_check()
     case "$2" in
     '='|'-eq')
       fc_op='-eq';
@@ -1355,6 +1361,7 @@
       fc_op='-ne';
       fc_comp='not';
       ;;
+### func_check()
     *)
       error \
         'func_check(): second argument is not a relational operator.';
@@ -1387,7 +1394,8 @@
   #############
   # func_pop ()
   #
-  # Retrieve the top element from the stack.
+  # Retrieve the top element from the function stack.  This is called
+  # by every return variable in each function.
   #
   # The stack elements are separated by `!'; the popped element is
   # identical to the original element, except that all `!' characters
@@ -1427,7 +1435,8 @@
   #############
   # func_push (<element>)
   #
-  # Store another element to stack.
+  # Store another element to the function stack.  This is called by
+  # func_check() at the beginning of each function.
   #
   # The stack elements are separated by `!'; if <element> contains a `!'
   # it is removed first.
@@ -1465,21 +1474,21 @@
   #############
   # func_stack_dump ()
   #
-  # Print the content of the stack.  Ignore the arguments.
+  # Print the content of the function stack.  Ignore the arguments.
   #
   func_stack_dump()
   {
     diag 'call stack(): '"${_FUNC_STACK}";
   } # func_stack_dump()
 
-else
+else                           # $_DEBUG_FUNC_CHECK is not `yes'
 
   func_check() { return; }
   func_pop() { return; }
   func_push() { return; }
   func_stack_dump() { return; }
 
-fi;
+fi;                            # test of $_DEBUG_FUNC_CHECK
 
 
 ########################################################################
@@ -1521,7 +1530,7 @@
 ########################################################################
 # is_dir (<name>)
 #
-# Test whether `name' is a directory.
+# Test whether `name' is a readable directory.
 #
 # Arguments : 1
 # Return    : `0' if arg1 is a directory, `1' otherwise.
@@ -1540,7 +1549,7 @@
 ########################################################################
 # is_empty (<string>)
 #
-# Test whether `string' is empty.
+# Test whether <string> is empty.
 #
 # Arguments : <=1
 # Return    : `0' if arg1 is empty or does not exist, `1' otherwise.
@@ -1559,7 +1568,7 @@
 ########################################################################
 # is_empty_file (<file_name>)
 #
-# Test whether `file_name' is an empty existing file.
+# Test whether <file_name> is an empty existing file.
 #
 # Arguments : <=1
 # Return    :
@@ -1585,7 +1594,7 @@
 ########################################################################
 # is_equal (<string1> <string2>)
 #
-# Test whether `string1' is equal to <string2>.
+# Test whether <string1> is equal to <string2>.
 #
 # Arguments : 2
 # Return    : `0' both arguments are equal strings, `1' otherwise.
@@ -1604,7 +1613,7 @@
 ########################################################################
 # is_existing (<name>)
 #
-# Test whether `name' is an existing file or directory.  Solaris 2.5 does
+# Test whether <name> is an existing file or directory.  Solaris 2.5 does
 # not have `test -e'.
 #
 # Arguments : 1
@@ -1628,7 +1637,7 @@
 ########################################################################
 # is_file (<name>)
 #
-# Test whether `name' is a readable file.
+# Test whether <name> is a readable file.
 #
 # Arguments : 1
 # Return    : `0' if arg1 is a readable file, `1' otherwise.
@@ -1645,12 +1654,12 @@
 
 
 ########################################################################
-# is_greater_than (<string1> <string2>)
+# is_greater_than (<integer1> <integer2>)
 #
-# Test whether `string1' is greater than <string2>.
+# Test whether <integer1> is greater than <integer2>.
 #
 # Arguments : 2
-# Return    : `0' if <string1> is a greater integer than <string2>,
+# Return    : `0' if <integer1> is a greater integer than <integer2>,
 #             `1' otherwise.
 #
 is_greater_than()
@@ -1689,7 +1698,7 @@
 ########################################################################
 # is_not_empty_file (<file_name>)
 #
-# Test whether `file_name' is a non-empty existing file.
+# Test whether <file_name> is a non-empty existing file.
 #
 # Arguments : <=1
 # Return    :
@@ -1710,7 +1719,7 @@
 ########################################################################
 # is_not_dir (<name>)
 #
-# Test whether `name' is not a readable directory.
+# Test whether <name> is not a readable directory.
 #
 # Arguments : 1
 # Return    : `0' if arg1 is a directory, `1' otherwise.
@@ -1729,7 +1738,7 @@
 ########################################################################
 # is_not_empty (<string>)
 #
-# Test whether `string' is not empty.
+# Test whether <string> is not empty.
 #
 # Arguments : <=1
 # Return    : `0' if arg1 exists and is not empty, `1' otherwise.
@@ -1748,7 +1757,7 @@
 ########################################################################
 # is_not_equal (<string1> <string2>)
 #
-# Test whether `string1' differs from `string2'.
+# Test whether <string1> differs from <string2>.
 #
 # Arguments : 2
 #
@@ -1766,7 +1775,7 @@
 ########################################################################
 # is_not_file (<filename>)
 #
-# Test whether `name' is a not readable file.
+# Test whether <filename> is a not readable file.
 #
 # Arguments : 1 (empty allowed)
 #
@@ -1782,9 +1791,9 @@
 
 
 ########################################################################
-# is_not_prog (<progrm>)
+# is_not_prog (<program>)
 #
-# Verify that <program> is not a program in $PATH.
+# Verify that <program> is not a command in $PATH.
 #
 # Arguments : 1,  <program> can have spaces and arguments.
 #
@@ -1802,7 +1811,7 @@
 ########################################################################
 # is_not_writable (<name>)
 #
-# Test whether `name' is a not a writable file or directory.
+# Test whether <name> is not a writable file or directory.
 #
 # Arguments : >=1 (empty allowed), more args are ignored
 #
@@ -1820,7 +1829,7 @@
 ########################################################################
 # is_not_X ()
 #
-# Test whether not running in X Window by checking $DISPLAY
+# Test whether the script is not running in X Window by checking $DISPLAY.
 #
 is_not_X()
 {
@@ -1836,7 +1845,7 @@
 ########################################################################
 # is_not_yes (<string>)
 #
-# Test whether `string' is not "yes".
+# Test whether <string> is not `yes'.
 #
 # Arguments : 1
 #
@@ -1852,9 +1861,9 @@
 
 
 ########################################################################
-# is_prog (<program>)
+# is_prog (<name>)
 #
-# Determine whether <name> is a program in $PATH
+# Determine whether <name> is a program in $PATH.
 #
 # Arguments : 1,  <program> can have spaces and arguments.
 #
@@ -1872,7 +1881,7 @@
 ########################################################################
 # is_writable (<name>)
 #
-# Test whether `name' is a writable file or directory.
+# Test whether <name> is a writable file or directory.
 #
 # Arguments : >=1 (empty allowed), more args are ignored
 #
@@ -1897,7 +1906,7 @@
 ########################################################################
 # is_X ()
 #
-# Test whether running in X Window by checking $DISPLAY
+# Test whether the script is running in X Window by checking $DISPLAY.
 #
 is_X()
 {
@@ -1913,7 +1922,7 @@
 ########################################################################
 # is_yes (<string>)
 #
-# Test whether `string' has value "yes".
+# Test whether <string> has value `yes'.
 #
 # Return    : `0' if arg1 is `yes', `1' otherwise.
 #
@@ -1941,7 +1950,7 @@
 ########################################################################
 # leave ([<code>])
 #
-# Clean exit without an error or with <code>.
+# Clean exit without an error or with error <code>.
 #
 leave()
 {
@@ -1969,6 +1978,9 @@
 ########################################################################
 # list_append (<list> <element>...)
 #
+# Add one or more elements to an existing list.  <list> may also be
+# empty.
+#
 # Arguments: >=2
 #   <list>: a variable name for a list of single-quoted elements
 #   <element>:  some sequence of characters.
@@ -2002,6 +2014,7 @@
       la_element="${la_s}";
       ;;
     esac;
+### list_append()
     if obj la_list is_empty
     then
       la_list="'${la_element}'";
@@ -2477,7 +2490,10 @@
 # is searched first with `<construction>[^-]*'.  If there is more than a
 # single element an error is created.  If none is found `<construction>*'
 # is searched.  Again an error is created for several results.
-# This function was constructed from list_single_from_abbrev().
+# This function was constructed from the former function
+# list_single_from_abbrev().
+#
+# This is a local function of list_from_cmdline_with_minus().
 #
 # Arguments: 2
 #   <list>:   a variable name for a list of single-quoted elements
@@ -2609,13 +2625,12 @@
 
 
 ########################################################################
-# list_from_split (<string> <separator>)
+# list_from_split (<string> <separator_char>)
 #
-# In <string>, escape all white space characters and replace each
-# <separator> by space.
+# Split <string> by <separator_char> into a list, omitting the separator.
 #
 # Arguments: 2: a <string> that is to be split into parts divided by
-#               <separator>
+#               character <separator_char>
 # Output:    the resulting list string
 #
 # Variable prefix: lfs
@@ -2679,12 +2694,12 @@
 
 
 ########################################################################
-# list_has (<var_name> <element>)
+# list_has (<list-name> <element>)
 #
-# Test whether the list <var_name> has the element <element>.
+# Test whether the list <list-name> has the element <element>.
 #
 # Arguments: 2
-#   <var_name>: a variable name for a list of single-quoted elements
+#   <list_name>: a variable name for a list of single-quoted elements
 #   <element>:  some sequence of characters.
 #
 # Variable prefix: lh
@@ -2799,7 +2814,7 @@
 # list_single_from_abbrev (<list-var> <abbrev>)
 #
 # Check whether the list has an element starting with <abbrev>.  If
-# there are more than a single element an error is created.
+# there are more than a single element an error is raised.
 #
 # Arguments: 2
 #   <list-var>: a variable name for a list of single-quoted elements
@@ -2831,6 +2846,7 @@
     lsfa_element='';
     eval set x "${lsfa_list}";
     shift;
+### list_single_from_abbrev()
     for i
     do
       case "$i" in
@@ -2844,7 +2860,6 @@
         ;;
       esac;
     done;
-# list_single_from_abbrev()
     obj lsfa_element echo1;
     eval "${_UNSET}" lsfa_abbrev;
     eval "${_UNSET}" lsfa_element;
@@ -2943,11 +2958,74 @@
 ########################################################################
 
 ########################################################################
+# Information on the search of man pages in groffer
+
+# The search of man pages is based on a set of directories.  That
+# starts with the so-called man path.  This is determined in function
+# man_setup() either by the command-line option --manpath, by $MANOPT,
+# or by $MANPATH.  There is also a program `manpath'.  If all of this
+# does not work a man path is created from $PATH with function
+# manpath_set_from_path().  We now have a set of existing directories
+# for the search of man pages; usually they end with `/man'.
+
+# The directory set of the man path can be changed in 2 ways.  If
+# operating system names are given in $SYSTEM or by --systems on the
+# command-line all man path directory will be appended by these names.
+# The appended system names replace the original man path; but if no
+# system name is set, the original man path is kept.  In `groffer',
+# this is done by the function manpath_add_lang_sys() in man_setup().
+
+# The next addition for directories is the language.  It is specified
+# by --locale or by one of the environment variables $LC_ALL,
+# $LC_MESSAGES, and $LANG.  The language name of `C' or `POSIX' means
+# the return to the default language (usually English); this deletes
+# former language specifications.  The language name and its
+# abbreviation with 2 characters is appended to the man page
+# directories.  But these new arising directories are added to the man
+# page, they do not replace it such as the system names did.  This is
+# done by function manpath_add_lang_sys() in man_setup() as well.
+
+# Now we have the basic set of directories for the search of man pages
+# for given filespec arguments.  The real directories with the man
+# page source files are gotten by appending `man<section>' to each
+# directory, where section is a single character of the form
+# `[1-9on]'.
+
+# There you find files named according to the form
+# <name>.<section>[<extension>][<compression>], where `[]' means
+# optional this time.  <name> is the name of the man page; <section>
+# is the single character from the last paragraphe; the optional
+# <extension> consists of some letters denoting special aspects for
+# the section; and the optional <compression> is something like `.gz',
+# `.Z', or `.bz2', meaning that the file is compressed.
+
+# If name, section. and extension are specified on the command-line
+# the file of the form <name>.<section><extension> with or without
+# <compression> are handled.  The first one found according to the
+# directory set for the section is shown.
+
+# If just name and section are specified on the command-line then
+# first <name>.<section> with or without <compression> are searched.
+# If no matching file was found, <name>.<section><extension> with or
+# without <compression> are searched for all possible extensions.
+
+# If only name is specified on the command-line then the section
+# directories are searched by and by, starting with section `1', until
+# a file is matched.
+
+# The function man_is_man() determines all suitable man files for a
+# command-line argument, while man_get() searches the single matching
+# file for display.
+
+
+########################################################################
 # man_get (<man-name> [<section> [<extension>]])
 #
-# Get a man-page to the temporary file.
+# Write a man page to the temporary file.
+#
+# Globals in: $_TMP_MANSPEC, $_MAN_SEC_CHARS, $_MAN_EXT, $_MAN_ALL
 #
-# Globals: in: $_TMP_MANSPEC, $_MAN_SEC_CHARS, $_MAN_EXT, $_MAN_ALL
+# Arguments: 1, 2, or 3
 #
 # Variable prefix: mg
 #
@@ -3094,6 +3172,27 @@
             ;;
           esac;
         done;                  # for f
+        for f
+        do
+          mg_f="$f";
+### man_get()
+          case "${mg_f}" in
+*/man"${mg_sec}"/"${mg_name}"."${mg_sec}"*)
+            if obj mg_f is_file
+            then
+              obj mg_f to_tmp && \
+                register_title "${mg_name}(${mg_sec})";
+              eval ${_UNSET} mg_ext;
+              eval ${_UNSET} mg_f;
+              eval ${_UNSET} mg_list;
+              eval ${_UNSET} mg_name;
+              eval ${_UNSET} mg_s;
+              eval ${_UNSET} mg_sec;
+              eval "${return_ok}";
+            fi;
+            ;;
+          esac;
+        done;                  # for f
       else                     # mg_ext is not empty
         for f
         do
@@ -3161,6 +3260,8 @@
 #              $_MAN_AUTO_SEC_CHARS
 #         out: $_TMP_MANSPEC
 #
+# Arguments: 1, 2, or 3
+#
 # Variable prefix: mim
 #
 man_is_man()
@@ -3459,9 +3560,18 @@
 } # manpath_add_lang_sys()
 
 
-# one argument, a system name
+# _manpath_add_sys (<system>)
+#
+# Append the existing subdirectories <system> of man path directories to
+# the list $mals_mp.
+#
+# Local function to manpath_add_lang_sys().
+#
+# Argument: 1, a operating system name (for appending to a man path
+#              directory)
 #
-# Globals: $_MAN_PATH, $mals_mp
+# Globals in:     $_MAN_PATH
+# Globals in/out: $mals_mp
 #
 # Variable prefix: _mas
 # 
@@ -3567,8 +3677,8 @@
 # This works like a method (object function) call for an object.
 # Run "<call_name> $<object> <arg> ...".
 #
-# The first argument represents an object whose data is given as first
-# argument to <call_name>().
+# The first argument represents an object name whose data is given as
+# first argument to <call_name>().
 #
 # Argument: >=2
 #           <object>: variable name
@@ -3619,7 +3729,7 @@
   obj od_res echo1;
   eval ${_UNSET} od_res;
   eval "${return_ok}";
-}
+} # obj_data()
 
 
 ########################################################################
@@ -3690,7 +3800,7 @@
   fi;
   eval "$1"='"$2"';
   eval "${return_ok}";
-}
+} # obj_set()
 
 
 ########################################################################
@@ -3766,10 +3876,10 @@
 
 ########################################################################
 # path_contains (<path> <dir>)
-#-
-# Test whether `dir' is contained in `path', a list separated by `:'.
 #
-# Arguments : 2 arguments.
+# Test whether <dir> is contained in <path>, a list separated by `:'.
+#
+# Arguments : 2
 # Return    : `0' if arg2 is substring of arg1, `1' otherwise.
 #
 path_contains()
@@ -3784,15 +3894,15 @@
       ;;
   esac;
   eval "${return_ok}";
-}
+} # path_contains()
 
 
 ########################################################################
 # path_not_contains (<path> <dir>)
 #
-# Test whether `dir' is not contained in colon separated `path'.
+# Test whether <dir> is not contained in colon separated <path>.
 #
-# Arguments : 2 arguments.
+# Arguments : 2
 #
 path_not_contains()
 {
@@ -3804,13 +3914,13 @@
     eval "${return_yes}";
   fi;
   eval "${return_ok}";
-}
+} # path_not_contains()
 
 
 ########################################################################
 # path_list (<path>)
 #
-# Replace a `:' separated path to a list with unique elements.
+# From a `:' separated path generate a list with unique elements.
 #
 # Arguments: 1: a colon-separated path
 # Output:    the resulting list, process it with `eval set'
@@ -3837,7 +3947,7 @@
   eval ${_UNSET} pl_elt;
   eval ${_UNSET} pl_list;
   eval "${return_ok}";
-}
+} # path_list()
 
 
 ########################################################################
@@ -3958,7 +4068,7 @@
   else
     eval "${return_good}";
   fi;
-}
+} # rm_file()
 
 
 ########################################################################
@@ -3984,13 +4094,13 @@
   else
     eval "${return_good}";
   fi;
-}
+} # rm_file_with_debug()
 
 
 ########################################################################
 # rm_tree (<dir_name>)
 #
-# Remove file if $_DEBUG_KEEP_FILES allows it.
+# Remove a file or a complete directory tree.
 #
 # Globals: $_DEBUG_KEEP_FILES
 #
@@ -4007,7 +4117,7 @@
   else
     eval "${return_good}";
   fi;
-}
+} # rm_tree()
 
 
 ########################################################################
@@ -4028,21 +4138,22 @@
     rm_file "${ss_f}";
     eval ${_UNSET} ss_f;
     eval "${return_ok}";
-  }
-else
+  } # save_stdin()
+else                           # no compression
   save_stdin()
   {
     func_check save_stdin '=' 0 "$@";
     cat >"${_TMP_STDIN}";
     eval "${return_ok}";
-  }
+  } # save_stdin()
 fi;
 
 
 ########################################################################
 # special_filespec ()
 #
-# Handle special modes like whatis and apropos.
+# Handle special modes like whatis and apropos.  Run their filespec
+# functions if suitable.
 #
 # Globals:  in: $_OPT_APROPOS, $_OPT_WHATIS, $_SPECIAL_SETUP
 #          out: $_SPECIAL_FILESPEC (internal)
@@ -4075,7 +4186,8 @@
 ########################################################################
 # special_setup ()
 #
-# Handle special modes like whatis and apropos.
+# Handle special modes like whatis and apropos.  Run their setup
+# functions if suitable.
 #
 special_setup()
 {
@@ -4101,7 +4213,7 @@
 ########################################################################
 # string_contains (<string> <part>)
 #
-# Test whether `part' is contained in `string'.
+# Test whether <part> is contained in <string>.
 #
 # Arguments : 2 text arguments.
 # Return    : `0' if arg2 is substring of arg1, `1' otherwise.
@@ -4124,7 +4236,7 @@
 ########################################################################
 # string_not_contains (<string> <part>)
 #
-# Test whether `part' is not substring of `string'.
+# Test whether <part> is not substring of <string>.
 #
 # Arguments : 2 text arguments.
 # Return    : `0' if arg2 is substring of arg1, `1' otherwise.
@@ -4139,7 +4251,7 @@
     eval "${return_yes}";
   fi;
   eval "${return_ok}";
-}
+} # string_not_contains()
 
 
 ########################################################################
@@ -4149,23 +4261,23 @@
 ########################################################################
 # tmp_cat ()
 #
-# output the temporary cat file (the concatenation of all input)
+# Output the temporary cat file (the concatenation of all input).
 #
 tmp_cat()
 {
   func_check tmp_cat '=' 0 "$@";
   cat "${_TMP_CAT}";
   eval "${return_var}" "$?";
-}
+} # tmp_cat()
 
 
 ########################################################################
 # tmp_create (<suffix>?)
 #
-# Create temporary file.
+# Create temporary file.  The generated name is `,' followed by
+# <suffix>.
 #
-# It's safe to use the shell process ID together with a suffix to
-# have multiple temporary files.
+# Argument: 0 or 1
 #
 # Globals: $_TMP_DIR
 #
@@ -4189,13 +4301,13 @@
   fi;
   eval ${_UNSET} tc_tmp;
   eval "${return_ok}";
-}
+} # tmp_create()
 
 
 ########################################################################
 # to_tmp (<filename>)
 #
-# print file (decompressed) to the temporary cat file
+# Print file (decompressed) to the temporary cat file.
 #
 # Variable prefix: tt
 #
@@ -4242,6 +4354,7 @@
       else                     # $_FILESPEC_IS_MAN ist not yes
         cat_z "${tt_1}" | soelim -I "${tt_dir}" >"${tt_file}";
       fi;
+### to_tmp()
       obj_from_output tt_grog grog "${tt_file}";
       case " ${tt_grog} " in
       *\ -m*)
@@ -4252,7 +4365,6 @@
 s/ -mm\([^ ]\)/ -m\1/g
 ')";
         shift;
-### to_tmp()
         for i
         do
           tt_i="$i";
@@ -4314,7 +4426,9 @@
 #############
 # _do_man_so (<so_arg>)
 #
-# Handle single .so file name for man pages
+# Handle single .so file name for man pages.
+#
+# Local function to to_tmp().
 #
 # Globals from to_tmp(): $tt_tmp, $tt_sofile, $tt_file
 # Globals: $_TMP_MAN
@@ -4345,7 +4459,7 @@
       eval "${return_ok}";
     fi;
     ;;
-# _do_man_so() of to_tmp()
+### _do_man_so() of to_tmp()
   *)                           # relative to man path
     eval grep "'/${_dms_soname}\$'" "${_TMP_MAN}" >"${tt_tmp}";
     if is_empty_file "${tt_tmp}"
@@ -4378,7 +4492,7 @@
       _dms_done='yes';
       break;
     done;
-# _do_man_so() of to_tmp()
+### _do_man_so() of to_tmp()
     if obj _dms_done is_not_yes
     then
       eval ${_UNSET} _dms_done;
@@ -4409,52 +4523,52 @@
 
 
 ########################################################################
-# to_tmp_line ([<text>])
+# to_tmp_line (<text>...)
 #
-# print line to the temporary cat file
+# Print single line with <text> to the temporary cat file.
 #
 to_tmp_line()
 {
-  func_check to_tmp_line '>=' 0 "$@";
+  func_check to_tmp_line '>=' 1 "$@";
   if obj _TMP_CAT is_empty
   then
     error 'to_tmp_line(): $_TMP_CAT is not yet set';
   fi;
   echo1 "$*" >>"${_TMP_CAT}";
   eval "${return_ok}";
-}
+} # to_tmp_line()
 
 
 ########################################################################
 # trap_set
 #
-# call function on signal 0
+# Call function on signal 0.
 #
 trap_set()
 {
   func_check trap_set '=' 0 "$@";
   trap 'clean_up' 0 2>${_NULL_DEV} || :;
   eval "${return_ok}";
-}
+} # trap_set()
 
 
 ########################################################################
 # trap_unset ()
-
-# disable trap on signal 0.
+#
+# Disable trap on signal 0.
 #
 trap_unset()
 {
   func_check trap_unset '=' 0 "$@";
   trap '' 0 2>${_NULL_DEV} || :;
   eval "${return_ok}";
-}
+} # trap_unset()
 
 
 ########################################################################
 # usage ()
 #
-# print usage information to stderr; for groffer option --help.
+# Print usage information to standard output; for groffer option --help.
 #
 usage()
 {
@@ -4549,14 +4663,14 @@
 EOF
 
   eval "${return_ok}";
-}
-
+} # usage()
 
 
 ########################################################################
 # version ()
 #
-# print version information to stderr
+# Print version information to standard output.
+# For groffer option --version.
 #
 version()
 {
@@ -4571,18 +4685,18 @@
 under the terms of the GNU General Public License.
 EOF
   eval "${return_ok}";
-}
+} # version()
 
 
 ########################################################################
 # warning (<string>)
 #
-# Print warning to stderr
+# Print warning to stderr.
 #
 warning()
 {
   echo2 "warning: $*";
-}
+} # warning()
 
 
 ########################################################################
@@ -4617,6 +4731,7 @@
     error "whatis_filename(): argument is not a readable file."
   fi;
   wf_dot='^\.'"${_SPACE_SED}"'*';
+### whatis_filename()
   if obj _FILESPEC_ARG is_equal '-'
   then
     wf_arg='stdin';
@@ -4784,7 +4899,7 @@
 ########################################################################
 # where_is_prog (<program>)
 #
-# Output path of a program if in $PATH.
+# Output path of a program and the given arguments if in $PATH.
 #
 # Arguments : 1, <program> can have spaces and arguments.
 # Output    : list of 2 elements: prog name (with directory) and arguments
@@ -4825,7 +4940,7 @@
   esac;
 
   wip_result='';
-# where_is_prog()
+### where_is_prog()
 
   # test whether $wip_noarg has directory, so it is not tested with $PATH
   case "${wip_noarg}" in
@@ -4854,7 +4969,7 @@
       exit_test;
       obj_from_output wip_file dir_name_append "${wip_dir}" "${wip_base}";
       exit_test;
-# where_is_prog()
+### where_is_prog()
       if test -f "${wip_file}" && test -x "${wip_file}"
       then
         wip_baseargs="$(echo1 "${wip_name}" |
@@ -4885,7 +5000,7 @@
       ;;
     esac; # end of test name with space
 
-# where_is_prog()
+### where_is_prog()
     eval ${_UNSET} wip_1;
     eval ${_UNSET} wip_args;
     eval ${_UNSET} wip_base;
@@ -4909,7 +5024,7 @@
   do
     wip_dir="$d";
     obj_from_output wip_file dir_name_append "${wip_dir}" "${wip_noarg}";
-# where_is_prog()
+### where_is_prog()
 
     # test $win_file on executable file
     if test -f "${wip_file}" && test -x "${wip_file}"
@@ -4937,7 +5052,7 @@
       wip_dir="$d";
       obj_from_output wip_file dir_name_append "${wip_dir}" "${wip_base}";
       exit_test;
-# where_is_prog()
+### where_is_prog()
 
       # test $win_file on executable file
       if test -f "${wip_file}" && test -x "${wip_file}"
@@ -4967,7 +5082,7 @@
         eval "${return_ok}";
       fi; # test of $wip_file on executable file
     done; # test path with base name without space
-# where_is_prog()
+### where_is_prog()
     ;;
   esac; # test of $wip_noarg on space
 
@@ -5002,7 +5117,7 @@
 #######################################################################
 # main_init ()
 #
-# set exit trap and create temporary files
+# Set exit trap and create temporary directory and some temporary files.
 #
 # Globals: $_TMP_DIR, $_TMP_CAT, $_TMP_STDIN
 #
@@ -5239,7 +5354,7 @@
 ########################################################################
 # main_parse_args (<command_line_args>*)
 #
-# Parse arguments; process options and filespec parameters
+# Parse arguments; process options and filespec parameters.
 #
 # Arguments: pass the command line arguments unaltered.
 # Globals:
@@ -5385,16 +5500,10 @@
     --dvi)
       _OPT_MODE='dvi';
       ;;
-    --dvi-viewer)              # viewer program for dvi mode; arg
-      _OPT_VIEWER_DVI_TTY="";
+    --dvi-viewer|--dvi-viewer-tty) # viewer program for dvi mode; arg
       _OPT_VIEWER_DVI="$1";
       shift;
       ;;
-    --dvi-viewer-tty)          # viewer program for dvi mode in tty; arg
-      _OPT_VIEWER_DVI="";
-      _OPT_VIEWER_DVI_TTY="$1";
-      shift;
-      ;;
     --extension)               # the extension for man pages, arg
       _OPT_EXTENSION="$1";
       shift;
@@ -5418,16 +5527,11 @@
     --html|--www)              # display with web browser
       _OPT_MODE=html;
       ;;
-    --html-viewer|--www-viewer) # viewer program for html mode; arg
-      _OPT_VIEWER_HTML_TTY="";
+    --html-viewer|--www-viewer|--html-viewer-tty|--www-viewer-tty)
+      # viewer program for html mode; arg
       _OPT_VIEWER_HTML="$1";
       shift;
       ;;
-    --html-viewer-tty|--www-viewer-tty) # viewer for html mode in tty; arg
-      _OPT_VIEWER_HTML="";
-      _OPT_VIEWER_HTML_TTY="$1";
-      shift;
-      ;;
     --iconic)                  # start viewers as icons
       _OPT_ICONIC='yes';
       ;;
@@ -5516,14 +5620,8 @@
       _OPT_MODE='pdf';
       ;;
 ### main_parse_args()
-    --pdf-viewer)              # viewer program for pdf mode; arg
+    --pdf-viewer|--pdf-viewer-tty) # viewer program for pdf mode; arg
       _OPT_VIEWER_PDF="$1";
-      _OPT_VIEWER_PDF_TTY="";
-      shift;
-      ;;
-    --pdf-viewer-tty)          # viewer program for pdf mode in tty; arg
-      _OPT_VIEWER_PDF="";
-      _OPT_VIEWER_PDF_TTY="$1";
       shift;
       ;;
     --print)                   # for argument test
@@ -5533,16 +5631,10 @@
     --ps)
       _OPT_MODE='ps';
       ;;
-    --ps-viewer)               # viewer program for ps mode; arg
-      _OPT_VIEWER_PS_TTY="";
+    --ps-viewer|--ps-viewer-tty) # viewer program for ps mode; arg
       _OPT_VIEWER_PS="$1";
       shift;
       ;;
-    --ps-viewer-tty)           # viewer program for ps mode in tty; arg
-      _OPT_VIEWER_PS="";
-      _OPT_VIEWER_PS_TTY="$1";
-      shift;
-      ;;
 ### main_parse_args()
     --resolution)              # set resolution for X devices, arg
       mpa_arg="$1";
@@ -5608,16 +5700,11 @@
       list_append _OPT_XRM "$1";
       shift;
       ;;
-    --x-viewer|--X-viewer)     # viewer program for x mode; arg
-      _OPT_VIEWER_X_TTY="";
+    --x-viewer|--X-viewer|--x-viewer-tty|--X-viewer-tty)
+      # viewer program for x mode; arg
       _OPT_VIEWER_X="$1";
       shift;
       ;;
-    --x-viewer-tty|--X-viewer-tty) # viewer program for x mode in tty; arg
-      _OPT_VIEWER_X="";
-      _OPT_VIEWER_X_TTY="$1";
-      shift;
-      ;;
     *)
       error 'main_parse_args(): unknown option '"\`${mpa_opt}'.";
       ;;
@@ -5710,7 +5797,7 @@
 ########################################################################
 # main_set_mode ()
 #
-# Determine the display mode.
+# Determine the display mode and the corresponding viewer program.
 #
 # Globals:
 #   in:  $DISPLAY, $_OPT_MODE, $_OPT_DEVICE
@@ -5744,34 +5831,11 @@
   if obj _DISPLAY_MODE is_equal 'groff'
   then
     eval ${_UNSET} msm_modes;
-    eval ${_UNSET} msm_viewer;
     eval ${_UNSET} msm_viewers;
     eval "${return_ok}";
   fi;
 
 ### main_set_mode()
-  case "${_OPT_MODE}" in
-  dvi)
-    _process_mode DVI;
-    ;;
-  html)
-    _process_mode HTML;
-    ;;
-  pdf)
-    _process_mode PDF;
-    ;;
-  ps)
-    _process_mode PS;
-    ;;
-  x)
-    _process_mode X;
-    ;;
-  esac;
-### main_set_mode()
-  if is_not_X
-  then
-    _VIEWER_BACKGROUND='no';
-  fi;
 
   case "${_OPT_MODE}" in
   '')                          # automatic mode
@@ -5783,7 +5847,6 @@
       fi;
       _DISPLAY_MODE='x';
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
@@ -5793,7 +5856,6 @@
         _DISPLAY_MODE='tty';
       fi;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
@@ -5803,7 +5865,6 @@
     then
       _DISPLAY_MODE='tty';
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
     fi;
@@ -5818,21 +5879,18 @@
   source)
     _DISPLAY_MODE='source';
     eval ${_UNSET} msm_modes;
-    eval ${_UNSET} msm_viewer;
     eval ${_UNSET} msm_viewers;
     eval "${return_ok}";
     ;;
   text)
     _DISPLAY_MODE='text';
     eval ${_UNSET} msm_modes;
-    eval ${_UNSET} msm_viewer;
     eval ${_UNSET} msm_viewers;
     eval "${return_ok}";
     ;;
   tty)
     _DISPLAY_MODE='tty';
     eval ${_UNSET} msm_modes;
-    eval ${_UNSET} msm_viewer;
     eval ${_UNSET} msm_viewers;
     eval "${return_ok}";
     ;;
@@ -5859,26 +5917,16 @@
     msm_1="$1";
     shift;
 
-    if is_X
-    then
-      _VIEWER_BACKGROUND='yes';
-    else
       _VIEWER_BACKGROUND='no';
-    fi;
 
     case "${msm_1}" in
     dvi)
-      if obj _OPT_VIEWER_DVI is_empty
-      then
-        obj_from_output msm_viewer _get_first_prog _VIEWER_DVI_X;
-      else
-        obj_from_output msm_viewer _check_X_prog _OPT_VIEWER_DVI _VIEWER_DVI_X;
-      fi;
+      _get_prog_args DVI;
       if is_not_equal "$?" 0
       then
         continue;
       fi;
-      if obj msm_viewer is_empty
+      if obj _DISPLAY_PROG is_empty
       then
         if is_equal "$#" 0
         then
@@ -5888,33 +5936,19 @@
         fi;
       fi;
 ### main_set_mode()
-      _obj_set_vars msm_viewer;
       _DISPLAY_MODE="dvi";
       eval ${_UNSET} msm_1;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
     html)
-      if obj _OPT_VIEWER_HTML is_empty
-      then
-        if is_X
-        then
-          msm_viewers="${_VIEWER_HTML_X}";
-        else
-          msm_viewers="${_VIEWER_HTML_TTY}";
-        fi;
-        obj_from_output msm_viewer _get_first_prog msm_viewers;
-      else
-        obj_from_output msm_viewer \
-         _check_X_prog _OPT_VIEWER_HTML _VIEWER_HTML_X;
-      fi;
+      _get_prog_args HTML;
       if is_not_equal "$?" 0
       then
         continue;
       fi;
-      if obj msm_viewer is_empty
+      if obj _DISPLAY_PROG is_empty
       then
         if is_equal "$#" 0
         then
@@ -5924,11 +5958,9 @@
         fi;
       fi;
 ### main_set_mode()
-      _obj_set_vars msm_viewer;
       _DISPLAY_MODE=html;
       eval ${_UNSET} msm_1;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
@@ -5950,18 +5982,13 @@
       then
         _PDF_HAS_GS='yes';
       fi;
-      if obj _OPT_VIEWER_PDF is_empty
-      then
-        obj_from_output msm_viewer _get_first_prog _VIEWER_PDF_X;
-      else
-        obj_from_output msm_viewer _check_X_prog _OPT_VIEWER_PDF _VIEWER_PDF_X;
-      fi;
+      _get_prog_args PDF;
       if is_not_equal "$?" 0
       then
         _PDF_DID_NOT_WORK='yes';
         continue;
       fi;
-      if obj msm_viewer is_empty
+      if obj _DISPLAY_PROG is_empty
       then
         _PDF_DID_NOT_WORK='yes';
         if is_equal "$#" 0
@@ -5971,27 +5998,20 @@
           continue;
         fi;
       fi;
-      _obj_set_vars msm_viewer;
       _DISPLAY_MODE="pdf";
       eval ${_UNSET} msm_1;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
 ### main_set_mode()
     ps)
-      if obj _OPT_VIEWER_PS is_empty
-      then
-        obj_from_output msm_viewer _get_first_prog _VIEWER_PS_X;
-      else
-        obj_from_output msm_viewer _check_X_prog _OPT_VIEWER_PS _VIEWER_PS_X;
-      fi;
+      _get_prog_args PS;
       if is_not_equal "$?" 0
       then
         continue;
       fi;
-      if obj msm_viewer is_empty
+      if obj _DISPLAY_PROG is_empty
       then
         if is_equal "$#" 0
         then
@@ -6000,11 +6020,9 @@
           continue;
         fi;
       fi;
-      _obj_set_vars msm_viewer;
       _DISPLAY_MODE="ps";
       eval ${_UNSET} msm_1;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
@@ -6012,7 +6030,6 @@
       _DISPLAY_MODE='text';
       eval ${_UNSET} msm_1;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
@@ -6021,22 +6038,16 @@
       _DISPLAY_MODE='tty';
       eval ${_UNSET} msm_1;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
     x)
-      if obj _OPT_VIEWER_X is_empty
-      then
-        obj_from_output msm_viewer _get_first_prog _VIEWER_X_X;
-      else
-        obj_from_output msm_viewer _check_X_prog _OPT_VIEWER_X _VIEWER_X_X;
-      fi;
+      _get_prog_args x;
       if is_not_equal "$?" 0
       then
         continue;
       fi;
-      if obj msm_viewer is_empty
+      if obj _DISPLAY_PROG is_empty
       then
         if is_equal "$#" 0
         then
@@ -6045,11 +6056,9 @@
           continue;
         fi;
       fi;
-      _obj_set_vars msm_viewer;
       _DISPLAY_MODE='x';
       eval ${_UNSET} msm_1;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
@@ -6058,7 +6067,6 @@
       _DISPLAY_MODE='X';
       eval ${_UNSET} msm_1;
       eval ${_UNSET} msm_modes;
-      eval ${_UNSET} msm_viewer;
       eval ${_UNSET} msm_viewers;
       eval "${return_ok}";
       ;;
@@ -6066,92 +6074,99 @@
   done;
   eval ${_UNSET} msm_1;
   eval ${_UNSET} msm_modes;
-  eval ${_UNSET} msm_viewer;
   eval ${_UNSET} msm_viewers;
   error_user "No suitable display mode found.";
 } # main_set_mode()
 
 
-# _obj_set_vars (<3-list-obj>)
+# _get_prog_args (<MODE>)
+#
+# Simplification for loop in main_set_mode().
 #
-# Set $_DISPLAY_PROG and $_DISPLAY_ARGS with the list elements.
+# Globals in/out: $_VIEWER_BACKGROUND
+# Globals in    : $_OPT_VIEWER_<MODE>, $_VIEWER_<MODE>_X, $_VIEWER_<MODE>_TTY
 #
-# Argument: 1, expect list with 3 elements from _get_first_prog() or
-#           _check_X_prog()
+# Variable prefix: _gpa
 #
-_obj_set_vars()
+_get_prog_args()
 {
-  func_check _set_vars '=' 1 "$@";
-  eval a='"${'"$1"'}"';
-  eval set x "$a";
-  shift;
-  if is_not_equal "$#" 3
-  then
-    error "_set_vars(): argument is not a list with 3 elements: $a";
-  fi;
+  func_check _get_prog_args '=' 1 "$@";
 
-  if is_empty "$1"
-  then
-    error "_set_vars(): program name is empty in the list: $1";
-  fi;
-  _DISPLAY_PROG="$1";
+  eval _gpa_opt='"${_OPT_VIEWER_'"$1"'}"';
+  _gpa_xlist=_VIEWER_"$1"_X;
+  _gpa_ttylist=_VIEWER_"$1"_TTY;
 
-  if is_not_empty "$2"
+  if obj _gpa_opt is_empty
   then
-    if obj _DISPLAY_ARGS is_empty
+    _VIEWER_BACKGROUND='no';
+    if is_X
     then
-      _DISPLAY_ARGS="$2";
+      _get_first_prog "${_gpa_xlist}";
+      x="$?";
+      if is_equal "$x" 0
+      then
+        _VIEWER_BACKGROUND='yes';
+      fi;
     else
-      _DISPLAY_ARGS="${_DISPLAY_ARGS} $2";
+      _get_first_prog "${_gpa_ttylist}";
+      x="$?";
     fi;
+    exit_test;
+    eval ${_UNSET} _gpa_opt;
+    eval ${_UNSET} _gpa_prog;
+    eval ${_UNSET} _gpa_ttylist;
+    eval ${_UNSET} _gpa_xlist;
+    eval "${return_var} $x";
+### _get_prog_args() of main_set_mode()
+  else                         # $_gpa_opt is set
+    obj_from_output _gpa_prog where_is_prog "${_gpa_opt}";
+    if is_not_equal "$?" 0 || obj _gpa_prog is_empty
+    then
+      exit_test;
+      echo2 "_get_prog_args(): '${_gpa_opt}' is not an existing program.";
+      eval ${_UNSET} _gpa_opt;
+      eval ${_UNSET} _gpa_prog;
+      eval ${_UNSET} _gpa_ttylist;
+      eval ${_UNSET} _gpa_xlist;
+      eval "${return_bad}";
   fi;
-  case "$3" in
-  yes|no)
-    _VIEWER_BACKGROUND="$3";
-    ;;
-  *)
-    error "_set_vars(): wrong value for $_VIEWER_BACKGROUND in the list: $3";
-    ;;
-  esac;
-} # _obj_set_vars() of main_set_mode()
+    exit_test;
 
+    # $_gpa_prog from opt is an existing program
 
-# _process_mode (<MODE>)
-#
-# Do some things for a given mode.  This is used by several modes.
-#
-# Argument: 1, a mode name in upper-case
-#
-_process_mode()
-{
-  func_check _process_mode '=' 1 "$@";
-  if eval obj _OPT_VIEWER_"$1"_TTY is_not_empty
+### _get_prog_args() of main_set_mode()
+    if is_X
   then
-    exit_test;
-    _VIEWER_BACKGROUND='no';
-    eval _OPT_VIEWER_"$1"='"${_OPT_VIEWER_'"$1"'_TTY}"';
-  fi;
-  exit_test;
-  if is_not_X && \
-     eval obj _OPT_VIEWER_"$1" is_empty && \
-     eval obj _VIEWER_"$1"_TTY is_empty
+      eval _check_prog_on_list ${_gpa_prog} ${_gpa_xlist};
+      if is_equal "$?" 0
   then
-    exit_test;
-    _OPT_MODE='';
+        _VIEWER_BACKGROUND='yes';
+      else
+        _VIEWER_BACKGROUND='no';
+        eval _check_prog_on_list ${_gpa_prog} ${_gpa_ttylist};
   fi;
-  exit_test;
-} # _process_mode() of main_set_mode()
+    else                       # is not X
+      _VIEWER_BACKGROUND='no';
+      eval _check_prog_on_list ${_gpa_prog} ${_gpa_ttylist};
+    fi;                                # is_X
+  fi;                          # test of $_gpa_opt
+  eval ${_UNSET} _gpa_opt;
+  eval ${_UNSET} _gpa_prog;
+  eval ${_UNSET} _gpa_ttylist;
+  eval ${_UNSET} _gpa_xlist;
+  eval "${return_god}";
+} # _get_prog_args() of main_set_mode()
 
 
 # _get_first_prog (<prog_list_name>)
 #
 # Retrieve from the elements of the list in the argument the first
 # existing program in $PATH.
+#
 # Local function for main_set_mode().
 #
 # Return  : `1' if none found, `0' if found.
-# Output  : the argument that succeeded, under where_is_prog(), and
-#           the value of $_VIEWER_BACKGROUND.
+# Output  : none
 #
 # Variable prefix: _gfp
 #
@@ -6172,9 +6187,10 @@
     exit_test;
     if is_equal "$?" 0 && obj _gfp_result is_not_empty
     then
-      list_append _gfp_result "${_VIEWER_BACKGROUND}";
-      obj _gfp_result echo1;
-      exit_test;
+      eval set x ${_gfp_result};
+      shift;
+      _DISPLAY_PROG="$1";
+      _DISPLAY_ARGS="$2";
       eval ${_UNSET} _gfp_i;
       eval ${_UNSET} _gfp_result;
       eval "${return_good}";
@@ -6186,127 +6202,87 @@
 } # _get_first_prog() of main_set_mode()
 
 
-# _check_X_prog (<prog_name> <X_prog_list_name>)
+# _check_prog_on_list (<prog> <args> <prog_list_name>)
+#
+# Check whether the content of <prog> is in the list <prog_list_name>.
+# The globals are set correspondingly.
 #
-# Check whether the content of <prog_name> without its arguments is
-# in the list <X_prog_list_name>.  If so the option is output with the
-# arguments of the list element, its corresponding arguments, and the
-# value yes/no of $_VIEWER_BACKGROUND.
 # Local function for main_set_mode().
 #
+# Arguments: 3
+#
 # Return  : `1' if not a part of the list, `0' if found in the list.
-# Output  : 3-element list, the option with arguments changed by
-#           where_is_prog(), and the value of $_VIEWER_BACKGROUND.
+# Output  : none
 #
-# Globals: $_VIEWER_BACKGROUND
+# Globals in    : $_VIEWER_<MODE>_X, $_VIEWER_<MODE>_TTY
+# Globals in/out: $_DISPLAY_PROG, $_DISPLAY_ARGS
 #
-# Variable prefix: _cXp
+# Variable prefix: _cpol
 #
-_check_X_prog()
+_check_prog_on_list()
 {
-  func_check _check_X_prog '=' 2 "$@";
-  eval _cXp_1='"${'"$1"'}"';
-  eval _cXp_2='"${'"$2"'}"';
-
-  obj_from_output _cXp_list1 where_is_prog "${_cXp_1}";
-  if is_not_equal "$?" 0 || obj _cXp_list1 is_empty
-  then
-    exit_test;
-    echo2 "_check_X_prog(): '${_cXp_1}' is not an existing program.";
-    eval ${_UNSET} _cXp_1;
-    eval ${_UNSET} _cXp_2;
-    eval ${_UNSET} _cXp_list1;
-    eval "${return_bad}";
-  fi;
-  exit_test;
-
-  if obj _VIEWER_BACKGROUND is_not_yes
-  then                         # no mode for X Window, so do not check it
-    list_append _cXp_list1 "${_VIEWER_BACKGROUND}";
-    obj _cXp_list1 echo1;
-    eval ${_UNSET} _cXp_1;
-    eval ${_UNSET} _cXp_2;
-    eval ${_UNSET} _cXp_list1;
-    eval "${return_good}";
-  fi;
-
-  eval set x ${_cXp_list1};
-  _cXp_prog1="$2";
-  _cXp_args1="$3";
+  func_check _check_prog_on_list '=' 3 "$@";
+  _DISPLAY_PROG="$1";
+  _DISPLAY_ARGS="$2";
 
-# _check_X_prog() of main_set_mode()
-  eval set x "${_cXp_2}";
+  eval _cpol_3='"${'"$3"'}"';
+  eval set x "${_cpol_3}";
   shift;
+  eval ${_UNSET} _cpol_3;
+
   for i
   do
-    _cXp_i="$i";
-    obj_from_output _cXp_list2 where_is_prog "${_cXp_i}";
-    if is_not_equal "$?" 0 || obj _cXp_list2 is_empty
+    _cpol_i="$i";
+    obj_from_output _cpol_list where_is_prog "${_cpol_i}";
+    if is_not_equal "$?" 0 || obj _cpol_list is_empty
     then
       exit_test;
       continue;
     fi;
     exit_test;
-    _cXp_prog2="$(eval set x ${_cXp_list2}; echo1 "$2")";
+    _cpol_prog="$(eval set x ${_cpol_list}; shift; echo1 "$1")";
 
-    if is_not_equal "${_cXp_prog1}" "${_cXp_prog2}"
+    if is_not_equal "${_DISPLAY_PROG}" "${_cpol_prog}"
     then
       exit_test;
       continue;
     fi;
     exit_test;
+### _check_prog_on_list() of main_set_mode()
 
     # equal, prog found
 
-    _cXp_args2="$(eval set x ${_cXp_list2}; echo1 "$3")";
-    if obj _cXp_args2 is_not_empty
+    _cpol_args="$(eval set x ${_cpol_list}; shift; echo1 "$2")";
+    eval ${_UNSET} _cpol_list;
+    if obj _cpol_args is_not_empty
     then
-      if obj _cXp_args1 is_empty
+      if obj _DISPLAY_ARGS is_empty
       then
-        _cXp_args1="${_cXp_args2}";
+        _DISPLAY_ARGS="${_cpol_args}";
       else
-        _cXp_args1="${_cXp_args2} ${_cXp_args1}";
+        _DISPLAY_ARGS="${_cpol_args} ${_DISPLAY_ARGS}";
       fi;
     fi;
-# _check_X_prog() of main_set_mode()
 
-    _cXp_list1='';
-    list_append _cXp_list1 \
-      "${_cXp_prog1}" "${_cXp_args1}" "${_VIEWER_BACKGROUND}";
-    exit_test;
-    echo1 "${_cXp_list1}";
-    eval ${_UNSET} _cXp_1;
-    eval ${_UNSET} _cXp_2;
-    eval ${_UNSET} _cXp_i;
-    eval ${_UNSET} _cXp_args1;
-    eval ${_UNSET} _cXp_list1;
-    eval ${_UNSET} _cXp_prog1;
-    eval ${_UNSET} _cXp_args2;
-    eval ${_UNSET} _cXp_list2;
-    eval ${_UNSET} _cXp_prog2;
+    eval ${_UNSET} _cpol_i;
+    eval ${_UNSET} _cpol_args;
+    eval ${_UNSET} _cpol_prog;
     eval "${return_good}";
   done; # for vars in list
 
-  _VIEWER_BACKGROUND='no';
-  list_append _cXp_list1 "${_VIEWER_BACKGROUND}";
-  echo1 "${_cXp_list1}";
-  eval ${_UNSET} _cXp_1;
-  eval ${_UNSET} _cXp_2;
-  eval ${_UNSET} _cXp_i;
-  eval ${_UNSET} _cXp_args1;
-  eval ${_UNSET} _cXp_list1;
-  eval ${_UNSET} _cXp_prog1;
-  eval ${_UNSET} _cXp_args2;
-  eval ${_UNSET} _cXp_list2;
-  eval ${_UNSET} _cXp_prog2;
-  eval "${return_good}";
-} # _check_X_prog() of main_set_mode()
+  # prog was not in the list
+  eval ${_UNSET} _cpol_i;
+  eval ${_UNSET} _cpol_args;
+  eval ${_UNSET} _cpol_list;
+  eval ${_UNSET} _cpol_prog;
+  eval "${return_bad}";
+} # _check_prog_on_list() of main_set_mode()
 
 
 #######################################################################
 # main_do_fileargs ()
 #
-# Process filespec arguments in $_FILEARGS.
+# Process filespec arguments.
 #
 # Globals:
 #   in: $_FILEARGS (process with `eval set x "$_FILEARGS"; shift;')
@@ -6780,8 +6756,7 @@
 # Do the actual display of the whole thing.
 #
 # Globals:
-#   in: $_DISPLAY_MODE, $_OPT_DEVICE,
-#       $_ADDOPTS_GROFF, $_ADDOPTS_POST, $_ADDOPTS_X,
+#   in: $_DISPLAY_MODE, $_OPT_DEVICE, $_ADDOPTS_GROFF,
 #       $_TMP_CAT, $_OPT_PAGER, $PAGER, $_MANOPT_PAGER,
 #       $_OUTPUT_FILE_NAME
 #
@@ -6810,7 +6785,6 @@
 
   case "${_DISPLAY_MODE}" in
   groff)
-    _ADDOPTS_GROFF="${_ADDOPTS_GROFF} ${_ADDOPTS_POST}";
     if obj _OPT_DEVICE is_not_empty
     then
       _ADDOPTS_GROFF="${_ADDOPTS_GROFF} -T${_OPT_DEVICE}";
@@ -6843,7 +6817,7 @@
 wrong device for ${_DISPLAY_MODE} mode: ${_OPT_DEVICE}";
       ;;
     esac;
-    md_addopts="${_ADDOPTS_GROFF} ${_ADDOPTS_POST}";
+    md_addopts="${_ADDOPTS_GROFF}";
     md_groggy="$(tmp_cat | grog -T${md_device})";
     exit_test;
     if obj _DISPLAY_MODE is_equal 'text'

Index: version.sh
===================================================================
RCS file: /cvsroot/groff/groff/contrib/groffer/version.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- version.sh  11 Sep 2006 16:06:18 -0000      1.2
+++ version.sh  16 Sep 2006 16:06:23 -0000      1.3
@@ -32,8 +32,8 @@
 export _PROGRAM_VERSION;
 export _LAST_UPDATE;
 
-_PROGRAM_VERSION='0.9.25';
-_LAST_UPDATE='11 Sep 2006';
+_PROGRAM_VERSION='0.9.26';
+_LAST_UPDATE='16 Sep 2006';
 
 # this setting of the groff version is only used before make is run,
 # otherwise @VERSION@ will set it, see groffer.sh.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]