summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwlemb <wlemb>2000-06-18 10:13:50 +0000
committerwlemb <wlemb>2000-06-18 10:13:50 +0000
commit0970054b23ca95cd320c2b2e88f813d71398ada3 (patch)
treeae63d1b17504d1f5f262bdd1baa8bb2e9e7892ce
parentd98dd82860df3e6e59efbe4c102dbcf2e7da573b (diff)
downloadgroff-0970054b23ca95cd320c2b2e88f813d71398ada3.tar.gz
* src/utils/tfmtodit/tfmtodit.cc: #include nonposix.h.
(tfm::load, gf::load): Open tfm and gf files in binary mode: these are binary files. (main): Support non-Posix systems with several different styles of slash characters in file names. * src/utils/pfbtops/pfbtops.c: #include nonposix.h. (main) [SET_BINARY]: Switch stdin into binary mode. * src/utils/indxbib/indxbib.cc: #include nonposix.h. (main): Support file names with several possible slash-type characters, as given by DIR_SEPS[] in nonposix.h. (main) [__MSDOS__]: If renaming the temporary index file fails because it has more than one dot in its trunk, replace the dot with an underscore and try again. (do_file): Use FOPEN_RB instead of "r". Skip every CR before a Newline. [__MSDOS__ || _MSC_VER]: Stop at the first ^Z character. * src/utils/hpftodit/hpftodit.cc: #include nonposix.h. (File::File): Open the input file in binary mode. Strip CR characters from each CR-LF pair. (xbasename): Support file names with several possible slash-type characters, as given by DIR_SEPS[] in nonposix.h. * src/include/Makefile.sub (HDRS): Add nonposix.h. * src/roff/troff/node.cc [HAVE_UNISTD_H]: Include <unistd.h>. (WIFEXITED, WEXITSTATUS, WTERMSIG, WIFSTOPPED, WSTOPSIG) [!_POSIX_VERSION]: Define for traditional Unix systems. (real_output_file::real_output_file): Remove the MSVC-specific call to popen, use instead POPEN_WT, appropriately defined on nonposix.h. #include nonposix.h. (real_output_file::~real_output_file): Remove the MSVC-specific call to pclose, a suitable macro is now defined on nonposix.h. Use the portable macros WIFEXITED, WIFSIGNALED, WTERMSIG, WSTOPSIG and WEXITSTATUS instead of assuming traditional Unix interpretation of the status returned by pclose. * src/roff/troff/input.cc (pipe_source): Remove the MSVC-specific call to popen, use POPEN_RT instead (appropriately defined on nonposix.h). #include nonposix.h. (ps_bbox_request): Open the PostScript file in binary mode. Close the file after processing it. (getpid) [_MSC_VER]: Remove; a suitable macro is now defined on nonposix.h. * src/roff/groff/pipeline.c (run_pipeline) [__MSDOS__ || _WIN32]: A version of run_pipeline that doesn't use `fork'. (signal_catcher) [__MSDOS__ || _WIN32]: New function. (system_shell_name, system_shell_dash_c) (is_system_shell) [__MSDOS__ || _WIN32]: New functions, to hide the ugliness of testing DOS/Windows file names for equality, and support both stock shells and ports of Unix shells. * src/roff/groff/groff.cc: #include nonposix.h. (BSHELL): Definition moved to nonposix.h. (main): Use PATH_SEP[0] instead of literal ':'. Use BSHELL_DASH_C instead of a literal "-c". (xbasename): Support file names with several possible slash-type characters, as given by DIR_SEPS[] in nonposix.h. (possible_command::print): Use BSHELL_DASH_C and IS_BSHELL instead of literal strings. * src/preproc/soelim/soelim.cc: #include nonposix.h. (do_file): Use IS_ABSOLUTE instead of testing for a literal '/'. * src/preproc/pic/Makefile.sub (YTABH): Change pic.tab.h to pic_tab.h. * src/preproc/pic/lex.cc: Change pic.tab.h to pic_tab.h. * src/preproc/eqn/Makefile.sub (YTABH): Rename eqn.tab.h to eqn_tab.h. * src/preproc/eqn/lex.cc: #include eqn_tab.h, not eqn.tab.h. * src/libs/libgroff/tmpfile.cc (DEFAULT_TMPDIR) [P_tmpdir]: If P_tmpdir is defined, use it instead of the literal "/tmp". (remove_tmp_files, add_tmp_file): New functions. (xtmpfile): Record temporary files and register an atexit function to delete them explicitly, instead of relying on the OS to do that, which doesn't work on non-Unix systems. * src/libs/libgroff/searchpath.cc: #include nonposix.h. (search_path::search_path): Use PATH_SEP instead of a literal colon. (search_path::command_line_dir): Ditto. (search_path::open_file): Use IS_ABSOLUTE, PATH_SEP and DIR_SEPS, to support non-Posix systems. * src/libc/libbib/search.cc: #include nonposix.h. (search_list::add_file): Open the file in binary mode. * src/libs/libbib/linear.cc: #include nonposix.h. (file_buffer::load): Remove r characters preceding n from the loaded buffer. * src/libs/libbib/index.cc: #include nonposix.h. (make_index_search_item): Open index_filename in O_BINARY mode. (index_search_item_iterator::get_tag): Ditto. Remove r characters before n characters. (index_search_item::check_files): Open files in binary mode. (index_search_item::munge_filename): Support DOS-style file names with backslashes and drive letters, use IS_ABSOLUTE. * src/devices/grops/ps.cc: #include nonposix.h. (main) [SET_BINARY]: Switch stdout to binary mode. * src/devices/grolj4/lj4.cc: #include nonposix.h. (main) [SET_BINARY]: Switch stdout to binary mode. * src/devices/grolbp/lbp.cc: #include nonposix.h (fill_pattern) [SET_BINARY]: Switch stdout to binary mode. * src/devices/grodvi/dvi.cc: #include nonposix.h. [_MSC_VER]: Remove inclusion of Windows-specific headers (done by nonposix.h). (main) [SET_BINARY]: Switch stdout to binary mode. [_MSC_VER]: Remove an explicit call to _setmode. * src/include/nonposix.h: New file. * Makefile.in (ENVSETUP): New variable, to set up case-sensitive operation when building with DJGPP. ($(TARGETS), dot, $(LIBDIRS), $(CPROGDIRS), $(CCPROGDIRS)) ($(DEVDIRS), $(TTYDEVDIRS), $(INCDIRS), $(OTHERDIRS)): Use ENVSETUP. * Makefile.comm: mv y.tab.[ch] to y_tab.[ch], to make it work on MS-DOS. (.man.n): Replace `;' with `|', since FONTPATH, MACROPATH, etc. can include a semi-colon on DOS/Windows. (depend.temp): Use depend1.temp instead of depend.temp1, to prevent files from overerwiting each other on 8+3 filesystems. * gendef.sh (t): Change definition to work with DOS/Windows. doc/groff.texinfo: Apart of some typo corrections, I also changed some index entris, to make them more non-ambiguous, and also put @ignore around some parts that are not yet written, to allow the Info output be readable.
-rw-r--r--ChangeLog145
-rw-r--r--INSTALL3
-rw-r--r--MORE.STUFF12
-rw-r--r--Makefile.comm54
-rw-r--r--Makefile.in25
-rw-r--r--doc/groff.texinfo927
-rw-r--r--gendef.sh6
-rw-r--r--src/devices/grodvi/dvi.cc5
-rw-r--r--src/devices/grolbp/lbp.cc6
-rw-r--r--src/devices/grolj4/lj4.cc4
-rw-r--r--src/devices/grops/ps.cc4
-rw-r--r--src/include/Makefile.sub1
-rw-r--r--src/libs/libbib/index.cc29
-rw-r--r--src/libs/libbib/linear.cc14
-rw-r--r--src/libs/libbib/search.cc3
-rw-r--r--src/libs/libgroff/font.cc2
-rw-r--r--src/libs/libgroff/searchpath.cc17
-rw-r--r--src/libs/libgroff/tmpfile.cc73
-rw-r--r--src/preproc/eqn/Makefile.sub2
-rwxr-xr-xsrc/preproc/eqn/eqn_tab.h (renamed from src/preproc/eqn/eqn.tab.h)0
-rw-r--r--src/preproc/eqn/lex.cc2
-rw-r--r--src/preproc/pic/Makefile.sub2
-rw-r--r--src/preproc/pic/lex.cc2
-rwxr-xr-xsrc/preproc/pic/pic_tab.h (renamed from src/preproc/pic/pic.tab.h)0
-rw-r--r--src/preproc/soelim/soelim.cc3
-rw-r--r--src/roff/groff/groff.cc26
-rw-r--r--src/roff/groff/pipeline.c182
-rw-r--r--src/roff/troff/input.cc23
-rw-r--r--src/roff/troff/node.cc34
-rw-r--r--src/utils/hpftodit/hpftodit.cc37
-rw-r--r--src/utils/indxbib/indxbib.cc50
-rw-r--r--src/utils/pfbtops/pfbtops.c5
-rw-r--r--src/utils/tfmtodit/tfmtodit.cc18
33 files changed, 1201 insertions, 515 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b1b4451..96b117e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,148 @@
+2000-06-17 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * src/utils/tfmtodit/tfmtodit.cc: #include nonposix.h.
+ (tfm::load, gf::load): Open tfm and gf files in binary mode: these
+ are binary files.
+ (main): Support non-Posix systems with several different styles of
+ slash characters in file names.
+
+ * src/utils/pfbtops/pfbtops.c: #include nonposix.h.
+ (main) [SET_BINARY]: Switch stdin into binary mode.
+
+ * src/utils/indxbib/indxbib.cc: #include nonposix.h.
+ (main): Support file names with several possible slash-type
+ characters, as given by DIR_SEPS[] in nonposix.h.
+ (main) [__MSDOS__]: If renaming the temporary index file fails
+ because it has more than one dot in its trunk, replace the dot
+ with an underscore and try again.
+ (do_file): Use FOPEN_RB instead of "r". Skip every CR before a
+ Newline.
+ [__MSDOS__ || _MSC_VER]: Stop at the first ^Z character.
+
+ * src/utils/hpftodit/hpftodit.cc: #include nonposix.h.
+ (File::File): Open the input file in binary mode. Strip CR
+ characters from each CR-LF pair.
+ (xbasename): Support file names with several possible slash-type
+ characters, as given by DIR_SEPS[] in nonposix.h.
+
+ * src/include/Makefile.sub (HDRS): Add nonposix.h.
+
+ * src/roff/troff/node.cc [HAVE_UNISTD_H]: Include <unistd.h>.
+ (WIFEXITED, WEXITSTATUS, WTERMSIG, WIFSTOPPED, WSTOPSIG)
+ [!_POSIX_VERSION]: Define for traditional Unix systems.
+ (real_output_file::real_output_file): Remove the MSVC-specific
+ call to popen, use instead POPEN_WT, appropriately defined on
+ nonposix.h. #include nonposix.h.
+ (real_output_file::~real_output_file): Remove the MSVC-specific
+ call to pclose, a suitable macro is now defined on nonposix.h.
+ Use the portable macros WIFEXITED, WIFSIGNALED, WTERMSIG, WSTOPSIG
+ and WEXITSTATUS instead of assuming traditional Unix
+ interpretation of the status returned by pclose.
+
+ * src/roff/troff/input.cc (pipe_source): Remove the MSVC-specific
+ call to popen, use POPEN_RT instead (appropriately defined on
+ nonposix.h). #include nonposix.h.
+ (ps_bbox_request): Open the PostScript file in binary mode.
+ Close the file after processing it.
+ (getpid) [_MSC_VER]: Remove; a suitable macro is now defined on
+ nonposix.h.
+
+ * src/roff/groff/pipeline.c (run_pipeline) [__MSDOS__ || _WIN32]:
+ A version of run_pipeline that doesn't use `fork'.
+ (signal_catcher) [__MSDOS__ || _WIN32]: New function.
+ (system_shell_name, system_shell_dash_c)
+ (is_system_shell) [__MSDOS__ || _WIN32]: New functions, to hide
+ the ugliness of testing DOS/Windows file names for equality, and
+ support both stock shells and ports of Unix shells.
+
+ * src/roff/groff/groff.cc: #include nonposix.h.
+ (BSHELL): Definition moved to nonposix.h.
+ (main): Use PATH_SEP[0] instead of literal ':'. Use BSHELL_DASH_C
+ instead of a literal "-c".
+ (xbasename): Support file names with several possible slash-type
+ characters, as given by DIR_SEPS[] in nonposix.h.
+ (possible_command::print): Use BSHELL_DASH_C and IS_BSHELL instead
+ of literal strings.
+
+ * src/preproc/soelim/soelim.cc: #include nonposix.h.
+ (do_file): Use IS_ABSOLUTE instead of testing for a literal '/'.
+
+ * src/preproc/pic/Makefile.sub (YTABH): Change pic.tab.h to
+ pic_tab.h.
+
+ * src/preproc/pic/lex.cc: Change pic.tab.h to pic_tab.h.
+
+ * src/preproc/eqn/Makefile.sub (YTABH): Rename eqn.tab.h to
+ eqn_tab.h.
+
+ * src/preproc/eqn/lex.cc: #include eqn_tab.h, not eqn.tab.h.
+
+ * src/libs/libgroff/tmpfile.cc (DEFAULT_TMPDIR) [P_tmpdir]: If
+ P_tmpdir is defined, use it instead of the literal "/tmp".
+ (remove_tmp_files, add_tmp_file): New functions.
+ (xtmpfile): Record temporary files and register an atexit function
+ to delete them explicitly, instead of relying on the OS to do
+ that, which doesn't work on non-Unix systems.
+
+ * src/libs/libgroff/searchpath.cc: #include nonposix.h.
+ (search_path::search_path): Use PATH_SEP instead of a literal
+ colon.
+ (search_path::command_line_dir): Ditto.
+ (search_path::open_file): Use IS_ABSOLUTE, PATH_SEP and DIR_SEPS,
+ to support non-Posix systems.
+
+ * src/libc/libbib/search.cc: #include nonposix.h.
+ (search_list::add_file): Open the file in binary mode.
+
+ * src/libs/libbib/linear.cc: #include nonposix.h.
+ (file_buffer::load): Remove \r characters preceding \n from the
+ loaded buffer.
+
+ * src/libs/libbib/index.cc: #include nonposix.h.
+ (make_index_search_item): Open index_filename in O_BINARY mode.
+ (index_search_item_iterator::get_tag): Ditto. Remove \r
+ characters before \n characters.
+ (index_search_item::check_files): Open files in binary mode.
+ (index_search_item::munge_filename): Support DOS-style file names
+ with backslashes and drive letters, use IS_ABSOLUTE.
+
+ * src/devices/grops/ps.cc: #include nonposix.h.
+ (main) [SET_BINARY]: Switch stdout to binary mode.
+
+ * src/devices/grolj4/lj4.cc: #include nonposix.h.
+ (main) [SET_BINARY]: Switch stdout to binary mode.
+
+ * src/devices/grolbp/lbp.cc: #include nonposix.h
+ (fill_pattern) [SET_BINARY]: Switch stdout to binary mode.
+
+ * src/devices/grodvi/dvi.cc: #include nonposix.h.
+ [_MSC_VER]: Remove inclusion of Windows-specific headers (done by
+ nonposix.h).
+ (main) [SET_BINARY]: Switch stdout to binary mode.
+ [_MSC_VER]: Remove an explicit call to _setmode.
+
+ * src/include/nonposix.h: New file.
+
+ * Makefile.in (ENVSETUP): New variable, to set up case-sensitive
+ operation when building with DJGPP.
+ ($(TARGETS), dot, $(LIBDIRS), $(CPROGDIRS), $(CCPROGDIRS))
+ ($(DEVDIRS), $(TTYDEVDIRS), $(INCDIRS), $(OTHERDIRS)): Use
+ ENVSETUP.
+
+ * Makefile.comm: mv y.tab.[ch] to y_tab.[ch], to make it work on
+ MS-DOS.
+ (.man.n): Replace `;' with `|', since FONTPATH, MACROPATH,
+ etc. can include a semi-colon on DOS/Windows.
+ (depend.temp): Use depend1.temp instead of depend.temp1, to
+ prevent files from overerwiting each other on 8+3 filesystems.
+
+ * gendef.sh (t): Change definition to work with DOS/Windows.
+
+ doc/groff.texinfo: Apart of some typo corrections, I also changed
+ some index entris, to make them more non-ambiguous, and also put
+ @ignore around some parts that are not yet written, to allow the
+ Info output be readable.
+
2000-06-10 Gael Queri <gqueri@mail.dotcom.fr>
Replaced specific checks for function declarations with a generic
diff --git a/INSTALL b/INSTALL
index 2cc25232..0465f4e5 100644
--- a/INSTALL
+++ b/INSTALL
@@ -2,6 +2,9 @@ To install groff, follow the instructions in the file INSTALL.gen.
This file contains information that supplements those instructions.
+(For instructions how to build groff with DJGPP tools for MS-DOS and
+MS-Windows, see the file arch/djgpp/README.)
+
groff is written in C++, so you will need a C++ compiler. The C++
source files use a suffix of `.cc', so your C++ compiler must be able
to handle this. If you don't already have a C++ compiler, I suggest
diff --git a/MORE.STUFF b/MORE.STUFF
index dab7c09b..c2e96ef4 100644
--- a/MORE.STUFF
+++ b/MORE.STUFF
@@ -4,10 +4,16 @@ More stuff for groff
win32
-----
-Another win32 port using the gcc compiler and other GNU tools, maintained by
-Thomer M. Gil <tmgil@cs.vu.nl>, is available from
+Here two ports using the gcc compiler and other GNU tools:
- http://www.cs.vu.nl/~tmgil/misc/wingroff.html
+ Thomer M. Gil <tmgil@cs.vu.nl>:
+
+ http://www.cs.vu.nl/~tmgil/misc/wingroff.html
+
+ Kees Zeelenberg <c.zeelenberg@hccnet.nl>:
+
+ ftp://ftp.franken.de/pub/win32/develop/gnuwin32/
+ cygwin/porters/Zeelenberg_Kees/B20/index.html
grap
----
diff --git a/Makefile.comm b/Makefile.comm
index 28b7b198..b6cb4eb6 100644
--- a/Makefile.comm
+++ b/Makefile.comm
@@ -99,14 +99,16 @@ extraclean:
else \
$(YACC) $(YACCFLAGS) $<; \
fi
- mv y.tab.c $@
+ -test -f y.tab.h && mv y.tab.h y_tab.h
+ -test -f y.tab.c && mv y.tab.c y_tab.c
+ mv y_tab.c $@
# Avoid ending up with two versions of $(YTABH).
if test -n "$(YTABH)"; then \
if test -f $(srcdir)/$(YTABH); then \
rm -f $(YTABH); \
- mv y.tab.h $(srcdir)/$(YTABH); \
+ mv y_tab.h $(srcdir)/$(YTABH); \
else \
- mv y.tab.h $(YTABH); \
+ mv y_tab.h $(YTABH); \
fi; \
fi
@@ -117,27 +119,27 @@ revision=`sed -e 's/^0$$//' -e 's/^[1-9].*$$/.&/' $(top_srcdir)/REVISION`
.man.n:
@echo Making $@ from $<
@-rm -f $@
- @sed -e "s;@FONTDIR@;$(fontdir);g" \
- -e "s;@FONTPATH@;$(fontpath);g" \
- -e "s;@MACRODIR@;$(tmacdir);g" \
- -e "s;@MACROPATH@;$(tmacpath);g" \
- -e "s;@DEVICE@;$(DEVICE);g" \
- -e "s;@DEFAULT_INDEX@;$(indexdir)/$(indexname);g" \
- -e "s;@DEFAULT_INDEX_NAME@;$(indexname);g" \
- -e "s;@INDEX_SUFFIX@;$(indexext);g" \
- -e "s;@COMMON_WORDS_FILE@;$(common_words_file);g" \
- -e "s;@MAN1EXT@;$(man1ext);g" \
- -e "s;@MAN5EXT@;$(man5ext);g" \
- -e "s;@MAN7EXT@;$(man7ext);g" \
- -e "s;@TMAC_S_PREFIX@;$(tmac_s_prefix);g" \
- -e "s;@TMAC_M_PREFIX@;$(tmac_m_prefix);g" \
- -e "s;@TMAC_AN_PREFIX@;$(tmac_an_prefix);g" \
- -e "s;@TMAC_MDIR@;$(tmacdir)/mm;g" \
- -e "s;@BROKEN_SPOOLER_FLAGS@;$(BROKEN_SPOOLER_FLAGS);g" \
- -e "s;@VERSION@;$(version)$(revision);g" \
- -e "s;@MDATE@;`$(SHELL) $(top_srcdir)/mdate.sh $<`;g" \
- -e "s;@g@;$(g);g" \
- -e "s;@G@;`echo $(g) | tr [a-z] [A-Z]`;g" \
+ @sed -e "s|@FONTDIR@|$(fontdir)|g" \
+ -e "s|@FONTPATH@|$(fontpath)|g" \
+ -e "s|@MACRODIR@|$(tmacdir)|g" \
+ -e "s|@MACROPATH@|$(tmacpath)|g" \
+ -e "s|@DEVICE@|$(DEVICE)|g" \
+ -e "s|@DEFAULT_INDEX@|$(indexdir)/$(indexname)|g" \
+ -e "s|@DEFAULT_INDEX_NAME@|$(indexname)|g" \
+ -e "s|@INDEX_SUFFIX@|$(indexext)|g" \
+ -e "s|@COMMON_WORDS_FILE@|$(common_words_file)|g" \
+ -e "s|@MAN1EXT@|$(man1ext)|g" \
+ -e "s|@MAN5EXT@|$(man5ext)|g" \
+ -e "s|@MAN7EXT@|$(man7ext)|g" \
+ -e "s|@TMAC_S_PREFIX@|$(tmac_s_prefix)|g" \
+ -e "s|@TMAC_M_PREFIX@|$(tmac_m_prefix)|g" \
+ -e "s|@TMAC_AN_PREFIX@|$(tmac_an_prefix)|g" \
+ -e "s|@TMAC_MDIR@|$(tmacdir)/mm|g" \
+ -e "s|@BROKEN_SPOOLER_FLAGS@|$(BROKEN_SPOOLER_FLAGS)|g" \
+ -e "s|@VERSION@|$(version)$(revision)|g" \
+ -e "s|@MDATE@|`$(SHELL) $(top_srcdir)/mdate.sh $<`|g" \
+ -e "s|@g@|$(g)|g" \
+ -e "s!@G@!`echo $(g) | tr [a-z] [A-Z]`!g" \
$< >$@
.PHONY: install_man
@@ -238,8 +240,8 @@ depend.temp: FORCE
test -z "$(CSRCS)" \
|| $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp
if test -n "$(YTABH)"; then \
- sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend.temp1; \
- mv depend.temp1 depend.temp; \
+ sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend1.temp; \
+ mv depend1.temp depend.temp; \
fi
.PHONY: TAGS_src
diff --git a/Makefile.in b/Makefile.in
index 65a6729e..ab07b8c6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -366,6 +366,11 @@ DISTDIRS=$(INCDIRS) $(LIBDIRS) $(PROGDIRS) \
TARGETS=all install install_bin install_data clean distclean mostlyclean \
realclean extraclean distfiles TAGS depend uninstall_sub
+# This ENVSETUP gork is required by the DJGPP build on Windows 9X,
+# where Make needs to be case-sensitive to find files like BI and VERSION.
+ENVSETUP=`test -f $(srcdir)/makefile.ccpg*\
+ && test -f $(srcdir)/Makefile.ccpg* && echo export FNCASE=y`
+
do=all
dodirs=$(ALLDIRS) dot
# Default target for subdir_Makefile
@@ -373,15 +378,17 @@ subdir=src/roff/troff
$(TARGETS):
- @$(MAKE) $(MDEFINES) do=$@ $(dodirs)
+ @$(ENVSETUP); $(MAKE) $(MDEFINES) do=$@ $(dodirs)
dot: FORCE
- @$(MAKE) $(MDEFINES) srcdir=$(srcdir) VPATH=$(srcdir) \
+ @$(ENVSETUP); \
+ $(MAKE) $(MDEFINES) srcdir=$(srcdir) VPATH=$(srcdir) \
-f $(top_srcdir)/Makefile.comm \
-f $(top_srcdir)/Makefile.sub $(do)
$(LIBDIRS): FORCE
- @if test $(srcdir) = .; \
+ @$(ENVSETUP); \
+ if test $(srcdir) = .; \
then srcdir=.; \
else srcdir=`cd $(srcdir); pwd`/$@; \
fi; \
@@ -395,7 +402,8 @@ $(LIBDIRS): FORCE
-f Makefile.dep $(do)
$(CPROGDIRS): FORCE
- @if test $(srcdir) = .; \
+ @$(ENVSETUP); \
+ if test $(srcdir) = .; \
then srcdir=.; \
else srcdir=`cd $(srcdir); pwd`/$@; \
fi; \
@@ -409,7 +417,8 @@ $(CPROGDIRS): FORCE
-f Makefile.dep $(do)
$(CCPROGDIRS): FORCE
- @if test $(srcdir) = .; \
+ @$(ENVSETUP); \
+ if test $(srcdir) = .; \
then srcdir=.; \
else srcdir=`cd $(srcdir); pwd`/$@; \
fi; \
@@ -423,7 +432,8 @@ $(CCPROGDIRS): FORCE
-f Makefile.dep $(do)
$(DEVDIRS) $(TTYDEVDIRS): FORCE
- @if test $(srcdir) = .; \
+ @$(ENVSETUP); \
+ if test $(srcdir) = .; \
then srcdir=.; \
else srcdir=`cd $(srcdir); pwd`/$@; \
fi; \
@@ -435,7 +445,8 @@ $(DEVDIRS) $(TTYDEVDIRS): FORCE
-f $(top_srcdir)/Makefile.dev $(do)
$(INCDIRS) $(OTHERDIRS): FORCE
- @if test $(srcdir) = .; \
+ @$(ENVSETUP); \
+ if test $(srcdir) = .; \
then srcdir=.; \
else srcdir=`cd $(srcdir); pwd`/$@; \
fi; \
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index c15c5f68..ca13abb7 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -634,14 +634,14 @@ entrenched in the @acronym{UNIX} community.
@cindex what is @code{groff}?
@cindex @code{groff} -- what is it?
-@code{groff} is of an older generation of document preparation systems,
-which operate more like compilers than the more recent interactive
-@acronym{WYSIWYG}@footnote{What You See Is What You Get} systems.
-@code{groff} and its contemporary counterpart, @TeX{}, both work using a
-@dfn{batch} paradigm: The input (or @dfn{source}) files are normal text
-files with embedded formatting commands. These files can then be
-processed by @code{groff} to produce a typeset document on a variety of
-devices.
+@code{groff} belongs to an older generation of document preparation
+systems, which operate more like compilers than the more recent
+interactive @acronym{WYSIWYG}@footnote{What You See Is What You Get}
+systems. @code{groff} and its contemporary counterpart, @TeX{}, both
+work using a @dfn{batch} paradigm: The input (or @dfn{source}) files are
+normal text files with embedded formatting commands. These files can
+then be processed by @code{groff} to produce a typeset document on a
+variety of devices.
Likewise, @code{groff} should not be confused with a @dfn{word
processor}, since that term connotes an integrated system which includes
@@ -707,17 +707,17 @@ J.@w{ }F.@w{ }Ossanna.
@cindex @code{nroff}
When they needed a more flexible language, a new version of @code{roff}
-called @code{nroff} (Newer @code{roff}) was written. It had a much more
-complicated syntax, but provided the basis for all future versions.
+called @code{nroff} (``Newer @code{roff}'') was written. It had a much
+more complicated syntax, but provided the basis for all future versions.
When they got a Graphic Systems CAT Phototypesetter, Ossanna wrote a
version of @code{nroff} which would drive it. It was dubbed
-@code{troff} for typesetter @code{roff}, although many people have
-speculated that it actually means Times @code{roff} because of the use
-of the Times font family in @code{troff} by default. As such, the name
-@code{troff} is pronounced `@w{t-roff}' rather than `trough'.
+@code{troff}, for ``typesetter @code{roff}'', although many people have
+speculated that it actually means ``Times @code{roff}'' because of the
+use of the Times font family in @code{troff} by default. As such, the
+name @code{troff} is pronounced `@w{t-roff}' rather than `trough'.
With @code{troff} came @code{nroff} (they were actually the same program
-except for some @samp{#ifdefs}), which was for producing output for line
+except for some @samp{#ifdef}s), which was for producing output for line
printers and character terminals. It understood everything @code{troff}
did, and ignored the commands which were not applicable (e.g.@: font
changes).
@@ -738,8 +738,8 @@ language and produced output specifically for the CAT phototypesetter.
He rewrote it in C, although it was now 7000@w{ }lines of uncommented
code and still dependent on the CAT. As the CAT became less common, and
was no longer supported by the manufacturer, the need to make it support
-other devices became a priority. However, before this could be done, he
-was killed in an auto accident.
+other devices became a priority. However, before this could be done,
+Ossanna was killed in an auto accident.
@pindex ditroff
@cindex @code{ditroff}
@@ -747,7 +747,7 @@ So, Brian Kernighan took on the task of rewriting @code{troff}. The
newly rewritten version produced a device independent code which was
very easy for postprocessors to read and translate to the appropriate
printer codes. Also, this new version of @code{troff} (called
-@code{ditroff} for `device independent @code{troff}') had several
+@code{ditroff} for ``device independent @code{troff}'') had several
extensions, which included drawing functions.
Due to the additional abilities of the new version of @code{troff},
@@ -759,7 +759,7 @@ other preprocessors, produced @code{pic} code.
James Clark began work on a GNU implementation of @code{ditroff} in
early@w{ }1989. The first version, @code{groff}@w{ }0.3.1, was released
-June@w{ }1990. @code{groff} included
+June@w{ }1990. @code{groff} included:
@itemize @bullet
@item
@@ -769,9 +769,9 @@ A replacement for @code{ditroff} with many extensions.
The @code{soelim}, @code{pic}, @code{tbl}, and @code{eqn} preprocessors.
@item
-Postprocessors for character devices, @sc{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
+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
@@ -806,65 +806,66 @@ output device to produce @acronym{HTML} output, have been added.
So what exactly is @code{groff} capable of doing? @code{groff} provides
a wide range of low-level text formatting operations. Using these, it
is possible to perform a wide range of formatting tasks, such as
-footnotes, table of contents, multiple columns, etc.
+footnotes, table of contents, multiple columns, etc. Here's a list of
+the most important operations supported by @code{groff}:
@itemize @bullet
@item
-Text filling, adjusting, and centering
+text filling, adjusting, and centering
@item
-Hyphenation
+hyphenation
@item
-Page control
+page control
@item
-Font and character size control
+font and character size control
@item
-Vertical spacing (i.e.@: double spacing)
+vertical spacing (i.e.@: double spacing)
@item
-Line length and indenting
+line length and indenting
@item
-Macros, strings, diversions, and traps
+macros, strings, diversions, and traps
@item
-Number registers
+number registers
@item
-Tabs, leaders, and fields
+tabs, leaders, and fields
@item
-Input and output conventions and character translation
+input and output conventions and character translation
@item
-Overstrike, bracket, line drawing, and zero-width functions
+overstrike, bracket, line drawing, and zero-width functions
@item
-Local horizontal and vertical motions and the width function
+local horizontal and vertical motions and the width function
@item
-Three-part titles
+three-part titles
@item
-Output line numbering
+output line numbering
@item
-Conditional acceptance of input
+conditional acceptance of input
@item
-Environment switching
+environment switching
@item
-Insertions from the standard input
+insertions from the standard input
@item
-Input/output file switching
+input/output file switching
@item
-Output and error messages
+output and error messages
@end itemize
@@ -874,7 +875,7 @@ Output and error messages
@section Macro Packages
@cindex macro packages
-Since @code{groff} provides such low level facilities, it can be quite
+Since @code{groff} provides such low-level facilities, it can be quite
difficult to use by itself. However, @code{groff} provides a
@dfn{macro} facility to specify how certain routine operations (e.g.@w{
}starting paragraphs, printing headers and footers, etc.)@: should be
@@ -930,10 +931,10 @@ mathematical pictures (@code{ideal}) and chemical structures
@code{groff} actually produces device independent code which may be fed
into a postprocessor which will produce output for a particular device.
-Currently, @code{groff} has postprocessors for @sc{PostScript},
-character terminals, X@w{ }Windows (for previewing), @TeX{} DVI format,
-HP LaserJet@w{ }4 and Canon LBP printers (which use @acronym{CAPSL}),
-and @acronym{HTML}.
+Currently, @code{groff} has postprocessors for @acronym{PostScript}
+devices, character terminals, X@w{ }Windows (for previewing), @TeX{} DVI
+format, HP LaserJet@w{ }4 and Canon LBP printers (which use
+@acronym{CAPSL}), and @acronym{HTML}.
@c =====================================================================
@@ -960,19 +961,18 @@ GNU/Linux system.
@cindex invoking @code{groff}
@cindex @code{groff} invocation
-@pindex groff
-@pindex gtroff
This section focuses on how to invoke the @code{groff} front end. This
front end takes care of the details of constructing the pipeline among
the preprocessors, @code{gtroff} and the postprocessor.
It has become a tradition that GNU programs get the prefix @samp{g} to
-distinguish it from its original counterparts provided by the host
-(@pxref{Environment}, for more details). Thus, for example, @code{geqn}
-is GNU @code{eqn}. On operating systems like Linux or the Hurd, which
-don't contain proprietary software, this prefix is omitted since GNU
-@code{troff} is the only used incarnation of @code{troff}. Exception:
-@code{groff} is never replaced by @code{roff}.
+distinguish it from its original counterparts provided by the host (see
+@ref{Environment}, for more details). Thus, for example, @code{geqn} is
+GNU @code{eqn}. On operating systems like Linux or the Hurd, which
+don't contain proprietary software, and on MS-DOS/MS-Windows, where
+@code{troff} and associated programs are not available at all, this
+prefix is omitted since GNU @code{troff} is the only used incarnation of
+@code{troff}. Exception: @code{groff} is never replaced by @code{roff}.
@menu
* Groff Options::
@@ -997,8 +997,9 @@ don't contain proprietary software, this prefix is omitted since GNU
@pindex grefer
@pindex gsoelim
@code{groff} normally runs the @code{gtroff} program and a postprocessor
-appropriate for the selected device. The default device is @samp{ps}.
-It can optionally preprocess with any of @code{gpic}, @code{geqn},
+appropriate for the selected device. The default device is @samp{ps}
+(but it can be changed when @code{groff} is configured and built). It
+can optionally preprocess with any of @code{gpic}, @code{geqn},
@code{gtbl}, @code{ggrn}, @code{grap}, @code{grefer}, or @code{gsoelim}.
This section only documents options to the @code{groff} front end. Many
@@ -1020,9 +1021,7 @@ groff [ -abeghilpstvzCEGNRSUVXZ ] [ -F@var{dir} ] [ -m@var{name} ]
[ @var{files}@dots{} ]
@end example
-The command line format for @code{gtroff} is as follows. As can be
-seen, many of the options to @code{groff} are actually passed on to
-@code{gtroff}.
+The command line format for @code{gtroff} is as follows.
@example
gtroff [ -abivzCERU ] [ -w@var{name} ] [ -W@var{name} ] [ -d@var{cs} ]
@@ -1031,14 +1030,20 @@ gtroff [ -abivzCERU ] [ -w@var{name} ] [ -W@var{name} ] [ -d@var{cs} ]
[ -F@var{dir} ] [ -M@var{dir} ] [ @var{files}@dots{} ]
@end example
+@noindent
+Obviously, many of the options to @code{groff} are actually passed
+on to @code{gtroff}.
+
Options without an argument can be grouped behind a single @option{-}.
-A filename of @samp{-} denotes the standard input. It is possible to
+A filename of @file{-} denotes the standard input. It is possible to
have whitespace between an option and its parameter.
-@pindex grog
The @code{grog} command can be used to guess the correct @code{groff}
command to format a file.
+Here's the description of the command-line options:
+
+@cindex command-line options
@table @samp
@item -h
Print a help message.
@@ -1102,11 +1107,13 @@ separate @option{-L} option. Note that @code{groff} does not prepend a
@samp{-} to @var{arg} before passing it to the postprocessor.
@item -T@var{dev}
-Prepare output for device @var{dev}. The default device is @samp{ps}.
-The following are the output devices currently available:
+Prepare output for device @var{dev}. The default device is @samp{ps},
+unless changed when @code{groff} was configured and built. The
+following are the output devices currently available:
+
@table @code
@item ps
-For @sc{PostScript} printers and previewers.
+For @acronym{PostScript} printers and previewers.
@item dvi
For @TeX{} DVI format.
@@ -1121,7 +1128,7 @@ For a 100@dmn{dpi} X11 previewer.
For typewriter-like devices.
@item latin1
-For typewriter-like devices using the @w{ISO Latin-1} (@w{ISO 8859-1})
+For typewriter-like devices that support the @w{Latin-1} (@w{ISO 8859-1})
character set.
@item utf8
@@ -1164,8 +1171,8 @@ This is unlikely to produce good results except with @option{-Tps}.
Note that this is not the same as using @option{-TX75} or
@option{-TX100} to view a document with @code{gxditview}: The former
-will us the metrics of the specified device, whereas the latter will use
-X-specific fonts and metrics.
+will use the metrics of the specified device, whereas the latter will
+use X-specific fonts and metrics.
@item -N
Don't allow newlines with @code{eqn} delimiters. This is the same as
@@ -1205,7 +1212,9 @@ Inhibit warning @var{name}. Multiple @option{-W} options are allowed.
Inhibit all error messages.
@item -C
-Enable compatibility mode.
+Enable compatibility mode. @xref{Implementation Differences}, for the
+list of incompatibilites between @code{groff} and traditional Unix
+@code{troff}.
@item -d@var{cs}
@itemx -d@var{name}=s
@@ -1225,28 +1234,29 @@ Number the first page @var{num}.
@item -o@var{list}
@vindex .P
Output only pages in @var{list}, which is a comma-separated list of page
-ranges; @var{n} means print page @var{n}, @samp{@var{m}-@var{n}} means
-print every page between @var{m} and @var{n}, @samp{-@var{n}} means
-print every page up to @var{n}, @samp{@var{n}-} means print every page
-from @var{n}. @code{gtroff} will exit after printing the last page in
-the list.
+ranges; @samp{@var{n}} means print page @var{n}, @samp{@var{m}-@var{n}}
+means print every page between @var{m} and @var{n}, @samp{-@var{n}}
+means print every page up to @var{n}, @samp{@var{n}-} means print every
+page beginning with @var{n}. @code{gtroff} will exit after printing the
+last page in the list. All the ranges are inclusive on both ends.
Within @code{gtroff}, this information can be extracted with the
@samp{.P} register. @xref{Built-in Registers}.
@item -r@var{cn}
@itemx -r@var{name}=@var{n}
-Set number register @var{c} or @var{name} to @var{n}. @var{c} must be a
-one-letter name; @var{name} can be of arbitrary length. @var{n} can be
-any @code{gtroff} numeric expression.
+Set number register @var{c} or @var{name} to the value @var{n}. @var{c}
+must be a one-letter name; @var{name} can be of arbitrary length.
+@var{n} can be any @code{gtroff} numeric expression.
@item -F@var{dir}
-Search @var{dir} for subdirectories dev@var{name} (@var{name} is the
-name of the device) for the @file{DESC} file and font files before the
-normal directory.
+Search @file{@var{dir}} for subdirectories @file{dev@var{name}}
+(@var{name} is the name of the device), for the @file{DESC} file, and
+for font files before looking in the standard directory.
@item -M@var{dir}
-Search directory @var{dir} for macro files before the normal directory.
+Search directory @file{@var{dir}} for macro files before the standard
+directory.
@item -I@var{dir}
This option is as described in @ref{gsoelim}. It implies the
@@ -1266,40 +1276,46 @@ not within @code{gtroff}) which can modify the behavior of @code{groff}.
@table @code
@item GROFF_COMMAND_PREFIX
-@tindex GROFF_COMMAND_PREFIX
+@tindex GROFF_COMMAND_PREFIX, environment variable
If this is set to @var{X}, then @code{groff} will run
-@var{X}@code{troff} instead of @code{gtroff}. This also applies to
+@code{@var{X}troff} instead of @code{gtroff}. This also applies to
@code{tbl}, @code{pic}, @code{eqn}, @code{grn}, @code{refer}, and
@code{soelim}. It does not apply to @code{grops}, @code{grodvi},
@code{grotty}, @code{grohtml}, @code{grolj4}, and @code{gxditview}.
@item GROFF_TMAC_PATH
-@tindex GROFF_TMAC_PATH
-A colon separated list of directories in which to search for macro
+@tindex GROFF_TMAC_PATH, environment variable
+A colon-separated list of directories in which to search for macro
files.
@item GROFF_TYPESETTER
-@tindex GROFF_TYPESETTER
+@tindex GROFF_TYPESETTER, environment variable
The default output device.
@item GROFF_FONT_PATH
-@tindex GROFF_FONT_PATH
-A colon separated list of directories in which to search for the
+@tindex GROFF_FONT_PATH, environment variable
+A colon-separated list of directories in which to search for the
@code{dev}@var{name} directory.
@item PATH
-@tindex PATH
+@tindex PATH, environment variable
The search path for commands executed by @code{groff}.
@item GROFF_TMPDIR
-@tindex GROFF_TMPDIR
-@tindex TMPDIR
+@tindex GROFF_TMPDIR, environment variable
+@tindex TMPDIR, environment variable
The directory in which temporary files will be created. If this is not
set and @env{TMPDIR} is set, temporary files will be created in that
-directory. Otherwise temporary files will be created in @code{/tmp}.
-The @code{grops} and @code{grefer} commands can create temporary files.
+directory. Otherwise temporary files will be created in a
+system-dependent default directory (on Unix and GNU/Linux systems, this
+is usually @file{/tmp}). The @code{grops} and @code{grefer} commands
+can create temporary files in this directory.
@end table
+Note that MS-DOS and MS-Windows ports of @code{groff} use semi-colons,
+rather than colons, to separate the directories in the lists described
+above.
+
@c =====================================================================
@@ -1316,8 +1332,8 @@ groff file
@end example
@noindent
-This command processes @var{file} without a macro package or a
-preprocessor. The output device is the default, @var{ps}, and the
+This command processes @file{file} without a macro package or a
+preprocessor. The output device is the default, @samp{ps}, and the
output is sent to stdout.
@example
@@ -1326,17 +1342,18 @@ groff -t -mandoc -Tascii file | less
@noindent
This is basically what a call to the @code{man} program does. The
-manual page @var{file} is processed with the @file{mandoc} macros (which
-in turn either calls the @file{man} or the @file{mdoc} macro package),
-using the @code{tbl} preprocessor and the @acronym{ASCII} output device.
-Finally, the result is displayed with the @code{less} pager.
+manual page @file{file} is processed with the @file{mandoc} macros
+(which in turn either calls the @file{man} or the @file{mdoc} macro
+package), using the @code{tbl} preprocessor and the @acronym{ASCII}
+output device. Finally, the result is displayed with the @code{less}
+pager.
@example
groff -X -m me file
@end example
@noindent
-Preview @var{file} with @code{gxditview}, using the @file{me} macro
+Preview @file{file} with @code{gxditview}, using the @file{me} macro
package. Since no @option{-T} option is specified, use the default
device (@samp{ps}). Note that you can either say @w{@samp{-m me}} or
@w{@samp{-me}}; the latter is an anachronism from the early days of
@@ -1351,8 +1368,8 @@ groff -man -rD1 -z file
@end example
@noindent
-Check @var{file} with the @file{man} macro package, forcing double-sided
-printing -- don't produce any output.
+Check @file{file} with the @file{man} macro package, forcing
+double-sided printing -- don't produce any output.
@c ---------------------------------------------------------------------
@@ -1363,17 +1380,18 @@ printing -- don't produce any output.
@node grog, , Invocation Examples, Invocation Examples
@subsection @code{grog}
-@code{grog} reads files and guesses which of the @code{groff}
-preprocessors and/or macro packages are are required for formatting
-them, and prints the @code{groff} command including those options on the
-standard output. The options generated are one of @option{-e},
-@option{-man}, @option{-me}, @option{-mm}, @option{-ms}, @option{-p},
-@option{-R}, @option{-g}, @option{-G}, @option{-s}, and @option{-t}.
+@pindex grog
+@code{grog} reads files, guesses which of the @code{groff} preprocessors
+and/or macro packages are required for formatting them, and prints the
+@code{groff} command including those options on the standard output.
+The options generated are one of @option{-e}, @option{-man},
+@option{-me}, @option{-mm}, @option{-ms}, @option{-p}, @option{-R},
+@option{-g}, @option{-G}, @option{-s}, and @option{-t}.
-A filename of @samp{-} is taken to refer to the standard input. If no
-files are specified the standard input will be read. Any specified
-options will be included in the printed command. No space is allowed
-between options and their arguments. For example,
+A special file name @file{-} is taken to refer to the standard input.
+If no files are specified the standard input will be read. Any
+specified options will be included in the printed command. No space is
+allowed between options and their arguments. For example,
@example
grog -Tdvi paper.ms
@@ -1382,7 +1400,7 @@ grog -Tdvi paper.ms
@noindent
will guess the appropriate command to print @file{paper.ms} and then
print it to the command line after adding the @option{-Tdvi} option.
-For direct execution, enclose the call to @code{grog} in backquotes on
+For direct execution, enclose the call to @code{grog} in backquotes at
the @acronym{UNIX} shell prompt:
@example
@@ -1402,7 +1420,7 @@ something meaningful (i.e.@: either a file or a pager program like
@node Tutorial for Macro Users, Macro Packages, Invoking groff, Top
@chapter Tutorial for Macro Users
@cindex tutorial for macro users
-@cindex macro tutorial for users
+@cindex macros, tutorial for users
@cindex user's tutorial for macros
@cindex user's macro tutorial
@@ -1421,7 +1439,8 @@ macro package.
@node Basics, Common Features, Tutorial for Macro Users, Tutorial for Macro Users
@section Basics
-@cindex basics
+@cindex basics of macros
+@cindex macro basics
This section covers some of the basic concepts necessary to understand
how to use a macro package.@footnote{This section is derived from
@@ -1432,11 +1451,12 @@ References are made throughout to more detailed information, if desired.
formatted document suitable for publication or framing. The input
consists of text, or words to be printed, and embedded commands
(@dfn{requests} and @dfn{escapes}), which tell @code{gtroff} how to
-format the output. For more detail on this @pxref{Embedded Commands}.
+format the output. For more detail on this, see @ref{Embedded
+Commands}.
-The word @dfn{argument} is used in this manual to mean a word or number
-which appears on the same line as a request which modifies the meaning
-of that request. For example, the request
+The word @dfn{argument} is used in this chapter to mean a word or number
+which appears on the same line as a request, and which modifies the
+meaning of that request. For example, the request
@example
.sp
@@ -1456,7 +1476,7 @@ separated from the request and from each other by spaces. More details
on this can be found in @ref{Request Arguments}.
The primary function of @code{gtroff} is to collect words from input
-lines, fill output lines with those words, justify the right hand margin
+lines, fill output lines with those words, justify the right-hand margin
by inserting extra spaces in the line, and output the result. For
example, the input:
@@ -1494,22 +1514,22 @@ The text formatter also does more complex things, such as automatically
numbering pages, skipping over page boundaries, putting footnotes in the
correct place, and so forth.
-Here a few hints for preparing text for input to @code{gtroff}. First,
-keep the input lines short. Short input lines are easier to edit, and
-@code{gtroff} will pack words onto longer lines anyhow. In keeping with
-this, it is helpful to begin a new line after every period, comma, or
-phrase, since common corrections are to add or delete sentences or
-phrases. Secondly, do not hyphenate words at the end of lines --
-@code{gtroff} is smart enough to hyphenate words for the user as needed,
-but is not smart enough to take hyphens out and join a word back
-together. Also, words such as ``mother-in-law'' should not be broken
-over a line, since then a space can occur where not wanted, such as
-``@w{mother- in}-law''.
+Here are a few hints for preparing text for input to @code{gtroff}.
+First, keep the input lines short. Short input lines are easier to
+edit, and @code{gtroff} will pack words onto longer lines anyhow. In
+keeping with this, it is helpful to begin a new line after every period,
+comma, or phrase, since common corrections are to add or delete
+sentences or phrases. Secondly, do not hyphenate words at the end of
+lines -- @code{gtroff} is smart enough to hyphenate words for the user
+as needed, but is not smart enough to take hyphens out and join a word
+back together. Also, words such as ``mother-in-law'' should not be
+broken over a line, since then a space can occur where not wanted, such
+as ``@w{mother- in}-law''.
@findex ls
@cindex double spacing
@cindex spacing
-@code{gtroff} will double space output text automatically if using the
+@code{gtroff} will double space output text automatically if you use the
request @w{@samp{.ls 2}}. Single spaced mode can be reactivated by
typing @w{@samp{.ls 1}}.
@@ -1517,11 +1537,9 @@ 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).
-@findex bp
@cindex new page
The @samp{.bp} request starts a new page, causing a line break.
-@findex sp
@cindex blank lines
@cindex empty lines
@cindex lines, empty
@@ -1661,7 +1679,7 @@ form).
The titles are called three-part titles, that is, there is a
left-justified part, a centered part, and a right-justified part. An
automatically generated page number may be put in any of these fields
-with the @samp{%} character (@pxref{Page Layout} for more details).
+with the @samp{%} character (see @ref{Page Layout}, for more details).
@c ---------------------------------------------------------------------
@@ -1745,7 +1763,7 @@ tables, etc).
@node Indices, Paper Formats, Table of Contents, Common Features
@subsection Indices
-@cindex index
+@cindex index, in macro package
While some macro packages will use the term @dfn{index}, none actually
provide that functionality. The facilities they call indices are
@@ -1767,7 +1785,7 @@ provide formats for letters and memoranda.
@node Multiple Columns, Font and Size Changes, Paper Formats, Common Features
@subsection Multiple Columns
-Some macro packages (except @file{man}) provide the ability to have two
+Some macro packages (but not @file{man}) provide the ability to have two
or more columns on a page.
@c ---------------------------------------------------------------------
@@ -1799,7 +1817,7 @@ All macro packages provide support for the various preprocessors.
@node Configuration and Customization, , Preprocessor Support, Common Features
@subsection Configuration and Customization
-Some macro packages provide means of customizing many of details of how
+Some macro packages provide means of customizing many of the details of how
the package behaves. This ranges from setting the default type size to
changing the appearance of section headers.
@@ -1888,6 +1906,8 @@ following page numbers: 1, 2, 2a, 2b, 2c, etc.
@node Man usage, Man font macros, Man options, man
@subsection Usage
+@cindex @code{man} macros
+@cindex macros for manual pages
@pindex man.local
This section describes the available macros for manual pages. For
@@ -1897,9 +1917,9 @@ further customization, put additional macros and requests into the file
@maindex TH
@Defmac{TH, title section [@var{extra1}] [@var{extra2}] [@var{extra3}]}
Sets the title of the man page to @var{title} and the section to
-@var{section}, which must take on a value between 1 and@w{ }8. The
-value @var{section} may also have a string appended, e.g.@: @samp{.pm},
-to indicate a specific subsection of the man pages.
+@var{section}, which must have a value between 1 and@w{ }8. The value
+of @var{section} may also have a string appended, e.g.@: @samp{.pm}, to
+indicate a specific subsection of the man pages.
Both @var{title} and @var{section} are positioned at the left and right
in the header line (with @var{section} in parentheses immediately
@@ -1909,7 +1929,7 @@ footer line (resp.@: at the left on even pages and at the right on odd
pages if double-sided printing is active). @var{extra3} is centered in
the header line.
-For @acronym{HTML} output, headers and footers are completely supressed.
+For @acronym{HTML} output, headers and footers are completely suppressed.
Additionally, this macro starts a new page; the new line number is@w{ }1
again (except if the @option{-rC1} option is given on the command line)
@@ -1931,9 +1951,9 @@ left margin for the following text is reset to its default value.
@Defmac{SS, [@var{heading}]}
Sets up an unnumbered section heading. Prints out all the text
following @code{SS} up to the end of the line (resp.@: the text in the
-next line if there is no argument to @code{SS}) in bold face, at the sam
-size as the base document size. Additionally, the left margin for the
-following text is reset to its default value.
+next line if there is no argument to @code{SS}) in bold face, at the
+same size as the base document size. Additionally, the left margin for
+the following text is reset to its default value.
@end_Defmac
@maindex TP
@@ -1974,9 +1994,9 @@ Sets up an indented paragraph, using @var{designator} as a tag to mark
its beginning. The indentation is set to @var{nnn} if that argument is
supplied (default unit is @samp{n}), otherwise the default indentation
value is used. Font size and face of the paragraph (but not the
-designator) are reset to its default values. To start an indented
+designator) are reset to their default values. To start an indented
paragraph with a particular indentation but without a designator, use
-@samp{""} (two doublequotes) as the first argument of @code{IP}.
+@samp{""} (two double quotes) as the first argument of @code{IP}.
For example, to start a paragraph with bullets as the designator and
4@dmn{en} indentation, write
@@ -1987,14 +2007,16 @@ For example, to start a paragraph with bullets as the designator and
@end_Defmac
@maindex HP
+@cindex hanging indentation, in manual pages
@Defmac{HP, [@var{nnn}]}
Sets up a paragraph with hanging left indentation. The indentation is
set to @var{nnn} if that argument is supplied (default unit is
@samp{n}), otherwise the default indentation value is used. Font size
-and face are reset to its default values.
+and face are reset to their default values.
@end_Defmac
@maindex RS
+@cindex left margin, how to move, in manual pages
@Defmac{RS, [@var{nnn}]}
This macro moves the left margin to the right by the value @var{nnn} if
specified (default unit is @samp{n}); otherwise the default indentation
@@ -2024,13 +2046,15 @@ macro): @code{SH}, @code{SS}, @code{TP}, @code{LP} (@code{PP},
@maindex RS
@maindex RE
-The macros @code{RS} and @code{RE} also cause a break but no insertion
-of vertical space.
+The macros @code{RS} and @code{RE} also cause a break but do not insert
+vertical space.
@c ---------------------------------------------------------------------
@node Man font macros, Miscellaneous man stuff, Man usage, man
@subsection Macros to set fonts
+@cindex fonts in manual pages
+@cindex @code{man}, how to set fonts
The standard font is Roman; the default text size is 10@w{ }point.
@@ -2041,6 +2065,7 @@ in a font that is one point size smaller than the default font.
@end_Defmac
@maindex SB
+@cindex boldface, in manual pages
@Defmac{SB, [@var{text}]}
Causes the text on the same line or the text on the next line to appear
in boldface font, one point size smaller than the default font.
@@ -2049,15 +2074,15 @@ in boldface font, one point size smaller than the default font.
@maindex BI
@Defmac{BI, text}
Causes text on the same line to appear alternately in bold face and
-italic. The text must be on the same line as the macro call. Thus
+italic. The text must be on the same line as the macro call. Thus,
@example
.BI this "word and" that
@end example
@noindent
-would cause `this' and `that' to appear in bold face, while `word and'
-appears in italics.
+would cause ``this'' and ``that'' to appear in bold face, while ``word
+and'' appears in italics.
@end_Defmac
@maindex IB
@@ -2106,6 +2131,7 @@ in bold face.
@end_Defmac
@maindex I
+@cindex italic, in manual pages
@Defmac{I, [@var{text}]}
Causes @var{text} to appear in italic. If no text is present on the
line where the macro is called, then the text of the next line appears
@@ -2125,6 +2151,7 @@ The default indentation is 7.2@dmn{n} for all output devices except for
@maindex DT
@maindex TH
+@cindex tab stops, in manual pages
@Defmac{DT}
Sets tabs every 0.5@w{ }inches. Since this macro is always called
during a @code{TH} request, it makes sense to call it only if the tab
@@ -2132,6 +2159,7 @@ positions have been changed.
@end_Defmac
@maindex PD
+@cindex empty space before a paragraph, in manual pages
@Defmac{PD, [@var{nnn}]}
Adjusts the empty space before a new paragraph (resp.@: section). The
optional argument gives the amount of space (default units are
@@ -2180,16 +2208,17 @@ This is equal to @code{\(lq} and @code{\(rq}, respectively.
@cindex preprocessor, calling convention
@cindex calling convention of preprocessors
If a preprocessor like @code{gtbl} or @code{geqn} is needed, it has
-become usage to make the first line of the man page look like this:
+become common usage to make the first line of the man page look like
+this:
@example
.\" @var{word}
@end example
-@pindex geqn
-@pindex grefer
-@pindex gtbl
-@pindex man
+@pindex geqn@r{, invocation in manual pages}
+@pindex grefer@r{, invocation in manual pages}
+@pindex gtbl@r{, invocation in manual pages}
+@pindex man@r{, invocation of preprocessors}
Note the single space character after the double quote. @var{word}
consists of letters for the needed preprocessors: @samp{e} for
@code{geqn}, @samp{r} for @code{grefer}, @samp{t} for @code{gtbl}.
@@ -2286,7 +2315,7 @@ Users of macro packages may skip it if not interested in details.
@node Text, Input Conventions, Programming Tutorial, Programming Tutorial
@section Text
-@cindex text
+@cindex text, @code{gtroff} processing
@code{gtroff} input files contain text with control commands
interspersed throughout. But, even without control codes, @code{gtroff}
@@ -2306,21 +2335,19 @@ implicit line breaks.
@node Filling and Adjusting, Hyphenation, Text, Text
@subsection Filling and Adjusting
-@cindex filling and adjusting
-@cindex adjusting and filling
+@cindex filling
+@cindex adjusting
When @code{gtroff} reads in text it collects words from input and fits
as many of them together on one output line as it can. This is known as
@dfn{filling}.
@cindex leading spaces
-@cindex spaces, leading
+@cindex spaces, leading and trailing
@cindex extra spaces
-@cindex spaces, extra
@cindex trailing spaces
-@cindex spaces, trailing
Once @code{gtroff} has a @dfn{filled} line it will try to @dfn{adjust}
-it. Which means it will widen the spacing between words until the text
+it. This means it will widen the spacing between words until the text
reaches the right margin (in the default adjustment mode). Extra spaces
between words are preserved, but spaces at the end of lines are ignored.
Spaces at the front of a line will cause a @dfn{break} (breaks will be
@@ -2334,16 +2361,16 @@ explained in @ref{Implicit Line Breaks})
@subsection Hyphenation
@cindex hyphenation
-Since the odds of finding a set of words, for every output line, which
-will fit nicely on a line without inserting excessive amounts of space
-between words is not great, @code{gtroff} will hyphenate words so that
-lines can be justified without there being too much space between words.
-It uses an internal hyphenation algorithm (a simplified version of the
-algorithm used within @TeX{}) to indicate which words can be hyphenated
-and how to do so. When a word is hyphenated the first part of the word
-will be added to the current filled line being output (with an attached
-hyphen), and the other portion will be added to the next line to be
-filled.
+Since the odds are not great for finding a set of words, for every
+output line, which will fit nicely on a line without inserting excessive
+amounts of space between words, @code{gtroff} will hyphenate words so
+that lines can be justified without there being too much space between
+words. It uses an internal hyphenation algorithm (a simplified version
+of the algorithm used within @TeX{}) to indicate which words can be
+hyphenated and how to do so. When a word is hyphenated the first part
+of the word will be added to the current filled line being output (with
+an attached hyphen), and the other portion will be added to the next
+line to be filled.
@xref{Manipulating Hyphenation}.
@@ -2355,11 +2382,11 @@ filled.
Although it is often debated, some typesetting rules say there should be
different amounts of space after various punctuation marks. For
-example, the @emph{Chicago typsetting manual} says that a period at the
+example, the @cite{Chicago typsetting manual} says that a period at the
end of a sentence should have twice as much space following it as would
a comma or a period as part of an abbreviation.
-@c XXX exact citation of Chigago manual
+@c XXX exact citation of Chicago manual
@cindex sentence space
@cindex space between sentences
@@ -2368,7 +2395,8 @@ a comma or a period as part of an abbreviation.
@samp{!}, @samp{?} and @samp{.}) as @dfn{end of sentence} characters.
When @code{gtroff} encounters one of these characters at the end of a
line it will append two @dfn{sentence spaces} in the formatted output.
-(Thus, one of the conventions mentioned in @ref{Input Conventions}.)
+(This justifies one of the conventions mentioned in @ref{Input
+Conventions}.)
@cindex transparent characters
@cindex character, transparent
@@ -2403,9 +2431,9 @@ character (at the end of a line), append @code{\&}.
@dfn{tabs} (normally code point @acronym{ASCII} @code{0x09} resp.@:
@acronym{EBCDIC} @code{0x05}), in the input into movements to the next
tabulator stop. These tab stops are initially located every half inch
-across the page. Using this simple tables can easily be made. However,
-it can often be deceptive as the appearance (and width) of the text on a
-terminal and the results from @code{gtroff} can vary greatly.
+across the page. Using this, simple tables can easily be made.
+However, it can often be deceptive as the appearance (and width) of the
+text on a terminal and the results from @code{gtroff} can vary greatly.
Also, a possible sticking point is that lines beginning with tab
characters will still be filled, again producing unexpected results.
@@ -2433,8 +2461,8 @@ will produce
@node Implicit Line Breaks, , Tab Stops, Text
@subsection Implicit Line Breaks
@cindex implicit line breaks
+@cindex implicit breaks of lines
@cindex line, implicit breaks
-@cindex break
@cindex break, implicit
@cindex line break
@@ -2477,7 +2505,7 @@ paragraphs. These are some conventions commonly used when typing
@itemize @bullet
@item
-Break lines after punctuation, particularly at the end of sentences,
+Break lines after punctuation, particularly at the end of a sentence,
and in other logical places. Keep separate phrases on lines by
themselves, as entire phrases are often added or deleted when editing.
@@ -2513,8 +2541,8 @@ these units are understood, by @code{gtroff}, to be a multiple of its
specified @code{gtroff} converts this into its @dfn{basic units}. This
basic unit, represented by a @samp{u}, is a device dependent measurement
which is quite small, ranging from 1/75th to 1/72000th of an inch. The
-values may be given as fractional numbers -- nevertheless, fractional
-basic units are always rounded to integers.
+values may be given as fractional numbers; however, fractional basic
+units are always rounded to integers.
Some of the measurement units are completely independent of any of the
current settings (e.g.@: type size) of @code{gtroff}.
@@ -2604,7 +2632,7 @@ Vertical space. This is equivalent to the current line spacing.
Many requests take a default unit. While this can be helpful at times,
it can cause strange errors in some expressions. For example, the line
length request expects em units. Here are several attempts to get a
-line length of 3.5@w{ }inches and the results:
+line length of 3.5@w{ }inches and their results:
@example
3.5i @result{} 3.5i
@@ -2621,6 +2649,7 @@ equals@w{ }10@dmn{p} (thus 1@dmn{m} equals@w{ }33@dmn{u}). The value
7i/2 will be first handled as 7i/2m, then converted to 1680u/66u which
is 25@dmn{u}, and this is approximately 0.1@dmn{i}.
+@cindex measurements, specifying safely
As a conclusion, the safest way to specify measurements is to always
attach a scaling indicator. If you want to multiply or divide by a
certain scalar value, use @samp{u} as the unit for that value.
@@ -2678,8 +2707,8 @@ Logical: @samp{&} (logical and), @samp{:} (logical or).
@opindex -
@opindex +
@opindex !
-@findex if
-@findex while
+@findex if@r{, and the @samp{!} operator}
+@findex while@r{, and the @samp{!} operator}
Unary operators: @samp{-} (negating, i.e.@: changing the sign), @samp{+}
(just for completeness; does nothing in expressions), @samp{!} (logical
not; this works only within @code{if} and @code{while} requests). See
@@ -2712,11 +2741,12 @@ Parentheses may be used as in any other language. However, in
@code{gtroff} they are necessary to ensure order of evaluation.
@code{gtroff} has no operator precedence; expressions are evaluated left
to right. This means that @samp{3+5*4} is evaluated as if it were
-parenthesized like @samp{(3+5)*4}, not as @samp{3+(5*4)}, as expected.
+parenthesized like @samp{(3+5)*4}, not as @samp{3+(5*4)}, as might be
+expected.
-@opindex +
-@opindex -
-@opindex |
+@opindex +@r{, and page motion}
+@opindex -@r{, and page motion}
+@opindex |@r{, and page motion}
@cindex motion operators
@cindex operators, motion
For many requests which cause a motion on the page, the unary operators
@@ -2750,7 +2780,7 @@ expressions, unless the entire expression is surrounded by parentheses.
Like any other language, @code{gtroff} has rules for properly formed
@dfn{identifiers}. In @code{gtroff}, an identifier can be made up of
-almost any printable character. The exception are the following
+almost any printable character, with the exception of the following
characters:
@itemize @bullet
@@ -2763,22 +2793,22 @@ Whitespace characters (space, tabs, and newlines).
@item
@cindex character, backspace
@cindex backspace character
-@cindex @acronym{EBCDIC} encoding
+@cindex @acronym{EBCDIC} encoding of backspace
Backspace (@acronym{ASCII}@w{ }@code{0x08} resp.@: @acronym{EBCDIC}@w{
}@code{0x16}) and character code @code{0x01}.
@item
-@cindex illegal input characters
-@cindex input characters, illegal
-@cindex characters, illegal input
+@cindex invalid input characters
+@cindex input characters, invalid
+@cindex characters, invalid input
@cindex unicode
-The following input characters are illegal and will be ignored if
+The following input characters are invalid and will be ignored if
@code{groff} runs on a machine based on @acronym{ASCII}, causing a
-warning message of type @samp{input} (@pxref{Debugging}, for more
+warning message of type @samp{input} (see @ref{Debugging}, for more
details): @code{0x00}, @code{0x0B}, @code{0x0D}-@code{0x1F},
@code{0x80}-@code{0x9F}.
-And here the illegal input characters if @code{groff} runs on an
+And here are the invalid input characters if @code{groff} runs on an
@acronym{EBCDIC} host: @code{0x00}, @code{0x08}, @code{0x09},
@code{0x0B}, @code{0x0D}-@code{0x14}, @code{0x17}-@code{0x1F},
@code{0x30}-@code{0x3F}.
@@ -2787,9 +2817,9 @@ Currently, some of these reserved codepoints are used internally, thus
making it non-trivial to extend @code{gtroff} to cover Unicode or other
character sets resp.@: encodings which use characters of these ranges.
-Note that illegal characters will be removed before parsing; an
-identifier `foo', followed by an illegal character, followed by `bar'
-will be treated as `foobar'.
+Note that invalid characters will be removed before parsing; an
+identifier @code{foo}, followed by an invalid character, followed by
+@code{bar} will be treated as @code{foobar}.
@end itemize
For example, any of the following is valid.
@@ -2814,7 +2844,7 @@ access the glyph @samp{foo}, followed by @samp{]}, whereas
@Deffn{Escape, \\A, ident}
Whether an identifier @var{ident} is valid in @code{gtroff} can be
tested with the @code{\A} escape. It expands to the character@w{ }1
-or@w{ }0 according to whether its argument (delimited by quotes usually)
+or@w{ }0 according to whether its argument (usually delimited by quotes)
is or is not acceptable as the name of a string, macro, diversion,
number register, environment, or font. It will return@w{ }0 if no
argument is given. This is useful for looking up user input in some
@@ -2832,7 +2862,7 @@ sort of associative table.
Identifiers in @code{gtroff} can be any length, but, in some contexts,
@code{gtroff} needs to be told where identifiers end and text begins
-(and in different ways depending on their length).
+(and in different ways depending on their length):
@findex (
@findex [
@@ -2910,7 +2940,7 @@ arguments.
@cindex zero width space character
@cindex character, zero width space
@cindex space character, zero width
-@findex \&
+@findex \&@r{, escaping control characters}
To begin a line with a control character without it being interpreted,
precede it with @code{\&}. This represents a zero width space, which
means it will not affect the output.
@@ -2933,6 +2963,8 @@ 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.
+Here are a few examples:
+
@example
.uh The Mouse Problem
.uh "The Mouse Problem"
@@ -2944,10 +2976,10 @@ or double), or have the spaces @dfn{escaped} with backslashes.
@noindent
The first line is the @code{uh} macro being called with 3 arguments,
@samp{The}, @samp{Mouse}, and @samp{Problem}. The latter two have the
-same effect or calling the @code{uh} macro with one argument @samp{The
+same effect or calling the @code{uh} macro with one argument, @samp{The
Mouse Problem}.@footnote{The last solution, i.e., using escaped spaces,
-is `classical' in the sense that it can be found in most @code{troff}
-documents. Nevertheless, it is not optimal in all situations since
+is ``classical'' in the sense that it can be found in most @code{troff}
+documents. Nevertheless, it is not optimal in all situations, since
@w{@samp{\ }} inserts a fixed-width, non-breaking space character which
can't stretch. @code{gtroff} provides a different command @code{\~} to
insert a stretchable, non-breaking space.}
@@ -2974,8 +3006,8 @@ requests -- arguments also may be passed in the same manner.
@subsection Escapes
@cindex escapes
-Escapes may occur anywhere in the input to @code{gtroff}. They begin
-with a backslash usually and are followed by a single character which
+Escapes may occur anywhere in the input to @code{gtroff}. They usually
+begin with a backslash and are followed by a single character which
indicates the function to be performed. The escape character can be
changed; see @ref{Character Translations}.
@@ -3123,7 +3155,7 @@ The digits @code{0}-@code{9}.
@opindex (
@opindex )
@opindex .
-The (single character) operators @samp{+-/*%<>=&:().}.
+The (single-character) operators @samp{+-/*%<>=&:().}.
@item
@cindex space character
@@ -3175,8 +3207,8 @@ more information.
@cindex comments
Probably one of the most@footnote{Unfortunately, this is a lie. But
-hopefully future @code{gtroff} hackers will believe it :-)} common forms
-of escapes is the comment.
+hopefully future @code{gtroff} hackers will believe it @code{:-)}}
+common forms of escapes is the comment.
@Deffn{Escape, \\"}
Start a comment. Everything to the end of the input line is ignored.
@@ -3190,6 +3222,8 @@ the line will be ignored, but the space leading up to it will be noticed
by @code{gtroff}. This only affects the @code{.ds} request.
@c XXX (any others?)
+@cindex tabs before comments
+@cindex comments, lining up with tabs
One possibly irritating idiosyncracy is that tabs must not be used to
line up comments. Tabs are not treated as white space between the
request and macro arguments.
@@ -3226,7 +3260,7 @@ quotes (@code{'''}) at the beginning of a line. This works, but
@end_Deffn
@Deffn{Escape, \\#}
-Now to avoid all this @code{gtroff} has a new comment mechanism using
+To avoid all this, @code{gtroff} has a new comment mechanism using
the @code{\#} escape. This escape works the same as @code{\"} except
that the newline is also ignored:
@@ -3248,7 +3282,8 @@ as expected.
@end_Deffn
@findex ig
-For large blocks of text, the @code{ig} request may be useful.
+For commenting away large blocks of text, the @code{ig} request may be
+useful.
@c XXX definition of .ig
@@ -3317,6 +3352,7 @@ Increment (decrement) register @var{ident} by @var{value}.
@result{} 2
@end example
+@cindex negating register values
To assign the negated value of a register to another register, some care
must be taken to get the desired result:
@@ -3440,8 +3476,9 @@ produces
-2, -4, -6, -8, -10
@end example
+@cindex increment value without changing the register
To change the increment value without changing the value of a register,
-the following can be used.
+the following can be used:
@example
.nr a \na 10
@@ -3455,9 +3492,9 @@ the following can be used.
@cindex formats, assigning
When a register is used in the text of an input file (as opposed to part
-of an expression) it is textually replaced (or interpolated) with a
+of an expression), it is textually replaced (or interpolated) with a
representation of that number. This output format can be changed to a
-variety of formats (numbers, Roman numerals, etc). This is done using
+variety of formats (numbers, Roman numerals, etc.). This is done using
the @code{af} request.
@Deffn{Request, af, ident format}
@@ -3469,30 +3506,30 @@ formats are available:
@table @code
@item 1
Decimal arabic numbers. This is the default format: 1, 2, 3,@w{
-}@dots{}
+}@enddots{}
@item 0@dots{}0
Decimal numbers with as many digits as specified. So, @samp{00} would
-result in printing numbers as 01, 02, 03,@w{ }@dots{}
+result in printing numbers as 01, 02, 03,@w{ }@enddots{}
In fact, any digit instead of zero will do; @code{gtroff} only counts
how many digits are specified. As a consequence, @code{af}'s default
format @samp{1} could be specified as @samp{0} also (and exactly this is
-returned by the @code{\g} escape).
+returned by the @code{\g} escape, see below).
@item I
@cindex roman numerals
@cindex numerals, Roman
-Upper-case Roman numerals: 0, I, II, III, IV,@w{ }@dots{}
+Upper-case Roman numerals: 0, I, II, III, IV,@w{ }@enddots{}
@item i
-Lower-case Roman numerals: 0, i, ii, iii, iv,@w{ }@dots{}
+Lower-case Roman numerals: 0, i, ii, iii, iv,@w{ }@enddots{}
@item A
-Upper-case letters: A, B, C, @dots{},@w{ }Z, AA, AB,@w{ }@dots{}
+Upper-case letters: A, B, C, @dots{},@w{ }Z, AA, AB,@w{ }@enddots{}
@item a
-Lower-case letters: a, b, c, @dots{},@w{ }z, aa, ab,@w{ }@dots{}
+Lower-case letters: a, b, c, @dots{},@w{ }z, aa, ab,@w{ }@enddots{}
@end table
Omitting the number register format will cause a warning of type
@@ -3513,19 +3550,27 @@ The following example will produce @samp{10, X, j, 010}:
\na
@end example
+@cindex roman numerals, maximum and minimum
+@cindex maximum values of Roman numerals
+@cindex minimum values of Roman numerals
The largest number representable for the @samp{i} and @samp{I} formats
is 39999 (resp.@: -39999); @acronym{UNIX} @code{troff} uses @samp{z} and
@samp{w} to represent 10000 and 5000 in Roman numerals, and so does
-@code{gtroff}. Currently, the correct glyphs (Unicode code points
+@code{gtroff}. Currently, the correct glyphs of Roman numeral five
+thousand and Roman numeral ten thousand (Unicode code points
@code{U+2182} and @code{U+2181}, respectively) are not available.
If @var{ident} doesn't exist, it will be created.
+@cindex read-only register, changing format
+@cindex changing format, read-only register
Changing the output format of a read-only register causes an error. It
is necessary to first copy the register's value to a writeable register,
then apply the @code{af} request to this other register.
@end_Deffn
+@cindex format of register
+@cindex register, format
@Deffn{Escape, \\g, ident}
Return the current format of the specified register @var{ident}. For
example, @samp{\ga} after the previous example would produce the string
@@ -3541,44 +3586,44 @@ returned.
@cindex registers, built-in
The following lists some built-in registers which are not described
-elsewhere in this manual. Any register which begin with a @samp{.} is
+elsewhere in this manual. Any register which begins with a @samp{.} is
read-only. A complete listing of all built-in registers can be found in
@ref{Register Index}.
@table @code
@item .H
-@cindex horizontal resolution
-@cindex resolution, horizontal
+@cindex horizontal resolution register
+@cindex resolution, horizontal, register
@vindex .H
Horizontal resolution in basic units.
@item .V
-@cindex vertical resolution
-@cindex resolution, vertical
+@cindex vertical resolution register
+@cindex resolution, vertical, register
@vindex .V
Vertical resolution in basic units.
@item dw
-@cindex day of the week
-@cindex date, day of the week
+@cindex day of the week register
+@cindex date, day of the week register
@vindex dw
Day of the week (1-7).
@item dy
-@cindex day of the month
-@cindex date, day of the month
+@cindex day of the month register
+@cindex date, day of the month register
@vindex dy
Day of the month (1-31).
@item mo
-@cindex month of the year
-@cindex date, month of the year
+@cindex month of the year register
+@cindex date, month of the year register
@vindex mo
Current month (1-12).
@item year
-@cindex date, year
-@cindex year, current
+@cindex date, year register
+@cindex year, current, register
@vindex year
The current year.
@@ -3614,8 +3659,8 @@ This document was formatted in \n(y4.
@vindex .c
@itemx c.
@vindex c.
-@cindex input line number
-@cindex line number, input
+@cindex input line number register
+@cindex line number, input, register
The current @emph{input} line number. Register @samp{.c} is read-only,
whereas @samp{c.} (a @code{gtroff} extension) is writable also,
affecting both @samp{.c} and @samp{c.}.
@@ -3623,8 +3668,8 @@ affecting both @samp{.c} and @samp{c.}.
@item ln
@vindex ln
@findex nm
-@cindex output line number
-@cindex line number, output
+@cindex output line number register
+@cindex line number, output, register
The current @emph{output} line number after a call to the @code{nm}
request to activate line numbering.
@@ -3632,30 +3677,33 @@ request to activate line numbering.
@item .x
@vindex .x
-@cindex major version number
-@cindex version number, major
+@cindex major version number register
+@cindex version number, major, register
The major version number. For example, if the version number is@w{
}1.03 then @code{.x} will contain@w{ }@samp{1}.
@item .y
@vindex .y
-@cindex minor version number
-@cindex version number, minor
+@cindex minor version number register
+@cindex version number, minor, register
The minor version number. For example, if the version number is@w{
}1.03 then @code{.y} will contain@w{ }@samp{03}.
@item .Y
@vindex .Y
-@cindex revision number
+@cindex revision number register
The revision number of @code{groff}.
@item .g
@vindex .g
+@cindex @code{gtroff} identification register
+@cindex GNU-specific register
Always@w{ }1. Macros should use this to determine whether they are
running under GNU @code{troff}.
@item .A
@vindex .A
+@cindex @acronym{ASCII} approximation output register
If the command line option @option{-a} is used to produce an
@acronym{ASCII} approximation of the output, this is set to@w{ }1, zero
otherwise. @xref{Groff Options}.
@@ -3674,6 +3722,7 @@ number register @code{.T} is set to@w{ }1, and zero otherwise.
@xref{Groff Options}.
@maindex \*(.T
+@cindex output device register
Additionally, @code{gtroff} predefines a single (read/write) string
register @code{.T} which contains the current output device (for
example, @samp{latin1} or @samp{ps}).
@@ -3777,11 +3826,12 @@ only centers text without filling.
@item b
@itemx n
-Justify to both margins. This is default of @code{gtroff}.
+Justify to both margins. This is the default used by @code{gtroff}.
@end table
-With no argument, @code{gtroff} will adjust lines the same way before
-adjusting has been deactivated (with a call to @code{na}, for example).
+With no argument, @code{gtroff} will adjust lines in the same way it did
+before adjusting has been deactivated (with a call to @code{na}, for
+example).
@example
text
@@ -3796,6 +3846,7 @@ text
@end example
@vindex .j
+@cindex current adjustment mode register
The current adjustment mode is available in the number register
@code{.j}; it can be stored and subsequently used to set adjustment.
@@ -3817,7 +3868,7 @@ Adjust the current line and cause a break.
In most cases this will produce very ugly results, since @code{gtroff}
doesn't have a sophisticated paragraph building algorithm (as @TeX{}
-have, for example); instead, @code{gtroff} fills and adjusts a paragraph
+does, for example); instead, @code{gtroff} fills and adjusts a paragraph
line by line:
@example
@@ -3851,24 +3902,24 @@ are@w{ }12.
@cindex mode, fill
If two arguments are given to the @code{ss} request, the second argument
sets the sentence space size. If the second argument is not given,
-@var{sentence_space_size} will be the same as @var{word_space_size}.
-The sentence space size is used in two circumstances: If the end of a
-sentence occurs at the end of a line in fill mode, then both an
-inter-word space and a sentence space will be added; if two spaces
-follow the end of a sentence in the middle of a line, then the second
-space will be a sentence space. Note that the behaviour of
-@acronym{UNIX} @code{troff} will be exactly that exhibited by GNU
-@code{troff} if a second argument is never given to the @code{ss}
-request. In GNU @code{troff}, as in @acronym{UNIX} @code{troff}, a
-sentence should always be followed with either a newline or two spaces.
+sentence space size will be set to @var{word_space_size}. The sentence
+space size is used in two circumstances: if the end of a sentence occurs
+at the end of a line in fill mode, then both an inter-word space and a
+sentence space will be added; if two spaces follow the end of a sentence
+in the middle of a line, then the second space will be a sentence space.
+Note that the behaviour of @acronym{UNIX} @code{troff} will be exactly
+that exhibited by GNU @code{troff} if a second argument is never given
+to the @code{ss} request. In GNU @code{troff}, as in @acronym{UNIX}
+@code{troff}, a sentence should always be followed by either a newline
+or two spaces.
@vindex .ss
@vindex .sss
-The number registers @code{.ss} and @code{.sss} are the values of the
+The number registers @code{.ss} and @code{.sss} hold the values of the
parameters set by the first and second arguments of the @code{ss}
request.
-The space and sentence space values are associated with the current
+The word space and sentence space values are associated with the current
environment (@pxref{Environments}).
This request is ignored in nroff mode; it is also ignored if there is no
@@ -3878,12 +3929,12 @@ parameter.
@cindex centering lines
@cindex lines, centering
@Deffn{Request, ce, [@var{nnn}]}
-Center text. While the @w{@samp{ad c}} request will also center text,
+Center text. While the @w{@samp{.ad c}} request will also center text,
it has the side effect of filling the text. @code{ce} will not fill the
text it affects. This request causes a break.
With no arguments, @code{ce} will center the next line of text.
-@var{nnn} is a number indicating the number of lines to be centered. If
+@var{nnn} specifies the number of lines to be centered. If
the argument is zero or negative, centering is disabled.
@findex ll
@@ -3917,9 +3968,9 @@ be centered, as set by the @code{ce} request.
@cindex right-justifying
@vindex .rj
@Deffn{Request, rj, [@var{nnn}]}
-Justify unfilled text to the right margin. Its arguments are identical
-to the @code{ce} request. The @code{.rj} number register is the number
-of lines to be right-justified as set by the @code{rj} request. This
+Justify unfilled text to the right margin. Arguments are identical to
+the @code{ce} request. The @code{.rj} number register is the number of
+lines to be right-justified as set by the @code{rj} request. This
request causes a line break.
@end_Deffn
@@ -3932,7 +3983,7 @@ request causes a line break.
@cindex hyphenation, manipulating
As discussed in @ref{Hyphenation}, @code{gtroff} will hyphenate words.
-There are a number of ways to influence how hyphenation is done.
+There are a number of ways to influence hyphenation.
@Deffn{Request, hy, [@var{mode}]}
Enable hyphenation. The request has an optional numeric argument,
@@ -3958,6 +4009,7 @@ Values in the previous table are additive. For example, the value@w{
two characters of a word.
@vindex .hy
+@cindex hyphenation restrictions register
The current hyphenation restrictions can be found in the number register
@samp{.hy}.
@@ -4004,7 +4056,7 @@ example:
@end example
@noindent
-Besides the space character, any character which hyphenation code value
+Besides the space character, any character whose hyphenation code value
is zero can be used to separate the arguments of @code{hw} (see the
documentation for the @code{hcode} request below for more information).
In addition, this request can be used more than once.
@@ -4030,13 +4082,13 @@ escape, also known as the @dfn{hyphenation character}, can be used.
Preceding a word with this character will prevent it from being
hyphenated, putting it in a word will indicate to @code{gtroff} that the
word may be hyphenated at that point. Note that this mechanism will
-only affect one word; to change the hyphenation of a word for the entire
-document, use the @code{hw} request.
+only affect that one occurrence of the word; to change the hyphenation
+of a word for the entire document, use the @code{hw} request.
@end_Deffn
@Deffn{Request, hc, [@var{char}]}
Change the hyphenation character to @var{char}. This character will
-then work the same as the @code{\%} escape, and, thus, no longer appear
+then work the same as the @code{\%} escape, and thus, no longer appear
in the output. Without an argument, @code{hc} will reset the
hyphenation character to be @code{\%} (the default) only.
@@ -4070,7 +4122,8 @@ invoked by the @file{troffrc} or @file{troffrc-end} file; by default,
@file{troffrc} loads hyphenation patterns for American English (in file
@file{hyphen.us}).
-It will cause an error if there is no current hyphenation language.
+@code{hpf} will cause an error if there is no current hyphenation
+language.
@end_Deffn
@cindex hyphenation code
@@ -4079,9 +4132,9 @@ It will cause an error if there is no current hyphenation language.
Sets the hyphenation code of character @var{c1} to @var{code1}, that of
@var{c2} to @var{code2}, etc. A hyphenation code must be a single input
character (not a special character) other than a digit or a space.
-Initially each lower-case letter (@samp{a}-@samp{z}) has a hyphenation
-code, which is itself, and each upper-case letter (@samp{A}-@samp{Z})
-has a hyphenation code which is the lower-case version of itself.
+Initially each lower-case letter (@samp{a}-@samp{z}) has its hyphenation
+set to itself, and each upper-case letter (@samp{A}-@samp{Z}) has a
+hyphenation code which is the lower-case version of itself.
This request will be ignored if it has no parameter.
@end_Deffn
@@ -4102,6 +4155,7 @@ A negative argument will reset the hyphenation margin to zero, emitting
a warning of type @samp{range}.
@vindex .hym
+@cindex current hyphenation margin register
The current hyphenation margin is available in the @code{.hym} register.
@end_Deffn
@@ -4109,7 +4163,7 @@ The current hyphenation margin is available in the @code{.hym} register.
@findex ad
@Deffn{Request, hys, [@var{hyphenation_space}]}
Set the hyphenation space to @var{hyphenation_space}. If the current
-adjustment mode is@w{ }@samp{b}, don't hyphenate the line if the line
+adjustment mode is@w{ }@samp{b}, don't hyphenate the line if it
can be justified by adding no more than @var{hyphenation_space} extra
space to each word space. Without argument, the hyphenation space is
set to its default value, which is@w{ }0. The default scaling indicator
@@ -4120,6 +4174,7 @@ A negative argument will reset the hyphenation space to zero, emitting a
warning of type @samp{range}.
@vindex .hys
+@cindex current hyphenation space register
The current hyphenation space is available in the @code{.hys} register.
@end_Deffn
@@ -4155,6 +4210,7 @@ request is usually invoked by the @file{troffrc} or the
@samp{us}.
@vindex .hla
+@cindex current hyphenation language register
The current hyphenation language is available as a string in the
read-only number register @samp{.hla}.
@@ -4198,6 +4254,7 @@ The line spacing is associated with the current environment
(@pxref{Environments}).
@vindex .L
+@cindex current line spacing register
The number register @code{.L} contains the current line spacing setting.
@end_Deffn
@@ -4214,26 +4271,29 @@ maximum of the values is used.
@xref{Escapes}, for details on parameter delimiting characters.
@vindex .a
+@cindex extra vertical line space register
The @code{.a} number register contains the most recent (nonnegative)
extra vertical line space.
@c XXX
+@ignore
@example
... example of inline equation ...
@end example
+@end ignore
@end_Deffn
@findex sp
@cindex no-space mode
@cindex mode, no-space
-@cindex blank lines
-@cindex lines, blank
+@cindex blank lines, disabling
+@cindex lines, blank, disabling
@Deffn{Request, ns, }
Enable @dfn{no-space mode}. In this mode, spacing (either via @code{sp}
or via blank lines) is disabled. The @code{bp} request to advance to
the next page is also disabled, except if it is accompanied by a page
-number (@pxref{Page Control}, for more information). This mode will end
-when actual text is output or the @code{rs} request is encountered.
+number (see @ref{Page Control}, for more information). This mode will
+end when actual text is output or the @code{rs} request is encountered.
This request is useful for macros which want to avoid that subsequent
macros inadvertently insert some vertical space before the text starts
@@ -4258,10 +4318,10 @@ diversion level.
@cindex tabs and fields
@cindex fields and tabs
-@cindex @acronym{EBCDIC} encoding
+@cindex @acronym{EBCDIC} encoding of a tab
A tab character (@acronym{ASCII} char@w{ }9, @acronym{EBCDIC} char@w{
-}5) causes a horizontal movement to the next tab stop (which is much
-like that on a typewriter).
+}5) causes a horizontal movement to the next tab stop (much
+like it did on a typewriter).
@Deffn{Escape, \\t, }
This escape is a non-interpreted tab character. In copy mode
@@ -4394,12 +4454,14 @@ Tab stops are associated with the current environment
Calling @code{ta} without an argument will unset all tab stops.
@item
-The start-up value of @code{gtroff} is @w{@samp{T 0.5i}}. Even in nroff
-mode this value is used (contrary to @acronym{UNIX} @code{nroff} which
+@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}).
@end itemize
@vindex .tabs
+@cindex current tab settings register
The number register @code{.tabs} contains a string representation of the
current tab settings suitable for use as an argument to the @code{ta}
request.
@@ -4578,10 +4640,10 @@ necessary then to double the escape character. Here an example:
.eo
.de BR
. ds result \&
-. while (\n[.$] >= 2) \{\
+. while (\n[.$] >= 2) \@{\
. as result \fB\$1\fR\$2
. shift 2
-. \}
+. \@}
. if \n[.$] .as result \fB\$1
\*[result]
. ft R
@@ -4716,7 +4778,7 @@ Without an argument, the @code{tr} request is ignored.
@end itemize
@end_Deffn
-@findex \!
+@findex \!@r{, and @code{trnt}}
@Deffn{Request, trnt, @var{a}@var{b}@var{c}@var{d}@dots{}}
@code{trnt} is the same as the @code{tr} request except that the
translations do not apply to text that is transparently throughput into
@@ -4794,7 +4856,7 @@ device; the code for switching to nroff mode is in the file
@cindex line dimensions
The following drawing shows the dimensions which @code{gtroff} uses for
placing a line of output onto the page. They are labeled with the
-request which manipulates that dimension.
+request which manipulates each dimension.
@example
@group
@@ -4817,19 +4879,19 @@ These dimensions are:
@cindex margin, left
@cindex page offset
@cindex offset, page
-@dfn{Page offset} -- This is the leftmost position of text on the final
+@dfn{Page offset} -- this is the leftmost position of text on the final
output, defining the @dfn{left margin}.
@item in
@cindex indentation
@cindex line indentation
-@dfn{Indentation} -- This is the distance from the left margin where
+@dfn{Indentation} -- this is the distance from the left margin where
text will be printed.
@item ll
@cindex line length
@cindex length of line
-@dfn{Line length} -- This is the distance from the left margin to right
+@dfn{Line length} -- this is the distance from the left margin to right
margin.
@end ftable
@@ -4953,6 +5015,7 @@ The line length is associated with the current environment.
@vindex .l
@vindex .ll
+@cindex current line length register
The current line length (as set by @code{ll}) can be found in the
built-in number register @code{.l}. The number register @code{.ll} is
the line length that applies to the current output line.
@@ -4983,6 +5046,7 @@ decrement the current value by @var{length}). This is the length of the
physical output page. The default scaling indicator is@w{ }@code{v}.
@vindex .p
+@cindex current page length register
The current setting can be found in the built-in number register
@samp{.p}.
@@ -5020,6 +5084,7 @@ with the @code{pc} request (see below).
@cindex title line, length
@findex lt
@vindex .lt
+@cindex current title line length register
The title line is printed using its own line length, which is specified
with the @code{lt} request. The current setting of this is available in
the @code{.lt} number register.
@@ -5032,6 +5097,7 @@ page. The only argument is the page number.
@vindex %
@vindex .pn
+@cindex current page number register
The current page number is stored in the number register @code{%}. The
number register @code{.pn} contains the number of the next page: either
the value set by a @code{pn} request, or the number of the current page
@@ -5056,6 +5122,7 @@ mechanism is disabled.
@findex bp
@findex pn
+@cindex new page
To stop processing the current page, and move to the next page, invoke
the @code{bp} request. This request will also cause a break. It can
also take an argument of what the next page should be numbered. The
@@ -5077,7 +5144,7 @@ It is often necessary to force a certain amount of space before a new
page occurs. This is most useful to make sure that there is not a
single @dfn{orphan} line left at the bottom of a page. The @code{ne}
request will ensure that there is a certain distance, specified by the
-first argument, before the next page is triggered (@pxref{Traps}, for
+first argument, before the next page is triggered (see @ref{Traps}, for
further information). The default unit for @code{ne} is @code{v} and
the default argument is@w{ }1@dmn{v}.
@@ -5143,7 +5210,7 @@ used via an escape.
@cindex previous font
@cindex font, previous
Font changes can be done either with the @code{ft} request or the
-@code{\f} request. With no arguments it will switch to the previous
+@code{\f} request. With no arguments, it will switch to the previous
font (also known as @samp{P}).
@example
@@ -5167,7 +5234,7 @@ Both of the above examples will produce the same output. Note the usage
of @samp{P} to indicate the previous font -- using @code{\f} it is not
possible to omit this parameter.
-Sometimes when putting letters of different fonts, more or less space at
+Sometimes, when putting letters of different fonts, more or less space at
such boundaries are needed. There are two escapes to help with this.
@findex \/
@@ -5223,8 +5290,8 @@ The @code{ftr} request will translate fonts; its syntax is
which translates font@w{ }@var{F} to font@w{ }@var{G}. Whenever a font
named @var{F} is referred to in a @code{\f} escape sequence, or in the
@code{ft}, @code{ul}, @code{bd}, @code{cs}, @code{tkf}, @code{special},
-@code{fspecial}, @code{fp}, or @code{code} requests, font@w{ }@var{G} will
-be used. If @var{G} is missing, or equal to @var{F} then font@w{
+@code{fspecial}, @code{fp}, or @code{code} requests, font@w{ }@var{G}
+will be used. If @var{G} is missing, or equal to @var{F} then font@w{
}@var{F} will not be translated.
@c ---------------------------------------------------------------------
@@ -5297,10 +5364,11 @@ say no more!
@end example
@noindent
-Note that after these font changes have taken place the original font
+Note that after these font changes have taken place, the original font
is restored.
@vindex .f
+@cindex current font position register
The current font in use, as a font position, is available in number
register @code{.f}. This can be useful to remember the current font,
for later recall.
@@ -5312,6 +5380,7 @@ for later recall.
@end example
@vindex .fp
+@cindex next free font position register
The number of the next free font position is available in the number
register @code{.fp}. This is useful when mounting a new font, like so:
@@ -5319,7 +5388,7 @@ register @code{.fp}. This is useful when mounting a new font, like so:
.fp \n[.fp] NEATOFONT
@end example
-@pindex DESC
+@pindex DESC@r{, and font mounting}
Fonts not listed in the @file{DESC} file are automatically mounted on
the next available font position when they are referenced. If a font is
to be mounted explicitly with the @code{fp} request on an unused font
@@ -5452,6 +5521,7 @@ having a zero space factor in @TeX{} (initially characters
@findex char
@cindex defining characters
@cindex characters, defining
+@cindex creating new characters
New characters can be created with the @code{char} request. It is
called as
@@ -5508,7 +5578,7 @@ were separate programs. These are no longer necessary in GNU
@findex ul
@cindex underlining
The @code{ul} request will print subsequent lines in italics on a device
-capable of it, or underline the text on an character output device. The
+capable of it, or underline the text on a character output device. The
single argument is the number of lines to be ``underlined,'' with no
argument, the next line will be underlined.
@@ -5541,19 +5611,20 @@ missing, emboldening will be turned off.
@cindex ligatures and kerning
@cindex kerning and ligatures
-What are ligatures?
+@c XXX What are ligatures?
@c XXX more info
@findex lg
@vindex .lg
+@cindex ligatures enabled register
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 number register @code{.lg} (set to@w{ }1 if ligatures are
enabled, 0@w{ }otherwise).
-What is kerning?
+@c XXX What is kerning?
@c XXX more info
@@ -5566,6 +5637,7 @@ characters can be inhibited by placing @code{\&} between them.
@findex kern
@vindex .kern
+@cindex kerning enabled register
Kerning can be activated with the @code{kern} request. If the parameter
is non-zero or missing, enable pairwise kerning, otherwise disable it.
The number register @code{.kern} is set to@w{ }1 if pairwise kerning is
@@ -5574,13 +5646,14 @@ enabled, 0@w{ }otherwise.
@findex tkf
@cindex track kerning
@cindex kerning, track
-What is track kerning?
+
+@c XXX What is track kerning?
@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. The syntax
-of the @code{tkf} request is
+of the @code{tkf} request is like this:
@example
.tkf @var{f} @var{s1} @var{n1} @var{s2} @var{n2}
@@ -5639,6 +5712,8 @@ typesetters, as @dfn{leading}.
@findex \s
@vindex .s
@vindex .v
+@cindex current type size register
+@cindex current vertical spacing register
Using the @code{ps} request and the @code{\s} escape the type size can
be changed. The @code{vs} request will change the vertical spacing.
The default unit for the @code{ps} and @code{vs} requests are points.
@@ -5693,9 +5768,11 @@ Some devices may only have certain permissible sizes, in which case
@c XXX example
+@ignore
@example
... .sz macro example?? ...
@end example
+@end ignore
@c ---------------------------------------------------------------------
@@ -5717,8 +5794,8 @@ 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
+@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}
@@ -5728,8 +5805,8 @@ as their argument (see below).
For example, suppose @var{sizescale} is@w{ }1000; then a scaled point
will be equivalent to a millipoint; the request @w{@samp{.ps 10.25}} is
-equivalent to @w{@samp{.ps 10.25z}} and thus sets the point size to 10250
-scaled points, which is equal to 10.25@w{ }points.
+equivalent to @w{@samp{.ps 10.25z}} and thus sets the point size to
+10250@w{ }scaled points, which is equal to 10.25@w{ }points.
It would make no sense to use the @samp{z} scale indicator in a numeric
expression whose default scale indicator was neither @samp{u} nor
@@ -5751,9 +5828,10 @@ the point size in scaled points.
@vindex .psr
@vindex .sr
+@cindex last-requested point size register
The last-requested point size in scaled points is contained in the
@code{.psr} number register. The last requested point size in points as
-a decimal fraction can be found in @code{.psr}. This is a string-valued
+a decimal fraction can be found in @code{.sr}. This is a string-valued
register.
@table @code
@@ -5770,7 +5848,7 @@ expression with a default scale indicator of @samp{z}.
@itemx \s'-@var{n}'
@itemx \s+'@var{n}'
@itemx \s-'@var{n}'
-Increases resp.@: decreases the point size by @var{n} scaled points;
+Increase or resp.@: decrease the point size by @var{n} scaled points;
@var{n} is a numeric expression with a default scale indicator of
@samp{z}.
@end table
@@ -5851,8 +5929,8 @@ argument onto the string named by the first argument.
@findex \@key{RET}
@cindex multi-line strings
@cindex strings, multi-line
-@cindex newline character, escaping
-@cindex escaping newline characters
+@cindex newline character in strings, escaping
+@cindex escaping newline characters in strings
Strings are not limited to a single line of text. A string can span
several lines by escaping the newlines with a backslash. The resulting
string will be stored @emph{without} the newlines.
@@ -5895,6 +5973,7 @@ Here the syntax of the @code{length} request:
It computes the length of @var{string} and returns it in the number
register@w{ }@var{xx} (which is not necessarily defined before).
+@ignore
@findex rn
@code{rn}
@@ -5914,6 +5993,8 @@ register@w{ }@var{xx} (which is not necessarily defined before).
@code{chop}
@c XXX
+@end ignore
+
@xref{Identifiers}, and @ref{Comments}.
@@ -5925,8 +6006,8 @@ register@w{ }@var{xx} (which is not necessarily defined before).
@cindex conditionals and loops
@cindex loops and conditionals
-@findex if
-@findex while
+@findex if@r{, operators to use with it}
+@findex while@r{, operators to use with it}
In @code{if} and @code{while} requests, there are several more operators
available:
@@ -5947,7 +6028,7 @@ True if the document is being processed in troff mode.
True if the string @var{xxx} is equal to the string @var{yyy}. Other
characters can be used in place of the single quotes.
@c XXX (Which?)
-The strings are `formatted' before being compared.
+The strings are ``formatted'' before being compared.
@c XXX (?)
@item r@var{xxx}
@@ -6065,8 +6146,8 @@ The preceding example produces:
Note the usage of the @code{\&} escape to avoid a control character at
the beginning of a line.
-@findex break
-@findex continue
+@findex break@r{, in a @code{while} loop}
+@findex continue@r{, in a @code{while} loop}
The @code{break} request will @dfn{break} out of a while loop. Be sure
not to confuse this with the @code{br} request (causing a line break).
The @code{continue} request will finish the current iteration of a while
@@ -6102,6 +6183,7 @@ paragraphs.
@end example
@findex am
+@cindex appending, to a macro
The @code{am} request works similarly to @code{de} except it appends
onto the macro named by the first argument. So, to make the previously
defined @samp{P} macro actually do indented instead of block paragraphs,
@@ -6133,11 +6215,11 @@ Macros can be aliased with the @code{als} request.
@cindex copy-in mode
@cindex mode, copy-in
-@findex \n
-@findex \$
-@findex \*
-@findex \\
-@findex \@key{RET}
+@findex \n@r{, when reading test for a macro}
+@findex \$@r{, when reading test for a macro}
+@findex \*@r{, when reading test for a macro}
+@findex \\@r{, when reading test for a macro}
+@findex \@key{RET}@r{, when reading test for a macro}
When @code{gtroff} reads in the text for a macro or diversion it copies
the text (including request lines, but excluding escapes) into an
internal buffer. Escapes will be converted into an internal form,
@@ -6177,7 +6259,7 @@ The number of arguments is available in the @code{.$} number register.
Any individual argument can be retrieved with one of the following
escapes:
-@cindex copy-in mode
+@cindex copy-in mode, and macro arguments
The escapes @code{\$@var{n}}, @code{\$(@var{nn}} and
@code{\$[@var{nnn}]} will result in the @var{n}th, @var{nn}th or
@var{nnn}th argument. As usual, the first form only accepts a single
@@ -6204,7 +6286,7 @@ arguments with each surrounded by double quotes, and separated by
spaces.
@findex \$0
-@findex als
+@findex als@r{, use with @code{\$0}}
The @code{\$0} escape is the name by which the current macro was
invoked. The @code{als} request can make a macro have more than one
name.
@@ -6219,7 +6301,7 @@ name.
This would be called as
@example
-.vl $Id: groff.texinfo,v 1.39 2000/05/28 21:46:40 wlemb Exp $
+.vl $Id: groff.texinfo,v 1.40 2000/06/18 10:13:51 wlemb Exp $
@end example
@xref{Request Arguments}.
@@ -6232,7 +6314,7 @@ This would be called as
@cindex page motions
@cindex motions, page
-@findex sp
+@findex sp@r{, as vertical page motion}
Motions up and down the page can be done with the @code{sp} request.
However, this causes a break so that the actual effect is to move to the
left margin and then to the specified location.
@@ -6249,10 +6331,11 @@ name given as an argument, with no argument it will return to the
location marked with the @code{mk} request
@c XXX example
-
+@ignore
@example
... dual column example ...
@end example
+@end ignore
The following escapes give fine control of movements about the page.
@@ -6281,6 +6364,9 @@ move down@w{ }.5@dmn{v}.
@end ftable
@findex \h
+@cindex inserting horizontal space
+@cindex horizontal space
+@cindex space, horizontal
Horizontal motions can be done via the @code{\h'@var{e}'} escape. The
expression@w{ }@var{e} indicates how far to move: positive is rightwards
and negative leftwards.
@@ -6290,11 +6376,11 @@ 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)
-space. (Note: It is a backslash followed by a space.)
+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/6th em space.
@@ -6319,9 +6405,11 @@ sentence recognition.
@c XXX example
+@ignore
@example
... tex logo example ...
@end example
+@end ignore
@findex \w
@cindex width escape
@@ -6333,9 +6421,11 @@ width of the given @var{text} in basic units.
@c XXX example
+@ignore
@example
... strlen example ...
@end example
+@end ignore
Font changes may occur in @var{text} which don't affect current
settings.
@@ -6359,18 +6449,19 @@ heights and depths of characters.
@item ct
@vindex ct
is set according to what kinds of characters occur in @var{text}:
+
@table @asis
@item 0
only short characters, no descenders or tall characters.
@item 1
-descender
+descender.
@item 2
-tall character
+tall character.
@item 3
-both a descender and a tall character
+both a descender and a tall character.
@end table
@item ssc
@@ -6402,8 +6493,8 @@ over that character.
@cindex requests for drawing
@code{gtroff} provides a number of ways to draw lines and other figures
-on the page. Used in combination with the page motion commands
-(@pxref{Page Motions}, for more info), a wide variety of figures can be
+on the page. Used in combination with the page motion commands (see
+@ref{Page Motions}, for more info), a wide variety of figures can be
drawn. However, for complex drawings these operations can be quite
cumbersome, and it may be wise to use graphic preprocessors like
@code{gpic} or @code{ggrn}. @xref{gpic}, and @ref{ggrn}, for more
@@ -6412,10 +6503,11 @@ information.
All drawing is done via escapes.
@findex \l
-@cindex horizontal line
-@cindex line, horizontal
+@cindex drawing horizontal lines
+@cindex horizontal line, drawing
+@cindex line, horizontal, drawing
The @code{\l} escape will draw a line rightwards from the current
-location. The full syntax for this escape is
+location. The full syntax for this escape is like this:
@example
\l'@var{l}@var{c}'
@@ -6459,8 +6551,9 @@ drawing escapes both draw from the current location to the beginning of
the @emph{input} line.
@findex \L
-@cindex vertical line
-@cindex line, vertical
+@cindex drawing vertical lines
+@cindex vertical line drawing
+@cindex line, vertical, drawing
@cindex line drawing character
@cindex character for line drawing
@cindex box rule character
@@ -6474,9 +6567,11 @@ ends.
@c XXX example
+@ignore
@example
...box macro...
@end example
+@end ignore
@findex \D
More flexible drawing functions are available via the @code{\D} escape.
@@ -6490,12 +6585,15 @@ Draw a line from the current location to the relative point specified by
@c XXX example
+@ignore
@example
...revised box macro...
@end example
+@end ignore
@item \D'c @var{d}'
-@cindex circles
+@cindex circle drawing
+@cindex drawing a circle
Draw a circle with a diameter of @var{d} with the leftmost point at the
current position.
@@ -6503,7 +6601,8 @@ current position.
Draw a solid circle with the same parameters as an outlined circle.
@item \D'e @var{dx} @var{dy}'
-@cindex ellipses
+@cindex drawing an ellipse
+@cindex ellipse drawing
Draw an ellipse with a horizontal diameter of @var{dx} and a vertical
diameter of @var{dy} with the leftmost point at the current position.
@@ -6511,18 +6610,21 @@ diameter of @var{dy} with the leftmost point at the current position.
Draw a solid ellipse with the same parameters as an outlined ellipse.
@item \D'a @var{dx1} @var{dy1} @var{dx2} @var{dy2}'
-@cindex arcs
+@cindex arc drawing
+@cindex drawing an arc
Draw an arc clockwise from the current location through the two
specified locations (@var{dx1},@var{dy1}) and (@var{dx2},@var{dy2}).
@item \D'~ @var{dx1} @var{dy1} @var{dx2} @var{dy2} ...'
-@cindex splines
+@cindex drawing a spline
+@cindex spline drawing
Draw a spline from the current location to (@var{dx1},@var{dy1}) and
then to (@var{dx2},@var{dy2}), and so on.
@item \D'f @var{n}'
@cindex gray shading
@cindex shading
+@cindex shades for filling objects
Set the shade of gray to be used for filling solid objects to@w{
}@var{n}; @var{n}@w{ }must be an integer between 0 and@w{ }1000, where 0
corresponds solid white and 1000 to solid black, and values in between
@@ -6531,25 +6633,30 @@ circles, solid ellipses and solid polygons. By default, a level of@w{
}1000 will be used.
@item \D'p @var{dx1} @var{dy1} @var{dx2} @var{dy2} ...'
-@cindex polygons
+@cindex drawing a polygon
+@cindex polygon drawing
Draw a polygon from the current location to (@var{dx1},@var{dy1}) and
then to (@var{dx2},@var{dy2}) and so on. When the specified data points
are exhausted, a line is drawn back to the starting point.
@c XXX example
+@ignore
@example
... box example (yes, again)...
@end example
+@end ignore
@item \D'P @var{dx1} @var{dy1} @var{dx2} @var{dy2} ...'
Draw a solid polygon with the same parameters as an outlined polygon.
@c XXX example
+@ignore
@example
... shaded box example ...
@end example
+@end ignore
@item \D't @var{n}'
@cindex line thickness
@@ -6639,14 +6746,16 @@ space at the bottom of the page for them.
@c XXX
+@ignore
@example
... (simplified) footnote example ...
@end example
+@end ignore
@findex vpt
@findex wh
-@findex dt
@vindex .vpt
+@cindex vertical position trap enable register
The @code{vpt} request will enable vertical position traps if the
argument is non-zero, disable them otherwise. Vertical position traps
are traps set by the @code{wh} or @code{dt} requests. Traps set by the
@@ -6656,7 +6765,7 @@ Initially vertical position traps are enabled. The current setting of
this is available in the number register @code{.vpt}.
@vindex .trunc
-@findex ne
+@findex ne@r{, and the @code{.trunc} register}
The number register @code{.trunc} contains the amount of vertical space
truncated by the most recently sprung vertical position trap, or, if the
trap was sprung by a @code{ne} request, minus the amount of vertical
@@ -6679,7 +6788,7 @@ Control}, for more information.
@cindex traps, diversion
@findex dt
-@vindex .t
+@vindex .t@r{, and diversions}
Traps can also be set @emph{within} a diversion using the @code{dt}
request. Like @code{wh} the first argument is the location of the trap
and the second argument is the name of the macro to be invoked. The
@@ -6772,9 +6881,11 @@ into. The @code{da} macro will append to an existing diversion.
@c XXX example
+@ignore
@example
... end-note example ...
@end example
+@end ignore
@vindex .z
@vindex .d
@@ -6924,13 +7035,15 @@ hyphen indicators, margin character data
partially collected lines
@end itemize
-These environments may be given arbitrary names (@pxref{Identifiers},
+These environments may be given arbitrary names (see @ref{Identifiers},
for more info). Old versions of @code{troff} only had environments
named @samp{0}, @samp{1} and@w{ }@samp{2}.
@findex ev
@vindex .ev
-The @code{ev} request will switch among environments. The single
+@cindex switch environments
+@cindex current environment number/name register
+The @code{ev} request will switch to another environment. The single
argument is the name of the environment to switch to. With no argument
@code{gtroff} will switch back to the previous environment. There is no
limit on the number of named environments; they will be created the
@@ -6947,11 +7060,13 @@ switch back to environment @samp{foo}.
@c XXX example
+@ignore
@example
... page break macro, revised ...
@end example
+@end ignore
-Here another example:
+Here is another example:
@example
.ev footnote-env
@@ -6967,6 +7082,7 @@ Here another example:
@end example
@findex evc
+@cindex copy environment
To copy an environment into the current one, use the @code{evc} request,
which takes the name of the environment to copy from as an argument.
@@ -6981,6 +7097,8 @@ which takes the name of the environment to copy from as an argument.
@cindex output and input requests
@findex so
+@cindex including a file
+@cindex file inclusion
The @code{so} request will read in the file given as an argument and
include it in place of the @code{so} request. This is quite useful for
large documents, i.e.@: keeping each chapter in a separate file.
@@ -7018,10 +7136,8 @@ considered a bug. This request causes a line break.
@findex trf
With @code{trf}, unlike @code{cf}, the file cannot contain characters
-such as NUL that are not legal @code{gtroff} input characters. This
-request causes a line break.
-
-@c XXX xref to illegal input characters
+such as NUL that are not valid @code{gtroff} input characters
+(@pxref{Identifiers}). This request causes a line break.
@findex nx
The @code{nx} request will force @code{gtroff} to continue processing of
@@ -7108,6 +7224,7 @@ print out the @code{nr} requests which will set the number registers
the @code{so} request.
@vindex systat
+@cindex @code{system()} return value register
The @code{systat} number register contains the return value of the
@code{system()} function executed by the last @code{sy} request.
@@ -7121,9 +7238,8 @@ The @code{opena} is like @code{open}, but if the file exists, append to
it instead of truncating it.
@findex write
-@findex ds
-@cindex copy-in mode
-@cindex mode, copy-in
+@cindex copy-in mode, and @code{write} requests
+@cindex mode, copy-in, and @code{write} requests
The @code{write} request will write to the file associated with the
stream specified by the first argument. The stream must previously have
been the subject of an open request. The remainder of the line is
@@ -7137,16 +7253,18 @@ argument; stream will no longer be an acceptable argument to the
@c XXX example
+@ignore
@example
... example of open write &c...
@end example
+@end ignore
@findex \V
The @code{\V} escape will interpolate the contents of the specified
-environment variable, as returned by @code{getenv()}. The argument to
-@code{\V} is specified as an identifier, i.e.@: @samp{\V@var{x}},
-@samp{\V(@var{xx}} or @samp{\V[@var{xxx}]}. @code{\V} is interpreted in
-copy-in mode.
+environment variable, as returned by the function @code{getenv}. The
+argument to @code{\V} is specified as an identifier, i.e.@:
+@samp{\V@var{x}}, @samp{\V(@var{xx}} or @samp{\V[@var{xxx}]}. @code{\V}
+is interpreted in copy-in mode.
@c =====================================================================
@@ -7184,7 +7302,7 @@ that do not know about this extension.
@section Miscellaneous
@cindex miscellaneous
-This section contains parts of @code{gtroff} which cannot (yet) be
+This section documents parts of @code{gtroff} which cannot (yet) be
categorized elsewhere in this manual.
@findex nm
@@ -7210,9 +7328,11 @@ to@w{ }1.
@c XXX example
+@ignore
@example
... line numbering example ...
@end example
+@end ignore
@findex mc
@cindex margin characters
@@ -7232,9 +7352,11 @@ there are programs available for doing this (they are called
@c XXX example
+@ignore
@example
... margin char example ...
@end example
+@end ignore
@findex lf
@pindex soelim
@@ -7249,9 +7371,11 @@ intelligible to the user.
@c XXX example
+@ignore
@example
... example of soelim'ed doc ...
@end example
+@end ignore
@c =====================================================================
@@ -7266,8 +7390,8 @@ and strategies for debugging.
@itemize @bullet
@item
@findex tm
-The @code{tm} request will send output to stderr; this is very useful
-for printing debugging output.
+The @code{tm} request will send output to the standard error stream;
+this is very useful for printing debugging output.
@item
When doing something involved it is useful to leave the debugging
@@ -7292,10 +7416,10 @@ it will cause @code{gtroff} to stop processing. With no argument it
will print @samp{User Abort}.
@item
-@findex ex
+@findex ex@r{, use in debugging}
@cindex exiting
The @code{ex} request will also cause @code{gtroff} to stop processing
-(if encountered at the topmost level; see also @ref{I/O}.
+if encountered at the topmost level; see also @ref{I/O}.
@item
If it is known in advance that there will be many errors and no useful
@@ -7340,7 +7464,7 @@ request causes a line break.
@cindex backtrace of input stack
@cindex input stack, backtrace
The @code{backtrace} request will print a backtrace of the input stack
-on stderr.
+to the standard error stream.
@item
@cindex warnings
@@ -7420,8 +7544,8 @@ Dubious syntax in numeric expressions.
@item di
@itemx 256
-@findex di
-@findex da
+@findex di@r{, debugging}
+@findex da@r{, debugging}
Use of @code{di} or @code{da} without an argument when there is no
current diversion.
@@ -7449,7 +7573,7 @@ Use of a tab character where a number was expected.
@item right-brace
@itemx 4096
-@findex \@}
+@findex \@}@r{, debugging}
Use of @code{\@}} where a number was expected.
@item missing
@@ -7495,6 +7619,7 @@ All warnings.
@section Implementation Differences
@cindex implementation differences
@cindex differences in implementation
+@cindex incompatibilities with Unix @code{troff}
@cindex compatibility mode
@cindex mode, compatibility
@@ -7510,8 +7635,8 @@ will interpret
.dsabcd
@end example
-@findex \*
-@findex \n
+@findex \*@r{, incompatibilities with Unix @code{troff}}
+@findex \n@r{, incompatibilities with Unix @code{troff}}
@findex cp
@vindex .C
@noindent
@@ -7552,7 +7677,7 @@ avoiding use of these escape sequences in names.
@cindex fractional point sizes
@cindex point sizes, fractional
-@findex ps
+@findex ps@r{, incompatibilities with Unix @code{troff}}
Fractional point sizes cause one noteworthy incompatibility. In
@acronym{UNIX} @code{troff} the @code{ps} request ignores scale
indicators and thus
@@ -7566,14 +7691,14 @@ will set the point size to 10@w{ }points, whereas in GNU @code{troff} it
will set the point size to 10@w{ }scaled points. @xref{Fractional Type
Sizes}, for more information.
-@findex bd
-@findex cs
-@findex tkf
-@findex tr
-@findex fp
-@cindex input and output characters
-@cindex output characters
-@cindex characters, input and output
+@findex bd@r{, incompatibilities with Unix @code{troff}}
+@findex cs@r{, incompatibilities with Unix @code{troff}}
+@findex tkf@r{, incompatibilities with Unix @code{troff}}
+@findex tr@r{, incompatibilities with Unix @code{troff}}
+@findex fp@r{, incompatibilities with Unix @code{troff}}
+@cindex input and output characters, compatibility with Unix
+@cindex output characters, compatibility with Unix
+@cindex characters, input and output, compatibility with Unix
In GNU @code{troff} there is a fundamental difference between
unformatted, input characters, and formatted, output characters.
Everything that affects how an output character will be output is stored
@@ -7597,11 +7722,11 @@ constructed might have had. For example,
.x
@end example
-@findex \e
-@findex \!
-@findex \?
-@cindex transparent output
-@cindex output, transparent
+@findex \e@r{, incompatibilities with Unix @code{troff}}
+@findex \!@r{, incompatibilities with Unix @code{troff}}
+@findex \?@r{, incompatibilities with Unix @code{troff}}
+@cindex transparent output, incompatibilities with Unix @code{troff}
+@cindex output, transparent, incompatibilities with Unix @code{troff}
@noindent
will print @samp{\\} in GNU @code{troff}; each pair of input backslashes
is turned into one output backslash and the resulting output backslashes
@@ -7749,7 +7874,7 @@ which are freely available.
@section @code{grap}
@cindex @code{grap}
-A freely available implementation of @code{grap}, written by Ted Faber,
+A free implementation of @code{grap}, written by Ted Faber,
is available as an extra package from the following address:
@display
@@ -8097,7 +8222,7 @@ horizontal resolution. Special characters cannot be printed using this
command.
@kindex tcommand
-@pindex DESC
+@pindex DESC@r{, and @code{tcommand}}
This command is only allowed if the @samp{tcommand} line is present in
the @file{DESC} file.
@@ -8117,7 +8242,7 @@ the @file{DESC} file.
@item s@var{n}
@kindex sizescale
-@pindex DESC
+@pindex DESC@r{, and @code{sizescale}}
The argument to the @samp{s} command is in scaled points (units of
points/@var{n}, where @var{n} is the argument to the @samp{sizescale}
command in the @file{DESC} file).
@@ -8179,9 +8304,11 @@ will produce
@c XXX example
+@ignore
@example
... sample output here ...
@end example
+@end ignore
@c ---------------------------------------------------------------------
@@ -8308,8 +8435,8 @@ The @code{gtroff} font format is roughly a superset of the
there is no associated binary format; all files are text files. The
font files for device @var{name} are stored in a directory
@file{dev@var{name}}. There are two types of file: a device description
-file called @file{DESC} and for each font@w{ }@samp{F} a font file
-called@w{ }@file{F}.
+file called @file{DESC} and for each font@w{ }@var{f} a font file
+called@w{ }@file{@var{f}}.
@menu
* DESC file format::
@@ -8323,7 +8450,7 @@ called@w{ }@file{F}.
@cindex @file{DESC} file format
@cindex font description file format
@cindex format of font description file
-@pindex DESC
+@pindex DESC@r{ file format}
The @file{DESC} file can contain the following types of line:
@@ -8388,7 +8515,7 @@ allowed for the sake of backwards compatibility.
@end table
The @code{res}, @code{unitwidth}, @code{fonts} and @code{sizes} lines
-are compulsory. Other commands are ignored by @code{gtroff} but may be
+are mandatory. Other commands are ignored by @code{gtroff} but may be
used by postprocessors to store arbitrary information about the device
in the @file{DESC} file.
@@ -8407,9 +8534,9 @@ each containing a sequence of blank delimited words; the first word in
the line is a key, and subsequent words give a value for that key.
@table @code
-@item name @var{F}
+@item name @var{f}
@kindex name
-The name of the font is@w{ }@var{F}.
+The name of the font is@w{ }@var{f}.
@item spacewidth @var{n}
@kindex spacewidth
diff --git a/gendef.sh b/gendef.sh
index e2b2575f..de32279b 100644
--- a/gendef.sh
+++ b/gendef.sh
@@ -11,7 +11,11 @@ do
#define $def"
done
-t=/tmp/groff.$$
+# Use $TMPDIR if defined. Default to cwd, for non-Unix systems
+# which don't have /tmp on each drive (we are going to remove
+# the file before we exit anyway). Put the PID in the basename,
+# since the extension can only hold 3 characters on MS-DOS.
+t=${TMPDIR-.}/gro$$.tmp
sed -e 's/=/ /' >$t <<EOF
$defs
diff --git a/src/devices/grodvi/dvi.cc b/src/devices/grodvi/dvi.cc
index 603ea7c2..04ef9c5a 100644
--- a/src/devices/grodvi/dvi.cc
+++ b/src/devices/grodvi/dvi.cc
@@ -19,10 +19,7 @@ with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "driver.h"
-#ifdef _MSC_VER
-#include <io.h>
-#include <fcntl.h>
-#endif
+#include "nonposix.h"
#define DEFAULT_LINEWIDTH 40
static int linewidth = DEFAULT_LINEWIDTH;
diff --git a/src/devices/grolbp/lbp.cc b/src/devices/grolbp/lbp.cc
index 48564647..fe06e1c4 100644
--- a/src/devices/grolbp/lbp.cc
+++ b/src/devices/grolbp/lbp.cc
@@ -31,6 +31,8 @@ TODO
#include "lbp.h"
#include "charset.h"
+#include "nonposix.h"
+
#ifdef HAVE_STRNCASECMP
#ifdef NEED_DECLARATION_STRNCASECMP
extern "C" {
@@ -58,7 +60,6 @@ private:
lbp_font(const char *);
};
-
class lbp_printer : public printer {
public:
lbp_printer();
@@ -176,6 +177,9 @@ lbp_printer::lbp_printer()
cur_symbol_set(0),
line_thickness(-1)
{
+#ifdef SET_BINARY
+ SET_BINARY(fileno(stdout));
+#endif
lbpinit(stdout);
lbpputs("\033c\033;\033[2&z\033[7 I\033[?32h\033[?33h\033[11h");
wp54charset(); // Define the new symbol set
diff --git a/src/devices/grolj4/lj4.cc b/src/devices/grolj4/lj4.cc
index 267391f8..0c23a456 100644
--- a/src/devices/grolj4/lj4.cc
+++ b/src/devices/grolj4/lj4.cc
@@ -33,6 +33,7 @@ X command to include bitmap graphics
*/
#include "driver.h"
+#include "nonposix.h"
static struct {
const char *name;
@@ -676,6 +677,9 @@ int main(int argc, char **argv)
default:
assert(0);
}
+#ifdef SET_BINARY
+ SET_BINARY(fileno(stdout));
+#endif
if (optind >= argc)
do_file("-");
else {
diff --git a/src/devices/grops/ps.cc b/src/devices/grops/ps.cc
index fc736389..c065dafa 100644
--- a/src/devices/grops/ps.cc
+++ b/src/devices/grops/ps.cc
@@ -21,6 +21,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "driver.h"
#include "stringclass.h"
#include "cset.h"
+#include "nonposix.h"
#include "ps.h"
#include <time.h>
@@ -1519,6 +1520,9 @@ int main(int argc, char **argv)
assert(0);
}
font::set_unknown_desc_command_handler(handle_unknown_desc_command);
+#ifdef SET_BINARY
+ SET_BINARY(fileno(stdout));
+#endif
if (optind >= argc)
do_file("-");
else {
diff --git a/src/include/Makefile.sub b/src/include/Makefile.sub
index 42064ec7..500f0597 100644
--- a/src/include/Makefile.sub
+++ b/src/include/Makefile.sub
@@ -13,6 +13,7 @@ HDRS=\
index.h \
lib.h \
macropath.h \
+ nonposix.h \
posix.h \
printer.h \
ptable.h \
diff --git a/src/libs/libbib/index.cc b/src/libs/libbib/index.cc
index 6717fcbd..55737717 100644
--- a/src/libs/libbib/index.cc
+++ b/src/libs/libbib/index.cc
@@ -35,6 +35,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "index.h"
#include "defs.h"
+#include "nonposix.h"
+
// Interface to mmap.
extern "C" {
void *mapread(int fd, int len);
@@ -274,7 +276,7 @@ search_item *make_index_search_item(const char *filename, int fid)
char *index_filename = new char[strlen(filename) + sizeof(INDEX_SUFFIX)];
strcpy(index_filename, filename);
strcat(index_filename, INDEX_SUFFIX);
- int fd = open(index_filename, O_RDONLY);
+ int fd = open(index_filename, O_RDONLY | O_BINARY);
if (fd < 0)
return 0;
index_search_item *item = new index_search_item(index_filename, fid);
@@ -358,7 +360,7 @@ int index_search_item_iterator::get_tag(int tagno,
}
tag *tp = indx->tags + tagno;
const char *filename = indx->munge_filename(indx->pool + tp->filename_index);
- int fd = open(filename, O_RDONLY);
+ int fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0) {
error("can't open `%1': %2", filename, strerror(errno));
return 0;
@@ -376,7 +378,7 @@ int index_search_item_iterator::get_tag(int tagno,
return 0;
}
int res = 0;
- FILE *fp = fdopen(fd, "r");
+ FILE *fp = fdopen(fd, FOPEN_RB);
if (!fp) {
error("fdopen failed");
close(fd);
@@ -410,6 +412,20 @@ int index_search_item_iterator::get_tag(int tagno,
error("fread on `%1' failed: %2", filename, strerror(errno));
else {
buf[0] = '\n';
+ // Remove the CR characters from CRLF pairs.
+ int sidx = 1, didx = 1;
+ for ( ; sidx < length + 1; sidx++, didx++)
+ {
+ if (buf[sidx] == '\r')
+ {
+ if (buf[++sidx] != '\n')
+ buf[didx++] = '\r';
+ else
+ length--;
+ }
+ if (sidx != didx)
+ buf[didx] = buf[sidx];
+ }
buf[length + 1] = '\n';
res = searcher.search(buf + 1, buf + 2 + length, pp, lenp);
if (res && ridp)
@@ -424,10 +440,11 @@ int index_search_item_iterator::get_tag(int tagno,
const char *index_search_item::munge_filename(const char *filename)
{
- if (filename[0] == '/')
+ if (IS_ABSOLUTE(filename))
return filename;
const char *cwd = pool;
- int need_slash = (cwd[0] != 0 && strchr(cwd, '\0')[-1] != '/');
+ int need_slash = (cwd[0] != 0
+ && strchr(DIR_SEPS, strchr(cwd, '\0')[-1]) == 0);
int len = strlen(cwd) + strlen(filename) + need_slash + 1;
if (len > filename_buflen) {
a_delete filename_buffer;
@@ -614,7 +631,7 @@ void index_search_item::check_files()
if (stat(path, &sb) < 0)
error("can't stat `%1': %2", path, strerror(errno));
else if (sb.st_mtime > mtime) {
- int fd = open(path, O_RDONLY);
+ int fd = open(path, O_RDONLY | O_BINARY);
if (fd < 0)
error("can't open `%1': %2", path, strerror(errno));
else
diff --git a/src/libs/libbib/linear.cc b/src/libs/libbib/linear.cc
index 77bd2312..a8c2a553 100644
--- a/src/libs/libbib/linear.cc
+++ b/src/libs/libbib/linear.cc
@@ -30,6 +30,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "error.h"
#include "cset.h"
#include "cmap.h"
+#include "nonposix.h"
#include "refid.h"
#include "search.h"
@@ -330,6 +331,19 @@ int file_buffer::load(int fd, const char *filename)
else {
close(fd);
buffer[3] = '\n';
+ int sidx = 4, didx = 4;
+ for ( ; sidx < size + 4; sidx++, didx++)
+ {
+ if (buffer[sidx] == '\r')
+ {
+ if (buffer[++sidx] != '\n')
+ buffer[didx++] = '\r';
+ else
+ size--;
+ }
+ if (sidx != didx)
+ buffer[didx] = buffer[sidx];
+ }
bufend = buffer + 4 + size;
if (bufend[-1] != '\n')
*bufend++ = '\n';
diff --git a/src/libs/libbib/search.cc b/src/libs/libbib/search.cc
index 8c7b3e16..1e027c60 100644
--- a/src/libs/libbib/search.cc
+++ b/src/libs/libbib/search.cc
@@ -27,6 +27,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "lib.h"
#include "errarg.h"
#include "error.h"
+#include "nonposix.h"
#include "refid.h"
#include "search.h"
@@ -53,7 +54,7 @@ void search_list::add_file(const char *filename, int silent)
{
search_item *p = make_index_search_item(filename, next_fid);
if (!p) {
- int fd = open(filename, O_RDONLY);
+ int fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0) {
if (!silent)
error("can't open `%1': %2", filename, strerror(errno));
diff --git a/src/libs/libgroff/font.cc b/src/libs/libgroff/font.cc
index bc830693..c3bfa23e 100644
--- a/src/libs/libgroff/font.cc
+++ b/src/libs/libgroff/font.cc
@@ -471,7 +471,7 @@ static char *trim_arg(char *p)
return p;
}
-// If the font can't be found, then if not_found is NULL it will be set
+// If the font can't be found, then if not_found is non-NULL, it will be set
// to 1 otherwise a message will be printed.
int font::load(int *not_found)
diff --git a/src/libs/libgroff/searchpath.cc b/src/libs/libgroff/searchpath.cc
index 78b1fcd9..a857c258 100644
--- a/src/libs/libgroff/searchpath.cc
+++ b/src/libs/libgroff/searchpath.cc
@@ -25,6 +25,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "lib.h"
#include "searchpath.h"
+#include "nonposix.h"
search_path::search_path(const char *envvar, const char *standard)
{
@@ -32,7 +33,7 @@ search_path::search_path(const char *envvar, const char *standard)
if (e && standard) {
dirs = new char[strlen(e) + strlen(standard) + 2];
strcpy(dirs, e);
- strcat(dirs, ":");
+ strcat(dirs, PATH_SEP);
strcat(dirs, standard);
}
else
@@ -59,11 +60,11 @@ void search_path::command_line_dir(const char *s)
char *p = dirs;
p += old_len - init_len;
if (init_len == 0)
- *p++ = ':';
+ *p++ = PATH_SEP[0];
memcpy(p, s, slen);
p += slen;
if (init_len > 0) {
- *p++ = ':';
+ *p++ = PATH_SEP[0];
memcpy(p, old + old_len - init_len, init_len);
p += init_len;
}
@@ -75,7 +76,7 @@ void search_path::command_line_dir(const char *s)
FILE *search_path::open_file(const char *name, char **pathp)
{
assert(name != 0);
- if (*name == '/' || dirs == 0 || *dirs == '\0') {
+ if (IS_ABSOLUTE(name) || dirs == 0 || *dirs == '\0') {
FILE *fp = fopen(name, "r");
if (fp) {
if (pathp)
@@ -88,14 +89,10 @@ FILE *search_path::open_file(const char *name, char **pathp)
unsigned namelen = strlen(name);
char *p = dirs;
for (;;) {
-#ifdef _MSC_VER
- char *end = strchr(p, ';');
-#else
- char *end = strchr(p, ':');
-#endif
+ char *end = strchr(p, PATH_SEP[0]);
if (!end)
end = strchr(p, '\0');
- int need_slash = end > p && end[-1] != '/';
+ int need_slash = end > p && strchr(DIR_SEPS, end[-1]) == 0;
char *path = new char[(end - p) + need_slash + namelen + 1];
memcpy(path, p, end - p);
if (need_slash)
diff --git a/src/libs/libgroff/tmpfile.cc b/src/libs/libgroff/tmpfile.cc
index 640b2542..378fc929 100644
--- a/src/libs/libgroff/tmpfile.cc
+++ b/src/libs/libgroff/tmpfile.cc
@@ -27,6 +27,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "lib.h"
#include "errarg.h"
#include "error.h"
+#include "nonposix.h"
extern "C" {
// Sun's stdlib.h fails to declare this.
@@ -38,8 +39,13 @@ extern "C" {
#define GROFF_TMPDIR_ENVVAR "GROFF_TMPDIR"
// otherwise if this is set, create temporary files there
#define TMPDIR_ENVVAR "TMPDIR"
+// otherwise if P_tmpdir is defined, create temporary files there
+#ifdef P_tmpdir
+# define DEFAULT_TMPDIR P_tmpdir
+#else
// otherwise create temporary files here.
-#define DEFAULT_TMPDIR "/tmp"
+# define DEFAULT_TMPDIR "/tmp"
+#endif
// Use this as the prefix for temporary filenames.
#define TMPFILE_PREFIX "groff"
@@ -64,9 +70,10 @@ char *xtmptemplate(char *postfix)
if (!dir)
dir = DEFAULT_TMPDIR;
}
-
- const char *p = strrchr(dir, '/');
- int needs_slash = (!p || p[1]);
+
+ size_t dir_len = strlen(dir);
+ const char *dir_end = dir + dir_len - 1;
+ int needs_slash = strchr(DIR_SEPS, *dir_end) == NULL;
char *templ = new char[strlen(dir) + needs_slash
+ sizeof(TMPFILE_PREFIX) - 1 + 6 + 1 + postlen];
strcpy(templ, dir);
@@ -80,6 +87,51 @@ char *xtmptemplate(char *postfix)
return( templ );
}
+// The trick with unlinking the temporary file while it is still in
+// use is not portable, it will fail on MS-DOS and most MS-Windows
+// filesystems. So it cannot be used on non-Posix systems.
+// Instead, we maintain a list of files to be deleted on exit, and
+// register an atexit function that will remove them all in one go.
+// This should be portable to all platforms.
+
+static struct xtmpfile_list {
+ struct xtmpfile_list *next;
+ char *fname;
+} *xtmpfiles_to_delete;
+
+static void remove_tmp_files(void)
+{
+ struct xtmpfile_list *p = xtmpfiles_to_delete;
+
+ while (p)
+ {
+ if (unlink(p->fname) < 0)
+ error("cannot unlink `%1': %2", p->fname, strerror(errno));
+ a_delete p->fname;
+ struct xtmpfile_list *old = p;
+ p = p->next;
+ free(old);
+ }
+}
+
+static void add_tmp_file(const char *name)
+{
+ if (xtmpfiles_to_delete == NULL)
+ atexit(remove_tmp_files);
+
+ char *fname = new char[FILENAME_MAX];
+ struct xtmpfile_list *p
+ = (struct xtmpfile_list *)malloc(sizeof(struct xtmpfile_list));
+ if (p == NULL)
+ {
+ error("cannot unlink `%1': %2", name, strerror(errno));
+ return;
+ }
+ p->next = xtmpfiles_to_delete;
+ p->fname = strcpy(fname, name);
+ xtmpfiles_to_delete = p;
+}
+
// Open a temporary file and with fatal error on failure.
#ifndef _MSC_VER
@@ -94,19 +146,19 @@ FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
if (fd < 0)
fatal("cannot create temporary file: %1", strerror(errno));
errno = 0;
- FILE *fp = fdopen(fd, "w+");
+ FILE *fp = fdopen(fd, FOPEN_RWB); // many callers of xtmpfile use binary I/O
if (!fp)
fatal("fdopen: %1", strerror(errno));
#else /* not HAVE_MKSTEMP */
if (!mktemp(templ) || !templ[0])
fatal("cannot create file name for temporary file");
errno = 0;
- FILE *fp = fopen(templ, "w+");
+ FILE *fp = fopen(templ, FOPEN_RWB);
if (!fp)
fatal("cannot open `%1': %2", templ, strerror(errno));
#endif /* not HAVE_MKSTEMP */
- if ((do_unlink) && (unlink(templ) < 0))
- error("cannot unlink `%1': %2", templ, strerror(errno));
+ if (do_unlink)
+ add_tmp_file(templ);
if ((namep != 0) && ((*namep) != 0)) {
*namep = templ;
} else {
@@ -117,6 +169,11 @@ FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
#else
+// FIXME: does MSVC have mktemp or mkstemp? If so, it should now
+// use the version above, as it no longer removes an open file.
+// The version below will NOT work with grohtml, since grohtml
+// wants to know the name of the file opened by xtmpfile!!
+
// If you're not running Unix, the following will do:
FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
{
diff --git a/src/preproc/eqn/Makefile.sub b/src/preproc/eqn/Makefile.sub
index 828854b1..7b43a6e5 100644
--- a/src/preproc/eqn/Makefile.sub
+++ b/src/preproc/eqn/Makefile.sub
@@ -38,7 +38,7 @@ HDRS=\
$(srcdir)/pbox.h
GRAM=$(srcdir)/eqn.y
YTABC=$(srcdir)/eqn.cc
-YTABH=$(srcdir)/eqn.tab.h
+YTABH=$(srcdir)/eqn_tab.h
NAMEPREFIX=$(g)
CLEANADD=neqn
diff --git a/src/preproc/eqn/eqn.tab.h b/src/preproc/eqn/eqn_tab.h
index 9a8b3cb2..9a8b3cb2 100755
--- a/src/preproc/eqn/eqn.tab.h
+++ b/src/preproc/eqn/eqn_tab.h
diff --git a/src/preproc/eqn/lex.cc b/src/preproc/eqn/lex.cc
index a46d20cd..0a5a4e29 100644
--- a/src/preproc/eqn/lex.cc
+++ b/src/preproc/eqn/lex.cc
@@ -19,7 +19,7 @@ with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "eqn.h"
-#include "eqn.tab.h"
+#include "eqn_tab.h"
#include "stringclass.h"
#include "ptable.h"
diff --git a/src/preproc/pic/Makefile.sub b/src/preproc/pic/Makefile.sub
index a15c030e..f1e29273 100644
--- a/src/preproc/pic/Makefile.sub
+++ b/src/preproc/pic/Makefile.sub
@@ -27,5 +27,5 @@ HDRS=\
$(srcdir)/text.h
GRAM=$(srcdir)/pic.y
YTABC=$(srcdir)/pic.cc
-YTABH=$(srcdir)/pic.tab.h
+YTABH=$(srcdir)/pic_tab.h
NAMEPREFIX=$(g)
diff --git a/src/preproc/pic/lex.cc b/src/preproc/pic/lex.cc
index 238a62f4..329578a5 100644
--- a/src/preproc/pic/lex.cc
+++ b/src/preproc/pic/lex.cc
@@ -21,7 +21,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "pic.h"
#include "ptable.h"
#include "object.h"
-#include "pic.tab.h"
+#include "pic_tab.h"
declare_ptable(char)
implement_ptable(char)
diff --git a/src/preproc/pic/pic.tab.h b/src/preproc/pic/pic_tab.h
index 2a3f9d81..2a3f9d81 100755
--- a/src/preproc/pic/pic.tab.h
+++ b/src/preproc/pic/pic_tab.h
diff --git a/src/preproc/soelim/soelim.cc b/src/preproc/soelim/soelim.cc
index 571f7345..257fc88a 100644
--- a/src/preproc/soelim/soelim.cc
+++ b/src/preproc/soelim/soelim.cc
@@ -28,6 +28,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "errarg.h"
#include "error.h"
#include "stringclass.h"
+#include "nonposix.h"
static int include_list_length;
static char **include_list;
@@ -157,7 +158,7 @@ int do_file(const char *filename)
whole_filename = filename;
whole_filename += '\0';
}
- else if (filename[0] == '/') {
+ else if (IS_ABSOLUTE(filename)) {
whole_filename = filename;
whole_filename += '\0';
errno = 0;
diff --git a/src/roff/groff/groff.cc b/src/roff/groff/groff.cc
index 6b7625e2..034052a8 100644
--- a/src/roff/groff/groff.cc
+++ b/src/roff/groff/groff.cc
@@ -35,9 +35,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "font.h"
#include "device.h"
#include "pipeline.h"
+#include "nonposix.h"
#include "defs.h"
-#define BSHELL "/bin/sh"
#define GXDITVIEW "gxditview"
// troff will be passed an argument of -rXREG=1 if the -X option is
@@ -202,7 +202,7 @@ int main(int argc, char **argv)
case 'F':
font::command_line_font_dir(optarg);
if (Fargs.length() > 0) {
- Fargs += ':';
+ Fargs += PATH_SEP[0];
Fargs += optarg;
}
else
@@ -297,7 +297,7 @@ int main(int argc, char **argv)
commands[POST_INDEX].append_arg("-");
if (lflag && !Xflag && spooler) {
commands[SPOOL_INDEX].set_name(BSHELL);
- commands[SPOOL_INDEX].append_arg("-c");
+ commands[SPOOL_INDEX].append_arg(BSHELL_DASH_C);
Largs += '\0';
Largs = spooler + Largs;
commands[SPOOL_INDEX].append_arg(Largs.contents());
@@ -328,7 +328,7 @@ int main(int argc, char **argv)
e += Fargs;
char *fontpath = getenv("GROFF_FONT_PATH");
if (fontpath && *fontpath) {
- e += ':';
+ e += PATH_SEP[0];
e += fontpath;
}
e += '\0';
@@ -346,7 +346,19 @@ const char *xbasename(const char *s)
{
if (!s)
return 0;
- const char *p = strrchr(s, '/');
+ // DIR_SEPS[] are possible directory separator characters, see nonposix.h
+ // We want the rightmost separator of all possible ones.
+ // Example: d:/foo\\bar.
+ const char *p = strrchr(s, DIR_SEPS[0]), *p1;
+ const char *sep = &DIR_SEPS[1];
+
+ while (*sep)
+ {
+ p1 = strrchr(s, *sep);
+ if (p1 && (!p || p1 > p))
+ p = p1;
+ sep++;
+ }
return p ? p + 1 : s;
}
@@ -478,8 +490,8 @@ void possible_command::build_argv()
void possible_command::print(int is_last, FILE *fp)
{
build_argv();
- if (argv[0] != 0 && strcmp(argv[0], BSHELL) == 0
- && argv[1] != 0 && strcmp(argv[1], "-c") == 0
+ if (IS_BSHELL(argv[0])
+ && argv[1] != 0 && strcmp(argv[1], BSHELL_DASH_C) == 0
&& argv[2] != 0 && argv[3] == 0)
fputs(argv[2], fp);
else {
diff --git a/src/roff/groff/pipeline.c b/src/roff/groff/pipeline.c
index 81308d05..96381208 100644
--- a/src/roff/groff/pipeline.c
+++ b/src/roff/groff/pipeline.c
@@ -97,6 +97,186 @@ static void sys_fatal P((const char *));
static const char *xstrsignal P((int));
static char *i_to_a P((int));
+/* MSVC can support asynchronous processes, but it's unlikely to have
+ fork(). So, until someone writes an emulation, let them at least
+ have a workable groff by using the good-ole DOS pipe simulation
+ via temporary files... */
+
+#if defined(__MSDOS__) || (defined(_WIN32) && !defined(__CYGWIN32__))
+
+#include <process.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "nonposix.h"
+
+/* A signal handler that just records that a signal has happened. */
+static int child_interrupted;
+
+static RETSIGTYPE signal_catcher (int signo)
+{
+ child_interrupted++;
+}
+
+static const char *sh = "sh";
+static const char *command = "command";
+
+const char *
+system_shell_name (void)
+{
+ static const char *shell_name;
+
+ /* We want them to be able to use a Unixy shell if they have it
+ installed. Let spawnlp try to find it, but if it fails, default
+ to COMMAND.COM. */
+ if (shell_name == NULL)
+ {
+ int sh_found = spawnlp (P_WAIT, sh, sh, "-c", ":", NULL) == 0;
+
+ if (sh_found)
+ shell_name = sh;
+ else
+ shell_name = command;
+ }
+ return shell_name;
+}
+
+const char *
+system_shell_dash_c (void)
+{
+ if (strcmp (system_shell_name(), sh) == 0)
+ return "-c";
+ else
+ return "/c";
+}
+
+int
+is_system_shell (const char *shell)
+{
+ char monocased_shell[FILENAME_MAX];
+ size_t shlen;
+ int ibase = 0, idot, i;
+
+ if (!shell) /* paranoia */
+ return 0;
+ idot = shlen = strlen(shell);
+
+ for (i = 0; i < shlen; i++)
+ {
+ if (isalpha(shell[i]))
+ monocased_shell[i] = tolower(shell[i]);
+ else
+ {
+ monocased_shell[i] = shell[i];
+ if (shell[i] == '.')
+ idot = i;
+ else if (shell[i] == '/' || shell[i] == '\\' || shell[i] == ':')
+ {
+ ibase = i + 1;
+ idot = shlen;
+ }
+ }
+ }
+ monocased_shell[i] = '\0';
+
+ /* "sh" and "sh.exe" should compare equal. */
+ return
+ strncmp(monocased_shell + ibase, system_shell_name(), idot - ibase) == 0
+ && (idot == shlen
+ || strcmp(monocased_shell + idot, ".exe") == 0
+ || strcmp(monocased_shell + idot, ".com") == 0);
+}
+
+/* MSDOS doesn't have `fork', so we need to simulate the pipe by
+ running the programs in sequence with redirected standard streams. */
+
+int run_pipeline (ncommands, commands)
+ int ncommands;
+ char ***commands;
+{
+ int save_stdin = dup(0);
+ int save_stdout = dup(1);
+ char *tmpfiles[2];
+ char tem1[L_tmpnam], tem2[L_tmpnam];
+ int infile = 0;
+ int outfile = 1;
+ int i, f, ret = 0;
+
+ tmpfiles[0] = tmpnam(tem1);
+ tmpfiles[1] = tmpnam(tem2);
+
+ for (i = 0; i < ncommands; i++)
+ {
+ int exit_status;
+ RETSIGTYPE (*prev_handler)(int);
+
+ if (i)
+ {
+ /* redirect stdin from temp file */
+ f = open(tmpfiles[infile], O_RDONLY|O_BINARY, 0666);
+ if (f < 0)
+ sys_fatal("open stdin");
+ if (dup2(f, 0) < 0)
+ sys_fatal("dup2 stdin");
+ if (close(f) < 0)
+ sys_fatal("close stdin");
+ }
+ if (i < ncommands - 1)
+ {
+ /* redirect stdout to temp file */
+ f = open(tmpfiles[outfile], O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);
+ if (f < 0)
+ sys_fatal("open stdout");
+ if (dup2(f, 1) < 0)
+ sys_fatal("dup2 stdout");
+ if (close(f) < 0)
+ sys_fatal("close stdout");
+ }
+ else if (dup2(save_stdout, 1) < 0)
+ sys_fatal("restore stdout");
+
+ /* run the program */
+ child_interrupted = 0;
+ prev_handler = signal(SIGINT, signal_catcher);
+ exit_status = spawnvp(P_WAIT, commands[i][0], commands[i]);
+ signal(SIGINT, prev_handler);
+ if (child_interrupted)
+ {
+ error("%1: Interrupted", commands[i][0], (char *)0, (char *)0);
+ ret |= 2;
+ }
+ else if (exit_status < 0)
+ {
+ error("couldn't exec %1: %2", commands[i][0],
+ strerror(errno), (char *)0);
+ fflush(stderr); /* just in case error() doesn't */
+ ret |= 4;
+ }
+ if (exit_status != 0)
+ ret |= 1;
+
+ /* There's no sense to continue with the pipe if one of the
+ programs has ended abnormally, is there? */
+ if (ret != 0)
+ break;
+
+ /* swap temp files: make output of this program be input for the next */
+ infile = 1 - infile;
+ outfile = 1 - outfile;
+ }
+
+ if (dup2(save_stdin, 0) < 0)
+ sys_fatal("restore stdin");
+
+ unlink(tmpfiles[0]);
+ unlink(tmpfiles[1]);
+
+ return ret;
+}
+
+#else /* not __MSDOS__, not _WIN32 */
+
int run_pipeline(ncommands, commands)
int ncommands;
char ***commands;
@@ -210,6 +390,8 @@ int run_pipeline(ncommands, commands)
return ret;
}
+#endif /* not __MSDOS__, not _WIN32 */
+
static void sys_fatal(s)
const char *s;
{
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index a11c36d3..529a70f1 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -37,6 +37,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
// Needed for getpid().
#include "posix.h"
+#include "nonposix.h"
+
#ifdef ISATTY_MISSING
#undef isatty
#define isatty(n) (1)
@@ -4447,11 +4449,7 @@ void pipe_source()
}
buf[buf_used] = '\0';
errno = 0;
-#ifdef _MSC_VER
- FILE *fp = popen(buf, "rt");
-#else
- FILE *fp = popen(buf, "r");
-#endif
+ FILE *fp = popen(buf, POPEN_RT);
if (fp)
input_stack::push(new file_iterator(fp, symbol(buf).contents(), 1));
else
@@ -4636,9 +4634,13 @@ void ps_bbox_request()
while (!tok.newline() && !tok.eof())
tok.next();
errno = 0;
- FILE *fp = fopen(nm.contents(), "r");
- if (fp)
+ // PS files might contain non-printable characters, such as ^Z
+ // and CRs not followed by an LF, so open them in binary mode.
+ FILE *fp = fopen(nm.contents(), FOPEN_RB);
+ if (fp) {
do_ps_file(fp, nm.contents());
+ fclose(fp);
+ }
else
error("can't open `%1': %2", nm.contents(), strerror(errno));
tok.next();
@@ -5847,13 +5849,6 @@ void warn_request()
skip_line();
}
-#ifdef _MSC_VER
-static int getpid(void)
-{
- return 1;
-}
-#endif
-
static void init_registers()
{
#ifdef LONG_FOR_TIME_T
diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc
index b3e1bec3..e5abff99 100644
--- a/src/roff/troff/node.cc
+++ b/src/roff/troff/node.cc
@@ -18,6 +18,10 @@ You should have received a copy of the GNU General Public License along
with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include "troff.h"
#include "symbol.h"
#include "dictionary.h"
@@ -30,6 +34,19 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "font.h"
#include "reg.h"
+#include "nonposix.h"
+
+#ifdef _POSIX_VERSION
+#include <sys/wait.h>
+#else /* not _POSIX_VERSION */
+/* traditional Unix */
+#define WIFEXITED(s) (((s) & 0377) == 0)
+#define WEXITSTATUS(s) (((s) >> 8) & 0377)
+#define WTERMSIG(s) ((s) & 0177)
+#define WIFSTOPPED(s) (((s) & 0377) == 0177)
+#define WSTOPSIG(s) (((s) >> 8) & 0377)
+#endif /* not _POSIX_VERSION */
+
#define STORE_WIDTH 1
symbol HYPHEN_SYMBOL("hy");
@@ -1195,11 +1212,7 @@ real_output_file::real_output_file()
{
#ifndef POPEN_MISSING
if (pipe_command) {
-#ifdef _MSC_VER
- if ((fp = _popen(pipe_command, "wt")) != 0) {
-#else
- if ((fp = popen(pipe_command, "w")) != 0) {
-#endif
+ if ((fp = popen(pipe_command, POPEN_WT)) != 0) {
piped = 1;
return;
}
@@ -1221,19 +1234,16 @@ real_output_file::~real_output_file()
}
#ifndef POPEN_MISSING
if (piped) {
-#ifdef _MSC_VER
- int result = _pclose(fp);
-#else
int result = pclose(fp);
-#endif
fp = 0;
if (result < 0)
fatal("pclose failed");
- if ((result & 0x7f) != 0)
+ if (!WIFEXITED(result))
error("output process `%1' got fatal signal %2",
- pipe_command, result & 0x7f);
+ pipe_command,
+ WIFSIGNALED(result) ? WTERMSIG(result) : WSTOPSIG(result));
else {
- int exit_status = (result >> 8) & 0xff;
+ int exit_status = WEXITSTATUS(result);
if (exit_status != 0)
error("output process `%1' exited with status %2",
pipe_command, exit_status);
diff --git a/src/utils/hpftodit/hpftodit.cc b/src/utils/hpftodit/hpftodit.cc
index af0738c4..2e5978c1 100644
--- a/src/utils/hpftodit/hpftodit.cc
+++ b/src/utils/hpftodit/hpftodit.cc
@@ -39,6 +39,7 @@ put filename in error messages (or fix lib)
#include "errarg.h"
#include "error.h"
#include "cset.h"
+#include "nonposix.h"
#define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
@@ -273,7 +274,9 @@ void usage()
File::File(const char *s)
{
- int fd = open(s, O_RDONLY);
+ // We need to read the file in binary mode because hpftodit relies
+ // on byte counts.
+ int fd = open(s, O_RDONLY | O_BINARY);
if (fd < 0)
fatal("cannot open `%1': %2", s, strerror(errno));
current_filename = s;
@@ -290,6 +293,24 @@ File::File(const char *s)
fatal("read unexpected number of bytes");
ptr_ = buf_;
end_ = buf_ + sb.st_size;
+ // These are actually text files, so we must get rid of the `\r'
+ // characters. This is also enabled for Posix systems, in case the
+ // input came from Windows...
+ unsigned char *p = buf_, *q = buf_;
+ while (q < end_)
+ {
+ if (*q == '\r')
+ {
+ if (*++q != '\n')
+ *p++ = '\r';
+ }
+#if defined(__MSDOS__) || defined(_MSC_VER)
+ if (*q == '\032') // ^Z means ``software EOF''
+ break;
+#endif
+ *p++ = *q++;
+ }
+ end_ = p;
}
void File::skip(int n)
@@ -774,6 +795,18 @@ int read_map(const char *file)
static
const char *xbasename(const char *s)
{
- const char *b = strrchr(s, '/');
+ // DIR_SEPS[] are possible directory separator characters, see
+ // nonposix.h. We want the rightmost separator of all possible
+ // ones. Example: d:/foo\\bar.
+ const char *b = strrchr(s, DIR_SEPS[0]), *b1;
+ const char *sep = &DIR_SEPS[1];
+
+ while (*sep)
+ {
+ b1 = strrchr(s, *sep);
+ if (b1 && (!b || b1 > b))
+ b = b1;
+ sep++;
+ }
return b ? b + 1 : s;
}
diff --git a/src/utils/indxbib/indxbib.cc b/src/utils/indxbib/indxbib.cc
index 4b28d983..bd4780d7 100644
--- a/src/utils/indxbib/indxbib.cc
+++ b/src/utils/indxbib/indxbib.cc
@@ -35,6 +35,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "index.h"
+#include "nonposix.h"
+
extern "C" {
// Sun's stdlib.h fails to declare this.
char *mktemp(char *);
@@ -198,7 +200,15 @@ int main(int argc, char **argv)
read_common_words_file();
if (!basename)
basename = optind < argc ? argv[optind] : DEFAULT_INDEX_NAME;
- const char *p = strrchr(basename, '/');
+ const char *p = strrchr(basename, DIR_SEPS[0]), *p1;
+ const char *sep = &DIR_SEPS[1];
+ while (*sep)
+ {
+ p1 = strrchr(basename, *sep);
+ if (p1 && (!p || p1 > p))
+ p = p1;
+ sep++;
+ }
long name_max;
if (p) {
char *dir = strsave(basename);
@@ -232,7 +242,7 @@ int main(int argc, char **argv)
#endif
if (fd < 0)
fatal("can't create temporary index file: %1", strerror(errno));
- indxfp = fdopen(fd, "w");
+ indxfp = fdopen(fd, FOPEN_WB);
if (indxfp == 0)
fatal("fdopen failed");
if (fseek(indxfp, sizeof(index_header), 0) < 0)
@@ -281,7 +291,22 @@ int main(int argc, char **argv)
strcat(index_file, INDEX_SUFFIX);
#ifdef HAVE_RENAME
if (rename(temp_index_file, index_file) < 0)
- fatal("can't rename temporary index file: %1", strerror(errno));
+ {
+#ifdef __MSDOS__
+ // RENAME could fail on plain MSDOS filesystems because
+ // INDEX_FILE is an invalid filename, e.g. it has multiple dots.
+ char *fname = p ? index_file + (p - basename) : 0;
+ char *dot = 0;
+
+ // Replace the dot with an underscore and try again.
+ if (fname
+ && (dot = strchr(fname, '.')) != 0
+ && strcmp(dot, INDEX_SUFFIX) != 0)
+ *dot = '_';
+ if (rename(temp_index_file, index_file) < 0)
+#endif
+ fatal("can't rename temporary index file: %1", strerror(errno));
+ }
#else /* not HAVE_RENAME */
ignore_fatal_signals();
if (unlink(index_file) < 0) {
@@ -429,7 +454,9 @@ static int do_whole_file(const char *filename)
static int do_file(const char *filename)
{
errno = 0;
- FILE *fp = fopen(filename, "r");
+ // Need binary I/O for MS-DOS/MS-Windows, because indxbib relies on
+ // byte counts to be consistent with fseek.
+ FILE *fp = fopen(filename, FOPEN_RB);
if (fp == 0) {
error("can't open `%1': %2", filename, strerror(errno));
return 0;
@@ -459,6 +486,21 @@ static int do_file(const char *filename)
int c = getc(fp);
if (c == EOF)
break;
+ // We opened the file in binary mode, so we need to skip
+ // every CR character before a Newline.
+ if (c == '\r') {
+ int peek = getc(fp);
+ if (peek = '\n') {
+ byte_count++;
+ c = peek;
+ }
+ else
+ ungetc(peek, fp);
+ }
+#if defined(__MSDOS__) || defined(_MSC_VER)
+ else if (c == 0x1a) // ^Z means EOF in text files
+ break;
+#endif
byte_count++;
switch (state) {
case START:
diff --git a/src/utils/pfbtops/pfbtops.c b/src/utils/pfbtops/pfbtops.c
index ece8193a..9aaeeccf 100644
--- a/src/utils/pfbtops/pfbtops.c
+++ b/src/utils/pfbtops/pfbtops.c
@@ -3,6 +3,8 @@
#include <stdio.h>
#include <getopt.h>
+#include "nonposix.h"
+
/* Binary bytes per output line. */
#define BYTES_PER_LINE (64/2)
#define HEX_DIGITS "0123456789abcdef"
@@ -52,6 +54,9 @@ int main(argc, argv)
perror(argv[optind]);
exit(1);
}
+#ifdef SET_BINARY
+ SET_BINARY(fileno(stdin));
+#endif
for (;;)
{
int type, c, i;
diff --git a/src/utils/tfmtodit/tfmtodit.cc b/src/utils/tfmtodit/tfmtodit.cc
index 16752742..ab3ab38f 100644
--- a/src/utils/tfmtodit/tfmtodit.cc
+++ b/src/utils/tfmtodit/tfmtodit.cc
@@ -57,6 +57,7 @@ both be zero. */
#include "error.h"
#include "assert.h"
#include "cset.h"
+#include "nonposix.h"
/* Values in the tfm file should be multiplied by this. */
@@ -273,7 +274,7 @@ int read4(unsigned char *&s)
int tfm::load(const char *file)
{
errno = 0;
- FILE *fp = fopen(file, "r");
+ FILE *fp = fopen(file, FOPEN_RB);
if (!fp) {
error("can't open `%1': %2", file, strerror(errno));
return 0;
@@ -413,7 +414,7 @@ int gf::load(const char *file)
int left_adj, right_adj;
const int gf_id_byte = 131;
errno = 0;
- FILE *fp = fopen(file, "r");
+ FILE *fp = fopen(file, FOPEN_RB);
if (!fp) {
error("can't open `%1': %2", file, strerror(errno));
return 0;
@@ -750,7 +751,18 @@ int main(int argc, char **argv)
int len = strlen(internal_name);
if (len > 4 && strcmp(internal_name + len - 4, ".tfm") == 0)
internal_name[len - 4] = '\0';
- char *s = strrchr(internal_name, '/');
+ // DIR_SEPS[] are possible directory separator characters, see nonposix.h.
+ // We want the rightmost separator of all possible ones.
+ // Example: d:/foo\\bar.
+ const char *s = strrchr(internal_name, DIR_SEPS[0]), *s1;
+ const char *sep = &DIR_SEPS[1];
+ while (*sep)
+ {
+ s1 = strrchr(internal_name, *sep);
+ if (s1 && (!s || s1 > s))
+ s = s1;
+ sep++;
+ }
printf("internalname %s\n", s ? s + 1 : internal_name);
int n;
if (t.get_param(2, &n)) {