groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/01: groffer: replace all options --*viewer* by a single --vie


From: Bernd Warken
Subject: [groff] 01/01: groffer: replace all options --*viewer* by a single --viewer
Date: Sat, 31 May 2014 14:32:41 +0000

bwarken pushed a commit to branch master
in repository groff.

commit 6e8c0971c4193551b4cc91e51e8a02b9cff146ad
Author: Bernd Warken <address@hidden>
Date:   Sat May 31 16:32:25 2014 +0200

    groffer: replace all options --*viewer* by a single --viewer
---
 contrib/groffer/ChangeLog   |    7 +
 contrib/groffer/func.pl     |   26 ++--
 contrib/groffer/groffer.man |  259 ++++++++++++++++++++---------------
 contrib/groffer/groffer.pl  |  317 ++++++++++++++++++++++---------------------
 contrib/groffer/version.sh  |    4 +-
 5 files changed, 335 insertions(+), 278 deletions(-)

diff --git a/contrib/groffer/ChangeLog b/contrib/groffer/ChangeLog
index d0f7b26..7d046d4 100644
--- a/contrib/groffer/ChangeLog
+++ b/contrib/groffer/ChangeLog
@@ -1,3 +1,10 @@
+2014-05-31  Bernd Warken  <address@hidden>
+
+       * groffer.pl, func.pl, groffer.man: Change all existing viewer
+       options into a single one `--viewer'.
+
+       * version.sh: Upgrade to version 2.1.0.
+
 2014-03-30  Steffen Nurpmeso  <address@hidden>
 
        * Makefile.sub: Put straight error-prevention prefixes for `rm'.
diff --git a/contrib/groffer/func.pl b/contrib/groffer/func.pl
index b292d3f..4532ed7 100644
--- a/contrib/groffer/func.pl
+++ b/contrib/groffer/func.pl
@@ -8,7 +8,7 @@
 # Copyright (C) 2006, 2009, 2014 Free Software Foundation, Inc.
 # Written by Bernd Warken <address@hidden>.
 
-# Last update: 25 Feb 2014
+# Last update: 31 May 2014
 
 # This file is part of `groffer', which is part of `groff'.
 
@@ -554,12 +554,9 @@ The most important groffer long options are
 --default-modes=mode1,mode2,...
                   set sequence of automatically tried modes.
 --dvi             display in a viewer for TeX device independent format.
---dvi-viewer=prog choose the viewer program for dvi mode.
 --groff           process like groff, disable viewing features.
 --help            display this helping output.
 --html            display in a web browser.
---html-viewer=program
-                  choose the web browser for html mode.
 --man             check file parameters first whether they are man pages.
 --mode=auto|dvi|groff|html|pdf|ps|source|text|tty|www|x|X
                   choose display mode.
@@ -567,20 +564,16 @@ The most important groffer long options are
 --no-special      disable --all, --apropos*, and --whatis
 --pager=program   preset the paging program for tty mode.
 --pdf             display in a PDF viewer.
---pdf-viewer=prog choose the viewer program for pdf mode.
 --ps              display in a Postscript viewer.
---ps-viewer=prog  choose the viewer program for ps mode.
 --source          output as roff source.
 --text            output in a text device without a pager.
 --to-stdout       output the content of the mode file without display.
 --tty             display with a pager on text terminal even when in X.
---tty-viewer=prog select a pager for tty mode; same as --pager.
+--viewer          choose a viewer for the actual device mode
+--viewer-tty      choose a viewer for the actual text mode
 --whatis          display the file name and description of man pages
 --www             same as --html.
---www-viewer=prog same as --html-viewer
 --x --X           display with "gxditview" using an X* device.
---x-viewer=prog   choose viewer program for x mode (X mode).
---X-viewer=prog   same as "--xviewer".
 
 The usual X Windows toolkit options transformed into GNU long options:
 --background=color, --bd=size, --bg=color, --bordercolor=color,
@@ -598,6 +591,19 @@ Development options that are not useful for normal usage:
 --debug-tmpdir, --do-nothing, --print=text
 
 EOF
+
+# The following mode-viewer options were replaced by a single --viewer
+# option.  The old options are only ignored:
+# --dvi-viewer=prog choose the viewer program for dvi mode.
+# --html-viewer=program
+#                  choose the web browser for html mode.
+# --pdf-viewer=prog choose the viewer program for pdf mode.
+# --ps-viewer=prog  choose the viewer program for ps mode.
+# --tty-viewer=prog select a pager for tty mode; same as --pager.
+# --www-viewer=prog same as --html-viewer
+# --x-viewer=prog   choose viewer program for x mode (X mode).
+# --X-viewer=prog   same as "--xviewer".
+
 } # usage()
 
 
diff --git a/contrib/groffer/groffer.man b/contrib/groffer/groffer.man
index b3c7a07..f3ec6c7 100644
--- a/contrib/groffer/groffer.man
+++ b/contrib/groffer/groffer.man
@@ -11,6 +11,10 @@ groffer \- display groff files and man\~pages on X and tty
 .
 .de author
 This file was written by Bernd Warken <address@hidden>.
+.
+.
+.P
+Latest update: 31 May 2014
 ..
 .de co
 Copyright (C) 2001, 2002, 2004\[en]2006, 2009\[en]2012, 2014
@@ -43,7 +47,10 @@ The license text is available in the internet at
 .\" Setup
 .\" --------------------------------------------------------------------
 .
-.ds Ellipsis "\&.\|.\|.\&\"
+.char \[Ellipsis] \f[S]\N'188'\fP
+.
+.\" ds Ellipsis \[el]
+.\" ds Ellipsis "\&.\|.\|.\&\"
 .
 .\" --------------------------------------------------------------------
 .\" Macro definitions
@@ -150,9 +157,17 @@ The license text is available in the internet at
 .\" --------------------------------------------------------------------
 .
 .SY groffer
-.OP option \*[Ellipsis]
 .OP \-\-
-.OP \%filespec \*[Ellipsis]
+.OP \%filespec \[Ellipsis]
+.YS
+.
+.SY groffer
+.OP mode-option \[Ellipsis]
+.OP groff-options \[Ellipsis]
+.OP man-options \[Ellipsis]
+.OP X-options \[Ellipsis]
+.OP \-\-
+.OP \%filespec \[Ellipsis]
 .YS
 .
 .SY groffer
