The groffer
program is written in Perl, the Perl version during
writing was v5.8.8.
groffer
provides its own parser for command-line arguments that
is compatible to both POSIX getopts
(1) and GNU getopt(1). It can
handle option arguments and file names containing white space and
a large set of special characters. The following standard types
of options are supported.
* The option consisting of a single minus -
refers to standard
input.
* A single minus followed by characters refers to a single
character option or a combination thereof; for example, the
groffer
short option combination -Qmfoo
is equivalent to
-Q -m foo
.
* Long options are options with names longer than one character;
they are always preceded by a double minus. An option argument
can either go to the next command-line argument or be appended
with an equal sign to the argument; for example, --long=arg
is
equivalent to --long arg
.
* An argument of --
ends option parsing; all further command-line
arguments are interpreted as filespec parameters, i.e. file
names or constructs for searching man pages).
* All command-line arguments that are neither options nor option
arguments are interpreted as filespec parameters and stored
until option parsing has finished. For example, the command
line
sh# groffer file1 -a -o arg file2
is equivalent to
sh# groffer -a -o arg -- file1 file2
The free mixing of options and filespec parameters follows the
GNU principle. That does not fulfill the strange option behavior
of POSIX that ends option processing as soon as the first non-
option argument has been reached. The end of option processing
can be forced by the option '--
' anyway.