code:
# htmlxref.cnf - reference file for free Texinfo manuals on the web.

htmlxrefversion=2016-07-11.22; # UTC

# Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software
# Foundation, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
#
# The latest version of this file is available at
# http://ftpmirror.gnu.org/texinfo/htmlxref.cnf.
# Email corrections or additions to bug-texinfo@gnu.org.
# The primary goal is to list all relevant GNU manuals;
# other free manuals are also welcome.
#
# To be included in this list, a manual must:
#
# - have a generic url, e.g., no version numbers;
# - have a unique file name (e.g., manual identifier), i.e., be related to the
#   package name.  Things like "refman" or "tutorial" don't work.
# - follow the naming convention for nodes described at
# http://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref.html
#   This is what makeinfo and texi2html implement.
#
# Unless the above criteria are met, it's not possible to generate
# reliable cross-manual references.
#
# For information on automatically generating all the useful formats for
# a manual to put on the web, see
# http://www.gnu.org/prep/maintain/html_node/Manuals-on-Web-Pages.html.

# For people editing this file: when a manual named foo is related to a
# package named bar, the url should contain a variable reference ${BAR}.
# Otherwise, the gnumaint scripts have no way of knowing they are
# associated, and thus gnu.org/manual can't include them.

# shorten references to manuals on www.gnu.org.
G = http://www.gnu.org
GS = ${G}/software

3dldf		mono	${GS}/3dldf/manual/user_ref/3DLDF.html
3dldf		node	${GS}/3dldf/manual/user_ref/

alive		mono	${GS}/alive/manual/alive.html
alive		node	${GS}/alive/manual/html_node/

anubis		chapter	${GS}/anubis/manual/html_chapter/
anubis		section	${GS}/anubis/manual/html_section/
anubis		node	${GS}/anubis/manual/html_node/

artanis		mono	${GS}/artanis/manual/artanis.html
artanis		node	${GS}/artanis/manual/html_node/

aspell		section	http://aspell.net/man-html/index.html

auctex		mono	${GS}/auctex/manual/auctex.html
auctex		node	${GS}/auctex/manual/auctex/

autoconf	mono	${GS}/autoconf/manual/autoconf.html
autoconf	node	${GS}/autoconf/manual/html_node/

autogen		mono	${GS}/autogen/manual/html_mono/autogen.html
autogen		chapter	${GS}/autogen/manual/html_chapter/
autogen		node	${GS}/autoconf/manual/html_node/

automake	mono	${GS}/automake/manual/automake.html
automake	node	${GS}/automake/manual/html_node/

avl		node	http://www.stanford.edu/~blp/avl/libavl.html/

bash		mono	${GS}/bash/manual/bash.html
bash		node	${GS}/bash/manual/html_node/

BINUTILS = http://sourceware.org/binutils/docs
binutils	node	${BINUTILS}/binutils/
 as		node	${BINUTILS}/as/
 bfd		node	${BINUTILS}/bfd/
 gprof		node	${BINUTILS}/gprof/
 ld		node	${BINUTILS}/ld/

bison		mono	${GS}/bison/manual/bison.html
bison		node	${GS}/bison/manual/html_node/

bpel2owfn	mono	${GS}/bpel2owfn/manual/2.0.x/bpel2owfn.html

ccd2cue		mono	${GS}/ccd2cue/manual/ccd2cue.html
ccd2cue		node	${GS}/ccd2cue/manual/html_node/

cflow		mono	${GS}/cflow/manual/cflow.html
cflow		node	${GS}/cflow/manual/html_node/

chess		mono	${GS}/chess/manual/gnuchess.html
chess		node	${GS}/chess/manual/html_node/

combine		mono	${GS}/combine/manual/combine.html
combine		chapter	${GS}/combine/manual/html_chapter/
combine		section	${GS}/combine/manual/html_section/
combine		node	${GS}/combine/manual/html_node/

complexity	mono	${GS}/complexity/manual/complexity.html
complexity	node	${GS}/complexity/manual/html_node/

coreutils	mono	${GS}/coreutils/manual/coreutils
coreutils	node	${GS}/coreutils/manual/html_node/

cpio		mono	${GS}/cpio/manual/cpio
cpio		node	${GS}/cpio/manual/html_node/

cssc		node	${GS}/cssc/manual/

#cvs cannot be handled here; see http://ximbiot.com/cvs/manual.

ddd		mono	${GS}/ddd/manual/html_mono/ddd.html

ddrescue	mono	${GS}/ddrescue/manual/ddrescue_manual.html

DICO = http://puszcza.gnu.org.ua/software/dico/manual
dico		mono	${DICO}/dico.html
dico		chapter	${DICO}/html_chapter/
dico		section	${DICO}/html_section/
dico		node	${DICO}/html_node/

diffutils	mono	${GS}/diffutils/manual/diffutils
diffutils	node	${GS}/diffutils/manual/html_node/

dmd		mono	${GS}/dmd/manual/dmd
dmd		node	${GS}/dmd/manual/html_node/

ed		mono	${GS}/ed/manual/ed_manual.html

EMACS = ${GS}/emacs/manual
emacs		mono	${EMACS}/html_mono/emacs.html
emacs		node	${EMACS}/html_node/emacs/
 #
 ada-mode	mono	${EMACS}/html_mono/ada-mode.html
 ada-mode	node	${EMACS}/html_node/ada-mode/
 #
 autotype	mono	${EMACS}/html_mono/autotype.html
 autotype	node	${EMACS}/html_node/autotype/
 #
 ccmode		mono	${EMACS}/html_mono/ccmode.html
 ccmode		node	${EMACS}/html_node/ccmode/
 #
 cl		mono	${EMACS}/html_mono/cl.html
 cl		node	${EMACS}/html_node/cl/
 #
 ebrowse	mono	${EMACS}/html_mono/ebrowse.html
 ebrowse	node	${EMACS}/html_node/ebrowse/
 #
 ediff		mono	${EMACS}/html_mono/ediff.html
 ediff		node	${EMACS}/html_node/ediff/
 #
 eieio		mono	${EMACS}/html_mono/eieio.html
 eieio		node	${EMACS}/html_node/eieio/
 #
 elisp		mono	${EMACS}/html_mono/elisp.html
 elisp		node	${EMACS}/html_node/elisp/
 #
 epa		mono	${EMACS}/html_mono/epa.html
 epa		node	${EMACS}/html_node/epa/
 #
 erc		mono	${EMACS}/html_mono/erc.html
 erc		node	${EMACS}/html_node/erc/
 #
 dired-x	mono	${EMACS}/html_mono/dired-x.html
 dired-x	node	${EMACS}/html_node/dired-x/
 #
 eshell		mono	${EMACS}/html_mono/eshell.html
 eshell		node	${EMACS}/html_node/eshell/
 #
 flymake	mono	${EMACS}/html_mono/flymake.html
 flymake	node	${EMACS}/html_node/flymake/
 #
 gnus		mono	${EMACS}/html_mono/gnus.html
 gnus		node	${EMACS}/html_node/gnus/
 #
 idlwave	mono	${EMACS}/html_mono/idlwave.html
 idlwave	node	${EMACS}/html_node/idlwave/
 #
 message	mono	${EMACS}/html_mono/message.html
 message	node	${EMACS}/html_node/message/
 #
 mh-e		mono	${EMACS}/html_mono/mh-e.html
 mh-e		node	${EMACS}/html_node/mh-e/
 #
 nxml-mode	mono	${EMACS}/html_mono/nxml-mode.html
 nxml-mode	node	${EMACS}/html_node/nxml-mode/
 #
 org		mono	${EMACS}/html_mono/org.html
 org		node	${EMACS}/html_node/org/
 #
 pcl-cvs	mono	${EMACS}/html_mono/pcl-cvs.html
 pcl-cvs	node	${EMACS}/html_node/pcl-cvs/
 #
 rcirc		mono	${EMACS}/html_mono/rcirc.html
 rcirc		node	${EMACS}/html_node/rcirc/
 #
 semantic	mono	${EMACS}/html_mono/semantic.html
 semantic	node	${EMACS}/html_node/semantic/
 #
 smtp		mono	${EMACS}/html_mono/smtpmail.html
 smtp		node	${EMACS}/html_node/smtpmail/
 #
 speedbar	mono	${EMACS}/html_mono/speedbar.html
 speedbar	node	${EMACS}/html_node/speedbar/
 #
 tramp		mono	${EMACS}/html_mono/tramp.html
 tramp		node	${EMACS}/html_node/tramp/
 #
 vip		mono	${EMACS}/html_mono/vip.html
 vip		node	${EMACS}/html_node/vip/
 #
 viper		mono	${EMACS}/html_mono/viper.html
 viper		node	${EMACS}/html_node/viper/
 #
 woman		mono	${EMACS}/html_mono/woman.html
 woman		node	${EMACS}/html_node/woman/
 # (end emacs manuals)

easejs		mono	${GS}/easejs/manual/easejs.html
easejs		node	${GS}/easejs/manual/

emacs-muse	node	${GS}/emacs-muse/manual/muse.html
emacs-muse	node	${GS}/emacs-muse/manual/html_node/

emms		node	${GS}/emms/manual/

findutils	mono	${GS}/findutils/manual/html_mono/find.html
findutils	node	${GS}/findutils/manual/html_node/find_html

FLEX = http://flex.sourceforge.net
flex		node	${FLEX}/manual/

gama		mono	${GS}/gama/manual/gama.html
gama		node	${GS}/gama/manual/html_node/

GAWK = ${GS}/gawk/manual
gawk		mono	${GAWK}/gawk.html
gawk		node	${GAWK}/html_node/
 gawkinet	mono	${GAWK}/gawkinet/gawkinet.html
 gawkinet	node	${GAWK}/gawkinet/html_node/

gcal		mono	${GS}/gcal/manual/gcal.html
gcal		node	${GS}/gcal/manual/html_node/

GCC = http://gcc.gnu.org/onlinedocs
gcc		node	${GCC}/gcc/
 cpp		node	${GCC}/cpp/
 gcj		node	${GCC}/gcj/
 gfortran	node	${GCC}/gfortran/
 gnat_rm	node	${GCC}/gnat_rm/
 gnat_ugn	node	${GCC}/gnat_ugn/
 libgomp	node	${GCC}/libgomp/
 libstdc++	node	${GCC}/libstdc++/
 #
 gccint		node	${GCC}/gccint/
 cppinternals	node	${GCC}/cppinternals/
 gfc-internals	node	${GCC}/gfc-internals/
 gnat-style	node	${GCC}/gnat-style/
 libiberty	node	${GCC}/libiberty/

GDB = http://sourceware.org/gdb/current/onlinedocs
gdb		node	${GDB}/gdb/
 stabs		node	${GDB}/stabs/

GDBM = http://www.gnu.org.ua/software/gdbm/manual
gdbm		mono	${GDBM}/gdbm.html
gdbm		chapter	${GDBM}/html_chapter/
gdbm		section ${GDBM}/html_section/
gdbm		node	${GDBM}/html_node/

gettext		mono	${GS}/gettext/manual/gettext.html
gettext		node	${GS}/gettext/manual/html_node/

gforth		node	http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/

global		mono	${GS}/global/manual/global.html

gmediaserver	node	${GS}/gmediaserver/manual/

gmp		node	http://www.gmplib.org/manual/

gnu-arch	node	${GS}/gnu-arch/tutorial/

gnu-c-manual	mono	${GS}/gnu-c-manual/gnu-c-manual.html

gnu-crypto	node	${GS}/gnu-crypto/manual/

gnubg		mono	${GS}/gnubg/manual/gnubg.html
gnubg		node	${GS}/gnubg/manual/html_node/

gnubik		mono	${GS}/gnubik/manual/gnubik.html
gnubik		node	${GS}/gnubik/manual/html_node/

gnulib		mono	${GS}/gnulib/manual/gnulib.html
gnulib		node	${GS}/gnulib/manual/html_node/

GNUN = ${GS}/trans-coord/manual
gnun		mono	${GNUN}/gnun/gnun.html
gnun		node	${GNUN}/gnun/html_node/
 web-trans	mono	${GNUN}/web-trans/web-trans.html
 web-trans	node	${GNUN}/web-trans/html_node/

GNUPG = http://www.gnupg.org/documentation/manuals
gnupg		node	${GNUPG}/gnupg/
 dirmngr	node	${GNUPG}/dirmngr/
 gcrypt		node	${GNUPG}/gcrypt/
 libgcrypt	node	${GNUPG}/gcrypt/
 ksba		node	${GNUPG}/ksba/
 assuan		node	${GNUPG}/assuan/
 gpgme		node	${GNUPG}/gpgme/

gnuprologjava	node	${GS}/gnuprologjava/manual/

gnuschool	mono	${GS}/gnuschool/gnuschool.html

GNUSTANDARDS = ${G}/prep
 maintain	mono	${GNUSTANDARDS}/maintain/maintain.html
 maintain	node	${GNUSTANDARDS}/maintain/html_node/
 #
 standards	mono	${GNUSTANDARDS}/standards/standards.html
 standards	node	${GNUSTANDARDS}/standards/html_node/

gnutls		mono	${GS}/gnutls/manual/gnutls.html
gnutls		node	${GS}/gnutls/manual/html_node/

gperf		mono	${GS}/gperf/manual/gperf.html
gperf		node	${GS}/gperf/manual/html_node/

grep		mono	${GS}/grep/manual/grep.html
grep		node	${GS}/grep/manual/html_node/