@@ -300,31 +315,38 @@ Long options can be abbreviated in several ways.
 .SY
 .OP \-\-auto
 .OP \-\-default
-.OP \-\-default\-modes mode1,mode2,\*[Ellipsis]
+.OP \-\-default\-modes mode1,mode2,\[Ellipsis]
 .OP \-\-dvi
-.OP \-\-dvi\-viewer prog
 .OP \-\-groff
 .OP \-\-html
-.OP \-\-html\-viewer prog
+.OP \-\-latin1
 .OP \-\-mode display_mode
 .OP \-\-pdf
 .OP \-\-pdf2
-.OP \-\-pdf\-viewer prog
 .OP \-\-ps
-.OP \-\-ps\-viewer prog
 .OP \-\-source
 .OP \-\-text
 .OP \-\-to\-stdout
 .OP \-\-tty
-.OP \-\-tty\-viewer prog
+.OP \-\-viewer prog
 .OP \-\-www
-.OP \-\-www\-viewer prog
 .OP \-\-x\~\fR|\fB\~\-\-X
-.OP \-\-x\-viewer\~\fR|\fB\~\-\-X\-viewer prog
 .YS
 .RE
 .
 .
+.ig
+Replace these options by --viewer
+.OP \-\-dvi\-viewer prog
+.OP \-\-html\-viewer prog
+.OP \-\-pdf\-viewer prog
+.OP \-\-ps\-viewer prog
+.OP \-\-tty\-viewer prog
+.OP \-\-www\-viewer prog
+.OP \-\-x\-viewer\~\fR|\fB\~\-\-X\-viewer prog
+..
+.
+.
 .TP
 .I options related to \%groff
 .RS
@@ -369,11 +391,11 @@ short options are accepted.
 .OP \-\-locale language
 .OP \-\-local\-file
 .OP \-\-location\~\fR|\fB\~\-\-where
-.OP \-\-manpath dir1:dir2:\*[Ellipsis]
+.OP \-\-manpath dir1:dir2:\[Ellipsis]
 .OP \-\-no\-location
 .OP \-\-pager program
-.OP \-\-sections sec1:sec2:\*[Ellipsis]
-.OP \-\-systems sys1,sys2,\*[Ellipsis]
+.OP \-\-sections sec1:sec2:\[Ellipsis]
+.OP \-\-systems sys1,sys2,\[Ellipsis]
 .OP \-\-troff\-device device
 .YS
 .P
@@ -617,8 +639,9 @@ default mode do not exist.
 .
 .
 .P
-In \%\f[CR]X\~Window\f[],
-many programs create their own window when called.
+In \%\f[CR]X\~Window\f[], many programs create their own window when
+called.
+.
 .B \%groffer
 can run these viewers as an independent program in the background.
 .
@@ -646,7 +669,8 @@ There is a chance to view the output source; for example, 
the
 combination of the options
 .B \-\-mode=ps
 and
-.B \-\-ps\-viewer=less
+.\# B \-\-ps\-viewer=less
+.B \-\-viewer=less
 shows the content of the
 .I Postscript
 output, the source code, with the pager
@@ -670,7 +694,7 @@ and restart option processing using only the rest of the 
command line.
 .
 .
 .TP
-.BI \-\-default\-modes \ mode1,mode2,\*[Ellipsis]
+.BI \-\-default\-modes \ mode1,mode2,\[Ellipsis]
 Set the sequence of modes for
 .I \%auto\~mode
 to the comma separated list given in the argument.
@@ -691,10 +715,8 @@ in this sequence.
 .B \-\-dvi
 Equivalent to
 .BR \-\-mode=\%dvi .
-.
-.
-.TP
-.BI \-\-dvi\-viewer \ prog
+.TQ
+.BI \-\-viewer \ prog
 Choose a viewer program for
 .IR \%dvi\~mode .
 .
@@ -721,10 +743,8 @@ Equivalent to
 .B \-\-html
 Equivalent to
 .BR \-\-mode=html .
-.
-.
-.TP
-.B \-\-html\-viewer
+.TQ
+.B \-\-viewer
 Choose a web browser program for viewing in
 .IR \%html\~mode .
 .
@@ -812,7 +832,7 @@ generator.
 The generated
 .I PDF file
 is displayed with suitable viewer programs, such as
-.BR ocular (1).
+.BR okular (1).
 .
 .
 .TP
@@ -886,7 +906,7 @@ program being distributed together with
 But the standard \%\f[CR]X\~Window\f[] tool
 .BR \%xditview (1)
 can also be chosen with the option
-.BR \-\-x\-viewer .
+.BR \-\-viewer .
 The default resolution is
 .BR 75dpi ,
 but
@@ -957,16 +977,12 @@ processing.
 .B \-\-pdf
 Equivalent to
 .BR \-\-mode=pdf .
-.
-.
-.TP
+.TQ
 .B \-\-pdf2
 Equivalent to
 .BR \-\-mode=pdf2 .
-.
-.
-.TP
-.BI \-\-pdf\-viewer \ prog
+.TQ
+.BI \-\-viewer \ prog
 Choose a viewer program for
 .IR \%pdf\~mode .
 .
@@ -979,10 +995,8 @@ arguments can be provided additionally.
 .B \-\-ps
 Equivalent to
 .BR \-\-mode=ps .
-.
-.
-.TP
-.BI \-\-ps\-viewer \ prog
+.TQ
+.BI \-\-viewer \ prog
 Choose a viewer program for
 .IR \%ps\~mode .
 .
@@ -990,6 +1004,8 @@ This can be a file name or a program to be searched in
 .Env_var $PATH .
 .
 Common Postscript viewers include
+.BR \%okular (1),
+.BR \%evince (1),
 .BR \%gv (1),
 .BR \%ghostview (1),
 and
@@ -1022,10 +1038,8 @@ It will not be displayed in graphical mode.
 .B \-\-tty
 Equivalent to
 .BR \-\-mode=tty .
-.
-.
-.TP
-.BI \-\-tty\-viewer \ prog
+.TQ
+.BI \-\-viewer \ prog
 Choose a text pager for mode
 .IR tty .
 The standard pager is
@@ -1043,22 +1057,17 @@ arguments can be provided additionally.
 .B \-\-www
 Equivalent to
 .BR \-\-mode=html .
