summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-04-10 12:54:10 +0000
committerwlemb <wlemb>2001-04-10 12:54:10 +0000
commit3eba6c39c3d6e7fd573a1c3f74063a35f9861407 (patch)
tree2c32998fa8ed173ab84325e9d345f5ea49f86a2c
parent21ebecd3dc1722faa746a7f5e943a580beffb138 (diff)
downloadgroff-3eba6c39c3d6e7fd573a1c3f74063a35f9861407.tar.gz
* NEWS: Updated.
* doc/groff.texinfo: Many fixes, additions, clarifications, etc. * src/devices/grodvi/dvi.cc (main): Accept --help and --version. (usage): Add stream argument. Don't exit. * src/devices/grohtml/post-html.cc (main): Accept --help and --version. Write --version output to stdout, not stderr. (usage): Add stream argument. Don't exit. * src/devices/grohtml-old/html.cc (main): Accept --help and --version. (usage): Add stream argument. Don't exit. * src/devices/grolbp/lbp.cc (long_options): Use symbolic getopt.h constants. (usage): Add stream argument. Don't exit. (main): Write --help output to stdout, not stderr. * src/devices/grolj4/lj4.cc (main): Accept --help and --version. (usage): Add stream argument. Don't exit. * src/devices/grops/ps.cc (main): Accept --help and --version. (usage): Add stream argument. Don't exit. * src/devices/grotty/tty.cc (main): Accept --help and --version. (usage): Add stream argument. Don't exit. * src/preproc/eqn/main.cc (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/preproc/grn/main.cc (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/preproc/html/pre-html.cc (usage): Add stream argument. (scanArguments): Accept --help and --version. * src/preproc/pic/main.cc (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/preproc/refer/refer.cc (main): Accept --help and --version. (usage): Add stream argument. Don't exit. * src/preproc/soelim/soelim.cc (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/preproc/tbl/main.cc (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/roff/groff/groff.cc (main): Accept --help and --version. (synopsis): Add stream argument. (help): Write --help output to stdout, not stderr. (usage): Add stream argument. Don't exit. * src/roff/grog/grog.pl: Accept --help and --version. (help): New sub. * src/roff/grog/grog.sh: Accept --help and --version. * src/roff/nroff/nroff.sh: Accept --help and --version. * src/roff/troff/input.cc (USAGE_EXIT_CODE): Remove macro. (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/utils/addftinfo/addftinfo.cc (main): Accept --help and --version. (usage): New function with stream argument, doesn't exit. * src/utils/hpftodit/hpftodit.cc (main): Accept --help and --version. (usage): New function with stream argument, doesn't exit. * src/utils/indxbib/indxbib.cc (main): Accept --help and --version. (usage): Add stream argument. Don't exit. * src/utils/lkbib/lkbib.cc (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/utils/lookbib/lookbib.cc (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/utils/pfbtops/pfbtops.c (usage): Add stream argument. Don't exit. (main): Accept --help and --version. * src/utils/tfmtodit/tfmtodit.cc (main): Accept --help and --version. (usage): Add stream argument. Don't exit.
-rw-r--r--ChangeLog66
-rw-r--r--NEWS3
-rw-r--r--doc/groff.texinfo790
-rw-r--r--src/devices/grodvi/dvi.cc21
-rwxr-xr-xsrc/devices/grohtml-old/html.cc22
-rw-r--r--src/devices/grohtml/post-html.cc30
-rw-r--r--src/devices/grolbp/lbp.cc34
-rw-r--r--src/devices/grolj4/lj4.cc24
-rw-r--r--src/devices/grops/ps.cc23
-rw-r--r--src/devices/grotty/tty.cc22
-rw-r--r--src/preproc/eqn/main.cc21
-rw-r--r--src/preproc/grn/main.cc33
-rw-r--r--src/preproc/html/pre-html.cc19
-rw-r--r--src/preproc/pic/main.cc33
-rw-r--r--src/preproc/refer/refer.cc33
-rw-r--r--src/preproc/soelim/soelim.cc21
-rw-r--r--src/preproc/tbl/main.cc19
-rw-r--r--src/roff/groff/groff.cc32
-rw-r--r--src/roff/grog/grog.pl8
-rw-r--r--src/roff/grog/grog.sh5
-rw-r--r--src/roff/nroff/nroff.sh5
-rw-r--r--src/roff/troff/input.cc23
-rw-r--r--src/utils/addftinfo/addftinfo.cc17
-rw-r--r--src/utils/hpftodit/hpftodit.cc24
-rw-r--r--src/utils/indxbib/indxbib.cc25
-rw-r--r--src/utils/lkbib/lkbib.cc29
-rw-r--r--src/utils/lookbib/lookbib.cc28
-rw-r--r--src/utils/pfbtops/pfbtops.c27
-rw-r--r--src/utils/tfmtodit/tfmtodit.cc29
29 files changed, 1008 insertions, 458 deletions
diff --git a/ChangeLog b/ChangeLog
index b84cf29e..80a78805 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,69 @@
+2001-04-10 Werner LEMBERG <wl@gnu.org>
+
+ * NEWS: Updated.
+ * doc/groff.texinfo: Many fixes, additions, clarifications, etc.
+
+2001-04-10 Bruno Haible <haible@clisp.cons.org>
+
+ * src/devices/grodvi/dvi.cc (main): Accept --help and --version.
+ (usage): Add stream argument. Don't exit.
+ * src/devices/grohtml/post-html.cc (main): Accept --help and --version.
+ Write --version output to stdout, not stderr.
+ (usage): Add stream argument. Don't exit.
+ * src/devices/grohtml-old/html.cc (main): Accept --help and --version.
+ (usage): Add stream argument. Don't exit.
+ * src/devices/grolbp/lbp.cc (long_options): Use symbolic getopt.h
+ constants.
+ (usage): Add stream argument. Don't exit.
+ (main): Write --help output to stdout, not stderr.
+ * src/devices/grolj4/lj4.cc (main): Accept --help and --version.
+ (usage): Add stream argument. Don't exit.
+ * src/devices/grops/ps.cc (main): Accept --help and --version.
+ (usage): Add stream argument. Don't exit.
+ * src/devices/grotty/tty.cc (main): Accept --help and --version.
+ (usage): Add stream argument. Don't exit.
+ * src/preproc/eqn/main.cc (usage): Add stream argument. Don't exit.
+ (main): Accept --help and --version.
+ * src/preproc/grn/main.cc (usage): Add stream argument. Don't exit.
+ (main): Accept --help and --version.
+ * src/preproc/html/pre-html.cc (usage): Add stream argument.
+ (scanArguments): Accept --help and --version.
+ * src/preproc/pic/main.cc (usage): Add stream argument. Don't exit.
+ (main): Accept --help and --version.
+ * src/preproc/refer/refer.cc (main): Accept --help and --version.
+ (usage): Add stream argument. Don't exit.
+ * src/preproc/soelim/soelim.cc (usage): Add stream argument. Don't
+ exit.
+ (main): Accept --help and --version.
+ * src/preproc/tbl/main.cc (usage): Add stream argument. Don't exit.
+ (main): Accept --help and --version.
+ * src/roff/groff/groff.cc (main): Accept --help and --version.
+ (synopsis): Add stream argument.
+ (help): Write --help output to stdout, not stderr.
+ (usage): Add stream argument. Don't exit.
+ * src/roff/grog/grog.pl: Accept --help and --version.
+ (help): New sub.
+ * src/roff/grog/grog.sh: Accept --help and --version.
+ * src/roff/nroff/nroff.sh: Accept --help and --version.
+ * src/roff/troff/input.cc (USAGE_EXIT_CODE): Remove macro.
+ (usage): Add stream argument. Don't exit.
+ (main): Accept --help and --version.
+ * src/utils/addftinfo/addftinfo.cc (main): Accept --help and --version.
+ (usage): New function with stream argument, doesn't exit.
+ * src/utils/hpftodit/hpftodit.cc (main): Accept --help and --version.
+ (usage): New function with stream argument, doesn't exit.
+ * src/utils/indxbib/indxbib.cc (main): Accept --help and --version.
+ (usage): Add stream argument. Don't exit.
+ * src/utils/lkbib/lkbib.cc (usage): Add stream argument. Don't exit.
+ (main): Accept --help and --version.
+ * src/utils/lookbib/lookbib.cc (usage): Add stream argument. Don't
+ exit.
+ (main): Accept --help and --version.
+ * src/utils/pfbtops/pfbtops.c (usage): Add stream argument. Don't exit.
+ (main): Accept --help and --version.
+ * src/utils/tfmtodit/tfmtodit.cc (main): Accept --help and --version.
+ (usage): Add stream argument. Don't exit.
+
2001-04-10 Ruslan Ermilov <ru@freebsd.org>
Fix indentation in SYNOPSIS.
diff --git a/NEWS b/NEWS
index b441fc79..4866f4f5 100644
--- a/NEWS
+++ b/NEWS
@@ -236,7 +236,8 @@ o groff will now install its data files into
will be searched before the local tmac directory.
o All programs now have option `-v' to show the version number; they will
- exit immediately afterwards, following the GNU standards.
+ exit immediately afterwards, following the GNU standards. Additionally,
+ `--version' and `--help' have been added, doing the obvious actions.
VERSION 1.16.1
==============
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index 9b1034b7..a6bedfe3 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -317,7 +317,7 @@ contributions are welcome. Send them to bug-groff@@gnu.org.
* Invoking groff::
* Tutorial for Macro Users::
* Macro Packages::
-* Programming Tutorial::
+* gtroff Reference::
* Preprocessors::
* Output Devices::
* File formats::
@@ -896,10 +896,10 @@ A replacement for @code{ditroff} with many extensions.
The @code{soelim}, @code{pic}, @code{tbl}, and @code{eqn} preprocessors.
@item
-Postprocessors for character devices, @acronym{PostScript}, @TeX{} DVI,
-and X@w{ }windows. GNU @code{troff} also eliminated the need for a
-separate @code{nroff} program with a postprocessor which would produce
-@acronym{ASCII} output.
+Postprocessors for character devices, @acronym{PostScript}, @TeX{}
+DVI, and X@w{ }windows. GNU @code{troff} also eliminated the need for
+a separate @code{nroff} program with a postprocessor which would
+produce @acronym{ASCII} output.
@item
A version of the @file{me} macros and an implementation of the
@@ -1670,8 +1670,8 @@ Four score and seven years ago,...
Sometimes a new output line should be started even though the current
line is not yet full; for example, at the end of a paragraph. To do
this it is possible to cause a @dfn{break}, which starts a new output
-line. Some requests cause a break automatically, as do blank input
-lines and input lines beginning with a space.
+line. Some requests cause a break automatically, as normally do blank
+input lines and input lines beginning with a space.
Not all input lines are text to be formatted. Some input lines are
requests which describe how to format the text. Requests always have a
@@ -1714,16 +1714,17 @@ can occur where not wanted, such as ``@w{mother- in}-law''.
request @w{@samp{.ls 2}}. Reactivate single spaced mode by typing
@w{@samp{.ls 1}}.
-A number of requests allow to change the way the output looks, sometimes
-called the @dfn{layout} of the output page. Most of these requests
-adjust the placing of @dfn{white space} (blank lines or spaces).
+A number of requests allow to change the way the output looks,
+sometimes called the @dfn{layout} of the output page. Most of these
+requests adjust the placing of @dfn{white space} (blank lines or
+spaces).
@cindex new page
The @samp{.bp} request starts a new page, causing a line break.
-@cindex blank lines
-@cindex empty lines
-@cindex lines, empty
+@cindex blank line
+@cindex empty line
+@cindex line, empty
The request @w{@samp{.sp @var{N}}} leaves @var{N}@w{ }lines of blank
space. @var{N}@w{ }can be omitted (meaning skip a single line) or can
be of the form @var{N}i (for @var{N}@w{ }inches) or @var{N}c (for
@@ -1805,12 +1806,12 @@ the following categories.
@subsection Paragraphs
@cindex paragraphs
-One of the most common and most used capability is starting a paragraph.
-There are a number of different types of paragraphs, any of which can be
-initiated with macros supplied by the macro package. Normally,
-paragraphs start with a blank line and the first line indented, like the
-text in this manual. There are also block style paragraphs, which omit
-the indentation:
+One of the most common and most used capability is starting a
+paragraph. There are a number of different types of paragraphs, any
+of which can be initiated with macros supplied by the macro package.
+Normally, paragraphs start with a blank line and the first line
+indented, like the text in this manual. There are also block style
+paragraphs, which omit the indentation:
@Example
Some men look at constitutions with sanctimonious
@@ -2017,7 +2018,7 @@ to changing the appearance of section headers.
@c =====================================================================
@c =====================================================================
-@node Macro Packages, Programming Tutorial, Tutorial for Macro Users, Top
+@node Macro Packages, gtroff Reference, Tutorial for Macro Users, Top
@chapter Macro Packages
@cindex macro packages
@cindex packages, macros
@@ -2075,8 +2076,9 @@ It is possible to use @samp{-man} instead of @w{@samp{-m man}}.
@table @code
@item -rcR=1
-This option (the default in nroff mode) creates a single, very long page
-instead of multiple pages. Use @code{-rcR=0} to disable it.
+This option (the default if a tty output device is used) creates a
+single, very long page instead of multiple pages. Use @code{-rcR=0}
+to disable it.
@item -rC1
If more than one manual page is given on the command line, number the
@@ -2439,10 +2441,10 @@ and automatically call the right preprocessor(s).
@c =====================================================================
@c =====================================================================
-@node Programming Tutorial, Preprocessors, Macro Packages, Top
-@chapter Programming Tutorial
-@cindex programming tutorial
-@cindex tutorial for programming
+@node gtroff Reference, Preprocessors, Macro Packages, Top
+@chapter @code{gtroff} Reference
+@cindex reference, @code{gtroff}
+@cindex @code{gtroff} reference
This chapter covers @strong{all} of the facilities of @code{gtroff}.
Users of macro packages may skip it if not interested in details.
@@ -2487,7 +2489,7 @@ Users of macro packages may skip it if not interested in details.
@c =====================================================================
-@node Text, Input Conventions, Programming Tutorial, Programming Tutorial
+@node Text, Input Conventions, gtroff Reference, gtroff Reference
@section Text
@cindex text, @code{gtroff} processing
@@ -2660,9 +2662,14 @@ line.
@cindex blank line
@cindex empty line
@cindex line, blank
-There are several ways to cause a break in @code{gtroff}. A blank line
-not only causes a break, but it also outputs a one line vertical
-space (effectively a blank line).
+@cindex blank line macro
+@rqindex blm
+There are several ways to cause a break in @code{gtroff}. A blank
+line not only causes a break, but it also outputs a one line vertical
+space (effectively a blank line). Note that this behaviour can be
+modified with the blank line macro request @code{blm}.
+
+@c XXX xref for blm
@cindex fill mode
@cindex mode, fill
@@ -2679,7 +2686,7 @@ discussed in @ref{Manipulating Filling and Adjusting}.
@c =====================================================================
-@node Input Conventions, Measurements, Text, Programming Tutorial
+@node Input Conventions, Measurements, Text, gtroff Reference
@section Input Conventions
@cindex input conventions
@cindex conventions for input
@@ -2707,7 +2714,7 @@ don't try using spaces to get proper indentation).
@c =====================================================================
-@node Measurements, Expressions, Input Conventions, Programming Tutorial
+@node Measurements, Expressions, Input Conventions, gtroff Reference
@section Measurements
@cindex measurements
@@ -2845,7 +2852,7 @@ certain scalar value, use @samp{u} as the unit for that value.
@c =====================================================================
-@node Expressions, Identifiers, Measurements, Programming Tutorial
+@node Expressions, Identifiers, Measurements, gtroff Reference
@section Expressions
@cindex expressions
@@ -2964,7 +2971,7 @@ expressions, unless the entire expression is surrounded by parentheses.
@c =====================================================================
-@node Identifiers, Embedded Commands, Expressions, Programming Tutorial
+@node Identifiers, Embedded Commands, Expressions, gtroff Reference
@section Identifiers
@cindex identifiers
@@ -3098,7 +3105,7 @@ defines it with a value of@w{ }0.
@c =====================================================================
-@node Embedded Commands, Registers, Identifiers, Programming Tutorial
+@node Embedded Commands, Registers, Identifiers, gtroff Reference
@section Embedded Commands
@cindex embedded commands
@cindex commands, embedded
@@ -3143,6 +3150,49 @@ optional tabs or spaces followed by an identifier which is the name of
the request. This may be followed by any number of space-separated
arguments (@emph{no} tabs here).
+@cindex structuring source code of documents or macro packages
+@cindex documents, structuring the source code
+@cindex macro packages, strucuring the source code
+Since a control character followed by whitespace only is ignored, it
+is common practice to use this feature for structuring the source code
+of documents or macro packages.
+
+@Example
+.de foo
+. tm This is foo.
+..
+.
+.
+.de bar
+. tm This is bar.
+..
+@endExample
+
+@cindex blank line
+@cindex blank line macro
+@rqindex blm
+Another possibility is to use the blank line macro request @code{blm}
+by assigning an empty macro to it.
+
+@Example
+.de do-nothing
+..
+.blm do-nothing \" activate blank line macro
+
+.de foo
+. tm This is foo.
+..
+
+
+.de bar
+. tm This is bar.
+..
+
+.blm \" deactivate blank line macro
+@endExample
+
+@c XXX xref to blm
+
@cindex zero width space character
@cindex character, zero width space
@cindex space character, zero width
@@ -3166,9 +3216,9 @@ character prevents this.
@cindex arguments to requests
Arguments to requests (and macros) are processed much like the shell:
-The line is split into arguments according to spaces. An argument which
-is intended to contain spaces can either be enclosed in quotes (single
-or double), or have the spaces @dfn{escaped} with backslashes.
+The line is split into arguments according to spaces. An argument
+which is intended to contain spaces can either be enclosed in double
+quotes, or have the spaces @dfn{escaped} with backslashes.
Here are a few examples:
@@ -3191,8 +3241,22 @@ documents. Nevertheless, it is not optimal in all situations, since
can't stretch. @code{gtroff} provides a different command @code{\~} to
insert a stretchable, non-breaking space.}
+@cindex @code{"}, as a macro argument
+@cindex double quote, as a macro argument
+A double quote which isn't preceded by a space doesn't start a macro
+argument. If not closing a string, it is printed literally.
+
+For example,
+
+@Example
+.xxx a" "b c" "de"fg"
+@endExample
+
+@noindent
+has the arguments @samp{a"}, @w{@samp{b c}}, @samp{de}, and @samp{fg"}.
+
@rqindex ds
-Note, however, that the @code{ds} request works differently.
+Duoble quotes in the @code{ds} request are handled differently.
@xref{Strings}, for more details.
@c ---------------------------------------------------------------------
@@ -3526,7 +3590,7 @@ affected (@pxref{Auto-increment}).
@c =====================================================================
-@node Registers, Manipulating Filling and Adjusting, Embedded Commands, Programming Tutorial
+@node Registers, Manipulating Filling and Adjusting, Embedded Commands, gtroff Reference
@section Registers
@cindex registers
@@ -3976,7 +4040,7 @@ example, @samp{latin1} or @samp{ps}).
@c =====================================================================
-@node Manipulating Filling and Adjusting, Manipulating Hyphenation, Registers, Programming Tutorial
+@node Manipulating Filling and Adjusting, Manipulating Hyphenation, Registers, gtroff Reference
@section Manipulating Filling and Adjusting
@cindex manipulating filling and adjusting
@cindex filling and adjusting, manipulating
@@ -4170,8 +4234,10 @@ The word space and sentence space values are associated with the current
environment (@pxref{Environments}).
Contrary to traditional Unix @code{troff}, this request is @emph{not}
-ignored in nroff mode; the given values are then rounded down to a
-multiple of@w{ }12.
+ignored if a tty output device is used; the given values are then
+rounded down to a multiple of@w{ }12.
+
+@c XXX xref implementation differences
The request is ignored if there is no parameter.
@endDefreq
@@ -4246,7 +4312,7 @@ This request causes a break.
@c =====================================================================
-@node Manipulating Hyphenation, Manipulating Spacing, Manipulating Filling and Adjusting, Programming Tutorial
+@node Manipulating Hyphenation, Manipulating Spacing, Manipulating Filling and Adjusting, gtroff Reference
@section Manipulating Hyphenation
@cindex manipulating hyphenation
@cindex hyphenation, manipulating
@@ -4498,7 +4564,7 @@ read-only number register @samp{.hla}.
@c =====================================================================
-@node Manipulating Spacing, Tabs and Fields, Manipulating Hyphenation, Programming Tutorial
+@node Manipulating Spacing, Tabs and Fields, Manipulating Hyphenation, gtroff Reference
@section Manipulating Spacing
@cindex manipulating spacing
@cindex spacing, manipulating
@@ -4596,7 +4662,7 @@ top-level diversion (@pxref{Diversions}).
@c =====================================================================
-@node Tabs and Fields, Character Translations, Manipulating Spacing, Programming Tutorial
+@node Tabs and Fields, Character Translations, Manipulating Spacing, gtroff Reference
@section Tabs and Fields
@cindex tabs and fields
@cindex fields and tabs
@@ -4738,10 +4804,12 @@ Tab stops are associated with the current environment
Calling @code{ta} without an argument removes all tab stops.
@item
-@cindex tab stops, in nroff mode
-The start-up value of @code{gtroff} is @w{@samp{T 0.5i}}. This value is
-used even in nroff mode (contrary to @acronym{UNIX} @code{nroff} which
-has tab stops preset every 0.8@dmn{i}).
+@cindex tab stops, for tty output devices
+The start-up value of @code{gtroff} is @w{@samp{T 0.5i}}. This value
+is used even for tty output devices (contrary to @acronym{UNIX}
+@code{nroff} which has tab stops preset every 0.8@dmn{i}).
+
+@c XXX xref implementation differences
@end itemize
@cindex current tab settings register
@@ -4879,7 +4947,7 @@ foo bar smurf
@c =====================================================================
-@node Character Translations, Troff and Nroff Mode, Tabs and Fields, Programming Tutorial
+@node Character Translations, Troff and Nroff Mode, Tabs and Fields, gtroff Reference
@section Character Translations
@cindex character translations
@cindex translations of characters
@@ -5087,7 +5155,7 @@ prints @samp{a}.
@c =====================================================================
-@node Troff and Nroff Mode, Line Layout, Character Translations, Programming Tutorial
+@node Troff and Nroff Mode, Line Layout, Character Translations, gtroff Reference
@section Troff and Nroff Mode
@cindex troff mode
@cindex mode, troff
@@ -5096,43 +5164,67 @@ prints @samp{a}.
Originally, @code{nroff} and @code{troff} were two separate programs,
the former for tty output, the latter for everything else. With GNU
-@code{troff}, both programs are merged into one executable.
-
-Usually, a macro package can be used with both @code{nroff} and
-@code{troff}. Nevertheless, it is sometimes necessary to make a
-distinction between the two programs (modes), and @code{gtroff}
-provides two built-in conditions @samp{n} and @samp{t} for the
-@code{if}, @code{ie}, and @code{while} requests to decide whether
-@code{gtroff} shall behave like @code{nroff} or like @code{troff}.
+@code{troff}, both programs are merged into one executable, sending
+its output to a device driver (@code{grotty} for tty devices,
+@code{grops} for @acronym{PostScript}, etc.) which interprets the
+intermediate output of @code{gtroff}. For @acronym{UNIX} @code{troff}
+it makes sense to talk about @dfn{Nroff mode} and @dfn{Troff mode}
+since the differences are hardcoded. For GNU @code{troff}, this
+distinction is not appropriate because @code{gtroff} simply takes the
+information given in the font files for a particular device without
+handling requests specially if a tty output device is used.
+
+Usually, a macro package can be used with all output devices.
+Nevertheless, it is sometimes necessary to make a distinction between
+tty and non-tty devices: @code{gtroff} provides two built-in
+conditions @samp{n} and @samp{t} for the @code{if}, @code{ie}, and
+@code{while} requests to decide whether @code{gtroff} shall behave
+like @code{nroff} or like @code{troff}.
@pindex troffrc
@pindex troffrc-end
@Defreq {troff, }
Make the @samp{t} built-in condition true (and the @samp{n} built-in
-condition false) for @code{if}, @code{ie}, and @code{while} conditional
-requests. This is the default if @code{gtroff} (@emph{not}
-@code{groff}) is started with the @option{-R} switch to avoid loading of
-the start-up files @file{troffrc} and @file{troffrc-end}. Without
-@option{-R}, @code{gtroff} stays in troff mode if the output device is
-not a tty (e.g.@: `ps').
+condition false) for @code{if}, @code{ie}, and @code{while}
+conditional requests. This is the default if @code{gtroff}
+(@emph{not} @code{groff}) is started with the @option{-R} switch to
+avoid loading of the start-up files @file{troffrc} and
+@file{troffrc-end}. Without @option{-R}, @code{gtroff} stays in troff
+mode if the output device is not a tty (e.g.@: `ps').
@endDefreq
@pindex tty.tmac
@Defreq {nroff, }
Make the @samp{n} built-in condition true (and the @samp{t} built-in
-condition false) for @code{if}, @code{ie}, and @code{while} conditional
-requests. This is the default if @code{gtroff} uses a tty output
-device; the code for switching to nroff mode is in the file
-@file{tty.tmac} which is loaded by the start-up file
-@code{troffrc}.
+condition false) for @code{if}, @code{ie}, and @code{while}
+conditional requests. This is the default if @code{gtroff} uses a tty
+output device; the code for switching to nroff mode is in the file
+@file{tty.tmac} which is loaded by the start-up file @code{troffrc}.
@endDefreq
-@xref{Conditionals and Loops}, for more details on built-in conditions.
-
+@xref{Conditionals and Loops}, for more details on built-in
+conditions.
+
+@c XXX move the following to grotty section
+
+@pindex less
+@cindex Teletype
+@cindex ISO 6249 SGR
+@cindex terminal control sequences
+@cindex control sequences, for terminals
+For tty output devices, underlining is done by emitting sequences of
+@samp{_} and @samp{\b} (the backspace character) before the actual
+character. Literally, this is printing an underline character, then
+moving back one character position, and printing the actual character
+at the same position as the underline character (similar to a
+typewriter). Usually, a modern terminal can't interpret this (and the
+original Teletype machines for which this sequence was appropriate are
+no longer in use). You need a pager program like @code{less} which
+translates this into ISO 6429 SGR sequences to control terminals.
@c =====================================================================
-@node Line Layout, Page Layout, Troff and Nroff Mode, Programming Tutorial
+@node Line Layout, Page Layout, Troff and Nroff Mode, gtroff Reference
@section Line Layout
@cindex line layout
@cindex layout, line
@@ -5190,22 +5282,19 @@ Replace me with a better (and more) example!
.ll +.5i
@endExample
-@cindex troff mode
-@cindex mode, troff
-@cindex nroff mode
-@cindex mode, nroff
+@pindex troffrc
@Defreq {po, [@Var{offset}]}
@Defreqx {po, @t{+}@Var{offset}}
@Defreqx {po, @t{-}@Var{offset}}
@Defregx {.o}
-Set horizontal page offset to @var{offset} (or increment or
-decrement the current value by @var{offset}). Note that this request
-does not cause a break, so changing the page offset in the middle of
-text being filled may not yield the expected result. The initial value
-is 1@dmn{i} if in troff mode, and 0 if in nroff mode (@pxref{Troff and
-Nroff Mode}); the default scaling indicator is@w{ }@code{m} (and not@w{
-}@code{v} as incorrectly documented in the original @acronym{UNIX} troff
-manual).
+Set horizontal page offset to @var{offset} (or increment or decrement
+the current value by @var{offset}). Note that this request does not
+cause a break, so changing the page offset in the middle of text being
+filled may not yield the expected result. The initial value is
+1@dmn{i}. For tty output devices, it is set to 0 in the startup file
+@file{troffrc}; the default scaling indicator is@w{ }@code{m} (and
+not@w{ }@code{v} as incorrectly documented in the original
+@acronym{UNIX} troff manual).
The current page offset can be found in the read-only number register
@samp{.o}.
@@ -5311,7 +5400,7 @@ collected line still uses the old line length value.
@c =====================================================================
-@node Page Layout, Page Control, Line Layout, Programming Tutorial
+@node Page Layout, Page Control, Line Layout, gtroff Reference
@section Page Layout
@cindex page layout
@cindex layout, page
@@ -5449,7 +5538,7 @@ register @code{%}.
@c =====================================================================
-@node Page Control, Fonts, Page Layout, Programming Tutorial
+@node Page Control, Fonts, Page Layout, gtroff Reference
@section Page Control
@cindex page control
@cindex control, page
@@ -5512,23 +5601,23 @@ unit is @samp{v}.
@c =====================================================================
-@node Fonts, Sizes, Page Control, Programming Tutorial
+@node Fonts, Sizes, Page Control, gtroff Reference
@section Fonts
@cindex fonts
@code{gtroff} can switch fonts at any point in the text.
The basic set of fonts is @samp{R}, @samp{I}, @samp{B}, and @samp{BI}.
-These are Times Roman, Italic, Bold, and Bold Italic. There is also at
-least one symbol font which contains various special symbols (Greek,
-mathematics). Such symbols fonts cannot be used directly, but should be
-used via an escape (@pxref{Using Symbols}).
+These are Times Roman, Italic, Bold, and Bold Italic. For non-tty
+devices, there is also at least one symbol font which contains various
+special symbols (Greek, mathematics).
@menu
* Changing Fonts::
* Font Families::
* Font Positions::
* Using Symbols::
+* Special Fonts::
* Artificial Fonts::
* Ligatures and Kerning::
@end menu
@@ -5819,11 +5908,48 @@ this is font 1 again
@c ---------------------------------------------------------------------
-@node Using Symbols, Artificial Fonts, Font Positions, Fonts
+@node Using Symbols, Special Fonts, Font Positions, Fonts
@subsection Using Symbols
@cindex using symbols
@cindex symbols, using
+@cindex glyph
+@cindex character
+@cindex ligature
+A @dfn{glyph} is a graphical representation of a @dfn{character}.
+While a character is an abstract entity containing semantic
+information, a glyph is something which can be actually seen on screen
+or paper. It is possible that a character has multiple glyph
+representation forms (for example, the character `A' can be either
+written in a roman or an italic font, yielding two different glyphs);
+sometimes more than one character maps to a single glyph (this is a
+@dfn{ligature} -- the most common is `fi').
+
+@c XXX
+
+Please note that currently the distinction between glyphs and
+characters in this reference is not clearly carried out. This will be
+improved eventually in the next revision.
+
+@cindex symbol
+@cindex special fonts
+@kindex fonts
+@pindex DESC
+@rqindex fspecial
+A @dfn{symbol} is simply a named glyph. Within @code{gtroff}, all
+glyph names of a particular font are defined in its font file. If the
+user requests a glyph not available in this font, @code{gtroff} looks
+up an ordered list of @dfn{special fonts}. By default, the
+@acronym{PostScript} output device supports the two special fonts
+@samp{SS} (slanted symbols) and @samp{S} (symbols) (the former is
+looked up before the latter). Other output devices use different
+names for special fonts. Fonts mounted with the @code{fonts} keyword
+in the @file{DESC} file are globally available. To install additional
+special fonts locally (i.e.@: for a particular font), use the
+@code{fspecial} request.
+
+@xref{Font Files}, and @ref{Special Fonts}, for more details.
+
@Defesc {\\, @lparen{}, nm, }
@Defescx {\\, @lbrack{}, name, @rbrack}
Insert a symbol @var{name} (two-character name @var{nm}). There is no
@@ -5854,13 +5980,13 @@ Typesets the character with code@w{ }@var{n} in the current font (this
is @strong{not} the input character code). @var{n} can be any
integer. Most devices only have characters with codes between 0
and@w{ }255; the Unicode output device uses codes in the range
-0--65536. If the current font does not contain a character with that
+0--65535. If the current font does not contain a character with that
code, special fonts are @emph{not} searched. The @code{\N} escape
sequence can be conveniently used in conjunction with the @code{char}
request:
@Example
-.char \[phone] \f(ZD\N'37'
+.char \[phone] \f[ZD]\N'37'
@endExample
@endDefesc
@@ -5869,9 +5995,10 @@ request:
@cindex unnamed characters
@cindex characters, unnamed
The code of each character is given in the fourth column in the font
-description file after the charset command. It is possible to include
-unnamed characters in the font description file by using a name of
-@samp{---}; the @code{\N} escape sequence is the only way to use these.
+description file after the @code{charset} command. It is possible to
+include unnamed characters in the font description file by using a
+name of @samp{---}; the @code{\N} escape sequence is the only way to
+use these.
@c XXX should be `glyph', not `character'
@@ -5880,8 +6007,8 @@ unnamed characters in the font description file by using a name of
@cindex properties of characters
Each character has certain properties associated with it. These
properties can be modified with the @code{cflags} request. The first
-argument is the the sum of the desired flags and the remaining arguments
-are the characters to have those properties.
+argument is the the sum of the desired flags and the remaining
+arguments are the characters to have those properties.
@table @code
@item 1
@@ -5928,104 +6055,183 @@ this property)
@glindex rq
an end of sentence character followed by any number of characters with
this property is treated as the end of a sentence if followed by a
-newline or two spaces; in other words the character is @dfn{transparent}
-for the purposes of end of sentence recognition -- this is the same as
-having a zero space factor in @TeX{} (initially characters
-@samp{"')]*\(dg\(rq} have this property).
+newline or two spaces; in other words the character is
+@dfn{transparent} for the purposes of end of sentence recognition --
+this is the same as having a zero space factor in @TeX{} (initially
+characters @samp{"')]*\(dg\(rq} have this property).
@end table
@cindex defining characters
@cindex characters, defining
@cindex creating new characters
-@Defreq {char, c string}
-New characters can be created with the @code{char} request. It is
-called as
-
-@Example
-.char @var{c} @var{string}
-@endExample
-
+@cindex escape character
+@cindex character, escape
@rqindex tr
+@rqindex cp
+@rqindex rc
@rqindex lc
@esindex \l
@esindex \L
+@esindex \&
+@esindex \e
@rqindex hcode
-@noindent
-This defines character@w{ }@var{c} to be @var{string}. Every time
-character@w{ }@var{c} needs to be printed, @var{string} is
-processed in a temporary environment and the result is wrapped up
-into a single object. Compatibility mode is turned off and the
-escape character is set to @samp{\} while @var{string} is being
+@Defreq {char, c [@Var{string}]}
+Define a new character@w{ }@var{c} to be @var{string} (which can be
+empty). Every time character@w{ }@var{c} needs to be printed,
+@var{string} is processed in a temporary environment and the result is
+wrapped up into a single object. Compatibility mode is turned off and
+the escape character is set to @samp{\} while @var{string} is being
processed. Any emboldening, constant spacing or track kerning is
applied to this object rather than to individual characters in
-@var{string}. A character defined by this request can be used just like
-a normal character provided by the output device. In particular other
-characters can be translated to it with the @code{tr} request; it can be
-made the leader character by the @code{lc} request; repeated patterns
-can be drawn with the character using the @code{\l} and @code{\L} escape
-sequences; words containing the character can be hyphenated correctly,
-if the @code{hcode} request is used to give the character a hyphenation
-code. There is a special anti-recursion feature: use of character
-within the character's definition is handled like normal characters
-not defined with @code{char}.
+@var{string}. A character defined by this request can be used just
+like a normal character provided by the output device. In particular,
+other characters can be translated to it with the @code{tr} request;
+it can be made the leader character by the @code{lc} request; repeated
+patterns can be drawn with the character using the @code{\l} and
+@code{\L} escape sequences; words containing the character can be
+hyphenated correctly, if the @code{hcode} request is used to give the
+character a hyphenation code. There is a special anti-recursion
+feature: Use of character within the character's definition is handled
+like normal characters not defined with @code{char}.
@endDefreq
@cindex removing character definition
@cindex character, removing definition
-@Defreq {rchar, def}
-A character definition can be removed with the @code{rchar} request.
-Its arguments are the characters to be removed. This undoes the effect
-of a @code{char} request.
+@Defreq {rchar, c1 c2 @dots{}}
+Remove the definitions of characters @var{c1}, @var{c2},@w{
+}@enddots{} This undoes the effect of a @code{char} request.
+
+It is possible to omit the whitespace between arguments.
@endDefreq
@xref{Special Characters}.
@c ---------------------------------------------------------------------
-@node Artificial Fonts, Ligatures and Kerning, Using Symbols, Fonts
+@node Special Fonts, Artificial Fonts, Using Symbols, Fonts
+@subsection Special Fonts
+@cindex special fonts
+@cindex fonts, special
+
+@c XXX
+
+To be written.
+
+@c ---------------------------------------------------------------------
+
+@node Artificial Fonts, Ligatures and Kerning, Special Fonts, Fonts
@subsection Artificial Fonts
@cindex artificial fonts
@cindex fonts, artificial
There are a number of requests for artificially creating fonts. These
-are largely vestiges of the days when output devices did not
-have a wide variety of fonts, and when @code{nroff} and @code{troff}
-were separate programs. These are no longer necessary in GNU
-@code{troff}.
+are largely vestiges of the days when output devices did not have a
+wide variety of fonts, and when @code{nroff} and @code{troff} were
+separate programs. These are no longer necessary in GNU
+@code{troff}. Nevertheless, they are supported.
@cindex underlining
-@Defreq {ul, lines}
-The @code{ul} request prints subsequent lines in italics on a device
-capable of it, or underlines the text on a character output device. The
-single argument is the number of lines to be ``underlined,'' with no
-argument, the next line is underlined.
+@Defreq {ul, [@Var{lines}]}
+The @code{ul} request normally underlines subsequent lines if a tty
+output device is used. Otherwise, the lines are printed in italics
+(only the term `underlined' is used in the following). The single
+argument is the number of input lines to be underlined; with no
+argument, the next line is underlined. If @var{lines} is zero or
+negative, stop the effects of @code{ul} (if it was active). Requests
+and empty lines do not count for computing the number of underlined
+input lines, even if they produce some output like @code{tl}. Lines
+inserted by macros (e.g.@: invoked by a trap) do count.
+
+At the beginning of @code{ul}, the current font is stored and the
+underline font is activated. Within the span of a @code{ul} request,
+it is possible to change fonts, but after the last line affected by
+@code{ul} the saved font is restored.
+
+@cindex underline font
+@cindex font, for underlining
+@rqindex uf
+This command is associated with the current environment. The
+underline font can be changed with the @code{uf} request.
+
+@c XXX @xref should be changed to grotty
+
+@xref{Troff and Nroff Mode}, for a discussion how underlining is
+implemented in for tty output devices, and which problems can arise.
+
The @code{ul} request does not underline spaces.
@endDefreq
@cindex continuous underlining
@cindex underlining, continuous
-@Defreq {cu, lines}
-The @code{cu} request is similar to @code{ul}
-but underlines spaces as well.
+@Defreq {cu, [@Var{lines}]}
+The @code{cu} request is similar to @code{ul} but underlines spaces as
+well (if a tty output device is used).
@endDefreq
-@c XXX more info
-
@cindex underline font
@cindex font for underlining
+@rqindex ul
+@rqindex cu
@Defreq {uf, font}
-The @code{uf} request sets the underline font used by @code{ul} and
-@code{cu}.
+The @code{uf} request globally sets the underline font used by
+@code{ul} and @code{cu}. By default, this is the font at position@w{
+}2. @var{font} can be either a non-negative font position or the name
+of a font.
@endDefreq
@cindex imitating bold face
@cindex bold face, imitating
-@Defreq {bd, font offset}
-The @code{bd} request artificially creates a bold font by printing each
-character twice, slightly offset. The first argument specifies the font
-to embolden, and the second is the number of basic units, minus one, by
-which the two characters is offset. If the second argument is
+@Defreq {bd, font [@Var{offset}]}
+@Defreqx {bd, font1 font2 [@Var{offset}]}
+@Defregx {.b}
+The @code{bd} request artificially creates a bold font by printing
+each character twice, slightly offset.
+
+Two syntax forms are available.
+
+@itemize @bullet
+@item
+Imitate a bold font unconditionally. The first argument specifies the
+font to embolden, and the second is the number of basic units, minus
+one, by which the two characters is offset. If the second argument is
missing, emboldening is turned off.
+
+@var{font} can be either a non-negative font position or the name of a
+font.
+
+@var{offset} is available in the @code{.b} read-only register if a
+special font is active; in the @code{bd} request, its default unit is
+@samp{u}.
+
+@rqindex fspecial
+@kindex special
+@cindex embolding of special fonts
+@cindex special fonts, emboldening
+@item
+Imitate a bold form conditionally. Embolden @var{font1} by
+@var{offset} only if font @var{font2} is the current font. This
+command can be issued repeatedly to set up different emboldening
+values for different current fonts. If the second argument is
+missing, emboldening is turned off for this particular current font.
+
+This affects special fonts only (either set up with the @code{special}
+command in font files or with the @code{fspecial} request).
+@end itemize
+@endDefreq
+
+@cindex constant character space mode
+@cindex mode for constant character space
+@cindex character, constant space
+@rqindex ps
+@Defreq {cs, font [@Var{width} [@Var{em-size}]]}
+Switch to and from constant character space mode. If activated, the
+width of every character is @math{@var{width}/36} ems. The em size is
+given absolutely by @var{em-size}; if this argument is missing, the em
+value is taken from the current font size (as set with the @code{ps}
+request) when the font is effectively in use. Without second and
+third argument, constant character space mode is deactivated.
+
+Default unit for @var{em-size} is @samp{z}; @var{width} is an integer.
@endDefreq
@c ---------------------------------------------------------------------
@@ -6035,81 +6241,78 @@ missing, emboldening is turned off.
@cindex ligatures and kerning
@cindex kerning and ligatures
-Ligatures are groups of characters that are run together.
-For example, look at the letters @code{f} and @code{i}
-in the word "file."
-This produces a cleaner look (albeit subtle) to the printed output.
-
-Most PostScript fonts support the fi and fl ligatures.
-The C/A/T typesetter that was the target of AT&T @code{troff}
-also supported ff, ffi, and ffl ligatures.
-Advanced typesetters or "expert" fonts may include ligatures
-for ft and ct, although GNU @code{troff} does not support these yet.
+Ligatures are groups of characters that are run together. For
+example, the letters `f' and `i' can form a ligature `fi' as in the
+word `file'. This produces a cleaner look (albeit subtle) to the
+printed output. Usually, ligatures are not available in fonts for tty
+output devices.
-@c XXX more info -> nroff mode
+Most @acronym{PostScript} fonts support the fi and fl ligatures. The
+C/A/T typesetter that was the target of AT&T @code{troff} also
+supported `ff', `ffi', and `ffl' ligatures. Advanced typesetters or
+`expert' fonts may include ligatures for `ft' and `ct', although GNU
+@code{troff} does not support these (yet).
@cindex ligatures enabled register
@Defreq {lg, [@Var{flag}]}
@Defregx {.lg}
The ligature mechanism can be switched on or off with the @code{lg}
-request; if the parameter is non-zero or missing, ligatures are enabled,
-otherwise disabled. Default is on. The current ligature mode can be
-found in the read-only number register @code{.lg} (set to 1 or@w{ }2 if
-ligatures are enabled, 0@w{ }otherwise).
-
-Setting the ligature mode to@w{ }2 enables the two-character
-ligatures (fi, fl, and ff) and disables the three-character
-ligatures (ffi and ffl).
+request; if the parameter is non-zero or missing, ligatures are
+enabled, otherwise disabled. Default is on. The current ligature
+mode can be found in the read-only number register @code{.lg} (set to
+1 or@w{ }2 if ligatures are enabled, 0@w{ }otherwise).
+
+Setting the ligature mode to@w{ }2 enables the two-character ligatures
+(fi, fl, and ff) and disables the three-character ligatures (ffi and
+ffl).
@endDefreq
-@dfn{Pairwise kerning} is another subtle typesetting mechanism
-that moves characters closer together when space permits.
-@iftex
-For example, look at the letters @code{T} and @code{a}
-in the word "Tape."
-The @code{a} is tucked slightly under the @code{T}.
-@end iftex
+@dfn{Pairwise kerning} is another subtle typesetting mechanism that
+modifies the distance between a character pair to improve readability.
+In most cases (but not always) the distance is decreased.
+@ifnotinfo
+For example, compare the combination of the letters `V' and `A'. With
+kerning, `VA' is printed. Without kerning it appears as `V@w{}A'.
+@end ifnotinfo
+Typewriter-like fonts and fonts for terminals where all characters
+have the same width don't use kerning.
-@c XXX more info
@cindex kerning enabled register
@Defreq {kern, [@Var{flag}]}
@Defregx {.kern}
-@Defescx {\\&, , , }
-Kerning can be activated with the @code{kern} request. If the parameter
-is non-zero or missing, enable pairwise kerning, otherwise disable it.
-The read-only number register @code{.kern} is set to@w{ }1 if pairwise
-kerning is enabled, 0@w{ }otherwise.
+Kerning can be activated with the @code{kern} request. If the
+parameter is non-zero or missing, enable pairwise kerning, otherwise
+disable it. The read-only number register @code{.kern} is set to@w{
+}1 if pairwise kerning is enabled, 0@w{ }otherwise.
@cindex zero width space character
@cindex character, zero width space
@cindex space character, zero width
If the font description file contains pairwise kerning information,
-characters from that font are kerned. Kerning between two
-characters can be inhibited by placing @code{\&} between them.
+characters from that font are kerned. Kerning between two characters
+can be inhibited by placing @code{\&} between them: @samp{V\&A}.
@endDefreq
-
@cindex track kerning
@cindex kerning, track
-Track kerning expands or reduces the space between characters.
-This can be handy, for example,
-if you need to squeeze a long word onto a single line
-or spread some text to fill a narrow column.
-@c XXX more info
-
-Track kerning must be used with great care since it is usually
-considered bad typography if the reader notices the effect.
+Track kerning expands or reduces the space between characters. This
+can be handy, for example, if you need to squeeze a long word onto a
+single line or spread some text to fill a narrow column. It must be
+used with great care since it is usually considered bad typography if
+the reader notices the effect.
@Defreq {tkf, f s1 n1 s2 n2}
Enable track kerning for font@w{ }@var{f}. If the current font is@w{
}@var{f} the width of every character is increased by an amount
-between @var{n1} and @var{n2}; if the current point size is less than or
-equal to @var{s1} the width is increased by @var{n1}; if it is
-greater than or equal to @var{s2} the width is increased by
-@var{n2}; if the point size is greater than or equal to @var{s1} and
-less than or equal to @var{s2} the increase in width is a linear
-function of the point size.
-@c XXX can n1 or n2 be negative?
+between @var{n1} and @var{n2} (@var{n1}, @var{n2} can be negative); if
+the current point size is less than or equal to @var{s1} the width is
+increased by @var{n1}; if it is greater than or equal to @var{s2} the
+width is increased by @var{n2}; if the point size is greater than or
+equal to @var{s1} and less than or equal to @var{s2} the increase in
+width is a linear function of the point size.
+
+The default unit is @samp{z} for @var{s1} and @var{s2}, @samp{p} for
+@var{n1} and @var{n2}.
@endDefreq
Sometimes, when typesetting letters of different fonts, more or less
@@ -6155,10 +6358,59 @@ isn't used widely.
@c (f to (f.
@endDefesc
+@Defesc {\\&, , , }
+This inserts a zero-width character, which is invisible. Its intended
+use is to stop interaction of a character with its surroundings.
+
+@itemize @bullet
+@item
+It prevents the insertion of extra space after an end of sentence
+character.
+
+@Example
+Test.
+Test.
+ @result{} Test. Test.
+Test.\&
+Test.
+ @result{} Test. Test.
+@endExample
+
+@item
+It prevents interpretation of a control character at the beginning of
+an input line.
+
+@Example
+.Test
+ @result{} warning: `Test' not defined
+\&.Test
+ @result{} .Test
+@endExample
+
+@item
+It prevents kerning between two characters.
+
+@ifnotinfo
+@example
+@group
+VA
+ @result{} @r{VA}
+V\&A
+ @result{} @r{V@w{}A}
+@end group
+@end example
+@end ifnotinfo
+
+@item
+It is needed to map an arbitrary character to nothing in the @code{tr}
+request (@pxref{Character Translations}).
+@end itemize
+@endDefesc
+
@c =====================================================================
-@node Sizes, Strings, Fonts, Programming Tutorial
+@node Sizes, Strings, Fonts, gtroff Reference
@section Sizes
@cindex sizes
@@ -6167,15 +6419,15 @@ isn't used widely.
@cindex size of type
@cindex vertical spacing
@cindex spacing, vertical
-@code{gtroff} uses two dimensions with each line of text, type size and
-vertical spacing. The @dfn{type size} is the height from the text
-@dfn{baseline} to the top of the tallest character (descenders may drop
-below this baseline). @dfn{Vertical spacing} is the amount of space
-@code{gtroff} allows for a line of text; normally, this is about 20%@w{
-}larger than the current type size. Ratios smaller than this can result
-in hard-to-read text; larger than this, it spreads the text out more
-vertically (useful for term papers). By default, @code{gtroff} uses
-10@w{ }point type on 12@w{ }point spacing.
+@code{gtroff} uses two dimensions with each line of text, type size
+and vertical spacing. The @dfn{type size} is the height from the text
+@dfn{baseline} to the top of the tallest character (descenders may
+drop below this baseline). @dfn{Vertical spacing} is the amount of
+space @code{gtroff} allows for a line of text; normally, this is about
+20%@w{ }larger than the current type size. Ratios smaller than this
+can result in hard-to-read text; larger than this, it spreads the text
+out more vertically (useful for term papers). By default,
+@code{gtroff} uses 10@w{ }point type on 12@w{ }point spacing.
@cindex leading
The difference between type size and vertical spacing is known, by
@@ -6197,12 +6449,14 @@ typesetters, as @dfn{leading}.
@Defescx {\\s, , size, }
@Defregx {.s}
Use the @code{ps} request or the @code{\s} escape to change the type
-size (in points). Specify the @var{size} as either an absolute point
-size, or as a relative change from the current size. The size@w{ }0, or
-no argument, goes back to the previous size.
+size (in points). Specify @var{size} as either an absolute point
+size, or as a relative change from the current size. The size@w{ }0,
+or no argument, goes back to the previous size.
+
+Default unit of @code{ps} is @samp{z}.
-The read-only number register @code{.s} returns the point size in points
-as a decimal fraction.
+The read-only number register @code{.s} returns the point size in
+points as a decimal fraction.
@Example
snap, snap,
@@ -6219,28 +6473,28 @@ and the text begins. Any of the following forms are valid:
@table @code
@item \s@var{n}
-Set the point size to @var{n}@w{ }points. @var{n}@w{ }must be either 0
-or in the range 4 to@w{ }39.
+Set the point size to @var{n}@w{ }points. @var{n}@w{ }must be either
+0 or in the range 4 to@w{ }39.
@item \s+@var{n}
@itemx \s-@var{n}
-Increase or decrease the point size by @var{n}@w{ }points.
-@var{n}@w{ }must be exactly one digit.
+Increase or decrease the point size by @var{n}@w{ }points. @var{n}@w{
+}must be exactly one digit.
@item \s(@var{nn}
-Set the point size to @var{nn}@w{ }points. @var{nn} must be exactly two
-digits.
+Set the point size to @var{nn}@w{ }points. @var{nn} must be exactly
+two digits.
@item \s+(@var{nn}
@itemx \s-(@var{nn}
@itemx \s(+@var{nn}
@itemx \s(-@var{nn}
-Increase or decrease the point size by @var{nn}@w{ }points.
-@var{nn} must be exactly two digits.
+Increase or decrease the point size by @var{nn}@w{ }points. @var{nn}
+must be exactly two digits.
@end table
-@xref{Fractional Type Sizes}, for yet another syntactical form of using
-the @code{\s} escape.
+@xref{Fractional Type Sizes}, for yet another syntactical form of
+using the @code{\s} escape.
Some devices may only have certain permissible sizes, in which case
@code{gtroff} rounds to the nearest permissible size.
@@ -6281,17 +6535,17 @@ spacing.
@esindex \H
@esindex \s
A @dfn{scaled point} is equal to 1/@var{sizescale} points, where
-@var{sizescale} is specified in the @file{DESC} file (1@w{ }by default.)
-There is a new scale indicator @samp{z} which has the effect of
-multiplying by @var{sizescale}. Requests and escape sequences in
-@code{gtroff} interpret arguments that represent a point size as being
-in units of scaled points, but they evaluate each such argument using a
-default scale indicator of @samp{z}. Arguments treated in this way are
-the argument to the @code{ps} request, the third argument to the
-@code{cs} request, the second and fourth arguments to the @code{tkf}
-request, the argument to the @code{\H} escape sequence, and those
-variants of the @code{\s} escape sequence that take a numeric expression
-as their argument (see below).
+@var{sizescale} is specified in the @file{DESC} file (1@w{ }by
+default.) There is a new scale indicator @samp{z} which has the
+effect of multiplying by @var{sizescale}. Requests and escape
+sequences in @code{gtroff} interpret arguments that represent a point
+size as being in units of scaled points, but they evaluate each such
+argument using a default scale indicator of @samp{z}. Arguments
+treated in this way are the argument to the @code{ps} request, the
+third argument to the @code{cs} request, the second and fourth
+arguments to the @code{tkf} request, the argument to the @code{\H}
+escape sequence, and those variants of the @code{\s} escape sequence
+that take a numeric expression as their argument (see below).
For example, suppose @var{sizescale} is@w{ }1000; then a scaled point
is equivalent to a millipoint; the request @w{@samp{.ps 10.25}} is
@@ -6352,7 +6606,7 @@ Increase or or decrease the point size by @var{n} scaled points;
@c =====================================================================
-@node Strings, Conditionals and Loops, Sizes, Programming Tutorial
+@node Strings, Conditionals and Loops, Sizes, gtroff Reference
@section Strings
@cindex strings
@@ -6510,7 +6764,7 @@ interpolated as strings.
@c =====================================================================
-@node Conditionals and Loops, Writing Macros, Strings, Programming Tutorial
+@node Conditionals and Loops, Writing Macros, Strings, gtroff Reference
@section Conditionals and Loops
@cindex conditionals and loops
@cindex loops and conditionals
@@ -6529,11 +6783,13 @@ True if the current page is even or odd numbered (respectively).
@item n
@rqindex nroff
-True if the document is being processed in nroff mode.
+True if the document is being processed in nroff mode (i.e., the
+@code{.nroff} command has been issued).
@item t
@rqindex troff
-True if the document is being processed in troff mode.
+True if the document is being processed in troff mode (i.e., the
+@code{.troff} command has been issued).
@item "@var{xxx}"@var{yyy}"
True if the string @var{xxx} is equal to the string @var{yyy}. Other
@@ -6696,7 +6952,7 @@ loop, immediately restarting the next iteration.
@c =====================================================================
-@node Writing Macros, Page Motions, Conditionals and Loops, Programming Tutorial
+@node Writing Macros, Page Motions, Conditionals and Loops, gtroff Reference
@section Writing Macros
@cindex writing macros
@cindex macros, writing
@@ -6872,7 +7128,7 @@ The @code{als} request can make a macro have more than one name.
This would be called as
@Example
-.vl $Id: groff.texinfo,v 1.70 2001/03/26 20:04:01 wlemb Exp $
+.vl $Id: groff.texinfo,v 1.71 2001/04/10 12:54:11 wlemb Exp $
@endExample
@endDefesc
@@ -6881,7 +7137,7 @@ This would be called as
@c =====================================================================
-@node Page Motions, Drawing Requests, Writing Macros, Programming Tutorial
+@node Page Motions, Drawing Requests, Writing Macros, gtroff Reference
@section Page Motions
@cindex page motions
@cindex motions, page
@@ -6953,21 +7209,23 @@ There are a number of special case escapes for horizontal motion:
@ftable @code
@item \@key{SP}
-an unbreakable and unpaddable (i.e.@: not expanded during filling)
+An unbreakable and unpaddable (i.e.@: not expanded during filling)
space. (Note: This is a backslash followed by a space.)
@item \~
-an unbreakable space that stretches like a normal inter-word space when
-a line is adjusted.
+An unbreakable space that stretches like a normal inter-word space
+when a line is adjusted.
@item \|
-a 1/6@dmn{th} em space. Ignored in nroff mode.
+A 1/6@dmn{th} em space. Ignored for tty output devices (rounded to
+zero).
@item \^
-a 1/12@dmn{th} em space. Ignored in nroff mode.
+A 1/12@dmn{th} em space. Ignored for tty output devices (rounded to
+zero).
@item \0
-a space the size of a digit.
+A space the size of a digit.
@item \&
@cindex zero width space character
@@ -7069,7 +7327,7 @@ position.
@c =====================================================================
-@node Drawing Requests, Traps, Page Motions, Programming Tutorial
+@node Drawing Requests, Traps, Page Motions, gtroff Reference
@section Drawing Requests
@cindex drawing requests
@cindex requests for drawing
@@ -7270,7 +7528,7 @@ to build large brackets and braces.
@c =====================================================================
-@node Traps, Diversions, Drawing Requests, Programming Tutorial
+@node Traps, Diversions, Drawing Requests, gtroff Reference
@section Traps
@cindex traps
@@ -7474,7 +7732,7 @@ Date:\t\t\a
@c =====================================================================
-@node Diversions, Environments, Traps, Programming Tutorial
+@node Diversions, Environments, Traps, gtroff Reference
@section Diversions
@cindex diversions
@@ -7632,7 +7890,7 @@ hacks; for example, the following sets register @code{n} to@w{ }1.
@c =====================================================================
-@node Environments, Suppressing output, Diversions, Programming Tutorial
+@node Environments, Suppressing output, Diversions, gtroff Reference
@section Environments
@cindex environments
@@ -7721,7 +7979,7 @@ Copies the environment @var{env} into the current environment.
@c =====================================================================
-@node Suppressing output, I/O, Environments, Programming Tutorial
+@node Suppressing output, I/O, Environments, gtroff Reference
@section Suppressing output
@cindex suppressing output
@@ -7763,7 +8021,7 @@ written since the last call to @code{\O}.
@c =====================================================================
-@node I/O, Postprocessor Access, Suppressing output, Programming Tutorial
+@node I/O, Postprocessor Access, Suppressing output, gtroff Reference
@section I/O
@cindex i/o
@cindex input and output requests
@@ -7960,7 +8218,7 @@ is interpreted in copy-in mode.
@c =====================================================================
-@node Postprocessor Access, Miscellaneous, I/O, Programming Tutorial
+@node Postprocessor Access, Miscellaneous, I/O, gtroff Reference
@section Postprocessor Access
@cindex postprocessor access
@cindex access of postprocessor
@@ -7991,7 +8249,7 @@ that do not know about this extension.
@c =====================================================================
-@node Miscellaneous, Debugging, Postprocessor Access, Programming Tutorial
+@node Miscellaneous, Debugging, Postprocessor Access, gtroff Reference
@section Miscellaneous
@cindex miscellaneous
@@ -8077,7 +8335,7 @@ intelligible to the user.
@c =====================================================================
-@node Debugging, Implementation Differences, Miscellaneous, Programming Tutorial
+@node Debugging, Implementation Differences, Miscellaneous, gtroff Reference
@section Debugging
@cindex debugging
@@ -8314,7 +8572,7 @@ All warnings.
@c =====================================================================
-@node Implementation Differences, Summary, Debugging, Programming Tutorial
+@node Implementation Differences, Summary, Debugging, gtroff Reference
@section Implementation Differences
@cindex implementation differences
@cindex differences in implementation
@@ -8460,7 +8718,7 @@ is unsuitable, the new @code{\?} escape sequence.
@c =====================================================================
-@node Summary, , Implementation Differences, Programming Tutorial
+@node Summary, , Implementation Differences, gtroff Reference
@section Summary
@cindex summary
@@ -8471,7 +8729,7 @@ is unsuitable, the new @code{\?} escape sequence.
@c =====================================================================
@c =====================================================================
-@node Preprocessors, Output Devices, Programming Tutorial, Top
+@node Preprocessors, Output Devices, gtroff Reference, Top
@chapter Preprocessors
@cindex preprocessors
diff --git a/src/devices/grodvi/dvi.cc b/src/devices/grodvi/dvi.cc
index 68774de0..74422f80 100644
--- a/src/devices/grodvi/dvi.cc
+++ b/src/devices/grodvi/dvi.cc
@@ -846,7 +846,7 @@ printer *make_printer()
return new dvi_printer;
}
-static void usage();
+static void usage(FILE *stream);
int main(int argc, char **argv)
{
@@ -854,7 +854,12 @@ int main(int argc, char **argv)
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
int c;
- while ((c = getopt(argc, argv, "F:vw:d")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((c = getopt_long(argc, argv, "F:vw:d", long_options, NULL)) != EOF)
switch(c) {
case 'v':
{
@@ -876,8 +881,13 @@ int main(int argc, char **argv)
case 'F':
font::command_line_font_dir(optarg);
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
@@ -895,9 +905,8 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-dv] [-F dir] [-w n] [files ...]\n",
+ fprintf(stream, "usage: %s [-dv] [-F dir] [-w n] [files ...]\n",
program_name);
- exit(1);
}
diff --git a/src/devices/grohtml-old/html.cc b/src/devices/grohtml-old/html.cc
index 89247256..102c043a 100755
--- a/src/devices/grohtml-old/html.cc
+++ b/src/devices/grohtml-old/html.cc
@@ -6533,7 +6533,7 @@ printer *make_printer()
return new html_printer;
}
-static void usage();
+static void usage(FILE *stream);
int main(int argc, char **argv)
{
@@ -6541,7 +6541,13 @@ int main(int argc, char **argv)
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
int c;
- while ((c = getopt(argc, argv, "F:atTvdgmx?I:r:")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((c = getopt_long(argc, argv, "F:atTvdgmx?I:r:", long_options, NULL))
+ != EOF)
switch(c) {
case 'v':
{
@@ -6585,8 +6591,13 @@ int main(int argc, char **argv)
// leave margins alone
margin_on = TRUE;
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
@@ -6601,9 +6612,8 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-avdgmt?] [-r resolution] [-F dir] [-I imagetype] [files ...]\n",
+ fprintf(stream, "usage: %s [-avdgmt?] [-r resolution] [-F dir] [-I imagetype] [files ...]\n",
program_name);
- exit(1);
}
diff --git a/src/devices/grohtml/post-html.cc b/src/devices/grohtml/post-html.cc
index 63965652..716e138d 100644
--- a/src/devices/grohtml/post-html.cc
+++ b/src/devices/grohtml/post-html.cc
@@ -1058,7 +1058,7 @@ printer *make_printer()
return new html_printer;
}
-static void usage();
+static void usage(FILE *stream);
void html_printer::set_style(const style &sty)
{
@@ -2785,13 +2785,19 @@ int main(int argc, char **argv)
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
int c;
- while ((c = getopt(argc, argv, "o:i:F:vd?lrn")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((c = getopt_long(argc, argv, "o:i:F:vd?lrn", long_options, NULL))
+ != EOF)
switch(c) {
case 'v':
{
extern const char *Version_string;
- fprintf(stderr, "post-grohtml version %s\n", Version_string);
- fflush(stderr);
+ printf("GNU post-grohtml (groff) version %s\n", Version_string);
+ exit(0);
break;
}
case 'F':
@@ -2803,9 +2809,6 @@ int main(int argc, char **argv)
case 'r':
auto_rule = FALSE;
break;
- case '?':
- usage();
- break;
case 'o':
/* handled by pre-html */
break;
@@ -2815,6 +2818,14 @@ int main(int argc, char **argv)
case 'n':
simple_anchors = TRUE;
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
+ case '?':
+ usage(stderr);
+ exit(1);
+ break;
default:
assert(0);
}
@@ -2828,9 +2839,8 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-vld?n] [-F dir] [files ...]\n",
+ fprintf(stream, "usage: %s [-vld?n] [-F dir] [files ...]\n",
program_name);
- exit(1);
}
diff --git a/src/devices/grolbp/lbp.cc b/src/devices/grolbp/lbp.cc
index edd49fd2..69196af4 100644
--- a/src/devices/grolbp/lbp.cc
+++ b/src/devices/grolbp/lbp.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1994, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 2000, 2001 Free Software Foundation, Inc.
Written by Francisco Andrés Verdú <pandres@dragonet.es> with many ideas
taken from the other groff drivers.
@@ -663,19 +663,19 @@ static void handle_unknown_desc_command(const char *command, const char *arg,
};
static struct option long_options[] = {
- {"orientation",1,NULL,'o'},
- {"version",0,NULL,'v'},
- {"copies",1,NULL,'c'},
- {"landscape",0,NULL,'l'},
- {"papersize",1,NULL,'p'},
- {"fontdir",1,NULL,'F'},
- {"help",0,NULL,'h'},
- {0, 0, 0, 0}
+ { "orientation", required_argument, NULL, 'o' },
+ { "version", no_argument, NULL, 'v' },
+ { "copies", required_argument, NULL, 'c' },
+ { "landscape", no_argument, NULL, 'l' },
+ { "papersize", required_argument, NULL, 'p' },
+ { "fontdir", required_argument, NULL, 'F' },
+ { "help", no_argument, NULL, 'h' },
+ { NULL, 0, 0, 0 }
};
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr,
+ fprintf(stream,
"usage: %s [-lvh] [-c n] [-p paper_size] [-F dir] [-o or] "\
" [files ...]\n"\
" -o --orientation=[portrait|landscape]\n"\
@@ -686,7 +686,6 @@ static void usage()
" -F --fontdir=dir\n"\
" -h --help\n",
program_name);
- exit(1);
}; // usage
int main(int argc, char **argv)
@@ -717,8 +716,8 @@ int main(int argc, char **argv)
break;
case 'v' : {
extern const char *Version_string;
- printf("GNU grolbp (groff) version %s\n",\
- Version_string);
+ printf("GNU grolbp (groff) version %s\n",
+ Version_string);
exit(0);
break;
};
@@ -744,9 +743,12 @@ int main(int argc, char **argv)
ncopies = unsigned(n);
break;
}
- case 'h' : usage();
+ case 'h' : usage(stdout);
+ exit(0);
break;
-
+ case '?' : usage(stderr);
+ exit(1);
+ break;
}; // switch (c)
}; // while (c > 0 )
diff --git a/src/devices/grolj4/lj4.cc b/src/devices/grolj4/lj4.cc
index 4bbb5f5a..9fbc6afa 100644
--- a/src/devices/grolj4/lj4.cc
+++ b/src/devices/grolj4/lj4.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1994, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -595,7 +595,7 @@ void handle_unknown_desc_command(const char *command, const char *arg,
}
}
-static void usage();
+static void usage(FILE *stream);
extern "C" int optopt, optind;
@@ -606,7 +606,13 @@ int main(int argc, char **argv)
setbuf(stderr, stderr_buf);
font::set_unknown_desc_command_handler(handle_unknown_desc_command);
int c;
- while ((c = getopt(argc, argv, ":F:p:d:lvw:c:")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((c = getopt_long(argc, argv, ":F:p:d:lvw:c:", long_options, NULL))
+ != EOF)
switch(c) {
case 'l':
landscape_flag = 1;
@@ -671,8 +677,13 @@ int main(int argc, char **argv)
line_width_factor = int(n);
break;
}
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
@@ -690,11 +701,10 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr,
+ fprintf(stream,
"usage: %s [-lv] [-d [n]] [-c n] [-p paper_size]\n"
" [-w n] [-F dir] [files ...]\n",
program_name);
- exit(1);
}
diff --git a/src/devices/grops/ps.cc b/src/devices/grops/ps.cc
index eb3b6cc8..98b1a910 100644
--- a/src/devices/grops/ps.cc
+++ b/src/devices/grops/ps.cc
@@ -1476,7 +1476,7 @@ printer *make_printer()
return new ps_printer;
}
-static void usage();
+static void usage(FILE *stream);
int main(int argc, char **argv)
{
@@ -1485,7 +1485,13 @@ int main(int argc, char **argv)
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
int c;
- while ((c = getopt(argc, argv, "F:P:glmc:w:vb:")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((c = getopt_long(argc, argv, "F:P:glmc:w:vb:", long_options, NULL))
+ != EOF)
switch(c) {
case 'v':
{
@@ -1531,8 +1537,13 @@ int main(int argc, char **argv)
broken_flags = atoi(optarg);
bflag = 1;
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
@@ -1551,11 +1562,9 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(
- stderr,
+ fprintf(stream,
"usage: %s [-glmv] [-b n] [-c n] [-w n] [-P prologue] [-F dir] [files ...]\n",
program_name);
- exit(1);
}
diff --git a/src/devices/grotty/tty.cc b/src/devices/grotty/tty.cc
index 497275ce..a8ee0653 100644
--- a/src/devices/grotty/tty.cc
+++ b/src/devices/grotty/tty.cc
@@ -424,7 +424,7 @@ printer *make_printer()
return new tty_printer(device);
}
-static void usage();
+static void usage(FILE *stream);
int main(int argc, char **argv)
{
@@ -432,7 +432,13 @@ int main(int argc, char **argv)
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
int c;
- while ((c = getopt(argc, argv, "F:vhfbuoBUd")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((c = getopt_long(argc, argv, "F:vhfbuoBUd", long_options, NULL))
+ != EOF)
switch(c) {
case 'v':
{
@@ -475,8 +481,13 @@ int main(int argc, char **argv)
// Ignore \D commands.
draw_flag = 0;
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
@@ -491,9 +502,8 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-hfvbuodBU] [-F dir] [files ...]\n",
+ fprintf(stream, "usage: %s [-hfvbuodBU] [-F dir] [files ...]\n",
program_name);
- exit(1);
}
diff --git a/src/preproc/eqn/main.cc b/src/preproc/eqn/main.cc
index a0d27ee4..e5c03aa4 100644
--- a/src/preproc/eqn/main.cc
+++ b/src/preproc/eqn/main.cc
@@ -234,12 +234,11 @@ static char *delim_search(char *ptr, int delim)
return 0;
}
-void usage()
+void usage(FILE *stream)
{
- fprintf(stderr,
+ fprintf(stream,
"usage: %s [ -rvDCNR ] -dxx -fn -sn -pn -mn -Mdir -Ts [ files ... ]\n",
program_name);
- exit(1);
}
int main(int argc, char **argv)
@@ -249,7 +248,14 @@ int main(int argc, char **argv)
setbuf(stderr, stderr_buf);
int opt;
int load_startup_file = 1;
- while ((opt = getopt(argc, argv, "DCRvd:f:p:s:m:T:M:rN")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "DCRvd:f:p:s:m:T:M:rN", long_options,
+ NULL))
+ != EOF)
switch (opt) {
case 'C':
compatible_flag = 1;
@@ -317,8 +323,13 @@ int main(int argc, char **argv)
case 'N':
no_newline_in_delim_flag = 1;
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
diff --git a/src/preproc/grn/main.cc b/src/preproc/grn/main.cc
index 209d60c0..76c067ff 100644
--- a/src/preproc/grn/main.cc
+++ b/src/preproc/grn/main.cc
@@ -220,12 +220,11 @@ void interpret(char *line);
void
-usage()
+usage(FILE *stream)
{
- fprintf(stderr,
+ fprintf(stream,
"usage: %s [ -vCs ] [ -M dir ] [ -F dir ] [ -T dev ] [ file ]\n",
program_name);
- exit(1);
}
@@ -260,14 +259,6 @@ main(int argc,
file[gfil++] = NULL;
break;
- case 'v':
- {
- extern const char *Version_string;
- printf("GNU grn (groff) version %s\n", Version_string);
- fflush(stdout);
- exit(0);
- break;
- }
case 'C': /* compatibility mode */
compatibility_flag = TRUE;
break;
@@ -288,13 +279,25 @@ main(int argc,
sflag = 1;
break;
+ case '-':
+ if (strcmp(*argv,"--version")==0) {
+ case 'v':
+ extern const char *Version_string;
+ printf("GNU grn (groff) version %s\n", Version_string);
+ exit(0);
+ break;
+ }
+ if (strcmp(*argv,"--help")==0) {
case '?':
- usage();
- break;
-
+ usage(stdout);
+ exit(0);
+ break;
+ }
+ // fallthrough
default:
error("unknown switch: %1", c);
- usage();
+ usage(stderr);
+ exit(1);
}
}
diff --git a/src/preproc/html/pre-html.cc b/src/preproc/html/pre-html.cc
index 2f00f786..6aae6cb4 100644
--- a/src/preproc/html/pre-html.cc
+++ b/src/preproc/html/pre-html.cc
@@ -985,14 +985,14 @@ static char_buffer inputFile;
/*
- * usage - emit usage arguments and exit.
+ * usage - emit usage arguments.
*/
-void usage()
+void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s troffname [-P-o vertical_image_offset] [-P-i image_resolution] [troff flags] [files]\n", program_name);
- fprintf(stderr, " vertical_image_offset (default %d/72 of an inch)\n", vertical_offset);
- fprintf(stderr, " image_resolution (default %d) pixels per inch\n", image_res);
+ fprintf(stream, "usage: %s troffname [-P-o vertical_image_offset] [-P-i image_resolution] [troff flags] [files]\n", program_name);
+ fprintf(stream, " vertical_image_offset (default %d/72 of an inch)\n", vertical_offset);
+ fprintf(stream, " image_resolution (default %d) pixels per inch\n", image_res);
}
/*
@@ -1008,12 +1008,15 @@ int scanArguments (int argc, char **argv)
image_res = atoi((char *)(argv[i]+2));
} else if (strncmp(argv[i], "-o", 2) == 0) {
vertical_offset = atoi((char *)(argv[i]+2));
- } else if (strcmp(argv[i], "-v") == 0) {
+ } else if ((strcmp(argv[i], "-v") == 0)
+ || (strcmp(argv[i], "--version") == 0)) {
extern const char *Version_string;
printf("GNU pre-grohtml (groff) version %s\n", Version_string);
exit(0);
- } else if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "-?") == 0)) {
- usage();
+ } else if ((strcmp(argv[i], "-h") == 0)
+ || (strcmp(argv[i], "--help") == 0)
+ || (strcmp(argv[i], "-?") == 0)) {
+ usage(stdout);
exit(0);
} else if (strcmp(argv[i], "troff") == 0) {
/* remember troff argument number */
diff --git a/src/preproc/pic/main.cc b/src/preproc/pic/main.cc
index 95ec3c31..87d2b930 100644
--- a/src/preproc/pic/main.cc
+++ b/src/preproc/pic/main.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -464,16 +464,15 @@ void do_whole_file(const char *filename)
}
#endif
-void usage()
+void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [ -nvC ] [ filename ... ]\n", program_name);
+ fprintf(stream, "usage: %s [ -nvC ] [ filename ... ]\n", program_name);
#ifdef TEX_SUPPORT
- fprintf(stderr, " %s -t [ -cvzC ] [ filename ... ]\n", program_name);
+ fprintf(stream, " %s -t [ -cvzC ] [ filename ... ]\n", program_name);
#endif
#ifdef FIG_SUPPORT
- fprintf(stderr, " %s -f [ -v ] [ filename ]\n", program_name);
+ fprintf(stream, " %s -f [ -v ] [ filename ]\n", program_name);
#endif
- exit(1);
}
#ifdef __MSDOS__
@@ -518,7 +517,13 @@ int main(int argc, char **argv)
int whole_file_flag = 0;
int fig_flag = 0;
#endif
- while ((opt = getopt(argc, argv, "T:CDSUtcvnxzpf")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "T:CDSUtcvnxzpf", long_options, NULL))
+ != EOF)
switch (opt) {
case 'C':
compatible_flag = 1;
@@ -572,8 +577,13 @@ int main(int argc, char **argv)
// zero length lines will be printed as dots
zero_length_line_flag++;
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
@@ -601,9 +611,10 @@ int main(int argc, char **argv)
if (whole_file_flag) {
if (optind >= argc)
do_whole_file("-");
- else if (argc - optind > 1)
- usage();
- else
+ else if (argc - optind > 1) {
+ usage(stderr);
+ exit(1);
+ } else
do_whole_file(argv[optind]);
}
else {
diff --git a/src/preproc/refer/refer.cc b/src/preproc/refer/refer.cc
index 19ac01be..b6cefc58 100644
--- a/src/preproc/refer/refer.cc
+++ b/src/preproc/refer/refer.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -99,7 +99,7 @@ static void immediately_output_references();
static unsigned store_reference(const string &);
static void divert_to_temporary_file();
static reference *make_reference(const string &, unsigned *);
-static void usage();
+static void usage(FILE *stream);
static void do_file(const char *);
static void split_punct(string &line, string &punct);
static void output_citation_group(reference **v, int n, label_type, FILE *fp);
@@ -172,7 +172,8 @@ int main(int argc, char **argv)
}
else {
error("option `f' requires an argument");
- usage();
+ usage(stderr);
+ exit(1);
}
}
else {
@@ -300,7 +301,8 @@ int main(int argc, char **argv)
}
else {
error("option `p' requires an argument");
- usage();
+ usage(stderr);
+ exit(1);
}
}
else {
@@ -334,23 +336,29 @@ int main(int argc, char **argv)
opt = ptr;
break;
}
+ case '-':
+ if (opt[1] == '\0') {
+ finished_options = 1;
+ opt++;
+ break;
+ }
+ if (strcmp(opt,"-version")==0) {
case 'v':
- {
extern const char *Version_string;
printf("GNU refer (groff) version %s\n", Version_string);
exit(0);
break;
}
- case '-':
- if (opt[1] == '\0') {
- finished_options = 1;
- opt++;
+ if (strcmp(opt,"-help")==0) {
+ usage(stdout);
+ exit(0);
break;
}
// fall through
default:
error("unrecognized option `%1'", *opt);
- usage();
+ usage(stderr);
+ exit(1);
break;
}
}
@@ -378,13 +386,12 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr,
+ fprintf(stream,
"usage: %s [-benvCPRS] [-aN] [-cXYZ] [-fN] [-iXYZ] [-kX] [-lM,N] [-p file]\n"
" [-sXYZ] [-tN] [-BL.M] [files ...]\n",
program_name);
- exit(1);
}
static void possibly_load_default_database()
diff --git a/src/preproc/soelim/soelim.cc b/src/preproc/soelim/soelim.cc
index 7fa05af3..e05f2406 100644
--- a/src/preproc/soelim/soelim.cc
+++ b/src/preproc/soelim/soelim.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -58,10 +58,9 @@ include_path_append(char *path)
}
-void usage()
+void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [ -vC ] [ -I file ] [ files ]\n", program_name);
- exit(1);
+ fprintf(stream, "usage: %s [ -vC ] [ -I file ] [ files ]\n", program_name);
}
int main(int argc, char **argv)
@@ -69,7 +68,12 @@ int main(int argc, char **argv)
program_name = argv[0];
include_path_append(".");
int opt;
- while ((opt = getopt(argc, argv, "CI:v")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "CI:v", long_options, NULL)) != EOF)
switch (opt) {
case 'v':
{
@@ -84,8 +88,13 @@ int main(int argc, char **argv)
case 'I':
include_path_append(optarg);
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
diff --git a/src/preproc/tbl/main.cc b/src/preproc/tbl/main.cc
index d13f026c..efc8fdcc 100644
--- a/src/preproc/tbl/main.cc
+++ b/src/preproc/tbl/main.cc
@@ -1447,10 +1447,9 @@ void process_table(table_input &in)
error("premature end of file");
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [ -vC ] [ files... ]\n", program_name);
- exit(1);
+ fprintf(stream, "usage: %s [ -vC ] [ files... ]\n", program_name);
}
int main(int argc, char **argv)
@@ -1459,7 +1458,12 @@ int main(int argc, char **argv)
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
int opt;
- while ((opt = getopt(argc, argv, "vCT:")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "vCT:", long_options, NULL)) != EOF)
switch (opt) {
case 'C':
compatible_flag = 1;
@@ -1474,8 +1478,13 @@ int main(int argc, char **argv)
case 'T':
// I'm sick of getting bug reports from IRIX users
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
diff --git a/src/roff/groff/groff.cc b/src/roff/groff/groff.cc
index ff0b9d67..0cdfb94b 100644
--- a/src/roff/groff/groff.cc
+++ b/src/roff/groff/groff.cc
@@ -96,7 +96,7 @@ void handle_unknown_desc_command(const char *command, const char *arg,
const char *filename, int lineno);
const char *xbasename(const char *);
-void usage();
+void usage(FILE *stream);
void help();
int main(int argc, char **argv)
@@ -117,8 +117,14 @@ int main(int argc, char **argv)
if (!command_prefix)
command_prefix = PROG_PREFIX;
commands[TROFF_INDEX].set_name(command_prefix, "troff");
- while ((opt = getopt(argc, argv,
- "abCd:eEf:F:gGhiI:lL:m:M:n:No:pP:r:RsStT:UvVw:W:XzZ"))
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, 'h' },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv,
+ "abCd:eEf:F:gGhiI:lL:m:M:n:No:pP:r:RsStT:UvVw:W:XzZ",
+ long_options, NULL))
!= EOF) {
char buf[3];
buf[0] = '-';
@@ -171,7 +177,7 @@ int main(int argc, char **argv)
{
extern const char *Version_string;
printf("GNU groff version %s\n", Version_string);
- printf("Copyright (C) 2000 Free Software Foundation, Inc.\n"
+ printf("Copyright (C) 1989-2001 Free Software Foundation, Inc.\n"
"GNU groff comes with ABSOLUTELY NO WARRANTY.\n"
"You may redistribute copies of groff and its subprograms\n"
"under the terms of the GNU General Public License.\n"
@@ -256,7 +262,8 @@ int main(int argc, char **argv)
Xflag++;
break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
@@ -647,9 +654,9 @@ char **possible_command::get_argv()
return argv;
}
-void synopsis()
+void synopsis(FILE *stream)
{
- fprintf(stderr,
+ fprintf(stream,
"usage: %s [-abeghilpstvzCENRSUVXZ] [-Fdir] [-mname] [-Tdev] [-ffam]\n"
" [-wname] [-Wname] [-Mdir] [-dcs] [-rcn] [-nnum] [-olist] [-Parg]\n"
" [-Larg] [-Idir] [files...]\n",
@@ -658,7 +665,7 @@ void synopsis()
void help()
{
- synopsis();
+ synopsis(stdout);
fputs("\n"
"-h\tprint this message\n"
"-t\tpreprocess with tbl\n"
@@ -697,15 +704,14 @@ void help()
"-U\tenable unsafe mode\n"
"-Idir\tsearch dir for soelim. Implies -s\n"
"\n",
- stderr);
+ stdout);
exit(0);
}
-void usage()
+void usage(FILE *stream)
{
- synopsis();
- fprintf(stderr, "%s -h gives more help\n", program_name);
- exit(1);
+ synopsis(stream);
+ fprintf(stream, "%s -h gives more help\n", program_name);
}
extern "C" {
diff --git a/src/roff/grog/grog.pl b/src/roff/grog/grog.pl
index da31514b..57cd1594 100644
--- a/src/roff/grog/grog.pl
+++ b/src/roff/grog/grog.pl
@@ -13,7 +13,8 @@ push(@command, "groff");
while ($ARGV[0] =~ /^-./) {
$arg = shift(@ARGV);
$sp = "" if $arg eq "-C";
- &usage(0) if $arg eq "-v";
+ &usage(0) if $arg eq "-v" || $arg eq "--version";
+ &help() if $arg eq "--help";
last if $arg eq "--";
push(@command, $arg);
}
@@ -133,6 +134,11 @@ sub usage {
exit $exit_status;
}
+sub help {
+ print "usage: grog [ option ...] [files...]\n";
+ exit 0;
+}
+
if ($pic || $tbl || $eqn || $grn || $grap || $refer) {
$s = "-";
$s .= "s" if $soelim;
diff --git a/src/roff/grog/grog.sh b/src/roff/grog/grog.sh
index 01056df9..7919dbf5 100644
--- a/src/roff/grog/grog.sh
+++ b/src/roff/grog/grog.sh
@@ -16,9 +16,12 @@ do
break;;
-C)
sp=; opts="$opts -C"; shift; break;;
- -v)
+ -v | --version)
echo "GNU grog (groff) version @VERSION@"
exit 0;;
+ --help)
+ echo "usage: grog [ option ...] [files...]"
+ exit 0;;
-*)
opts="$opts $arg"; shift;;
*)
diff --git a/src/roff/nroff/nroff.sh b/src/roff/nroff/nroff.sh
index 4f15e464..0e9eebdd 100644
--- a/src/roff/nroff/nroff.sh
+++ b/src/roff/nroff/nroff.sh
@@ -66,9 +66,12 @@ for i
# Solaris 2.2 `man' uses -u0; ignore it,
# since `less' and `more' can use the emboldening info.
;;
- -v)
+ -v | --version)
echo "GNU nroff (groff) version @VERSION@"
exit 0 ;;
+ --help)
+ echo "usage: nroff [-h] [-i] [-mNAME] [-nNUM] [-oLIST] [-rCN] [-Tname] [FILE...]"
+ exit 0 ;;
--)
shift
break ;;
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index bcbdb2a1..472298d7 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -58,7 +58,6 @@ extern "C" {
#endif /* not isatty */
#endif /* not ISATTY_MISSING */
-#define USAGE_EXIT_CODE 1
#define MACRO_PREFIX "tmac."
#define MACRO_POSTFIX ".tmac"
#define INITIAL_STARTUP_FILE "troffrc"
@@ -6031,13 +6030,12 @@ static void add_string(const char *s, string_list **p)
*p = new string_list(s);
}
-void usage(const char *prog)
+void usage(FILE *stream, const char *prog)
{
- errprint(
-"usage: %1 -abivzCERU -wname -Wname -dcs -ffam -mname -nnum -olist\n"
+ fprintf(stream,
+"usage: %s -abivzCERU -wname -Wname -dcs -ffam -mname -nnum -olist\n"
" -rcn -Tname -Fdir -Mdir [files...]\n",
prog);
- exit(USAGE_EXIT_CODE);
}
int main(int argc, char **argv)
@@ -6068,7 +6066,13 @@ int main(int argc, char **argv)
if (putenv(strsave(e.contents())))
fatal("putenv failed");
}
- while ((c = getopt(argc, argv, "abivw:W:zCEf:m:n:o:r:d:F:M:T:tqs:RU"))
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((c = getopt_long(argc, argv, "abivw:W:zCEf:m:n:o:r:d:F:M:T:tqs:RU",
+ long_options, NULL))
!= EOF)
switch(c) {
case 'v':
@@ -6154,8 +6158,13 @@ int main(int argc, char **argv)
case 'U':
safer_flag = 0; // unsafe behaviour
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout,argv[0]);
+ exit(0);
+ break;
case '?':
- usage(argv[0]);
+ usage(stderr,argv[0]);
+ exit(1);
break; // never reached
default:
assert(0);
diff --git a/src/utils/addftinfo/addftinfo.cc b/src/utils/addftinfo/addftinfo.cc
index 73a05870..43a81bcb 100644
--- a/src/utils/addftinfo/addftinfo.cc
+++ b/src/utils/addftinfo/addftinfo.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -31,6 +31,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "cset.h"
#include "guess.h"
+static void usage(FILE *stream);
static void usage();
static void version();
static void convert_font(const font_params &, FILE *, FILE *);
@@ -67,8 +68,12 @@ int main(int argc, char **argv)
{
program_name = argv[0];
for (int i = 1; i < argc; i++) {
- if (!strcmp(argv[i], "-v"))
+ if (!strcmp(argv[i], "-v") || !strcmp(argv[i],"--version"))
version();
+ if (!strcmp(argv[i],"--help")) {
+ usage(stdout);
+ exit(0);
+ }
}
if (argc < 4)
usage();
@@ -123,11 +128,15 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-v] [-param value] ... "
+ fprintf(stream, "usage: %s [-v] [-param value] ... "
"resolution unitwidth font\n",
program_name);
+}
+static void usage()
+{
+ usage(stderr);
exit(1);
}
diff --git a/src/utils/hpftodit/hpftodit.cc b/src/utils/hpftodit/hpftodit.cc
index f2a7afee..f81f5ad8 100644
--- a/src/utils/hpftodit/hpftodit.cc
+++ b/src/utils/hpftodit/hpftodit.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1994, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -173,6 +173,7 @@ static int special_flag = 0;
static int italic_flag = 0;
static int italic_sep;
+static void usage(FILE *stream);
static void usage();
static const char *xbasename(const char *);
static void read_tags(File &);
@@ -206,7 +207,12 @@ int main(int argc, char **argv)
int opt;
int debug_flag = 0;
- while ((opt = getopt(argc, argv, "dsvi:")) != EOF) {
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "dsvi:", long_options, NULL)) != EOF) {
switch (opt) {
case 'd':
debug_flag = 1;
@@ -225,8 +231,13 @@ int main(int argc, char **argv)
exit(0);
}
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
usage();
+ break;
default:
assert(0);
}
@@ -264,10 +275,15 @@ int main(int argc, char **argv)
}
static
-void usage()
+void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-s] [-i n] tfm_file map_file output_font\n",
+ fprintf(stream, "usage: %s [-s] [-i n] tfm_file map_file output_font\n",
program_name);
+}
+static
+void usage()
+{
+ usage(stderr);
exit(1);
}
diff --git a/src/utils/indxbib/indxbib.cc b/src/utils/indxbib/indxbib.cc
index 321a7c28..99a6baf4 100644
--- a/src/utils/indxbib/indxbib.cc
+++ b/src/utils/indxbib/indxbib.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -98,7 +98,7 @@ int truncate_len = 6;
int shortest_len = 3;
int max_keys_per_item = 100;
-static void usage();
+static void usage(FILE *stream);
static void write_hash_table();
static void init_hash_table();
static void read_common_words_file();
@@ -131,7 +131,14 @@ int main(int argc, char **argv)
const char *directory = 0;
const char *foption = 0;
int opt;
- while ((opt = getopt(argc, argv, "c:o:h:i:k:l:t:n:c:d:f:vw")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "c:o:h:i:k:l:t:n:c:d:f:vw",
+ long_options, NULL))
+ != EOF)
switch (opt) {
case 'c':
common_words_file = optarg;
@@ -178,8 +185,13 @@ int main(int argc, char **argv)
exit(0);
break;
}
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
default:
assert(0);
@@ -323,13 +335,12 @@ int main(int argc, char **argv)
return failed;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr,
+ fprintf(stream,
"usage: %s [-vw] [-c file] [-d dir] [-f file] [-h n] [-i XYZ] [-k n]\n"
" [-l n] [-n n] [-o base] [-t n] [files...]\n",
program_name);
- exit(1);
}
static void check_integer_arg(char opt, const char *arg, int min, int *res)
diff --git a/src/utils/lkbib/lkbib.cc b/src/utils/lkbib/lkbib.cc
index bc9bd535..4d3cadcb 100644
--- a/src/utils/lkbib/lkbib.cc
+++ b/src/utils/lkbib/lkbib.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -32,11 +32,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "refid.h"
#include "search.h"
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-nv] [-p database] [-i XYZ] [-t N] keys ...\n",
+ fprintf(stream, "usage: %s [-nv] [-p database] [-i XYZ] [-t N] keys ...\n",
program_name);
- exit(1);
}
int main(int argc, char **argv)
@@ -47,7 +46,13 @@ int main(int argc, char **argv)
int search_default = 1;
search_list list;
int opt;
- while ((opt = getopt(argc, argv, "nvVi:t:p:")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "nvVi:t:p:", long_options, NULL))
+ != EOF)
switch (opt) {
case 'V':
verify_flag = 1;
@@ -81,13 +86,21 @@ int main(int argc, char **argv)
case 'p':
list.add_file(optarg);
break;
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
+ break;
default:
assert(0);
}
- if (optind >= argc)
- usage();
+ if (optind >= argc) {
+ usage(stderr);
+ exit(1);
+ }
char *filename = getenv("REFER");
if (filename)
list.add_file(filename);
diff --git a/src/utils/lookbib/lookbib.cc b/src/utils/lookbib/lookbib.cc
index 96192aee..dc55ed93 100644
--- a/src/utils/lookbib/lookbib.cc
+++ b/src/utils/lookbib/lookbib.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -36,11 +36,10 @@ extern "C" {
int isatty(int);
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-v] [-i XYZ] [-t N] database ...\n",
+ fprintf(stream, "usage: %s [-v] [-i XYZ] [-t N] database ...\n",
program_name);
- exit(1);
}
int main(int argc, char **argv)
@@ -49,7 +48,12 @@ int main(int argc, char **argv)
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
int opt;
- while ((opt = getopt(argc, argv, "vVi:t:")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "vVi:t:", long_options, NULL)) != EOF)
switch (opt) {
case 'V':
verify_flag = 1;
@@ -77,13 +81,21 @@ int main(int argc, char **argv)
exit(0);
break;
}
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
+ break;
default:
assert(0);
}
- if (optind >= argc)
- usage();
+ if (optind >= argc) {
+ usage(stderr);
+ exit(1);
+ }
search_list list;
for (int i = optind; i < argc; i++)
list.add_file(argv[i]);
diff --git a/src/utils/pfbtops/pfbtops.c b/src/utils/pfbtops/pfbtops.c
index bb2a85ab..2159dbd8 100644
--- a/src/utils/pfbtops/pfbtops.c
+++ b/src/utils/pfbtops/pfbtops.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <getopt.h>
+#include <limits.h>
#include "nonposix.h"
@@ -18,10 +19,9 @@ static void error(s)
exit(2);
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-v] [pfb_file]\n", program_name);
- exit(1);
+ fprintf(stream, "usage: %s [-v] [pfb_file]\n", program_name);
}
int main(argc, argv)
@@ -30,10 +30,15 @@ int main(argc, argv)
{
int opt;
extern int optind;
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
program_name = argv[0];
- while ((opt = getopt(argc, argv, "v")) != EOF) {
+ while ((opt = getopt_long(argc, argv, "v", long_options, NULL)) != EOF) {
switch (opt) {
case 'v':
{
@@ -42,13 +47,21 @@ int main(argc, argv)
exit(0);
break;
}
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
+ break;
}
}
- if (argc - optind > 1)
- usage();
+ if (argc - optind > 1) {
+ usage(stderr);
+ exit(1);
+ }
if (argc > optind && !freopen(argv[optind], "r", stdin))
{
perror(argv[optind]);
diff --git a/src/utils/tfmtodit/tfmtodit.cc b/src/utils/tfmtodit/tfmtodit.cc
index d8f2a5fe..96768d2b 100644
--- a/src/utils/tfmtodit/tfmtodit.cc
+++ b/src/utils/tfmtodit/tfmtodit.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-1992, 2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -680,7 +680,7 @@ struct {
{ CH_ff, CH_l, CH_ffl, "ffl" },
};
-static void usage();
+static void usage(FILE *stream);
int main(int argc, char **argv)
{
@@ -689,7 +689,12 @@ int main(int argc, char **argv)
int skewchar = -1;
int opt;
const char *gf_file = 0;
- while ((opt = getopt(argc, argv, "svg:k:")) != EOF)
+ static const struct option long_options[] = {
+ { "help", no_argument, 0, CHAR_MAX + 1 },
+ { "version", no_argument, 0, 'v' },
+ { NULL, 0, 0, 0 }
+ };
+ while ((opt = getopt_long(argc, argv, "svg:k:", long_options, NULL)) != EOF)
switch (opt) {
case 'g':
gf_file = optarg;
@@ -717,14 +722,21 @@ int main(int argc, char **argv)
exit(0);
break;
}
+ case CHAR_MAX + 1: // --help
+ usage(stdout);
+ exit(0);
+ break;
case '?':
- usage();
+ usage(stderr);
+ exit(1);
break;
case EOF:
assert(0);
}
- if (argc - optind != 3)
- usage();
+ if (argc - optind != 3) {
+ usage(stderr);
+ exit(1);
+ }
gf g;
if (gf_file) {
if (!g.load(gf_file))
@@ -855,9 +867,8 @@ int main(int argc, char **argv)
return 0;
}
-static void usage()
+static void usage(FILE *stream)
{
- fprintf(stderr, "usage: %s [-sv] [-g gf_file] [-k skewchar] tfm_file map_file font\n",
+ fprintf(stream, "usage: %s [-sv] [-g gf_file] [-k skewchar] tfm_file map_file font\n",
program_name);
- exit(1);
}