groff		node	${GS}/groff/manual/html_node/

GRUB = ${GS}/grub/manual
  grub		mono	${GRUB}/grub.html
  grub		node	${GRUB}/html_node/
  #
  multiboot	mono	${GRUB}/multiboot/multiboot.html
  multiboot	node	${GRUB}/multiboot/html_node/

gsasl		mono	${GS}/gsasl/manual/gsasl.html
gsasl		node	${GS}/gsasl/manual/html_node/

gsl		node	${GS}/gsl/manual/html_node/

gsrc		mono	${GS}/gsrc/manual/gsrc.html
gsrc		node	${GS}/gsrc/manual/html_node/

gss		mono	${GS}/gss/manual/gss.html
gss		node	${GS}/gss/manual/html_node/

gtypist		mono	${GS}/gtypist/doc/

guile		mono	${GS}/guile/manual/guile.html
guile		node	${GS}/guile/manual/html_node/

GUILE_GNOME = ${GS}/guile-gnome/docs
 gobject 	node	${GUILE_GNOME}/gobject/html/
 glib		node	${GUILE_GNOME}/glib/html/
 atk		node	${GUILE_GNOME}/atk/html/
 pango		node	${GUILE_GNOME}/pango/html/
 pangocairo	node	${GUILE_GNOME}/pangocairo/html/
 gdk		node	${GUILE_GNOME}/gdk/html/
 gtk		node	${GUILE_GNOME}/gtk/html/
 libglade	node	${GUILE_GNOME}/libglade/html/
 gnome-vfs	node	${GUILE_GNOME}/gnome-vfs/html/
 libgnomecanvas	node	${GUILE_GNOME}/libgnomecanvas/html/
 gconf		node	${GUILE_GNOME}/gconf/html/
 libgnome	node	${GUILE_GNOME}/libgnome/html/
 libgnomeui	node	${GUILE_GNOME}/libgnomeui/html/
 corba		node	${GUILE_GNOME}/corba/html/
 clutter	node	${GUILE_GNOME}/clutter/html/
 clutter-glx	node	${GUILE_GNOME}/clutter-glx/html/

guile-gtk	node	${GS}/guile-gtk/docs/guile-gtk/

guile-rpc	mono	${GS}/guile-rpc/manual/guile-rpc.html
guile-rpc	node	${GS}/guile-rpc/manual/html_node/

guix		mono	${GS}/guix/manual/guix.html
guix		node	${GS}/guix/manual/html_node/

gv		mono	${GS}/gv/manual/gv.html
gv		node	${GS}/gv/manual/html_node/

gzip		mono	${GS}/gzip/manual/gzip.html
gzip		node	${GS}/gzip/manual/html_node/

hello		mono	${GS}/hello/manual/hello.html
hello		node	${GS}/hello/manual/html_node/

help2man	mono	${GS}/help2man/help2man.html

idutils		mono	${GS}/idutils/manual/idutils.html
idutils		node	${GS}/idutils/manual/html_node/

inetutils	mono	${GS}/inetutils/manual/inetutils.html
inetutils	node	${GS}/inetutils/manual/html_node/

jwhois		mono	${GS}/jwhois/manual/jwhois.html
jwhois		node	${GS}/jwhois/manual/html_node/

libc		mono	${GS}/libc/manual/html_mono/libc.html
libc		node	${GS}/libc/manual/html_node/

LIBCDIO = ${GS}/libcdio
 libcdio	mono	${LIBCDIO}/libcdio.html
 cd-text	mono	${LIBCDIO}/cd-text-format.html

libextractor	mono	${GS}/libextractor/manual/libextractor.html
libextractor	node	${GS}/libextractor/manual/html_node/

libidn		mono	${GS}/libidn/manual/libidn.html
libidn		node	${GS}/libidn/manual/html_node/

librejs		mono	${GS}/librejs/manual/librejs.html
librejs		node	${GS}/librejs/manual/html_node/

libmatheval	mono	${GS}/libmatheval/manual/libmatheval.html

LIBMICROHTTPD = ${GS}/libmicrohttpd
libmicrohttpd		mono	${LIBMICROHTTPD}/manual/libmicrohttpd.html
libmicrohttpd		node	${LIBMICROHTTPD}/manual/html_node/
 microhttpd-tutorial	mono	${LIBMICROHTTPD}/tutorial.html

libtasn1	mono	${GS}/libtasn1/manual/libtasn1.html
libtasn1	node	${GS}/libtasn1/manual/html_node/

libtool		mono	${GS}/libtool/manual/libtool.html
libtool		node	${GS}/libtool/manual/html_node/

lightning	mono	${GS}/lightning/manual/lightning.html
lightning	node	${GS}/lightning/manual/html_node/

# The stable/ url redirects immediately, but that's ok.
# The .html extension is omitted on their web site, but it works if given.
LILYPOND = http://lilypond.org/doc/stable/Documentation
 lilypond-internals	node ${LILYPOND}/internals/
 lilypond-learning	node ${LILYPOND}/learning/
 lilypond-notation 	node ${LILYPOND}/notation/
 lilypond-snippets 	node ${LILYPOND}/snippets/
 lilypond-usage		node ${LILYPOND}/usage/
 lilypond-web		node ${LILYPOND}/web/
 music-glossary		node ${LILYPOND}/music-glossary/

liquidwar6	mono	${GS}/liquidwar6/manual/liquidwar6.html
liquidwar6	node	${GS}/liquidwar6/manual/html_node/

lispintro	mono	${GS}/emacs/emacs-lisp-intro/html_mono/emacs-lisp-intro.html
lispintro	node	${GS}/emacs/emacs-lisp-intro/html_node/index.html

LSH = http://www.lysator.liu.se/~nisse/lsh
  lsh		mono	${LSH}/lsh.html

m4		mono	${GS}/m4/manual/m4.html
m4		node	${GS}/m4/manual/html_node/

mailutils	mono	${GS}/mailutils/manual/mailutils.html
mailutils	chapter	${GS}/mailutils/manual/html_chapter/
mailutils	section	${GS}/mailutils/manual/html_section/
mailutils	node	${GS}/mailutils/manual/html_node/

make		mono	${GS}/make/manual/make.html
make		node	${GS}/make/manual/html_node/

mdk		mono	${GS}/mdk/manual/mdk.html
mdk		node	${GS}/mdk/manual/html_node/

METAEXCHANGE = http://ftp.gwdg.de/pub/gnu2/iwfmdh/doc/texinfo
 iwf_mh		node	${METAEXCHANGE}/iwf_mh.html
 scantest	node	${METAEXCHANGE}/scantest.html

MIT_SCHEME = ${GS}/mit-scheme/documentation
 mit-scheme-ref	  node	${MIT_SCHEME}/mit-scheme-ref/
 mit-scheme-user  node	${MIT_SCHEME}/mit-scheme-user/
 sos		  node	${MIT_SCHEME}/mit-scheme-sos/
 mit-scheme-imail node	${MIT_SCHEME}/mit-scheme-imail/

moe		mono	${GS}/moe/manual/moe_manual.html

motti		node	${GS}/motti/manual/

mpc		node	http://www.multiprecision.org/index.php?prog=mpc&page=html

mpfr		mono	http://www.mpfr.org/mpfr-current/mpfr.html

mtools		mono	${GS}/mtools/manual/mtools.html

myserver	node	http://www.myserverproject.net/documentation/

nano		mono	http://www.nano-editor.org/dist/latest/nano.html

nettle		chapter	http://www.lysator.liu.se/~nisse/nettle/nettle.html

ocrad		mono	${GS}/ocrad/manual/ocrad_manual.html

parted		mono	${GS}/parted/manual/parted.html
parted		node	${GS}/parted/manual/html_node/

pascal		mono	http://www.gnu-pascal.de/gpc/

# can't use pcb since url's contain dates --30nov10

perl		mono	${GS}/perl/manual/perldoc-all.html

PIES = http://www.gnu.org.ua/software/pies/manual
pies		mono	${PIES}/pies.html
pies 		chapter	${PIES}/html_chapter/
pies 		section	${PIES}/html_section/
pies		node	${PIES}/html_node/

plotutils	mono	${GS}/plotutils/manual/en/plotutils.html
plotutils	node	${GS}/plotutils/manual/en/html_node/

proxyknife	mono	${GS}/proxyknife/manual/proxyknife.html
proxyknife	node	${GS}/proxyknife/manual/html_node/

pspp		mono	${GS}/pspp/manual/pspp.html
pspp		node	${GS}/pspp/manual/html_node/

pyconfigure	mono	${GS}/pyconfigure/manual/pyconfigure.html
pyconfigure	node	${GS}/pyconfigure/manual/html_node/

R = http://cran.r-project.org/doc/manuals
 R-intro	mono	${R}/R-intro.html
 R-lang		mono	${R}/R-lang.html
 R-exts		mono	${R}/R-exts.html
 R-data		mono	${R}/R-data.html
 R-admin	mono	${R}/R-admin.html
 R-ints		mono	${R}/R-ints.html

rcs		mono	${GS}/rcs/manual/rcs.html
rcs		node	${GS}/rcs/manual/html_node/

READLINE = http://cnswww.cns.cwru.edu/php/chet/readline
readline        mono    ${READLINE}/readline.html
 rluserman      mono    ${READLINE}/rluserman.html
 history        mono    ${READLINE}/history.html

recode		mono	http://recode.progiciels-bpi.ca/manual/index.html

recutils	mono	${GS}/recutils/manual/recutils.html
recutils	node	${GS}/recutils/manual/html_node/

reftex		mono	${GS}/auctex/manual/reftex.html
reftex		node	${GS}/auctex/manual/reftex/

remotecontrol	mono	${GS}/remotecontrol/manual/remotecontrol.html
remotecontrol	node	${GS}/remotecontrol/manual/html_node/

rottlog		mono	${GS}/rottlog/manual/rottlog.html
rottlog		node	${GS}/rottlog/manual/html_node/

RUSH = http://www.gnu.org.ua/software/rush/manual
rush		mono	${RUSH}/rush.html
rush 		chapter	${RUSH}/html_chapter/
rush 		section	${RUSH}/html_section/
rush		node	${RUSH}/html_node/

screen		mono	${GS}/screen/manual/screen.html
screen		node	${GS}/screen/manual/html_node/

sed		mono	${GS}/sed/manual/sed.html
sed		node	${GS}/sed/manual/html_node/

sharutils	mono	${GS}/sharutils/manual/html_mono/sharutils.html
sharutils	chapter	${GS}/sharutils/manual/html_chapter/
sharutils	node	${GS}/sharutils/manual/html_node/

# can't use mono files since they have generic names
SMALLTALK = ${GS}/smalltalk
smalltalk	node	${SMALLTALK}/manual/html_node/
 smalltalk-base	node	${SMALLTALK}/manual-base/html_node/
 smalltalk-libs	node	${SMALLTALK}/manual-libs/html_node/

sourceinstall	mono	${GS}/sourceinstall/manual/sourceinstall.html
sourceinstall	node	${GS}/sourceinstall/manual/html_node/

sqltutor	mono	${GS}/sqltutor/manual/sqltutor.html
sqltutor	node	${GS}/sqltutor/manual/html_node/

src-highlite	mono	${GS}/src-highlite/source-highlight.html

swbis		mono	${GS}/swbis/manual.html

tar		mono	${GS}/tar/manual/tar.html
tar		chapter	${GS}/tar/manual/html_chapter/
tar		section	${GS}/tar/manual/html_section/
tar		node	${GS}/autoconf/manual/html_node/

teseq		mono	${GS}/teseq/teseq.html
teseq		node	${GS}/teseq/html_node/

TEXINFO = ${GS}/texinfo/manual
texinfo		mono	${TEXINFO}/texinfo/texinfo.html
texinfo		node	${TEXINFO}/texinfo/html_node/
 #
 info		mono	${TEXINFO}/info/info.html
 info		node	${TEXINFO}/info/html_node/
 #
 info-stnd	mono	${TEXINFO}/info-stnd/info-stnd.html
 info-stnd	node	${TEXINFO}/info-stnd/html_node/

thales		node	${GS}/thales/manual/

units		mono	${GS}/units/manual/units.html
units		node	${GS}/units/manual/html_node/

vc-dwim		mono	${GS}/vc-dwim/manual/vc-dwim.html
vc-dwim		node	${GS}/vc-dwim/manual/html_node/

wdiff		mono	${GS}/wdiff/manual/wdiff.html
wdiff		node	${GS}/wdiff/manual/html_node/

websocket4j	mono	${GS}/websocket4j/manual/websocket4j.html
websocket4j	node	${GS}/websocket4j/manual/html_node/

wget		mono	${GS}/wget/manual/wget.html
wget		node	${GS}/wget/manual/html_node/

xboard		mono	${GS}/xboard/manual/xboard.html
xboard		node	${GS}/xboard/manual/html_node/

# emacs-page
# Free TeX-related Texinfo manuals on tug.org.

T = http://tug.org/texinfohtml

dvipng		mono	${T}/dvipng.html
dvips		mono	${T}/dvips.html
eplain		mono	${T}/eplain.html
kpathsea	mono	${T}/kpathsea.html
latex2e		mono	${T}/latex2e.html
tlbuild		mono	${T}/tlbuild.html
web2c		mono	${T}/web2c.html

# Local Variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "htmlxrefversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:


code:
@echo off
perl "%~dpn0" %*

repo_name: mthl/texinfo

license: mit