-.
-.
-.TP
-.BI \-\-www\-viewer \ prog
-Equivalent to
-.BR \-\-html\-viewer .
+.TQ
+.B \-\-viewer
+.IR prog .
 .
 .
 .TP
 .B \-\-X\~\fR|\fB\~\-\-x
 Equivalent to
 .BR \-\-mode=x .
-.
-.
-.TP
-.BI \-\-X\-viewer\~\fR|\fB\~\-\-x\-viewer \ prog
+.TQ
+.BI \-\-viewer " prog"
 Choose a viewer program for
 .IR \%x\~mode .
 Suitable viewer programs are
@@ -1551,7 +1560,7 @@ This was added by
 .
 .
 .TP
-.BI \-\-manpath \ 'dir1:dir2:\*[Ellipsis]'
+.BI \-\-manpath \ 'dir1:dir2:\[Ellipsis]'
 Use the specified search path for retrieving
 .I \%man\~pages
 instead of the program defaults.
@@ -1567,12 +1576,13 @@ Set the pager program in
 .IR \%tty\~mode ;
 default is
 .BR \%less .
-This is equivalent to
-.BR \-\-tty\-viewer .
+.
+This can be set with
+.BR \-\-viewer .
 .
 .
 .TP
-.BI \-\-sections \ sec1:sec2:\*[Ellipsis]
+.BI \-\-sections \ sec1:sec2:\[Ellipsis]
 Restrict searching for
 .I \%man\~pages
 to the given
@@ -1581,7 +1591,7 @@ a colon-separated list.
 .
 .
 .TP
-.BI \-\-systems \ sys1,sys2,\*[Ellipsis]
+.BI \-\-systems \ sys1,sys2,\[Ellipsis]
 Search for
 .I \%man\~pages
 for the given operating systems; the argument
@@ -2103,9 +2113,9 @@ The modes are selected by option the arguments of
 Additionally, each of this argument can be specified as an option of
 its own, such as
 .BR anymode .
-Most of these modes have a viewer program, which can be chosen by an
-option that is constructed like
-.BR \-\-\,\fIanymode\/\fR\-viewer .
+Most of these modes have a viewer program, which can be chosen by the
+option
+.BR \-\-viewer .
 .
 .
 .P
@@ -2264,7 +2274,7 @@ or
 The pager to be used can be specified by one of the options
 .B \-\-pager
 and
-.BR \-\-tty\-viewer ,
+.BR \-\-viewer ,
 or by the environment variable
 .Env_var \%$PAGER .
 If all of this is not used the
@@ -3373,8 +3383,8 @@ or
 # groffer options that are used in each call of groffer
 \-\-foreground=DarkBlue
 \-\-resolution=100
-\-\-x\-viewer=gxditview \-geometry 900x1200
-\-\-pdf\-viewer xpdf \-Z 150
+\-\-viewer=gxditview \-geometry 900x1200
+\-\-viewer xpdf \-Z 150
 .fi
 .hy
 .ft
@@ -3558,7 +3568,7 @@ The formatted files are concatenated and displayed in one 
piece.
 .
 .sp
 .EX
-\fIsh#\fR\~LANG=de\~groffer\~\-\-man\~\-\-www\~\-\-www-viewer=galeon\~ls
+\fIsh#\fR\~LANG=de\~groffer\~\-\-man\~\-\-viewer=galeon\~ls
 .EE
 .sp
 Retrieve the German
@@ -3785,6 +3795,15 @@ all of them can be used with
 .
 .
 .TP
+.BR \%grog (@MAN1EXT@)
+This program tries to guess the necessary
+.B \%groff
+command line options from the input and the
+.B groffer
+options.
+.
+.
+.TP
 .BR \%groff (@MAN7EXT@)
 Documentation of the
 .I \%groff
@@ -3792,29 +3811,36 @@ language.
 .
 .
 .TP
-.BR \%grog (@MAN1EXT@)
-Internally,
-.B \%groffer
-tries to guess the
-.B \%groff
-command line options from the input using this program.
+.BR groff_char (@MAN7EXT@)
+Documentation on the
+.I \%groff
+characters, special characters, and glyphs..
+.
+.
+.TP
+.BR groff_tmac (@MAN5EXT@)
+Documentation on the
+.I \%groff
+macro files.
 .
 .
 .TP
 .BR groff_out (@MAN5EXT@)
 Documentation on the
 .I \%groff intermediate output
+before the run of a
+.IR postprocessor .
 .nh
 .RI ( ditroff
 output).
 .hy
 .
-.
-.TP
-.BR groff_tmac (@MAN5EXT@)
-Documentation on the
-.I \%groff
-macro files.
+This can be run by the
+.B groff
+or
+.B groffer
+option
+.BR -Z .
 .
 .
 .TP
@@ -3831,8 +3857,9 @@ supported by
 .BR \%groffer .
 .
 .
-.P
-.BR \%gxditview (@MAN1EXT@),
+.TP
+.BR \%gxditview (@MAN1EXT@)
+.TQ
 .BR \%xditview (1x)
 .RS
 Viewers for
@@ -3841,34 +3868,42 @@ Viewers for
 .RE
 .
 .
-.P
-.BR \%kpdf (1),
-.BR \%kghostview (1),
-.BR \%evince (1),
-.BR \%ggv (1),
-.BR \%gv (1),
-.BR \%ghostview (1),
+.TP
+.BR \%kpdf (1)
+.TQ
+.BR \%kghostview (1)
+.TQ
+.BR \%evince (1)
+.TQ
+.BR \%ggv (1)
+.TQ
+.BR \%gv (1)
+.TQ
+.BR \%ghostview (1)
+.TQ
 .BR \%gs (1)
-.RS
 Viewers for
 .BR \%groffer 's
 .IR \%ps\~mode .
-.RE
 .
 .
-.P
-.BR \%kpdf (1),
-.BR \%acroread (1),
-.BR \%evince (1),
-.BR \%xpdf (1),
-.BR \%gpdf (1),
-.BR \%kghostview (1),
+.TP
+.BR \%kpdf (1)
+.TQ
+.BR \%acroread (1)
+.TQ
+.BR \%evince (1)
+.TQ
+.BR \%xpdf (1)
+.TQ
+.BR \%gpdf (1)
+.TQ
+.BR \%kghostview (1)
+.TQ
 .BR \%ggv (1)