code:
#!/bin/sh
# $Id$
# Written by Thomas Esser.  Public domain.
# Execute texi2dvi --pdf.

test -f /bin/ksh && test -z "$RUNNING_KSH" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
  && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; }
unset RUNNING_KSH

test -f /bin/bsh && test -z "$RUNNING_BSH" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
  && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
unset RUNNING_BSH

# hack around a bug in zsh:
test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'

rcs_revision='$Revision$'
rcs_version=`set - $rcs_revision; echo $2`

# special-case --version following GNU standards for identifying the
# program name.  If --version is specified as other than the first
# argument, we don't output the standard name, but then, we're not
# obliged to.
if test "x$1" = x--version; then
  cat <<EOF
texi2pdf (GNU Texinfo 6.3) $rcs_version

Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
  exit 0
fi

texi2dvi --pdf ${1+"$@"}


code:
#!/bin/sh
# $Id$
# Texinfo's wrapper for the Gnulib script config/srclist-update,
# to define particular variables our srclist.txt uses.
#
# Copyright 2013, 2014, 2015 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# per-user overrides.
case $LOGNAME in
karl)
  : ${EMACSSRC=/usr/local/gnu/src/dist-emacs};      export EMACSSRC
  : ${GETTEXT=/usr/local/gnu/src/dist-gettext};     export GETTEXT
  : ${AUTOMAKE=/usr/local/gnu/share/automake-1.15}; export AUTOMAKE
  : ${GSASL=$HOME/gnu/src/gsasl};                   export GSASL
  : ${GNULIB=$HOME/gnu/src/gnulib};                 export GNULIB
  ;;
esac

mydir=`dirname $0`
(cd "$mydir/.." && $GNULIB/config/srclist-update <util/srclist.txt) \
| sed 's/^## /cp /'

path: util/srclist-txi


code:
# $Id$
# Files which we keep in sync from other places.
# This is input for the script config/srclist-update in the gnulib
# project on savannah, and the wrapper srclist-txi in this directory.
#
# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013,
# 2014, 2015
# Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

doc/texinfo.tex					build-aux

# Maintained in Emacs, which uses doclicense.texi instead of the usual
# fdl.texi; seems cleaner to change it than to have two copies of the FDL.
$EMACSSRC/doc/misc/info.texi			doc	doclicense

$GETTEXT/gettext-runtime/ABOUT-NLS		.
#
$GETTEXT/gettext-tools/po/Makefile.in.in	po_document
# must merge by hand, not just copy, until .twjr is supported by gettext.
#$GETTEXT/gettext-tools/po/Makefile.in.in	po
$GETTEXT/gettext-tools/po/Makevars.template	po
$GETTEXT/gettext-tools/po/Rules-quot		po
$GETTEXT/gettext-tools/po/boldquot.sed		po
$GETTEXT/gettext-tools/po/en@boldquot.header	po
$GETTEXT/gettext-tools/po/en@quot.header	po
$GETTEXT/gettext-tools/po/insert-header.sin	po
$GETTEXT/gettext-tools/po/quot.sed		po
$GETTEXT/gettext-tools/po/remove-potcdate.sin	po
$GETTEXT/gettext-tools/po/remove-potcdate.sin	po_document

$GNULIBSRC/build-aux/compile		build-aux
$GNULIBSRC/build-aux/config.guess	build-aux
$GNULIBSRC/build-aux/config.rpath	build-aux
$GNULIBSRC/build-aux/config.sub		build-aux
$GNULIBSRC/build-aux/depcomp		build-aux
$GNULIBSRC/build-aux/install-sh		build-aux
$GNULIBSRC/build-aux/mdate-sh		build-aux
#
$GNULIBSRC/doc/COPYINGv3		./COPYING
$GNULIBSRC/doc/INSTALL			./INSTALL.generic
$GNULIBSRC/doc/fdl.texi			doc

# Should only need to be updated after major Automake releases.
$AUTOMAKE/tap-driver.sh			build-aux
$AUTOMAKE/test-driver			build-aux
$AUTOMAKE/missing			build-aux

$GSASL/doc/gdoc 			contrib


code:
#!/bin/sh

set -x

texi2dvi=$srcdir/texi2dvi

out=`$texi2dvi --version`
if test $? -ne 0 || test -z "$out"; then
  echo "$0: $texi2dvi --version failed." >&2
  exit 1
fi

out=`$texi2dvi --help`
if test $? -ne 0 || test -z "$out"; then
  echo "$0: $texi2dvi --help failed." >&2
  exit 1
fi

exit 0


code:
#! /usr/bin/env perl
# texi-elements-by-size -- dump list of elements based on words or line counts.
# Also serve as an example of using the Texinfo::Parser module,
# including the usual per-format options.
#
# Copyright 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Original author: Patrice Dumas <pertusus@free.fr>

use strict;

use Config; # to determine the path separator
use Getopt::Long qw(GetOptions);
Getopt::Long::Configure("gnu_getopt");

BEGIN {
  # The purpose of these includes is to make it possible to run the
  # script from a Texinfo source checkout.  If that's not relevant,
  # probably best to simply assume all the needed packages are in the
  # Perl include path.
  #
  (my $mydir = $0) =~ s,/[^/]*$,,;  # dir we are in
  my $txi_libdir = "$mydir/../tp";  # find tp relative to $0
  unshift (@INC, $txi_libdir);
  #
  my @txi_maint_dirs = qw(Text-Unidecode Unicode-EastAsianWidth libintl-perl);
  unshift (@INC, map { "$txi_libdir/maintain/lib/$_/lib" } @txi_maint_dirs );
}

use Texinfo::Parser;
use Texinfo::Structuring;
use Texinfo::Convert::TextContent;

my $my_version = "0.1 (TP $Texinfo::Parser::VERSION)";

(my $real_command_name = $0) =~ s/.*\///;
$real_command_name =~ s/\.pl$//;

# determine the path separators
my $path_separator = $Config{'path_sep'};
$path_separator = ':' if (!defined($path_separator));
my $quoted_path_separator = quotemeta($path_separator);

my $force = 0;
my $use_sections = 0;
my $count_words = 0;
my $no_warn = 0;

# placeholder for future i18n.
sub __($) {
  return $_[0];
}

my $format = 'info';  # make our counts from the Info output
# this is the format associated with the output format, which is replaced
# when the output format changes.  It may also be removed if there is the
# corresponding --no-ifformat.
#my $default_expanded_format = [ $format ];

# directories specified on the command line.
my @include_dirs = ();
my @prepend_dirs = ();

my $parser_default_options = {
                              #'expanded_formats' => [],
                              'expanded_formats' => [ $format ],
                              'values' => {},
                              #'gettext' => \&__
                              };

sub set_expansion($$) {
  my $region = shift;
  my $set = shift;
  $set = 1 if (!defined($set));
  if ($set) {
    push @{$parser_default_options->{'expanded_formats'}}, $region
      unless (grep {$_ eq $region} @{$parser_default_options->{'expanded_formats'}});
  } else {
    @{$parser_default_options->{'expanded_formats'}} =
      grep {$_ ne $region} @{$parser_default_options->{'expanded_formats'}};
#    @{$default_expanded_format}
#       = grep {$_ ne $region} @{$default_expanded_format};
  }
}

my $result_options = Getopt::Long::GetOptions (
 'help|h' => sub { print help(); exit 0; },
 'version|V' => sub {print "$real_command_name $my_version\n\n";
                     printf __("Copyright (C) %s Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.\n"), "2016";
      exit 0;},
  'force' => \$force,
  'ifhtml!' => sub { set_expansion('html', $_[1]); },
  'ifinfo!' => sub { set_expansion('info', $_[1]); },
  'ifxml!' => sub { set_expansion('xml', $_[1]); },
  'ifdocbook!' => sub { set_expansion('docbook', $_[1]); },
  'iftex!' => sub { set_expansion('tex', $_[1]); },
  'ifplaintext!' => sub { set_expansion('plaintext', $_[1]); },
  'use-sections!' => \$use_sections,
  'count-words!' => \$count_words,
  'no-warn' => \$no_warn,
  'D=s' => sub {$parser_default_options->{'values'}->{$_[1]} = 1;},
  'U=s' => sub {delete $parser_default_options->{'values'}->{$_[1]};},
  'I=s' => sub {
                push @include_dirs, split(/$quoted_path_separator/, $_[1]); },
  'P=s' => sub { unshift @prepend_dirs, split(/$quoted_path_separator/, $_[1]); },
 'number-sections!' => sub { set_from_cmdline('NUMBER_SECTIONS', $_[1]); },
);

exit 1 if (!$result_options);

my @input_files = @ARGV;
# use STDIN if not a tty, like makeinfo does
@input_files = ('-') if (!scalar(@input_files) and !-t STDIN);

die sprintf(__("%s: missing file argument.\n"), $real_command_name)
   .sprintf(__("Try `%s --help' for more information.\n"), $real_command_name)
     unless (scalar(@input_files) >= 1);

if (scalar(@input_files) > 1) {
  warn sprintf(__("%s: superfluous file arguments: @input_files\n"),
       $real_command_name);
}

my $input_file_name = shift @input_files;

sub help() {
  my $help =
    sprintf(__("Usage: %s [OPTION]... TEXINFO-FILE...\n"), $real_command_name)
   ."\n".
    __("Write to standard output a list of Texinfo elements (nodes or sections)
sorted by the number of lines (or words) they contain,
after translation to Info format.\n")
."\n";

  $help .= __("General Options:
  --count-words    count words instead of lines.
  --force          keep going even if Texinfo file parsing fails.
  --help           display this help and exit.
  --no-warn        suppress warnings (but not errors).
  --use-sections   use sections as elements instead of nodes.
  --version        display version information and exit.\n")
."\n";
  $help .= __("Input file options:
  -D VAR                        define the variable VAR, as with \@set.
  -I DIR                        append DIR to the \@include search path.
  -P DIR                        prepend DIR to the \@include search path.
  -U VAR                        undefine the variable VAR, as with \@clear.\n")
."\n";
  $help .= __("Conditional processing in input:
  --ifdocbook       process \@ifdocbook and \@docbook.
  --ifhtml          process \@ifhtml and \@html.
  --ifinfo          process \@ifinfo.
  --ifplaintext     process \@ifplaintext.
  --iftex           process \@iftex and \@tex.
  --ifxml           process \@ifxml and \@xml.
  --no-ifdocbook    do not process \@ifdocbook and \@docbook text.
  --no-ifhtml       do not process \@ifhtml and \@html text.
  --no-ifinfo       do not process \@ifinfo text.
  --no-ifplaintext  do not process \@ifplaintext text.
  --no-iftex        do not process \@iftex and \@tex text.
  --no-ifxml        do not process \@ifxml and \@xml text.

  Also, for the --no-ifFORMAT options, do process \@ifnotFORMAT text.\n");
  return $help;

}

sub _exit($) {
  my $error_count = shift;
  exit (1) if ($error_count and !$force);
}

sub handle_errors($$) {
  my $self = shift;
  my $error_count = shift;
  my ($errors, $new_error_count) = $self->errors();
  $error_count += $new_error_count if ($new_error_count);
  foreach my $error_message (@$errors) {
    warn $error_message->{'error_line'} if ($error_message->{'type'} eq 'error'
                                           or !$no_warn);
  }

  _exit($error_count);
  return $error_count;
}

my $input_directory = '.';
if ($input_file_name =~ /(.*\/)/) {
  $input_directory = $1;
}

my $parser_options = { %$parser_default_options };
$parser_options->{'include_directories'} = [@include_dirs];
my @prepended_include_directories = ('.');
push @prepended_include_directories, $input_directory
    if ($input_directory ne '.');
unshift @{$parser_options->{'include_directories'}},
   @prepended_include_directories;
unshift @{$parser_options->{'include_directories'}}, @prepend_dirs;

my $error_count = 0;
my $parser = Texinfo::Parser::parser($parser_options);
my $tree = $parser->parse_texi_file($input_file_name);

if (!defined($tree)) {
  handle_errors($parser, $error_count);
  exit (1);
}

my $converter_options = {};
$converter_options->{'parser'} = $parser;
my $converter = Texinfo::Convert::TextContent->converter($converter_options);

my ($sorted_name_counts_array, $formatted_result)
  = $converter->sort_element_counts($tree, $use_sections,
                                    $count_words);

print STDOUT $formatted_result;

exit (0);

path: util/texi-elements-by-size


code:
#! /bin/sh
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or (La)TeX) sources.
# $Id$
#
# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
# 2014, 2015, 2016 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Originally written by Noah Friedman.
#
# Please send bug reports, etc. to bug-texinfo@gnu.org.
# If possible, please send a copy of the output of the script called with
# the `--debug' option when making a bug report.

test -f /bin/ksh && test -z "$RUNNING_KSH" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
  && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; }
unset RUNNING_KSH

# No failure shall remain unpunished.
set -e

# In case the default sed doesn't suffice.
: ${SED=sed}

# This string is expanded automatically when this file is checked out.
rcs_revision='$Revision$'
rcs_version=`set - $rcs_revision; echo $2`
program=`echo $0 | $SED -e 's!.*/!!'`

build_mode=${TEXI2DVI_BUILD_MODE:-local}
build_dir=${TEXI2DVI_BUILD_DIRECTORY:-.}

orig_pwd=`pwd`

# Initialize variables for option overriding and otherwise.
# Don't use `unset' since old bourne shells don't have this command.
# Instead, assign them an empty value.
action=compile
batch=false     # interact normally
debug=false
escape="\\"
expand=false    # true for expansion via makeinfo
includes=
line_error=true # pass --file-line-error to TeX
max_iters=7     # when to quit
oname=          # --output
out_lang=dvi
quiet=false     # let the tools' message be displayed
set_language=
src_specials=
shell_escape=
latex2html=hevea  # or set to tex4ht
textra=         # Extra TeX commands to insert in the input file.
txiprereq=19990129 # minimum texinfo.tex version with macro expansion
verb=false      # true for verbose mode
translate_file= # name of charset translation file

# We have to initialize IFS to space tab newline since we save and
# restore IFS and apparently POSIX allows stupid/broken behavior with
# empty-but-set IFS.
# http://lists.gnu.org/archive/html/automake-patches/2006-05/msg00008.html
# We need space, tab and newline, in precisely that order.  And don't leave
# trailing blanks.
space=' '
tab='	'
newline='
'
IFS="$space$tab$newline"

# In case someone pedantic insists on using grep -E.
: ${EGREP=egrep}

# Systems which define $COMSPEC or $ComSpec use semicolons to separate
# directories in TEXINPUTS -- except for Cygwin and Msys, where COMSPEC
# might be inherited, but : is used.

# In the case of Msys, uname returns a value derived from MSYSTEM, as
# MSYSTEM is user configurable, it is not so safe to use it to detect
# Msys. It is safer to use OSTYPE, this is why we set MSYSTEM to
# $OSTYPE before calling uname
if test -n "$COMSPEC$ComSpec" \
   && MSYSTEM=$OSTYPE uname | $EGREP -iv 'cygwin|msys' >/dev/null; then
  path_sep=";"
else
  path_sep=":"
fi

# Pacify verbose cds.
CDPATH=${ZSH_VERSION+.}$path_sep

# Now we define numerous functions, with no other executable code.
# The main program is at the end of the file.

#  Standard help and version functions.
#
# usage - display usage and exit successfully.
usage ()
{
  # We used to simply have `echo "$usage"', but coping with the
  # changing behavior of `echo' is much harder than simply using a
  # here-doc.
  #
  #             echo '\noto'   echo '\\noto'   echo -e '\\noto'
  # bash 3.1      \noto           \\noto          \noto
  # bash 3.2       %oto           \noto           -e \noto
  #
  # where % denotes the eol character.
  cat <<EOF
Usage: $program [OPTION]... FILE...
  or:  texi2pdf [OPTION]... FILE...
  or:  pdftexi2dvi [OPTION]... FILE...

Run each Texinfo or (La)TeX FILE through TeX in turn until all
cross-references are resolved, building all indices.  The directory
containing each FILE is searched for included files.  The suffix of FILE
is used to determine its language ((La)TeX or Texinfo).  To process
(e)plain TeX files, set the environment variable LATEX=tex.

When invoked as \`texi2pdf' or given the option --pdf generate PDF output.
Otherwise, generate DVI.

General options:
  -b, --batch         no interaction
  -D, --debug         turn on shell debugging (set -x)
  -h, --help          display this help and exit successfully
  -o, --output=OFILE  leave output in OFILE; only one input FILE is allowed
  -q, --quiet         no output unless errors (implies --batch)
  -v, --version       display version information and exit successfully
  -V, --verbose       report on what is done
  --max-iterations=N  don't process files more than N times [$max_iters]
  --mostly-clean      remove auxiliary files or directories from
                          previous runs (but not the output)

Output format:
      --dvi     output a DVI file [default]
      --dvipdf  output a PDF file via DVI (using a dvi-to-pdf program)
      --html    output an HTML file from LaTeX, using HeVeA
      --info    output an Info file from LaTeX, using HeVeA
  -p, --pdf     use pdftex or pdflatex for processing
      --ps      output a PostScript file via DVI (using dvips)
      --text    output a plain text file from LaTeX, using HeVeA

TeX tuning:
  -E, --expand               macro expansion using makeinfo
  -I DIR                     search DIR for Texinfo files
  -l, --language=LANG        specify LANG for FILE, either latex or texinfo
      --no-line-error        do not pass --file-line-error to TeX
      --shell-escape         pass --shell-escape to TeX
      --src-specials         pass --src-specials to TeX
      --translate-file=FILE  use given charset translation file for TeX
  -t, --command=CMD          insert CMD in copy of input file

Any CMD strings are added after @setfilename for Texinfo input, or in
the first line for LaTeX input.  Multiple values accumulate.

Build modes:
  --build=MODE         specify the treatment of auxiliary files [$build_mode]
      --tidy           same as --build=tidy
  -c, --clean          same as --build=clean
      --build-dir=DIR  specify where the tidy compilation is performed;
                         implies --tidy;
                         defaults to TEXI2DVI_BUILD_DIRECTORY [$build_dir]

The MODE specifies where the TeX compilation takes place, and, as a
consequence, how auxiliary files are treated.  The build mode can also
be set using the environment variable TEXI2DVI_BUILD_MODE.

Valid values of MODE are:
  \`local'      compile in the current directory, leaving all the auxiliary
               files around.  This is the traditional TeX use.
  \`tidy'       compile in a local *.t2d directory, where the auxiliary files
               are left.  Output files are copied back to the original file.
  \`clean'      same as \`tidy', but remove the auxiliary directory afterwards.
               Every compilation therefore requires the full cycle.

The values of these environment variables are used to run the
corresponding commands, if they are set:

  BIBER BIBTEX DVIPDF DVIPS EGREP HEVEA LATEX MAKEINDEX MAKEINFO
  PDFLATEX PDFTEX SED T4HT TEX TEX4HT TEXINDEX TEXINDY THUMBPDF_CMD

Regarding --dvipdf, if DVIPDF is not set in the environment, the
following programs are looked for (in this order): dvipdfmx dvipdfm
dvipdf dvi2pdf dvitopdf.

If Texinfo is installed on your site, then the command

  info texi2dvi

should give you access to more documentation.

Report bugs to bug-texinfo@gnu.org,
general questions and discussion to help-texinfo@gnu.org.
GNU Texinfo home page: <http://www.gnu.org/software/texinfo/>
General help using GNU software: <http://www.gnu.org/gethelp/>
EOF
  exit 0
}

# version - Display version info and exit successfully.
version ()
{
  cat <<EOF
texi2dvi (GNU Texinfo 6.3) $rcs_version

Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
  exit 0
}

#  Generic auxiliary functions.

# List of variables containing paths to directories or files that
# we need to update.
path_vars='work_build workdir t2ddir work_bak in_input'

# Change directory, updating some relative paths.
cd_dir ()
{
  cd "$1"

  # Check if argument is absolute, and if so, make all the path variables
  # absolute.
  case "$1" in
  [\\/]* | ?:[\\/]*)  # absolute path
    for cdd_dir in $path_vars; do
      eval "$cdd_dir=\`absolute \$$cdd_dir\`"
    done
    return ;;
  esac

  # Replace each path component with ".." and remove any trailing slash.
  cdd_prefix=`echo "$1" | \$SED -e 's/[^/\\][^/\\]*/../g' -e 's/[/\\]$//'`

  # Add this prefix for some variables.
  for cdd_dir in $path_vars; do
    eval "case \"\$$cdd_dir\" in
          [\\/]* | ?:[\\/]*) ;;  # absolute path - do nothing
          ?*)
             eval \"\$cdd_dir=\$cdd_prefix/\\\$\$cdd_dir\" ;;
          esac"
    # Without first level of quotes, where CDD_DIR is $cdd_dir:
    #      case "$CDD_DIR" in
    #      [\\/]* | ?:[\\/]*) ;;
    #      *)
    #         eval "$cdd_dir=$cdd_prefix/\$$cdd_dir" ;;
    #      esac
    #
    # Inner 'eval' becomes
    #     CDD_DIR=CDD_PREFIX/$CDD_DIR
    # where CDD_DIR is $cdd_dir and CDD_PREFIX is $cdd_prefix
  done
}

# cd_orig - Return to the original directory.
cd_orig ()
{
  # In case $orig_pwd is on a different drive (for DOS).
  cd /

  # Return to the original directory so that
  # - the next file is processed in correct conditions
  # - the temporary file can be removed
  cd "$orig_pwd" || exit 1

  test -z "$cdd_prefix" && return

  # strip off ../../ from some variables
  # quote string by placing \ before each character (each either . or /)
  cdd_prefix_q=`echo "$cdd_prefix" | \$SED -e 's/\\(.\\)/\\\\\\1/g'`
  # after backslashes quote within backquoted string:
  #             echo "$cdd_prefix" | $SED -e 's/\(.\)/\\\1/g'

  for cdo_dir in $path_vars ; do
    eval "$cdo_dir=\`echo \"\$$cdo_dir\" | \$SED -e 's/^$cdd_prefix_q\///'\`"

    # Becomes
    # CDO_DIR=`echo "$CDO_DIR" | $SED -e 's/^CDD_PREFIX//'`

    # eval $cdo_dir=\${$cdo_dir#\$cdd_prefix/}
    # would be simpler, but doesn't work in older shells.
  done
}

# func_dirname FILE - Return the directory part of FILE.
func_dirname ()
{
  dirname "$1" 2>/dev/null \
  || { echo "$1" | $SED 's!/[^/]*$!!;s!^$!.!'; }
}

# noext FILE - Return FILE with one extension removed:
#   foo.bar.baz -> foo.bar
noext ()
{
  echo "$1" | $SED -e 's/\.[^/.][^/.]*$//'
}

# absolute NAME - Return an absolute path to NAME.
absolute ()
{
  case $1 in
   [\\/]* | ?:[\\/]*)
      # Absolute paths don't need to be expanded.
      echo "$1"
      ;;
   *) absolute_slashes=`echo "$1" | $SED -n 's,.*[^/]\(/*\)$,\1,p'`
      absolute_rel=$orig_pwd/`func_dirname "$1"`
      if test -d "$absolute_rel"; then
        (cd "$absolute_rel" 2>/dev/null \
         && absolute_name=`pwd`/`basename "$1"`"$absolute_slashes"
         echo "$absolute_name")
      else
        error 1 "not a directory: $absolute_rel"
      fi
      ;;
  esac
}

# ensure_dir DIR1 DIR2... - Make sure given directories exist.
ensure_dir ()
{
  for dir
  do
    # Beware that in parallel builds we may have several concurrent
    # attempts to create the directory.  So fail only if "mkdir"
    # failed *and* the directory still does not exist.
    test -d "$dir" \
      || mkdir "$dir" \
      || test -d "$dir" \
      || error 1 "cannot create directory: $dir"
  done
}

# error EXIT_STATUS LINE1 LINE2... - Report an error and exit with
#   failure if EXIT_STATUS is non-null.
error ()
{
  error_status="$1"
  shift
  report "$@"
  if test "$error_status" != 0; then
    exit $error_status
  fi
}

# findprog PROG - Return true if PROG is somewhere in PATH, else false.
findprog ()
{
  saveIFS="$IFS"
  IFS=$path_sep  # break path components at the path separator
  for dir in $PATH; do
    IFS=$saveIFS
    # The basic test for an executable is `test -f $f && test -x $f'.
    # (`test -x' is not enough, because it can also be true for directories.)
    # We have to try this both for $1 and $1.exe.
    #
    # Note: On Cygwin and DJGPP, `test -x' also looks for .exe.  On Cygwin,
    # also `test -f' has this enhancement, but not on DJGPP.  (Both are
    # design decisions, so there is little chance to make them consistent.)
    # Thusly, it seems to be difficult to make use of these enhancements.
    #
    if   { test -f "$dir/$1"     && test -x "$dir/$1"; } \
      || { test -f "$dir/$1.exe" && test -x "$dir/$1.exe"; }; then
      return 0
    fi
  done
  return 1
}

# report LINE1 LINE2... - Echo each argument to stderr.
report ()
{
  for i in "$@"
  do
    echo >&2 "$0: $i"
  done
}

# run COMMAND-LINE - Run COMMAND-LINE verbosely, catching errors as failures.
run ()
{
  verbose "Running $@"
  "$@" 2>&5 1>&2 \
  || error 1 "$1 failed"
}

# verbose WORD1 WORD2... - Echo concatenated WORDs to stderr, if $verb.
verbose ()
{
  if $verb; then
    echo >&2 "$0: $@"
  fi
}

#  Handling lists.
#
# list_append LIST-NAME ELEM - Append ELEM to (the contents of) LIST-NAME.
list_append ()
{
  list_name="$1"
  shift
  eval set X \$$list_name "$@"
  shift
  eval $list_name=\""$@"\"
}

# list_concat_dirs LIST-NAME DIR-LIST - Append to LIST-NAME all the
# components (including empty ones) from the $path_sep-separated list
# DIR-LIST.  Make the paths absolute.
list_concat_dirs ()
{
  lcd_list="$1"
  # Empty path components are meaningful to tex.  We rewrite them as
  # `EMPTY' so they don't get lost when we split on $path_sep.
  # Hopefully no one will have an actual directory named EMPTY.
  lcd_replace_EMPTY="-e 's/^$path_sep/EMPTY$path_sep/g' \
                     -e 's/$path_sep\$/${path_sep}EMPTY/g' \
                     -e 's/$path_sep$path_sep/${path_sep}EMPTY${path_sep}/g'"
  save_IFS=$IFS
  IFS=$path_sep
  set x `echo "$2" | eval $SED $lcd_replace_EMPTY`; shift
  IFS=$save_IFS
  for lcd_dir
  do
    case $lcd_dir in
      EMPTY)
       list_append $lcd_list ""
       ;;
      *)
       if test -d $lcd_dir; then
          dir=`absolute "$lcd_dir"`
         list_append $lcd_list "$lcd_dir"
       fi
       ;;
    esac
  done
}