-.RS
 Viewers for
 .BR \%groffer 's
 .IR \%pdf\~mode .
-.RE
 .
 .
 .P
@@ -3882,35 +3917,41 @@ Viewers for
 .RE
 .
 .
-.P
-.BR \%konqueror (1),
-.BR \%epiphany (1),
-.BR \%firefox (1),
-.BR \%mozilla (1),
-.BR \%netscape (1),
+.TP
+.BR \%konqueror (1)
+.TQ
+.BR \%epiphany (1)
+.TQ
+.BR \%firefox (1)
+.TQ
+.BR \%mozilla (1)
+.TQ
+.BR \%netscape (1)
+.TQ
 .BR \%lynx (1)
-.RS
 Web-browsers for
 .BR \%groffer 's
 .I \%html
 or
 .IR \%www\~mode .
-.RE
 .
 .
 .TP
 .BR \%less (1)
+.TQ
+.BR more (1)
 Standard pager program for the
 .IR \%tty\~mode .
 .
 .
-.P
-.BR \%gzip (1),
+.TP
+.BR \%gzip (1)
+.TQ
 .BR \%bzip2 (1)
-.RS
+.TQ
+.BR \%xz (1)
 The decompression programs supported by
 .BR \%groffer .
-.RE
 .
 .
 .\" --------------------------------------------------------------------
diff --git a/contrib/groffer/groffer.pl b/contrib/groffer/groffer.pl
index 1a19a8b..1a7b65b 100755
--- a/contrib/groffer/groffer.pl
+++ b/contrib/groffer/groffer.pl
@@ -10,7 +10,7 @@
 
 # Written by Bernd Warken <address@hidden>.
 
-# Last update: 25 Feb 2014
+# Last update: 31 May 2014
 
 # This file is part of `groffer', which is part of `groff'.
 
@@ -193,9 +193,9 @@ my %Viewer_X = ('DVI' => ['kdvi', 'xdvi', 'dvilx'],
                          'xpdf -z 150', 'gpdf', 'xpdf', 'zathura'.
                          'epdfview', 'qpdfview', 'apvlv', 'qpdfview',
                          'kghostview --scale 1.45', 'gv', 'ggv'],
-               'PS' => ['gs', 'gs_x11', 'ghostscript', 'ghostview',
-                        'kghostview --scale 1.45',
-                        'gv', 'okular', 'kpdf', 'evince', 'ggv'],
+               'PS' => ['okular', 'evince', 'gv',
+                        'gs', 'gs_x11', 'ghostscript', 'ghostview',
+                        'kghostview --scale 1.45', 'ggv', 'kpdf'],
                'TTY' => ['xless'],
                'X' => ['gxditview', 'xditview'],
              );
@@ -250,19 +250,23 @@ sub main_set_options {
   'debug-filenames', 'debug-func', 'debug-grog', 'debug-not-func',
   'debug-keep', 'debug-lm', 'debug-params', 'debug-stacks',
   'debug-tmpdir', 'debug-user', 'default', 'do-nothing', 'dvi',
-  'groff', 'help', 'intermediate-output', 'html', 'man',
+  'groff', 'help', 'intermediate-output', 'html', 'latin1', 'man',
   'no-location', 'no-man', 'no-special', 'pdf', 'pdf2', 'ps', 'rv', 'source',
   'text', 'to-stdout', 'text-device', 'tty', 'tty-device', 'version',
   'whatis', 'where', 'www', 'x', 'X');
 
 ### main_set_options()
-  my @opts_groffer_long_arg = ('default-modes', 'device',
-  'dvi-viewer', 'dvi-viewer-tty', 'extension', 'fg', 'fn', 'font',
-  'foreground', 'html-viewer', 'html-viewer-tty', 'mode',
-  'pdf-viewer', 'pdf-viewer-tty', 'print', 'ps-viewer',
-  'ps-viewer-tty', 'title', 'tty-viewer', 'tty-viewer-tty',
-  'www-viewer', 'www-viewer-tty', 'x-viewer', 'x-viewer-tty',
-  'X-viewer', 'X-viewer-tty');
+  my @opts_groffer_long_arg =
+    ('default-modes', 'device', 'extension', 'fg', 'fn', 'font',
+     'foreground', 'mode', 'print', 'title', 'viewer',
+     # tty viewers are ignored
+     'dvi-viewer-tty', 'html-viewer-tty', 'pdf-viewer-tty',
+     'ps-viewer-tty', 'tty-viewer-tty', 'www-viewer-tty',
+     'X-viewer-tty', 'x-viewer-tty',
+     # viewers for modes are ignored
+     'dvi-viewer', 'html-viewer', 'pdf-viewer', 'ps-viewer', 'tty-viewer',
+     'www-viewer', 'X-viewer', 'x-viewer',
+    );
 
   ##### groffer options inhereted from groff
 
@@ -363,26 +367,28 @@ sub main_set_options {
                          '--bw' => '--borderwidth',
                          '--debug-all' => '--debug',
                          '--ditroff' => '--intermediate-output',
-                         '--dvi-viewer-tty' => '--dvi-viewer',
                          '--fg' => '--foreground',
                          '--fn' => '--font',
                          '--ft' => '--font',
-                         '--html-viewer-tty' => '--html-viewer',
-                         '--pdf-viewer-tty' => '--pdf-viewer',
-                         '--ps-viewer-tty' => '--ps-viewer',
+                         '--latin1' => '--tty',
                          '--troff-device' => '--device',
                          '--tty-device' => '--text-device',
-                         '--tty-viewer' => '--pager',
-                         '--tty-viewer-tty' => '--pager',
+                         '--viewer' => '--viewer',
                          '--where' => '--location',
                          '--www' => '--html',
-                         '--www-viewer' => '--html-viewer',
-                         '--www-viewer-tty' => '--html-viewer',
-                         '--x-viewer-tty' => '--x-viewer',
                          '--X' => '--x',
-                         '--X-viewer' => '--x-viewer',
-                         '--X-viewer-tty' => '--x-viewer',
-                        );
+                         # '--dvi-viewer' => '--viewer',
+                         '--dvi-viewer-tty' => '--viewer',
+                         '--html-viewer-tty' => '--viewer',
+                         '--pdf-viewer-tty' => '--viewer',
+                         '--ps-viewer-tty' => '--viewer',
+                         '--tty-viewer' => '--pager',
+                         '--tty-viewer-tty' => '--pager',
+                         '--www-viewer' => '--viewer',
+                         '--www-viewer-tty' => '--pager',
+                         '--X-viewer' => '--viewer', '--X-viewer-tty'
+                         => '--pager', '--x-viewer' => '--viewer',
+                         '--x-viewer-tty' => '--pager', );
 
   # groff short options with leading minus
   foreach (@opts_groff_short_na) {
@@ -392,7 +398,7 @@ sub main_set_options {
     $Opts_Groff_Short{"-$_"} = 1;
   }
 
-}                              # main_set_options()
+} # main_set_options()
 
 
 ########################################################################