# list_prefix LIST-NAME SEP -> STRING - Return string with each element
# of LIST-NAME preceded by SEP.
list_prefix ()
{
  lp_separator="$2"
  eval set X \$$1
  shift
  lp_result=''
  for i
  do
    lp_result="$lp_result \"$lp_separator\" \"$i\""
  done
  echo "$lp_result"
}

# list_infix LIST-NAME SEP -> STRING - Same as list_prefix, but a separator.
list_infix ()
{
  eval set X \$$1
  shift
  save_IFS="$IFS"
  IFS=$path_sep
  echo "$*"
  IFS=$save_IFS
}

# list_dir_to_abs LIST-NAME - Convert list to using only absolute dir names.
# Currently unused, but should replace absolute_filenames some day.
list_dir_to_abs ()
{
  ldta_list="$1"
  eval set X \$$ldta_list
  shift
  ldta_result=''
  for dir
  do
    dir=`absolute "$dir"`
    test -d "$dir" || continue
    ldta_result="$ldata_result \"$dir\""
  done
  set X $ldta_result; shift
  eval $ldta_list=\"$@\"
}

#  Language auxiliary functions.
#
# out_lang_set LANG - set $out_lang to LANG (dvi, pdf, etc.), or error.
out_lang_set ()
{
  case $1 in
    dvi|dvipdf|html|info|pdf|ps|text) out_lang=$1;;
    *) error 1 "invalid output format: $1";;
  esac
}

# out_lang_tex - Return the tex output language (DVI or PDF) for $out_lang.
out_lang_tex ()
{
  case $out_lang in
    dvi | ps | dvipdf ) echo dvi;;
    pdf ) echo $out_lang;;
    html | info | text ) echo $out_lang;;
    *)    error 1 "invalid out_lang: $1";;
  esac
}

# out_lang_ext - Return the extension for $out_lang (pdf, dvi, etc.).
out_lang_ext ()
{
  case $out_lang in
    dvipdf ) echo pdf;;
    dvi | html | info | pdf | ps | text ) echo $out_lang;;
    *)    error 1 "invalid out_lang: $1";;
  esac
}

#  TeX file auxiliary functions.
#
# absolute_filenames TEX-PATH -> TEX-PATH - Convert relative paths to
# absolute, so we can run in another directory (e.g., in tidy build
# mode, or during the macro-support detection).
absolute_filenames ()
{
  # Empty path components are meaningful to tex.  We rewrite them as
  # `EMPTY' so they don't get lost when we split on $path_sep.
  # Hopefully no one will have an actual directory named EMPTY.
  af_replace_empty="-e 's/^$path_sep/EMPTY$path_sep/g' \
                    -e 's/$path_sep\$/${path_sep}EMPTY/g' \
                    -e 's/$path_sep$path_sep/${path_sep}EMPTY${path_sep}/g'"
  af_result=`echo "$1" | eval $SED $af_replace_empty`
  save_IFS=$IFS
  IFS=$path_sep
  set x $af_result; shift
  af_result=
  af_path_sep=
  for dir
  do
    case $dir in
      EMPTY)
        af_result=$af_result$af_path_sep
        ;;
      *)
        if test -d "$dir"; then
          af_result=$af_result$af_path_sep`absolute "$dir"`
        else
          # Even if $dir is not a directory, preserve it in the path.
          # It might contain metacharacters that TeX will expand in
          # turn, e.g., /some/path/{a,b,c}.  This will not get the
          # implicit absolutification of the path, but we can't help that.
          af_result=$af_result$af_path_sep$dir
        fi
        ;;
    esac
    af_path_sep=$path_sep
  done
  echo "$af_result"
}

# output_base_name FILE - Return the name of FILE, possibly renamed to
# satisfy --output.  FILE is local, i.e., without any directory part.
output_base_name ()
{
  case $oname in
    '') echo "$1";;
     *) obn_out_noext=`noext "$oname"`
        obn_file_ext=`echo "$1" | $SED 's/^.*\.//'`
        echo "$obn_out_noext.$obn_file_ext"
      ;;
  esac
}

# destdir - Return the directory where the output is expected.
destdir ()
{
  case $oname in
    '')  echo "$orig_pwd";;
    *)   dirname "$oname";;
  esac
}

# move_to_dest FILE... - Move FILE(s) to the place where the user expects.
# Truly move it, that is, it must not remain in its build location
# unless that is also the output location.  (Otherwise it might appear
# as an extra file in make distcheck.)
#
# FILE can be the principal output (in which case -o directly applies),
# or an auxiliary file with the same base name.
move_to_dest ()
{
#  echo "move_to_dest $*, tidy=$tidy, oname=$oname"

  # If we built in place and have no output name, there is nothing to
  # do, so just return.
  case $tidy:$oname in
    false:) return;;
  esac

  for file
  do
    test -f "$file" \
    || error 1 "no such file or directory: $file"
    case $tidy:$oname in
      true:)  mtd_destdir=$orig_pwd
              mtd_destfile=$mtd_destdir/$file;;
      true:*) mtd_destfile=`output_base_name "$file"`
              mtd_destdir=`dirname "$mtd_destfile"`;;
      false:*) mtd_destfile=$oname
               mtd_destdir=`dirname "$mtd_destfile"`;;
    esac

    # We want to compare the source location and the output location,
    # and if they are different, do the move.  But if they are the
    # same, we must preserve the source.  Since we can't assume
    # stat(1) or test -ef is available, resort to comparing the
    # directory names, canonicalized with pwd.  We can't use cmp -s
    # since the output file might not actually change from run to run;
    # e.g., TeX DVI output is timestamped to only the nearest minute.
    mtd_destdir=`cd "$mtd_destdir" && pwd`
    mtd_destbase=`basename "$mtd_destfile"`

    mtd_sourcedir=`dirname "$file"`
    mtd_sourcedir=`cd "$mtd_sourcedir" && pwd`
    mtd_sourcebase=`basename "$file"`

    if test "$mtd_sourcedir/$mtd_sourcebase" != "$mtd_destdir/$mtd_destbase"
    then
      verbose "Moving $file to $mtd_destfile"
      rm -f "$mtd_destfile"
      mv "$file" "$mtd_destfile"
    fi
  done
}

#  Managing xref files.
#
# aux_file_p FILE - Echo FILE if FILE is an aux file.
aux_file_p ()
{
  test -f "$1" || return 0
  case $1 in
    *.aux) echo "$1";;
    *)     return 0;;
  esac
}

# bibaux_file_p FILE - Echo FILE if FILE contains citation requests.
bibaux_file_p ()
{
  test -s "$1" || return 0
  if (grep '^\\bibstyle[{]' "$1"   \
      && grep '^\\bibdata[{]' "$1" \
      ## The following line is suspicious: fails when there
      ## are citations in sub aux files.  We need to be
      ## smarter in this case.
      ## && grep '^\\citation[{]' "$f"
      ) >&6 2>&1;
  then
    echo "$1"
  fi
  return 0
}

# index_file_p FILE - Echo FILE if FILE is an index file.
index_file_p ()
{
  test -f "$1" || return 0
  case $in_lang:$latex2html:`out_lang_tex`:`$SED '1q' "$1"` in
    # When working with TeX4HT, *.idx are created by LaTeX.  They must
    # be processed to produce *.4ix, *.4dx files.  The *.4dx file is
    # passed to makeindex to produce the *.ind file.  This sequence is
    # handled by run_index, so we are only interested in the *.idx
    # files, which have each "\indexentry" preceded by a
    # "\beforeentry".
    latex:tex4ht:html:"\\beforeentry {"*) echo $1;;

    # When index.sty is used, there is a space before the brace.
    latex:*:*:"\\indexentry{"*|latex:*:*:"\\indexentry {"*) echo $1;;

    texinfo:*:*:"\\entry{"*) echo $1;;
  esac
  return 0
}

########### not used currently
# xref_file_p FILE - Return success if FILE is an xref file (indexes,
# tables and lists).
xref_file_p ()
{
  test -f "$1" || return 1
  # If the file is not suitable to be an index or xref file, don't
  # process it.  It's suitable if the first character is a
  # backslash or right quote or at, as long as the first line isn't
  # \input texinfo.
  case `$SED '1q' "$1"` in
    "\\input texinfo"*) return 1;;
    [\\''@]*)           return 0;;
           *)           return 1;;
  esac
}

# Used in generated_files_get
generated_files_get_from_log ()
{
  if test -f "$1.log"; then
    # Usually the output is like: \openout1 = `foobar.tex'.
    # (including the final period)
    # but luatex outputs: \openout1 = foobar.tex
    # (no quotes, no period).
    # So we have to make the punctuation optional.
    grep '^\\openout[0-9]' "$1.log" \
      | $SED -e "s/\\\\openout[^=]*= *[\`']*//" \
           -e "s/'\.$//"
  fi
}

# Used in generated_files_get
generated_files_get_from_fls ()
{
  if test -f "$1.fls"; then
    grep '^OUTPUT ' "$1.fls" | cut -b 8- \
      | grep -v '\.dvi$' | grep -v '\.log$' | grep -v '\.pdf$' || true
  fi
}

# generated_files_get - Output the list of files generated by the TeX
#                       compilation.
generated_files_get ()
{
  $generated_files_get_method "$in_noext"
  if test $generated_files_get_method = generated_files_get_from_fls; then
    if test -r "$in_noext.fl"; then
      report 'WARNING!!  The fl index may typeset as garbage!' # goes to stderr
      report 'Try upgrading your version of texinfo.tex, or else try setting'
      report 'the environment variable TEXI2DVI_USE_RECORDER to '\''no'\''.'
report 'Once you'\''ve done that, delete the file with an '\''fl'\'' extension.'
    fi
  fi
}

# xref_files_save - set xref_files_orig from xref_files_orig, and save xref
#                   files in $work_bak.
xref_files_save ()
{
  # Save copies of auxiliary files for later comparison.
  xref_files_orig=$xref_files_new
  if test -n "$xref_files_orig"; then
    verbose "Backing up xref files: $xref_files_orig"
    # The following line improves `cp $xref_files_orig "$work_bak"'
    # by preserving the directory parts.  Think of
    # cp chap1/main.aux chap2/main.aux $work_bak.
    #
    # Users may have, e.g., --keep-old-files.  Don't let this interfere.
    # (Don't use unset for the sake of ancient shells.)
    TAR_OPTIONS=; export TAR_OPTIONS
    tar cf - $xref_files_orig | (cd "$work_bak" && tar xf -)
  fi
}

# xref_files_changed - Return success if the xref files have changed
# since the previous run.
xref_files_changed ()
{
  # LaTeX (and the package changebar) report in the LOG file if it
  # should be rerun.  This is needed for files included from
  # subdirs, since texi2dvi does not try to compare xref files in
  # subdirs.  Performing xref files test is still good since LaTeX
  # does not report changes in xref files.
  if grep "Rerun to get" "$in_noext.log" >&6 2>&1; then
    return 0
  fi
  # Similarly, check for biblatex report of whether rerunning is needed.
  if grep "biblatex.*(re)run" "$in_noext.log" >&6 2>&1; then
    return 0
  fi

  # If old and new lists don't have the same file list,
  # then something has definitely changed.
  xref_files_new=`generated_files_get`
  verbose "Original xref files = $xref_files_orig"
  verbose "New xref files      = $xref_files_new"
  if test "x$xref_files_orig" != "x$xref_files_new"; then
    return 0
  fi

  # Compare each file until we find a difference.
  for this_file in $xref_files_new; do
    verbose "Comparing xref file `echo $this_file | $SED 's|\./||g'` ..."
    # cmp -s returns nonzero exit status if files differ.
    if cmp -s "$this_file" "$work_bak/$this_file"; then :; else
      verbose "xref file `echo $this_file | $SED 's|\./||g'` differed ..."
      if $debug; then
        diff -u "$work_bak/$this_file" "$this_file"
      fi
      return 0
    fi
  done

  # No change.
  return 1
}