@@ -403,7 +409,7 @@ sub main_set_options {
 my @Manopt;
 
 sub main_parse_MANOPT {
-  if ($ENV{'MANOPT'}) {
+  if ( $ENV{'MANOPT'} ) {
     @Manopt = `sh $File_split_env_sh MANOPT`;
     chomp @Manopt;
 
@@ -412,37 +418,37 @@ sub main_parse_MANOPT {
     # All options not in %opts are ignored.
     # Check options used with %Opts_Cmdline_Double.
     # 0: option used ('' for ignore), 1: has argument or not
-### main_parse_MANOPT()
+    ### main_parse_MANOPT()
     my %opts = ('-7' => ['--ascii', 0],
-               '--ascii' => ['--ascii', 0],
+               '-L' => ['--locale', 1],
+               '-M' => ['--manpath', 1],
+               '-P' => ['--pager', 1],
+               '-S' => ['--sections', 1],
+               '-T' => ['-T', 1],
+               '-w' => ['--location', 0],
                '-a' => ['--all', 0],
-               '--all' => ['--all', 0],
                '-c' => ['', 1],
-               '--catman' => ['', 1],
                '-e' => ['--extension', 1],
-               '--extension' => ['--extension', 1],
                '-f' => ['--whatis', 1],
-               '--whatis' => ['--whatis', 1],
-               '-L' => ['--locale', 1],
-               '--locale' => ['--locale', 1],
                '-m' => ['--systems', 1],
-               '--systems' => ['--systems', 1],
-               '-M' => ['--manpath', 1],
-               '-manpath' => ['--manpath', 1],
-               '--manpath' => ['--manpath', 1],
                '-p' => ['', 1],
-               '--preprocessor' => ['', 1],
-               '-P' => ['--pager', 1],
-               '-pager' => ['--pager', 1],
                '-r' => ['', 1],
+               '-manpath' => ['--manpath', 1],
+               '-pager' => ['--pager', 1],
                '-prompt' => ['', 1],
-               '-S' => ['--sections', 1],
                '-sections' => ['--sections', 1],
-               '-T' => ['-T', 1],
+               '--all' => ['--all', 0],
+               '--ascii' => ['--ascii', 0],
+               '--catman' => ['', 1],
                '--device' => ['-T', 1],
-               '-w' => ['--location', 0],
-               '--where' => ['--location', 0],
+               '--extension' => ['--extension', 1],
+               '--locale' => ['--locale', 1],
                '--location' => ['--location', 0],
+               '--manpath' => ['--manpath', 1],
+               '--preprocessor' => ['', 1],
+               '--systems' => ['--systems', 1],
+               '--whatis' => ['--whatis', 1],
+               '--where' => ['--location', 0],
               );
 
 ### main_parse_MANOPT()
@@ -494,7 +500,7 @@ my @Starting_ARGV = @ARGV;
 sub main_config_params {       # handle configuration files
   # options may not be abbreviated, but must be exact
   my @conf_args;
-  foreach my $f (@Conf_Files) {
+  foreach my $f ( @Conf_Files ) {
     if (-s $f) {
       my $fh;
       open $fh, "<$f" || next;
@@ -513,7 +519,7 @@ sub main_config_params {    # handle configuration files
          warn "Wrong option $line in configuration file $f.\n";
          next;
        }
-       if ($line =~ /^--[ =]/) {
+       if ( $line =~ /^--[ =]/ ) {
          warn "No option name in `$line' in configuration " .
            "file $f.\n";
          next;
@@ -522,46 +528,42 @@ sub main_config_params {  # handle configuration files
        # -- or -
        if ($line =~ /^--?$/) {
          warn "`$line' is not allowed in configuration files.\n";
-         next;
-       }
-       ### main_config_params()
-       if ($line =~ /^--/) {   # line is long option
+         next; }
+### main_config_params()
+       if ($line =~ /^--/) {           # line is long option
          my ($name, $arg);
-         if ($line =~ /[ =]/) { # has arg on line
-           $line =~ /^(--[^ =]+)[ =] ?(.*)$/;
+         if ($line =~ /[ =]/) {        # has arg on line $line =~
+           /^(--[^ =]+)[ =] ?(.*)$/;
            ($name, $arg) = ($1, $2);
            $arg =~ s/[\'\"]//g;
-         } else {              # does not have an argument on line
+         } else {                      # does not have an argument on line
            $name = $line;
-         }
-         $name =~ s/[\'\"]//g;
+         } $name =~ s/[\'\"]//g;
          unless (exists $Opts_Cmdline_Long{$name}) {
            # option does not exist
            warn "Option `$name' does not exist.\n";
            next LINE;
          }
          # option exists
-         if ($Opts_Cmdline_Long{$name}) { # option has arg
+         if ( $Opts_Cmdline_Long{$name} ) { # option has arg
            if (defined $arg) {
              push @conf_args, $name, $arg;
              next LINE;
-           } else {
-             warn "Option `$name' needs an argument in " .
-               "configuration file $f\n";
-             next LINE;
-           }
-         } else {              # option has no arg
+           } else { warn "Option `$name' needs an argument in " .
+                      "configuration file $f\n";
+                    next LINE;
+                  }
+         } else { # option has no arg
            if (defined $arg) {
              warn "Option `$name' may not have an argument " .
                "in configuration file $f\n";
              next LINE;
            } else {
-             push @conf_args, $name;
-             next LINE;
+             push @conf_args, $name; next LINE;
            }
          }
-         ### main_config_params()
-       } else {                # line is short option or cluster
+### main_config_params()
+       } else {                        # line is short option or cluster
          $line =~ s/^-//;
          while ($line) {
            $line =~ s/^(.)//;
@@ -572,19 +574,19 @@ sub main_config_params {  # handle configuration files
                "have an argument.\n";
              next LINE;
            }
-           if (exists $Opts_Cmdline_Short{$opt}) {
+           if ( exists $Opts_Cmdline_Short{$opt} ) {
              # short opt exists
              push @conf_args, $opt;
-             if ($Opts_Cmdline_Short{$opt}) { # with arg
+             if ( $Opts_Cmdline_Short{$opt} ) { # with arg
                my $arg = $line;
                $arg =~ s/^ //;
                $arg =~ s/\'\"//g;
                push @conf_args, "$arg";
                next LINE;
-             } else {          # no arg
+             } else { # no arg
                next;
              }
-           } else {            # short option does not exist
+           } else { # short option does not exist
              warn "Wrong short option `-$opt' from " .
                "configuration.  Rest of line ignored.\n";
              next LINE;
@@ -597,9 +599,9 @@ sub main_config_params {    # handle configuration files
   }
 
 ### main_config_params()
-  # handle environment variable $GROFFER_OPT
+  #handle environment variable $GROFFER_OPT
   my @GROFFER_OPT;
-  if ($ENV{'GROFFER_OPT'}) {
+  if ( $ENV{'GROFFER_OPT'} ) {
     @GROFFER_OPT = `sh $File_split_env_sh GROFFER_OPT`;
     chomp @GROFFER_OPT;
   }
@@ -610,7 +612,7 @@ sub main_config_params {    # handle configuration files
     my @argv0 = (@GROFFER_OPT, @ARGV);
     my @argv;
     my $only_files = 0;
-    my $n = $#argv0;             # last element
+    my $n = $#argv0;           # last element
     my $n1 = scalar @GROFFER_OPT; # first element of @ARGV
     my $i = 0;                 # number of the element
     my @s = ('the environment variable $GROFFER_OPT', 'the command line');
@@ -630,27 +632,27 @@ sub main_config_params {  # handle configuration files
       }
 
 ### main_config_params()
-      if ($elt =~ /^-$/) {     # -
+      if ( $elt =~ /^-$/ ) { # -
        push @Filespecs, $elt;
        next ELT;
       }
-      if ($elt =~ /^--$/) {    # --
+      if ($elt =~ /^--$/) { # --
        $only_files = 1;
        next ELT;
       }
 
-      if ($elt =~ /^--[ =]/) { # no option name
+      if ($elt =~ /^--[ =]/) { # no option name
        warn "No option name in `$elt' at $s[$j].\n";
        next ELT;
       }
-      if ($elt =~ /^---/) {    # wrong with three minus
+      if ($elt =~ /^---/) { # wrong with three minus
        warn "Wrong option `$elt' at $s[$j].\n";
        next ELT;
       }
 
-      if ($elt =~ /^--[^-]/) { # long option
+      if ($elt =~ /^--[^-]/) { # long option
        my ($name, $opt, $abbrev, $arg);
-       if ($elt =~ /[ =]/) {   # has arg on elt
+       if ($elt =~ /[ =]/) { # has arg on elt
          $elt =~ /^--([^ =]+)[ =] ?(.*)$/;
          ($name, $arg) = ($1, $2);
          $opt = "--$name";
@@ -666,25 +668,24 @@ sub main_config_params {  # handle configuration files
        $name =~ s/[\'\"]//g;
        my $match = $name;
        $match =~ s/-/[^- ]*-/g;
-       ### main_config_params()
-       if (exists $Opts_Cmdline_Long{$opt}) {
+       if ( exists $Opts_Cmdline_Long{$opt} ) {
          # option exists exactly
-       } elsif ($Opts_Cmdline_Long_Str =~ / (${match}[^- ]*?) /) {
+       } elsif ( $Opts_Cmdline_Long_Str =~ / (${match}[^- ]*?) / ) {
          # option is an abbreviation without further -
          my $n0 = $1;
-         if ($Opts_Cmdline_Long_Str =~
-             / (${match}[^- ]*) .* (${match}[^- ]*) /) {
+         if ( $Opts_Cmdline_Long_Str =~
+              /\s(${match}[^-\s]*)\s.*\s(${match}[^-\s]*) / ) {
            warn "Option name `--$abbrev' is not unique: " .
              "--$1 --$2 \n";
            next ELT;
          }
          $name = $n0;
          $opt = "--$n0";
-       } elsif ($Opts_Cmdline_Long_Str =~ / (${match}[^ ]*) /) {
+       } elsif ( $Opts_Cmdline_Long_Str =~ /\s(${match}[^\s]*)\s/ ) {
          # option is an abbreviation with further -
          my $n0 = $1;
-         if ($Opts_Cmdline_Long_Str =~
-             / (${match}[^ ]*) .* (${match}[^ ]*) /) {
+         if ( $Opts_Cmdline_Long_Str =~
+              /\s(${match}[^\s]*)\s.*\s(${match}[^\s]*)\s/ ) {
            warn "Option name `--$abbrev' is not unique: " .
              "--$1 --$2 \n";
            next ELT;
@@ -696,23 +697,21 @@ sub main_config_params {  # handle configuration files
          next ELT;
        }
 ### main_config_params()
-       if ($Opts_Cmdline_Long{$opt}) { # option has arg
+       if ( $Opts_Cmdline_Long{$opt} ) { # option has arg
          if (defined $arg) {
            push @argv, "--$name", $arg;
            next ELT;
-         } else {              # $arg not defined, argument at next element
+         } else { # $arg not defined, argument at next element
            if (($i == $n1) || ($i > $n)) {
              warn "No argument left for option " .
                "`$elt' at $s[$j].\n";
-             next ELT;
-           }
-           ### main_config_params()
+             next ELT; }
            # add argument as next element
            push @argv, "--$name", $argv0[$i];
            ++$i;
            next ELT;
-         }                     # if (defined $arg)
-       } else {                # option has no arg
+         }             # if (defined $arg)
+       } else {        # option has no arg
          if (defined $arg) {
            warn "Option `$abbrev' may not have an argument " .
              "at $s[$j].\n";
@@ -721,59 +720,56 @@ sub main_config_params {  # handle configuration files
            push @argv, "--$name";
            next ELT;
          }
-       }                       # if ($Opts_Cmdline_Long{$opt})
+       }               # if ($Opts_Cmdline_Long{$opt})
 ### main_config_params()
-      } elsif ($elt =~ /^-[^-]/) { # short option or cluster
+      } elsif ( $elt =~ /^-[^-]/ ) { # short option or cluster
        my $cluster = $elt;
        $cluster =~ s/^-//;
        while ($cluster) {
          $cluster =~ s/^(.)//;
          my $opt = "-$1";
-         if (exists $Opts_Cmdline_Short{$opt}) { # opt exists
-           if ($Opts_Cmdline_Short{$opt}) { # with arg
+         if ( exists $Opts_Cmdline_Short{$opt} ) {     # opt exists
+           if ( $Opts_Cmdline_Short{$opt} ) {          # with arg
              if ($cluster) {   # has argument in this element
-               $cluster =~ s/^ //;
+               $cluster =~ s/^\s//;
                $cluster =~ s/\'\"//g;
-                               # add argument as rest of this element
+               # add argument as rest of this element
                push @argv, $opt, $cluster;
                next ELT;
-             } else {          # argument at next element
+             } else { # argument at next element
                if (($i == $n1) || ($i > $n)) {
                  warn "No argument left for option " .
                    "`$opt' at $s[$j].\n";
-                 next ELT;
-               }
-               ### main_config_params()
-                               # add argument as next element
+                 next ELT; }
+### main_config_params()
+               # add argument as next element
                push @argv, $opt, $argv0[$i];
                ++$i;
                next ELT;
              }
-           } else {            # no arg
-             push @argv, $opt;
-             next;
+           } else { # no arg
+             push @argv, $opt; next;
            }
-         } else {              # short option does not exist
+         } else { # short option does not exist
            warn "Wrong short option `$opt' at $s[$j].\n";
            next ELT;
-         }                     # if (exists $Opts_Cmdline_Short{$opt})
-       }                       # while ($cluster)
-      } else {                 # not an option, file name
+         }             # if (exists $Opts_Cmdline_Short{$opt})
+       }               # while ($cluster)
+      } else {         # not an option, file name
        push @Filespecs, $elt;
        next;
       }
     }
 ### main_config_params()
     @Options = (@Manopt, @conf_args, @argv);
-    foreach my $i (0..$#Options) {
-      if ( exists $Opts_Cmdline_Double{ $Options[$i] } ) {
+    foreach my $i ( 0..$#Options ) {
+      if ( exists $Opts_Cmdline_Double{$Options[$i]} ) {
        $Options[$i] = $Opts_Cmdline_Double{ $Options[$i] };
       }
-    }
-    @Filespecs = ('-') unless (@Filespecs);
+    } @Filespecs = ('-') unless (@Filespecs);
     @ARGV = (@Options, '--', @Filespecs);
   }
-} # main_config_params()
+}
 
 if (0) {
   print STDERR "<$_>\n" foreach @ARGV;
@@ -784,8 +780,7 @@ if (0) {
 # main_parse_params()
 ########################################################################
 
-my $i;
-my $n;
+my $i; my $n;
 
 $Opt{'XRM'} = [];
 
@@ -796,10 +791,10 @@ sub main_parse_params {
   # options that are ignored in this part
   # shell version of groffer: --debug*, --shell
   # man options: --catman (only special in man),
-  #              --preprocessor (force groff preproc., handled by grog),
-  #              --prompt (prompt for less, ignored),
-  #              --troff (-mandoc, handled by grog),
-  #              --update (inode check, ignored)
+  #             --preprocessor (force groff preproc., handled by grog),
+  #             --prompt (prompt for less, ignored),
+  #             --troff (-mandoc, handled by grog),
+  #             --update (inode check, ignored)
   my %ignored_opts = (
                      '--catman' => 0,
                      '--debug-func' => 0,
@@ -828,19 +823,20 @@ sub main_parse_params {
      '--help' => sub { &usage(); $Opt{'DO_NOTHING'} = 1; },
      '--source' => sub { $Opt{'MODE'} = 'source'; },
      '--device' =>
-     sub {  $Opt{'DEVICE'} = &_get_arg();
-           my %modes = ( 'dvi'=> 'dvi',
-                         'html' => 'html',
-                         'lbp' => 'groff',
-                         'lj4' => 'groff',
-                         'pdf' => 'pdf',
-                         'pdf2' => 'pdf',
-                         'ps' => 'ps',
-                         'ascii' => 'tty',
-                         'cp1047' => 'tty',
-                         'latin1' => 'tty',
-                         'utf8' => 'tty',
-                       );
+     sub { $Opt{'DEVICE'} = &_get_arg();
+          my %modes = (
+                       'ascii' => 'tty',
+                       'cp1047' => 'tty',
+                       'dvi'=> 'dvi',
+                       'html' => 'html',
+                       'latin1' => 'tty',
+                       'lbp' => 'groff',
+                       'lj4' => 'groff',
+                       'pdf' => 'pdf',
+                       'pdf2' => 'pdf',
+                       'ps' => 'ps',
+                       'utf8' => 'tty',
+                      );
            if ($Opt{'DEVICE'} =~ /^X.*/) {
              $Opt{'MODE'} = 'x';
            } elsif ( exists $modes{ $Opt{'DEVICE'} } ) {
@@ -895,8 +891,6 @@ sub main_parse_params {
      sub { $Opt{'DISPLAY'} = &_get_arg(); },
      '--do-nothing' => sub { $Opt{'DO_NOTHING'} = 1; },
      '--dvi' => sub { $Opt{'MODE'} = 'dvi'; },
-     '--dvi-viewer' =>         # viewer program for dvi mode; arg
-     sub { $Opt{'VIEWER_DVI'} = &_get_arg(); },
      '--extension' =>          # the extension for man pages, arg
      sub { $Opt{'EXTENSION'} = &_get_arg(); },
      '--foreground' =>         # foreground color for viewers, arg
@@ -907,8 +901,6 @@ sub main_parse_params {
      sub { $Opt{'GEOMETRY'} = &_get_arg(); },
      '--groff' => sub { $Opt{'MODE'} = 'groff'; },
      '--html' => sub { $Opt{'MODE'} = 'html'; },
-     '--html-viewer' =>                # viewer program for html mode; arg
-     sub { $Opt{'VIEWER_HTML'} = &_get_arg(); },
      '--iconic' =>             # start viewers as icons
      sub { $Opt{'ICONIC'} = 1; },
      '--locale' =>             # set language for man pages, arg
@@ -964,13 +956,9 @@ sub main_parse_params {
      sub { $Opt{'PAGER'} = &_get_arg(); },
      '--pdf' => sub { $Opt{'MODE'} = 'pdf'; },
      '--pdf2' => sub { $Opt{'MODE'} = 'pdf2'; },
-     '--pdf-viewer' =>         # viewer program for pdf and pdf2 mode; arg
-     sub { $Opt{'VIEWER_PDF'} = &_get_arg(); },
      '--print' =>              # print argument, for argument test
      sub { my $arg = &_get_arg; print STDERR "$arg\n"; },
      '--ps' => sub { $Opt{'MODE'} = 'ps'; },
-     '--ps-viewer' =>          # viewer program for ps mode; arg
-     sub { $Opt{'VIEWER_PS'} = &_get_arg(); },
      '--resolution' =>         # set resolution for X devices, arg
      sub { my $arg = &_get_arg();
           my %res = ( '75' => 75,
@@ -1017,21 +1005,32 @@ sub main_parse_params {
             }
           }
         },
-     '--tty' =>                        # tty mode, text with pager
-     sub { $Opt{'MODE'} = 'tty'; },
-     '--to-stdout' =>          # print mode file without display
-     sub { $Opt{'STDOUT'} = 1; },
      '--text-device' =>                # device for tty mode; arg
      sub { $Opt{'TEXT_DEVICE'} = &_get_arg(); },
+     '--to-stdout' =>          # print mode file without display
+     sub { $Opt{'STDOUT'} = 1; },
+     '--tty' =>                        # tty mode, text with pager
+     sub { $Opt{'MODE'} = 'tty'; },
+     '--viewer' =>             # viewer for actiual mode
+     sub { $Opt{'VIEWER'} = &_get_arg(); },
      '--whatis' => sub { delete $Opt{'APROPOS'}; $Opt{'WHATIS'} = 1; },
      '--x' => sub { $Opt{'MODE'} = 'x'; },
 ### main_parse_params()
      '--xrm' =>                        # pass X resource string, arg
      sub { my $arg = &_get_arg(); push @{$Opt{'XRM'}}, $arg if $arg; },
-     '--x-viewer' =>           # viewer program for x mode; arg
-     sub { $Opt{'VIEWER_X'} = &_get_arg(); },
     );
 
+#     '--dvi-viewer' =>                # viewer program for dvi mode; arg
+#     sub { $Opt{'VIEWER_DVI'} = &_get_arg(); },
+#     '--html-viewer' =>               # viewer program for html mode; arg
+#     sub { $Opt{'VIEWER_HTML'} = &_get_arg(); },
+#     '--pdf-viewer' =>                # viewer program for pdf and pdf2 mode; 
arg
+#     sub { $Opt{'VIEWER_PDF'} = &_get_arg(); },
+#     '--ps-viewer' =>         # viewer program for ps mode; arg
+#     sub { $Opt{'VIEWER_PS'} = &_get_arg(); },
+#     '--x-viewer' =>          # viewer program for x mode; arg
+#     sub { $Opt{'VIEWER_X'} = &_get_arg(); },
+
   my %short_opts = (
                    '-V' => sub { $Opt{'V'} = 1; },
                    '-X' => sub { $Opt{'X'} = 1; },
@@ -1040,7 +1039,7 @@ sub main_parse_params {
   if (0) {
     # check if all options are handled in parse parameters
 
-    #short options
+    # short options
     my %these_opts = (%ignored_opts, %short_opts, %Opts_Groff_Short,
                      %Opts_Cmdline_Double);
     foreach my $key (keys %Opts_Cmdline_Short) {
@@ -1084,7 +1083,7 @@ sub main_parse_params {
        }
       }                                # if (exists $short_opts{$opt})
     }                          # if ($opt =~ /^-([^-])$/)
-    # Now it is a long option
+    # now it is a long option
 
     # handle ignored options
     if ( exists $ignored_opts{ $opt } ) {
@@ -1232,7 +1231,7 @@ sub main_set_mode {
     } else {                   # other modes
       &_get_prog_args($m) ? return 1 : next LOOP;
     }                          # if $m
-  }                            # LOOP: foreach
+  }                            # loop: foreach
   die 'set mode: no suitable display mode found under ' .
     join(', ', @modes) . ';' unless $Display{'MODE'};
   die 'set mode: no viewer available for mode ' . $Display{'MODE'} . ';'
@@ -1251,9 +1250,12 @@ sub main_set_mode {
 # Simplification for loop in set mode.
 #
 # Globals in/out: $Viewer_Background
-# Globals in    : $Opt{VIEWER_<MODE>}, $Viewer_X{<MODE>},
+# globals in    : $Opt{VIEWER}, $VIEWER_X{<MODE>},
 #                 $Viewer_tty{<MODE>}
 #
+## globals in    : $Opt{VIEWER_<MODE>}, $VIEWER_X{<MODE>},
+##                 $Viewer_tty{<MODE>}
+##
 sub _get_prog_args {
   my $n = @_;
   die "_get_prog_args(): one argument is needed; you used $n;"
@@ -1265,11 +1267,12 @@ sub _get_prog_args {
   my $xlist = $Viewer_X{$MODE};
   my $ttylist = $Viewer_tty{$MODE};
 
-  my $vm = "VIEWER_${MODE}";
+#  my $vm = "VIEWER_${MODE";
+  my $vm = "VIEWER";
   my $opt = $Opt{$vm};
 
   if ($opt) {
-    my %prog = where_is_prog $opt;
+    my %prog = &where_is_prog($opt);
     my $prog_ref = \%prog;
     unless (%prog) {
       warn "_get_prog_args(): `$opt' is not an existing program;";
diff --git a/contrib/groffer/version.sh b/contrib/groffer/version.sh
index 339fc33..9c2a592 100644
--- a/contrib/groffer/version.sh
+++ b/contrib/groffer/version.sh
@@ -29,8 +29,8 @@
 export _PROGRAM_VERSION;
 export _LAST_UPDATE;
 
-_PROGRAM_VERSION='2.0.2';
-_LAST_UPDATE='26 Feb 2014';
+_PROGRAM_VERSION='2.1.0';
+_LAST_UPDATE='31 May 2014';
 
 # 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]