#  Running the TeX suite.
#
# Set tex_cmd variable, for running TeX.
make_tex_cmd ()
{
  case $in_lang:$latex2html:`out_lang_tex` in
    latex:*:dvi|latex:tex4ht:html)
        tex=${LATEX:-latex};;
    latex:*:pdf)
        tex=${PDFLATEX:-pdflatex};;
    texinfo:*:dvi)
        # MetaPost also uses the TEX environment variable.  If the user
        # has set TEX=latex for that reason, don't bomb out.
        case $TEX in
          *latex) tex=tex;; # don't bother trying to find etex
               *) tex=$TEX
        esac;;
    texinfo:*:pdf) tex=$PDFTEX;;
    *) error 1 "$out_lang not supported for $in_lang";;
  esac

  # Beware of aux files in subdirectories that require the
  # subdirectory to exist.
  case $in_lang:$tidy in
    latex:true)
       $SED -n 's|^[ ]*\\include{\(.*\)/.*}.*|\1|p' "$in_input" |
       sort -u |
       while read d
       do
         ensure_dir "$work_build/$d"
       done
       ;;
  esac

  # Note that this will be used via an eval: quote properly.
  tex_cmd="$tex"

  # If possible, make TeX report error locations in GNU format.
  if $line_error; then
    if test "${tex_help:+set}" != set; then
      # Go to a temporary directory to try --help, since old versions that
      # don't accept --help will generate a texput.log.
      tex_help_dir=$t2ddir/tex_help
      ensure_dir "$tex_help_dir"
      tex_help=`cd "$tex_help_dir" >&6 && $tex --help </dev/null 2>&1 || true`
    fi
    # The mk program and perhaps others want to parse TeX's
    # original error messages.
    case $tex_help in
      *file-line-error*) tex_cmd="$tex_cmd --file-line-error";;
    esac
  fi

  # Tell TeX about -recorder option, if specified
  # recorder_option_maybe is in { " -recorder", "" }
  tex_cmd="$tex_cmd$recorder_option_maybe"

  # Tell TeX about TCX file, if specified.
  test -n "$translate_file" \
                       && tex_cmd="$tex_cmd --translate-file=$translate_file"

  # Tell TeX to make source specials (for backtracking from output to
  # source, given a sufficiently smart editor), if specified.
  test -n "$src_specials" && tex_cmd="$tex_cmd $src_specials"

  # Tell TeX to allow running external executables
  test -n "$shell_escape" && tex_cmd="$tex_cmd $shell_escape"

  # Tell TeX to be batch if requested.
  if $batch; then
    # \batchmode does not show terminal output at all, so we don't
    # want that.  And even in batch mode, TeX insists on having input
    # from the user.  Close its stdin to make it impossible.
    tex_cmd="$tex_cmd </dev/null '${escape}nonstopmode'"
  fi
}

# run_tex - Run TeX as "$tex $in_input", taking care of errors and logs.
run_tex ()
{
  make_tex_cmd

  # Check for any unusual characters in the filename.
  # However, >, \ and any whitespace characters are not supported
  # filenames.
  in_input_funnies=`echo "$in_input" \
    | $SED -e 's![^}#$%&^_{~]!!g' -e 's!\(.\)!\1\''
!g' | uniq`

  if test -n "$in_input_funnies" ; then
    # Make > an end group character, as it's unlikely to appear in
    # a filename.
    tex_cmd="$tex_cmd '${escape}bgroup${escape}catcode62=2${escape}relax'"

    # If the filename has funny characters, change the TeX category codes of
    # some characters within a group, and use \expandafter to input the file
    # outside of the group.
    for w in $in_input_funnies ; do
      tex_cmd="$tex_cmd '${escape}catcode\`${escape}$w=12${escape}relax'"
    done

    # Set \toks0 to "\input FILENAME\relax"
    tex_cmd="$tex_cmd '${escape}toks0${escape}bgroup${escape}input' '$in_input' '${escape}relax>"

    # Expand \toks0 after the end of the group
    tex_cmd="$tex_cmd${escape}expandafter${escape}egroup"
    tex_cmd="$tex_cmd${escape}the${escape}toks0${escape}relax'"
  else
    # In the case of a simple filename, just pass the filename
    # with no funny tricks.
    tex_cmd="$tex_cmd '${escape}input' '$in_input'"
  fi

  verbose "$0: Running $tex_cmd ..."
  if (eval "$tex_cmd" >&5); then
    case $out_lang in
      dvi | pdf ) move_to_dest "$in_noext.$out_lang";;
    esac
  else
    error 1 "$tex exited with bad status, quitting."
  fi
}

# run_bibtex - Run bibtex (or biber) on current file
# - if its input (AUX) exists,
# - or if some citations are missing (LOG contains `Citation'),
# - or if the LOG complains of a missing .bbl.
#
# Don't try to be too smart:
# 1. Running bibtex only if the bbl file exists and is older than
# the LaTeX file is wrong, since the document might include files
# that have changed.
#
# 2. Because there can be several AUX (if there are \include's),
# but a single LOG, looking for missing citations in LOG is
# easier, though we take the risk of matching false messages.
run_bibtex ()
{
  case $in_lang in
    latex)   bibtex=${BIBTEX:-bibtex};;
    texinfo) return;;
  esac

  # "Citation undefined" is for LaTeX, "Undefined citation" for btxmac.tex.
  # The no .aux && \bibdata test is also for btxmac, in case it was the
  # first run of a bibtex-using document.  Otherwise, it's possible that
  # bibtex would never be run.
  if test -r "$in_noext.aux" \
     && test -r "$in_noext.log" \
     && ( (grep 'Warning:.*Citation.*undefined' "$in_noext.log" \
          || grep '.*Undefined citation' "$in_noext.log" \
          || grep 'No file .*\.bbl\.' "$in_noext.log") \
          || (grep 'No \.aux file' "$in_noext.log" \
              && grep '^\\bibdata' "$in_noext.aux") ) \
        >&6 2>&1; \
  then
    bibtex_aux=`filter_files bibaux_file_p`
    for f in $bibtex_aux; do
      run $bibtex "$f"
    done
  fi

  # biber(+biblatex) check.
  if test -r "$in_noext.bcf" \
     && grep '</bcf:controlfile>' "$in_noext.bcf" >/dev/null; then
    run ${BIBER:-biber} "$in_noext"
  fi
}

# filter_file PREDICATE - Print the names of files in xref_files_new
#                         that match PREDICATE.
filter_files ()
{
  test -n "$xref_files_new" || return 0
  echo "$xref_files_new" |
  # Filter existing files matching the criterion.
  #
  while read file; do
    $1 "$file"
  done |
  sort |
  # Some files are opened several times, e.g., listings.sty's *.vrb.
  uniq
}

# run_index - Run texindex (or makeindex or texindy) on current index
# files.  If they already exist, and after running TeX a first time the
# index files don't change, then there's no reason to run TeX again.
# But we won't know that if the index files are out of date or nonexistent.
run_index ()
{
  index_files=`filter_files index_file_p`
  test -n "$index_files" \
  || return 0

  : ${MAKEINDEX:=makeindex}
  : ${TEXINDEX:=texindex}
  : ${TEXINDY:=texindy}

  case $in_lang:$latex2html:`out_lang_tex` in
    latex:tex4ht:html)
      for index_file in $index_files
      do
        index_noext=`noext "$index_file"`
        run tex \
            '\def\filename{{'"$index_noext"'}{idx}{4dx}{ind}}
             \input idxmake.4ht'
        run $MAKEINDEX -o $index_noext.ind $index_noext.4dx
      done
      ;;

    latex:*)
      if $TEXINDY --version >&6 2>&1; then
        run $TEXINDY $index_files
      else
        run $MAKEINDEX $index_files
      fi
      ;;

    texinfo:*)
      run $TEXINDEX $index_files
      ;;
  esac
}

# run_tex4ht - Run the last two phases of TeX4HT: tex4ht extracts the
# HTML from the instrumented DVI file, and t4ht converts the figures and
# installs the files when given -d.
#
# Because knowing exactly which files are created is complex (in
# addition the names are not simple to compute), which makes it
# difficult to install the output files in a second step, we
# tell t4ht to install the output files.
run_tex4ht ()
{
  case $in_lang:$latex2html:`out_lang_tex` in
    latex:tex4ht:html)
      : ${TEX4HT:=tex4ht} ${T4HT:=t4ht}
      run "$TEX4HT" "-f/$in_noext"
      # Do not remove the / after the destdir.
      run "$T4HT" "-d`destdir`/" "-f/$in_noext"
      ;;
  esac
}

# run_thumbpdf - Run thumbpdf.
run_thumbpdf ()
{
  if test `out_lang_tex` = pdf \
     && test -r "$in_noext.log" \
     && grep 'thumbpdf\.sty'  "$in_noext.log" >&6 2>&1; \
  then
    thumbpdf=${THUMBPDF_CMD:-thumbpdf}
    thumbcmd="$thumbpdf $in_dir/$in_noext"
    verbose "Running $thumbcmd ..."
    if $thumbcmd >&5; then
      run_tex
    else
      report "$thumbpdf exited with bad status." \
             "Ignoring its output."
    fi
  fi
}

# run_dvipdf FILE.dvi - Convert FILE.dvi to FILE.pdf.
run_dvipdf ()
{
  # Find which dvi->pdf program is available.
  if test -n "$DVIPDF"; then
    dvipdf=$DVIPDF  # user envvar, use it without checking

  elif test -z "$dvipdf"; then
    for i in dvipdfmx dvipdfm dvipdf dvi2pdf dvitopdf; do
      if findprog $i; then
        dvipdf=$i
      fi
    done
  fi
  # These tools have varying interfaces, some 'input output', others
  # 'input -o output'.  They all seem to accept 'input' only,
  # outputting using the expected file name.
  run $dvipdf "$1"
  if test ! -f `echo "$1" | $SED -e 's/\.dvi$/.pdf/'`; then
    error 1 "cannot find output file"
  fi
}

# run_tex_suite - Run the TeX tools until a stable point is reached.
run_tex_suite ()
{
  # Move to the working directory.
  if $tidy; then
    verbose "cd $work_build"
    cd_dir "$work_build" || exit 1
  fi

  # Count the number of cycles.
  suite_cycle=0

  # Start by checking the log files for what files were created last
  # time.  This will mean that if they don't change, we finish in 1 cycle.
  xref_files_new=`generated_files_get`
  xref_files_save

  while :; do
    # check for (probably) LaTeX loop (e.g. varioref)
    if test $suite_cycle -eq "$max_iters"; then
      error 0 "Maximum of $max_iters cycles exceeded"
      break
    fi

    # report progress
    suite_cycle=`expr $suite_cycle + 1`
    verbose "Cycle $suite_cycle for $command_line_filename"

    run_core_conversion
    xref_files_changed || break
    xref_files_save

    # We run bibtex first, because it's more likely for the indexes
    # to change after bibtex is run than the reverse, though either
    # would be rare.
    run_bibtex
    run_index
  done

  # If we were using thumbpdf and producing PDF, then run thumbpdf
  # and TeX one last time.
  run_thumbpdf

  # If we are using tex4ht, call it.
  run_tex4ht

  # Install the result if we didn't already (i.e., if the output is
  # dvipdf or ps).
  case $latex2html:$out_lang in
    *:dvipdf)
      run_dvipdf "$in_noext.`out_lang_tex`"
      move_to_dest "$in_noext.`out_lang_ext`"
      ;;
    *:ps)
      : ${DVIPS:=dvips}
      run $DVIPS -o "$in_noext.`out_lang_ext`" "$in_noext.`out_lang_tex`"
      move_to_dest "$in_noext.`out_lang_ext`"
      ;;
  esac

  cd_orig
}

#  TeX processing auxiliary tools.
#
# run_makeinfo - Expand macro commands in the original source file using
# Makeinfo.  Always use `end' footnote style, since the `separate' style
# generates different output (arguably this is a bug in -E).  Discard
# main info output, the user asked to run TeX, not makeinfo.
run_makeinfo ()
{
  test $in_lang = texinfo \
    || return 0

  # Unless required by the user, makeinfo expansion is wanted only
  # if texinfo.tex is too old.
  if $expand; then
    makeinfo=${MAKEINFO:-makeinfo}
  else
    # Check if texinfo.tex performs macro expansion by looking for
    # its version.  The version is a date of the form YEAR-MO-DA.
    # We don't need to use [0-9] to match the digits since anyway
    # the comparison with $txiprereq, a number, will fail with non-digits.
    # Run in a temporary directory to avoid leaving files.
    version_test_dir=$t2ddir/version_test
    ensure_dir "$version_test_dir"
    if (
       cd "$version_test_dir"
       echo '\input texinfo.tex @bye' >txiversion.tex
       # Be sure that if tex wants to fail, it is not interactive:
       # close stdin.
       $TEX txiversion.tex </dev/null >txiversion.out 2>txiversion.err
    ); then :; else
      report "texinfo.tex appears to be broken.
This may be due to the environment variable TEX set to something
other than (plain) tex, a corrupt texinfo.tex file, or
to tex itself simply not working."
      cat "$version_test_dir/txiversion.out"
      cat "$version_test_dir/txiversion.err" >&2
      error 1 "quitting."
    fi
    eval `$SED -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p' "$version_test_dir/txiversion.out"`
    verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' ..."
    if test "$txiprereq" -le "$txiversion" >&6 2>&1; then
      makeinfo=
    else
      makeinfo=${MAKEINFO:-makeinfo}
    fi
    # If TeX is preloaded, offer the user this convenience:
    if test "$txiformat" = Texinfo; then
      escape=@
    fi
  fi

  if test -n "$makeinfo"; then
    # in_src: the file with macros expanded.
    # Use the same basename to generate the same aux file names.
    work_src=$workdir/src
    ensure_dir "$work_src"
    in_src=$work_src/$in_base
    run_mi_includes=`list_prefix includes -I`
    verbose "Macro-expanding $command_line_filename to $in_src ..."
    # eval $makeinfo because it might be defined as something complex
    # (running missing) and then we end up with things like '"-I"',
    # and "-I" (including the quotes) is not an option name.  This
    # happens with gettext 0.14.5, at least.
    $SED "$comment_iftex" "$command_line_filename" \
      | eval $makeinfo --footnote-style=end -I "$in_dir" $run_mi_includes \
        -o /dev/null --macro-expand=- \
      | $SED "$uncomment_iftex" >"$in_src"
    # Continue only if everything succeeded.
    if test $? -ne 0 \
       || test ! -r "$in_src"; then
      verbose "Expansion failed, ignored...";
    else
      in_input=$in_src
    fi
  fi
}

# Unfortunately, makeinfo --iftex --no-ifinfo doesn't work well enough
# in versions before 5.0, as makeinfo can't parse the TeX commands
# inside @tex blocks, so work around with sed.
#
# This sed script preprocesses Texinfo sources in order to keep the
# iftex sections only.  We want to remove non-TeX sections, and comment
# (with `@c _texi2dvi') TeX sections so that makeinfo does not try to
# parse them.  Nevertheless, while commenting TeX sections, don't
# comment @macro/@end macro so that makeinfo does propagate them.
# Similarly, preserve the @top node to avoid makeinfo complaining about
# it being missed.  Comment it out after preprocessing, so that it does
# not appear in the generated document.
#
# We assume that `@c _texi2dvi' or `@c (_texi2dvi)' starting a line is
# not present in the document.  Additionally, conditionally defined
# macros inside the @top node may end up with the wrong value, although
# this is unlikely in practice.
#
comment_iftex=\
'/^@tex/,/^@end tex/{
  s/^/@c _texi2dvi/
}
/^@iftex/,/^@end iftex/{
  s/^/@c _texi2dvi/
  /^@c _texi2dvi@macro/,/^@c _texi2dvi@end macro/{
    s/^@c _texi2dvi//
  }
}
/^@ifnottex/,/^@end ifnottex/{
  s/^/@c (_texi2dvi)/
  /^@c (_texi2dvi)@node Top/,/^@c (_texi2dvi)@end ifnottex/ {
    /^@c (_texi2dvi)@end ifnottex/b
    s/^@c (_texi2dvi)//
  }
}
/^@ifinfo/,/^@end ifinfo/{
  /^@node/p
  /^@menu/,/^@end menu/p
  t
  s/^/@c (_texi2dvi)/
}
s/^@ifnotinfo/@c _texi2dvi@ifnotinfo/
s/^@end ifnotinfo/@c _texi2dvi@end ifnotinfo/'

# Uncomment @iftex blocks by removing any leading `@c texi2dvi' (repeated
# copies can sneak in via macro invocations).  Likewise, comment out
# the @top node inside a @ifnottex block.
uncomment_iftex=\
's/^@c _texi2dvi\(@c _texi2dvi\)*//
/^@c (_texi2dvi)@ifnottex/,/^@c (_texi2dvi)@end ifnottex/{
  s/^/@c (_texi2dvi)/
}'

# insert_commands - Insert $textra commands after @setfilename (Texinfo)
# or at the beginning of the file (LaTeX).  Recommended to be used for
# @finalout, @smallbook, etc.
insert_commands ()
{
  if test -n "$textra"; then
    # _xtr.  The file with the user's extra commands.
    work_xtr=$workdir/xtr
    in_xtr=$work_xtr/$in_base
    ensure_dir "$work_xtr"
    verbose "Inserting extra commands: $textra"
    case $in_lang in
      latex)   textra_cmd=1i;;
      texinfo) textra_cmd='/^@setfilename/a';;
      *)       error 1 "internal error, unknown language: $in_lang";;
    esac
    $SED "$textra_cmd\\
$textra" "$in_input" >"$in_xtr"
    in_input=$in_xtr
  fi

  case $in_lang:$latex2html:`out_lang_tex` in
    latex:tex4ht:html)
      # _tex4ht.  The file with the added \usepackage{tex4ht}.
      work_tex4ht=$workdir/tex4ht
      in_tex4ht=$work_tex4ht/$in_base
      ensure_dir "$work_tex4ht"
      verbose "Inserting \\usepackage{tex4ht}"
      perl -pe 's<\\documentclass(?:\[.*\])?{.*}>
                 <$&\\usepackage[xhtml]{tex4ht}>' \
        "$in_input" >"$in_tex4ht"
      in_input=$in_tex4ht
      ;;
  esac
}

# compute_language FILENAME - Return the short string for the language
# in which FILENAME is written: `texinfo' or `latex'.
compute_language ()
{
  # If the user explicitly specified the language, use that.
  # Otherwise, if the first line is \input texinfo, assume it's texinfo.
  # Otherwise, guess from the file extension.
  if test -n "$set_language"; then
    echo $set_language
  elif $SED 1q "$1" | grep 'input texinfo' >&6; then
    echo texinfo
  else
    # Get the type of the file (latex or texinfo) from the given language
    # we just guessed, or from the file extension if not set yet.
    case $1 in
      *.ltx | *.tex | *.drv | *.dtx) echo latex;;
      *)                             echo texinfo;;
    esac
  fi
}

# run_hevea (MODE) - Convert to HTML/INFO/TEXT.
#
# Don't pass `-noiso' to hevea: it's useless in HTML since anyway the
# charset is set to latin1, and troublesome in other modes since
# accented characters loose their accents.
#
# Don't pass `-o DEST' to hevea because in that case it leaves all its
# auxiliary files there too...  Too bad, because it means we will need
# to handle images some day.
run_hevea ()
{
  run_hevea_name="${HEVEA:-hevea}"
  run_hevea_cmd="$run_hevea_name"

  case $1 in
    html) ;;
    text|info) run_hevea_cmd="$run_hevea_cmd -$1";;
    *) error 1 "run_hevea_cmd: invalid argument: $1";;
  esac

  # Compiling to the tmp directory enables to preserve a previous
  # successful compilation.
  run_hevea_cmd="$run_hevea_cmd -fix -O -o '$out_base'"
  run_hevea_cmd="$run_hevea_cmd `list_prefix includes -I` -I '$orig_pwd' "
  run_hevea_cmd="$run_hevea_cmd '$in_input'"

  if $debug; then
    run_hevea_cmd="$run_hevea_cmd -v -v"
  fi

  verbose "running $run_hevea_cmd"
  if eval "$run_hevea_cmd" >&5; then
    # hevea leaves trailing white spaces, this is annoying.
    case $1 in text|info)
      perl -pi -e 's/[ \t]+$//g' "$out_base"*;;
    esac
    case $1 in
    html|text) move_to_dest "$out_base";;
    info) # There can be foo.info-1, foo.info-2 etc.
               move_to_dest "$out_base"*;;
    esac
  else
    error 1 "$run_hevea_name exited with bad status, quitting."
  fi
}

# run_core_conversion - Run TeX (or HeVeA).
run_core_conversion ()
{
  case $in_lang:$latex2html:`out_lang_tex` in
    *:dvi|*:pdf|latex:tex4ht:html)
        run_tex;;
    latex:*:html|latex:*:text|latex:*:info)
        run_hevea $out_lang;;
    *)
        error 1 "invalid input/output combination: $in_lang/$out_lang";;
  esac
}

# compile - Run the full compilation chain, from pre-processing to
# installation of the output at its expected location.
compile ()
{
  # Set include path for tools:
  #   .  Include current directory in case there are files there already, so
  #     we don't have more TeX runs than necessary.  orig_pwd is used in case
  #     we are in clean build mode, where we have cd'd to a temp directory.
  #   .  Include directory containing file, in case there are other
  #     files @include'd.
  #   .  Keep a final path_sep to get the default (system) TeX
  #     directories included.
  #   .  If we have any includes, put those at the end.

  common="$orig_pwd$path_sep$in_dir$path_sep"
  #
  txincludes=`list_infix includes $path_sep`
  test -n "$txincludes" && common="$common$txincludes$path_sep"
  #
  for var in $tex_envvars; do
    eval val="\$common\$${var}_orig"
    # Convert relative paths to absolute paths, so we can run in another
    # directory (e.g., in clean build mode, or during the macro-support
    # detection).
    val=`absolute_filenames "$val"`
    eval $var="\"$val\""
    export $var
    eval verbose \"$var=\'\$${var}\'\"
  done

  # --expand
  run_makeinfo

  # --command, --texinfo
  insert_commands

  # Run until a fixed point is reached.
  run_tex_suite
}

# make_openout_test FLAGS EXTENSION
# - Run TeX with an input file that performs an \openout.  Pass FLAGS to TeX.
#
make_openout_test ()
{
    ensure_dir "$workdir"/check_recorder
    cd_dir "$workdir"/check_recorder
    cat > openout.tex <<EOF
\newwrite\ourwrite
\immediate\openout\ourwrite dum.dum
\bye
EOF
    # \bye doesn't work for LaTeX, but it will cause latex
    # to exit with an input error.
    recorder_option_maybe="$1"
    save_batch=$batch
    batch=true
    make_tex_cmd
    batch=$save_batch
    tex_cmd="$tex_cmd '${escape}input' ./openout.tex"
    # ./ in case . isn't in path
    verbose "$0: running $tex_cmd ..."
    rm -fr "openout.$2"
    (eval "$tex_cmd" >/dev/null 2>&1)
}

# Check tex supports -recorder option
check_recorder_support ()
{
  verbose "Checking TeX recorder support..."
  make_openout_test " -recorder" fls
  if test -f openout.fls && grep '^OUTPUT dum.dum$' openout.fls > /dev/null
  then
    cd_orig
    verbose "Checking TeX recorder support... yes"
    return 0
  else
    cd_orig
    verbose "Checking TeX recorder support... no"
    return 1
  fi
}

# Check tex supports \openout traces in log
check_openout_in_log_support ()
{
  verbose "Checking TeX \openout in log support..."
  make_openout_test "" log
  if test -f openout.log \
     && grep '^\\openout..\? *= *`\?dum\.dum'\''\?' openout.log >/dev/null
  then
    cd_orig
    verbose "Checking TeX \openout in log support... yes"
    return 0
  else
    cd_orig
    verbose "Checking TeX \openout in log support... no"
    return 1
  fi
}

# Set that output auxiliary files are detected with the -recorder option,
# which creates a file JOBNAME.fls which is a machine-readable listing of
# files read and written during the job.
set_aux_files_from_fls ()
{
  recorder_option_maybe=" -recorder"
  generated_files_get_method=generated_files_get_from_fls
}

# Set that output auxiliary files are detected with searching for \openout
# in the log file.
set_aux_files_from_log ()
{
  recorder_option_maybe=''
  generated_files_get_method=generated_files_get_from_log
}

# Decide whether output auxiliary files are detected with the -recorder
# option, or by searching for \openout in the log file.
decide_aux_files_method ()
{
  # Select output file detection method
  # Valid values of TEXI2DVI_USE_RECORDER are:
  #   yes           use the -recorder option, no checks.
  #   no            scan for \openout in the log file, no checks.
  #   yesmaybe      check whether -recorder option is supported, and if yes
  #                use it, otherwise check for tracing \openout in the
  #                log file is supported, and if yes use it, else it is an
  #                error.
  #   nomaybe      same as `yesmaybe', except that the \openout trace in
  #                log file is checked first.
  #
  #  The default behaviour is `nomaybe'.

  test -n "$TEXI2DVI_USE_RECORDER" || TEXI2DVI_USE_RECORDER=nomaybe

  case $TEXI2DVI_USE_RECORDER in
    yes) set_aux_files_from_fls;;

    no)	set_aux_files_from_log;;

    yesmaybe)
      if check_recorder_support; then
        set_aux_files_from_fls
      elif check_openout_in_log_support; then
        set_aux_files_from_log
      else
        error 1 "TeX neither supports -recorder nor outputs \\openout lines in its log file"
      fi
      ;;

    nomaybe)
      if check_openout_in_log_support; then
        set_aux_files_from_log
      elif check_recorder_support; then
        set_aux_files_from_fls
      else
        error 1 "TeX neither supports -recorder nor outputs \\openout lines in its log file"
      fi
      ;;

    *) error 1 "Invalid value of TEXI2DVI_USE_RECORDER environment variable : $TEXI2DVI_USE_RECORDER.";;

  esac
}

# remove FILE...
remove ()
{
  verbose "Removing" "$@"
  rm -rf "$@"
}

# all_files - Echo the names of all files generated, including those by
#             auxiliary tools like texindex.
all_files ()
{
  echo $in_noext.log
  echo $in_noext.fls
  filter_files add_all_filter
}

# Echo FILE and any generated file based thereon.
add_all_filter ()
{
  echo $1
  case $in_lang in
    texinfo)
      # texindex: texinfo.cp -> texinfo.cps
      if test -n "`index_file_p $1`" ; then
        echo $1s
      fi
      ;;
    latex)
      if test -n "`aux_file_p $1`"; then
        # bibtex: *.aux -> *.bbl and *.blg.
        echo $1 | $SED 's/^\(.*\)\.aux$/\1.bbl/'
        echo $1 | $SED 's/^\(.*\)\.aux$/\1.blg/'
        # -recorder: .fls
        echo $1 | $SED 's/^\(.*\)\.aux$/\1.fls/'
      fi
      ;;
  esac
}

# mostly_clean - Remove auxiliary files and directories.  Changes back to
# the original directory.
mostly_clean ()
{
  cd_orig
  set X "$t2ddir"
  shift
  $tidy || {
    set X ${1+"$@"} `all_files`
    shift
  }
  remove ${1+"$@"}
}

# cleanup - Remove what should be removed according to options.
# Called at the end of each compilation cycle, and at the end of
# the script.  Changes the current directory.
cleanup ()
{
  case $clean:$tidy in
    true:true) mostly_clean ;;                # build mode is "clean"
    false:false) cd_orig; remove "$t2ddir";;  # build mode is "local"
  esac
}

#  input_file_name_decode - Decode COMMAND_LINE_FILENAME, and set the
# following shell variables:
#
# - COMMAND_LINE_FILENAME
#   The filename given on the commmand line, but cleaned of TeX commands.
# - IN_DIR
#   The directory containing the input file.
# - IN_BASE
#   The input file base name (no directory part).
# - IN_NOEXT
#   The input file name with neither file extensions nor directory part.
# - IN_INPUT
#   The path to the input file for passing as a command-line argument
#   to TeX.  Defaults to COMMAND_LINE_FILENAME, but might change if the
#   input is preprocessed.
input_file_name_decode ()
{
  # See if we are run from within AUC-Tex, in which case we are
  # passed `\input{FOO.tex}' or even `\nonstopmode\input{FOO.tex}'.
  case $command_line_filename in
    *\\nonstopmode*)
      batch=true;;
  esac
  case $command_line_filename in
    *\\input{*}*)
      # Let AUC-TeX error parser deal with line numbers.
      line_error=false
      command_line_filename=`\
        expr X"$command_line_filename" : X'.*input{\([^}]*\)}'`
      ;;
  esac

  # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
  # prepend `./' in order to avoid that the tools take it as an option.
  echo "$command_line_filename" | LC_ALL=C $EGREP '^(/|[A-Za-z]:/)' >&6 \
  || command_line_filename="./$command_line_filename"

  # See if the file exists.  If it doesn't we're in trouble since, even
  # though the user may be able to reenter a valid filename at the tex
  # prompt (assuming they're attending the terminal), this script won't
  # be able to find the right xref files and so forth.
  test -r "$command_line_filename" \
  || error 1 "cannot read $command_line_filename, skipping."

  # Get the name of the current directory.
  in_dir=`func_dirname "$command_line_filename"`

  # Strip directory part but leave extension.
  in_base=`basename "$command_line_filename"`
  # Strip extension.
  in_noext=`noext "$in_base"`

  # The normalized file name to compile.  Must always point to the
  # file to actually compile (in case of recoding, macro-expansion etc.).
  in_input=$in_dir/$in_base

  # Compute the output file name.
  if test x"$oname" != x; then
    out_name=$oname
  else
    out_name=$in_noext.`out_lang_ext`
  fi
  out_dir=`func_dirname "$out_name"`
  out_dir_abs=`absolute "$out_dir"`
  out_base=`basename "$out_name"`
  out_noext=`noext "$out_base"`
}

#
#################### Main program starts ##########################

# Initialize more variables.
#
# Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
# Likewise for bibtex and makeindex.
tex_envvars="BIBINPUTS BSTINPUTS DVIPSHEADERS INDEXSTYLE MFINPUTS MPINPUTS \
TEXINPUTS TFMFONTS"
for var in $tex_envvars; do
  eval ${var}_orig=\$$var
  export $var
done

# Push a token among the arguments that will be used to notice when we
# ended options/arguments parsing.
# Use "set dummy ...; shift" rather than 'set - ..." because on
# Solaris set - turns off set -x (but keeps set -e).
# Use ${1+"$@"} rather than "$@" because Digital Unix and Ultrix 4.3
# still expand "$@" to a single argument (the empty string) rather
# than nothing at all.
arg_sep="$$--$$"
set dummy ${1+"$@"} "$arg_sep"; shift

while test x"$1" != x"$arg_sep"; do
  # Handle --option=value by splitting apart and putting back on argv.
  case "$1" in
    --*=*)
      opt=`echo "$1" | $SED -e 's/=.*//'`
      val=`echo "$1" | $SED -e 's/[^=]*=//'`
      shift
      set dummy "$opt" "$val" ${1+"$@"}; shift
      ;;
  esac

  case "$1" in
    -@ ) escape=@;;
    -~ ) verbose "Option -~ is obsolete: texi2dvi ignores it.";;
    # Silently and without documentation accept -b and --b[atch] as synonyms.
    -b | --batch) batch=true;;
         --build)      shift; build_mode=$1;;
         --build-dir)  shift; build_dir=$1; build_mode=tidy;;
    -c | --clean) build_mode=clean;;
    -D | --debug) debug=true;;
    -e | -E | --expand) expand=true;;
    -h | --help) usage;;
    -I)   shift; list_concat_dirs includes "$1";;
    -l | --lang | --language) shift; set_language=$1;;
    --mostly-clean) action=mostly-clean;;
    --no-line-error) line_error=false;;
    --max-iterations) shift; max_iters=$1;;
    -o | --out  | --output)
      shift
      # Make it absolute, just in case we also have --clean, or whatever.
      oname=`absolute "$1"`;;

    # Output formats.
    -O|--output-format) shift; out_lang_set "$1";;
       --dvi|--dvipdf|--html|--info|--pdf|--ps|--text)
       out_lang_set `echo "x$1" | $SED 's/^x--//'`;;

    -p) out_lang_set pdf;;
    -q | -s | --quiet | --silent) quiet=true; batch=true;;
    --src-specials) src_specials=--src-specials;;
    --shell-escape) shell_escape=--shell-escape;;
    --tex4ht) latex2html=tex4ht;;
    -t | --texinfo | --command ) shift; textra="$textra\\
"`echo "$1" | $SED 's/\\\\/\\\\\\\\/g'`;;
    --translate-file ) shift; translate_file="$1";;
    --tidy) build_mode=tidy;;
    -v | --vers*) version;;
    -V | --verb*) verb=true;;
    --) # What remains are not options.
      shift
      while test x"$1" != x"$arg_sep"; do
        set dummy ${1+"$@"} "$1"; shift
        shift
      done
      break;;
    -*)
      error 1 "Unknown or ambiguous option \`$1'." \
              "Try \`--help' for more information."
      ;;
    *) set dummy ${1+"$@"} "$1"; shift;;
   esac
   shift
done
# Pop the token
shift

# $tidy:  compile in a t2d directory.
# $clean: remove all the aux files.
case $build_mode in
  local) clean=false; tidy=false;;
  tidy)  clean=false; tidy=true;;
  clean) clean=true;  tidy=true;;
      *) error 1 "invalid build mode: $build_mode";;
esac

# Interpret remaining command line args as filenames.
case $# in
 0)
  error 2 "Missing file arguments." "Try \`--help' for more information."
  ;;
 1) ;;
 *)
  if test -n "$oname"; then
    error 2 "Can't use option \`--output' with more than one argument."
  fi
  ;;
esac

# We can't do much without tex.
# End up with the TEX and PDFTEX variables set to what we are going to use.
#
# If $TEX is set to a directory, don't use it.
test -n "$TEX" && test -d "$TEX" && unset TEX

# But otherwise, use $TEX if it is set.
if test -z "$TEX"; then
  if findprog tex; then :; else cat <<EOM >&2
You don't have a working TeX binary (tex) installed anywhere in
your PATH, and texi2dvi cannot proceed without one.  If you want to use
this script, you'll need to install TeX (if you don't have it) or change
your PATH or TEX environment variable (if you do).  See the --help
output for more details.

For information about obtaining TeX, please see http://tug.org/texlive,
or do a web search for TeX and your operating system or distro.
EOM
    exit 1
  fi

  # We want to use etex (or pdftex) if they are available, and the user
  # didn't explicitly specify.  We don't check for elatex and pdfelatex
  # because (as of 2003), the LaTeX team has asked that new distributions
  # use etex by default anyway.
  #
  if findprog etex; then TEX=etex; else TEX=tex; fi
fi

# For many years, the pdftex binary has included the e-tex extensions,
# but for those people with ancient TeX distributions ...
if test -z "$PDFTEX"; then
  if findprog pdfetex; then PDFTEX=pdfetex; else PDFTEX=pdftex; fi
fi

# File descriptor usage:
# 0 standard input
# 1 standard output (--verbose messages)
# 2 standard error
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 5 tools output (turned off by --quiet)
# 6 tracing/debugging (set -x output, etc.)

# Main tools' output (TeX, etc.) that TeX users are used to seeing.
#
# If quiet, discard, else redirect to the message flow.
if $quiet; then
  exec 5>/dev/null
else
  exec 5>&1
fi

# Enable tracing, and auxiliary tools output.
#
# This fd should be used where you'd typically use /dev/null to throw
# output away.  But sometimes it is convenient to see that output (e.g.,
# from a grep) to aid debugging.  Especially debugging at distance, via
# the user.
#
if $debug; then
  exec 6>&1
  set -vx
else
  exec 6>/dev/null
fi

#  Main program main loop - TeXify each file in turn.
for command_line_filename
do
  verbose "Processing $command_line_filename ..."

  input_file_name_decode

  # `texinfo' or `latex'?
  in_lang=`compute_language "$command_line_filename"`

  # An auxiliary directory used for all the auxiliary tasks involved
  # in compiling this document.
  case $build_dir in
      '' | . ) t2ddir=$out_noext.t2d ;;
      *) # Avoid collisions between multiple occurrences of the same
         # file, so depend on the output path.  Remove leading `./',
         # at least to avoid creating a file starting with `.!', i.e.,
         # an invisible file. The sed expression is fragile if the cwd
         # has active characters.  Transform / into ! so that we don't
         # need `mkdir -p'.  It might be something to reconsider.
         t2ddir=$build_dir/`echo "$out_dir_abs/$out_noext.t2d" |
             $SED "s,^$orig_pwd/,,;s,^\./,,;s,/,!,g"`
  esac
  # Remove it at exit if clean mode.
  trap "cleanup" 0 1 2 15

  ensure_dir "$build_dir" "$t2ddir"

  # Sometimes there are incompatibilities between auxiliary files for
  # DVI and PDF.  The contents can also change whether we work on PDF
  # and/or DVI.  So keep separate spaces for each.
  workdir=$t2ddir/`out_lang_tex`
  ensure_dir "$workdir"

  # _build.  In a tidy build, where the auxiliary files are output.
  if $tidy; then
    work_build=$workdir/build
  else
    work_build=.
  fi

  # _bak.  Copies of the previous auxiliary files (another round is
  # run if they differ from the new ones).
  work_bak=$workdir/bak

  # Make those directories.
  ensure_dir "$work_build" "$work_bak"

  # Decide how to find auxiliary files created by TeX.
  decide_aux_files_method

  case $action in
    compile)
      # Compile the document.
      compile
      cleanup
      ;;

    mostly-clean)
      xref_files_new=`generated_files_get`
      mostly_clean
      ;;
  esac
done

verbose "done."
exit 0 # exit successfully, not however we ended the loop.
# Local Variables:
# sh-basic-offset: 2
# sh-indentation: 2
# End:


code:
#! /bin/sh
# $Id$
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Original author: Patrice Dumas.

# Convert Texinfo to HTML, setting the default style to be the texi2html
# style.
#
# It is not fully compatible with texi2html.  There is no possibility of
# splitting indices, and translated strings cannot (yet?) be customized.
# Command line processing and options have also changed, and the
# customization API is new.
#
# Thus, since this is not a drop-in replacement for the old texi2html,
# we do not install it.  It's here as an example.
#
# See the texi2html node in the Texinfo manual for more.
#
exec texi2any --set-init-variable TEXI2HTML=1 "$@"


code:
@echo off
REM Copyright 2016 Free Software Foundation, Inc.
REM
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
REM the Free Software Foundation; either version 3 of the License,
REM or (at your option) any later version.
REM
REM This program is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
REM GNU General Public License for more details.
REM
REM You should have received a copy of the GNU General Public License
REM along with this program.  If not, see <http://www.gnu.org/licenses/>.
REM
REM Originally written by Eli Zaretskii.
REM Please send bug reports, etc. to bug-texinfo@gnu.org.
REM
REM Batch file wrapper for the texindex.awk program.
REM See the texindex shell script for more rationale.
REM
setlocal
REM Directory where this script lives with a trailing backslash
set mydir=%~dp0
REM Allow the user override the awk interpreter location
set awkbinary=
if "%TEXINDEX_AWK%" == "" goto DefaultAwk
set awkbinary=%TEXINDEX_AWK%
if exist "%awkbinary%.exe" goto UserAwk
if exist "%awkbinary%" goto UserAwk
echo %0: TEXINDEX_AWK environment variable set, but its value
echo %0: is not a readable file.  Ignoring TEXINDEX_AWK.
:DefaultAwk
set awkbinary=gawk
:UserAwk
REM Find the texindex.awk script file
set tiscript=
if "%TEXINDEX_SCRIPT%" == "" goto DefaultScript
set tiscript=%TEXINDEX_SCRIPT%
if exist "%tiscript%" goto UserScript
echo %0: TEXINDEX_SCRIPT environment variable set, but its value
echo %0: is not a readable file.  Ignoring TEXINDEX_SCRIPT.
:DefaultScript
REM In the development tree, the script is in ../texindex/
set tiscript="%mydir%..\texindex\texindex.awk"
if exist %tiscript% goto UserScript
REM The installed script should be in the ../share/ directory relative to us
set tiscript="%mydir%..\share\texindex.awk"
REM If not found, abort
if exist %tiscript% goto UserScript
echo %0: could not locate texindex.awk script, quitting
exit /b 1
:UserScript
REM Double each backslash in our name because Gawk will interpret
REM backslashes in the name such that e.g. \t becomes a TAB
set mypath=%0
set escaped=%mypath:\=\\%
REM Finally, invoke the script
"%awkbinary%" -v Invocation_name="%escaped%" -f "%tiscript%" -- %*


code:
OVERRIDE YES

PUBLIC "-//GNU//DTD TexinfoML V__VERSION__//EN" "texinfo.dtd"