head	1.11;
access;
symbols
	perseant-exfatfs-base-20261102:1.11
	perseant-exfatfs-base-20250801:1.11
	perseant-exfatfs-base-20240630:1.11
	cjep_sun2x:1.11.0.14
	cjep_sun2x-base:1.11
	cjep_staticlib_x-base1:1.11
	cjep_staticlib_x:1.11.0.12
	cjep_staticlib_x-base:1.11
	phil-wifi-20200421:1.11
	phil-wifi-20200411:1.11
	phil-wifi-20200406:1.11
	pgoyette-compat-merge-20190127:1.11
	pgoyette-compat-20190127:1.11
	pgoyette-compat-20190118:1.11
	pgoyette-compat-1226:1.11
	pgoyette-compat-1126:1.11
	pgoyette-compat-1020:1.11
	pgoyette-compat-0930:1.11
	pgoyette-compat-0906:1.11
	netbsd-7-2-RELEASE:1.10
	pgoyette-compat-0728:1.11
	pgoyette-compat-0625:1.11
	pgoyette-compat-0521:1.11
	pgoyette-compat-0502:1.11
	pgoyette-compat-0422:1.11
	pgoyette-compat-0415:1.11
	pgoyette-compat-0407:1.11
	pgoyette-compat-0330:1.11
	pgoyette-compat-0322:1.11
	pgoyette-compat-0315:1.11
	netbsd-7-1-2-RELEASE:1.10
	pgoyette-compat:1.11.0.10
	pgoyette-compat-base:1.11
	netbsd-7-1-1-RELEASE:1.10
	perseant-stdc-iso10646:1.11.0.8
	perseant-stdc-iso10646-base:1.11
	prg-localcount2-base3:1.11
	prg-localcount2-base2:1.11
	prg-localcount2-base1:1.11
	prg-localcount2:1.11.0.6
	prg-localcount2-base:1.11
	pgoyette-localcount-20170426:1.11
	bouyer-socketcan-base1:1.11
	pgoyette-localcount-20170320:1.11
	netbsd-7-1:1.10.0.10
	netbsd-7-1-RELEASE:1.10
	netbsd-7-1-RC2:1.10
	netbsd-7-nhusb-base-20170116:1.10
	bouyer-socketcan:1.11.0.4
	bouyer-socketcan-base:1.11
	pgoyette-localcount-20170107:1.11
	netbsd-7-1-RC1:1.10
	pgoyette-localcount-20161104:1.11
	netbsd-7-0-2-RELEASE:1.10
	localcount-20160914:1.11
	netbsd-7-nhusb:1.10.0.8
	netbsd-7-nhusb-base:1.10
	pgoyette-localcount-20160806:1.11
	pgoyette-localcount-20160726:1.11
	pgoyette-localcount:1.11.0.2
	pgoyette-localcount-base:1.11
	netbsd-7-0-1-RELEASE:1.10
	netbsd-7-0:1.10.0.6
	netbsd-7-0-RELEASE:1.10
	netbsd-7-0-RC3:1.10
	netbsd-7-0-RC2:1.10
	netbsd-7-0-RC1:1.10
	netbsd-5-2-3-RELEASE:1.9
	netbsd-5-1-5-RELEASE:1.9
	netbsd-6-0-6-RELEASE:1.9
	netbsd-6-1-5-RELEASE:1.9
	netbsd-7:1.10.0.4
	netbsd-7-base:1.10
	yamt-pagecache-base9:1.10
	yamt-pagecache-tag8:1.9
	netbsd-6-1-4-RELEASE:1.9
	netbsd-6-0-5-RELEASE:1.9
	tls-earlyentropy:1.10.0.2
	tls-earlyentropy-base:1.10
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.10
	riastradh-drm2-base3:1.10
	netbsd-6-1-3-RELEASE:1.9
	netbsd-6-0-4-RELEASE:1.9
	netbsd-5-2-2-RELEASE:1.9
	netbsd-5-1-4-RELEASE:1.9
	netbsd-6-1-2-RELEASE:1.9
	netbsd-6-0-3-RELEASE:1.9
	netbsd-5-2-1-RELEASE:1.9
	netbsd-5-1-3-RELEASE:1.9
	netbsd-6-1-1-RELEASE:1.9
	riastradh-drm2-base2:1.9
	riastradh-drm2-base1:1.9
	riastradh-drm2:1.9.0.30
	riastradh-drm2-base:1.9
	netbsd-6-1:1.9.0.34
	netbsd-6-0-2-RELEASE:1.9
	netbsd-6-1-RELEASE:1.9
	netbsd-6-1-RC4:1.9
	netbsd-6-1-RC3:1.9
	agc-symver:1.9.0.32
	agc-symver-base:1.9
	netbsd-6-1-RC2:1.9
	netbsd-6-1-RC1:1.9
	yamt-pagecache-base8:1.9
	netbsd-5-2:1.9.0.28
	netbsd-6-0-1-RELEASE:1.9
	yamt-pagecache-base7:1.9
	netbsd-5-2-RELEASE:1.9
	netbsd-5-2-RC1:1.9
	matt-nb6-plus-nbase:1.9
	yamt-pagecache-base6:1.9
	netbsd-6-0:1.9.0.26
	netbsd-6-0-RELEASE:1.9
	netbsd-6-0-RC2:1.9
	tls-maxphys:1.9.0.24
	tls-maxphys-base:1.10
	matt-nb6-plus:1.9.0.22
	matt-nb6-plus-base:1.9
	netbsd-6-0-RC1:1.9
	yamt-pagecache-base5:1.9
	yamt-pagecache-base4:1.9
	netbsd-6:1.9.0.20
	netbsd-6-base:1.9
	netbsd-5-1-2-RELEASE:1.9
	netbsd-5-1-1-RELEASE:1.9
	yamt-pagecache-base3:1.9
	yamt-pagecache-base2:1.9
	yamt-pagecache:1.9.0.2
	yamt-pagecache-base:1.9
	cherry-xenmp:1.9.0.18
	cherry-xenmp-base:1.9
	bouyer-quota2-nbase:1.9
	bouyer-quota2:1.9.0.16
	bouyer-quota2-base:1.9
	matt-mips64-premerge-20101231:1.9
	matt-nb5-mips64-premerge-20101231:1.9
	matt-nb5-pq3:1.9.0.14
	matt-nb5-pq3-base:1.9
	netbsd-5-1:1.9.0.12
	netbsd-5-1-RELEASE:1.9
	netbsd-5-1-RC4:1.9
	matt-nb5-mips64-k15:1.9
	netbsd-5-1-RC3:1.9
	netbsd-5-1-RC2:1.9
	netbsd-5-1-RC1:1.9
	netbsd-5-0-2-RELEASE:1.9
	matt-nb5-mips64-premerge-20091211:1.9
	matt-premerge-20091211:1.9
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.9
	matt-nb4-mips64-k7-u2a-k9b:1.9
	matt-nb5-mips64-u1-k1-k5:1.9
	matt-nb5-mips64:1.9.0.10
	netbsd-5-0-1-RELEASE:1.9
	jym-xensuspend-nbase:1.9
	netbsd-5-0:1.9.0.8
	netbsd-5-0-RELEASE:1.9
	netbsd-5-0-RC4:1.9
	netbsd-5-0-RC3:1.9
	netbsd-5-0-RC2:1.9
	jym-xensuspend:1.9.0.6
	jym-xensuspend-base:1.9
	netbsd-5-0-RC1:1.9
	netbsd-5:1.9.0.4
	netbsd-5-base:1.9
	matt-mips64-base2:1.9
	matt-mips64:1.8.0.28
	netbsd-4-0-1-RELEASE:1.8
	wrstuden-revivesa-base-3:1.9
	wrstuden-revivesa-base-2:1.9
	wrstuden-fixsa-newbase:1.8
	texinfo-4-8:1.1.1.7
	wrstuden-revivesa-base-1:1.8
	yamt-pf42-base4:1.8
	yamt-pf42-base3:1.8
	hpcarm-cleanup-nbase:1.8
	yamt-pf42-baseX:1.8
	yamt-pf42-base2:1.8
	wrstuden-revivesa:1.8.0.26
	wrstuden-revivesa-base:1.8
	yamt-pf42:1.8.0.24
	yamt-pf42-base:1.8
	keiichi-mipv6:1.8.0.22
	keiichi-mipv6-base:1.8
	matt-armv6-nbase:1.8
	matt-armv6-prevmlocking:1.8
	wrstuden-fixsa-base-1:1.8
	netbsd-4-0:1.8.0.20
	netbsd-4-0-RELEASE:1.8
	cube-autoconf:1.8.0.18
	cube-autoconf-base:1.8
	netbsd-4-0-RC5:1.8
	netbsd-4-0-RC4:1.8
	netbsd-4-0-RC3:1.8
	netbsd-4-0-RC2:1.8
	netbsd-4-0-RC1:1.8
	matt-armv6:1.8.0.16
	matt-armv6-base:1.8
	matt-mips64-base:1.8
	hpcarm-cleanup:1.8.0.14
	hpcarm-cleanup-base:1.8
	netbsd-3-1-1-RELEASE:1.8
	netbsd-3-0-3-RELEASE:1.8
	wrstuden-fixsa:1.8.0.12
	wrstuden-fixsa-base:1.8
	abandoned-netbsd-4-base:1.8
	abandoned-netbsd-4:1.8.0.6
	netbsd-3-1:1.8.0.8
	netbsd-3-1-RELEASE:1.8
	netbsd-3-0-2-RELEASE:1.8
	netbsd-3-1-RC4:1.8
	netbsd-3-1-RC3:1.8
	netbsd-3-1-RC2:1.8
	netbsd-3-1-RC1:1.8
	netbsd-4:1.8.0.10
	netbsd-4-base:1.8
	netbsd-3-0-1-RELEASE:1.8
	netbsd-3-0:1.8.0.4
	netbsd-3-0-RELEASE:1.8
	netbsd-3-0-RC6:1.8
	netbsd-3-0-RC5:1.8
	netbsd-3-0-RC4:1.8
	netbsd-3-0-RC3:1.8
	netbsd-3-0-RC2:1.8
	netbsd-3-0-RC1:1.8
	netbsd-2-0-3-RELEASE:1.7
	netbsd-2-1:1.7.0.6
	netbsd-2-1-RELEASE:1.7
	netbsd-2-1-RC6:1.7
	netbsd-2-1-RC5:1.7
	netbsd-2-1-RC4:1.7
	netbsd-2-1-RC3:1.7
	netbsd-2-1-RC2:1.7
	netbsd-2-1-RC1:1.7
	netbsd-2-0-2-RELEASE:1.7
	netbsd-3:1.8.0.2
	netbsd-3-base:1.8
	netbsd-2-0-1-RELEASE:1.7
	netbsd-2:1.7.0.4
	netbsd-2-base:1.7
	netbsd-2-0-RELEASE:1.7
	netbsd-2-0-RC5:1.7
	netbsd-2-0-RC4:1.7
	netbsd-2-0-RC3:1.7
	netbsd-2-0-RC2:1.7
	netbsd-2-0-RC1:1.7
	texinfo-4-7:1.1.1.6
	netbsd-2-0:1.7.0.2
	netbsd-2-0-base:1.7
	netbsd-1-6-PATCH002-RELEASE:1.3
	netbsd-1-6-PATCH002:1.3
	netbsd-1-6-PATCH002-RC4:1.3
	netbsd-1-6-PATCH002-RC3:1.3
	netbsd-1-6-PATCH002-RC2:1.3
	netbsd-1-6-PATCH002-RC1:1.3
	texinfo-4-6:1.1.1.5
	netbsd-1-6-PATCH001:1.3
	netbsd-1-6-PATCH001-RELEASE:1.3
	netbsd-1-6-PATCH001-RC3:1.3
	netbsd-1-6-PATCH001-RC2:1.3
	texinfo-4-5:1.1.1.4
	netbsd-1-6-PATCH001-RC1:1.3
	texinfo-4-3:1.1.1.3
	fvdl_fs64_base:1.3
	netbsd-1-6-RELEASE:1.3
	netbsd-1-6-RC3:1.3
	netbsd-1-6-RC2:1.3
	netbsd-1-6-RC1:1.3
	netbsd-1-6:1.3.0.2
	netbsd-1-6-base:1.3
	netbsd-1-5-PATCH003:1.2
	netbsd-1-5-PATCH002:1.2
	texinfo-4-0:1.1.1.2
	netbsd-1-5-PATCH001:1.2
	netbsd-1-5-RELEASE:1.2
	netbsd-1-5-BETA2:1.2
	netbsd-1-5-BETA:1.2
	netbsd-1-4-PATCH003:1.2
	netbsd-1-5-ALPHA2:1.2
	netbsd-1-5:1.2.0.8
	netbsd-1-5-base:1.2
	netbsd-1-4-PATCH002:1.2
	wrstuden-devbsize-19991221:1.2
	wrstuden-devbsize:1.2.0.6
	wrstuden-devbsize-base:1.2
	comdex-fall-1999:1.2.0.4
	comdex-fall-1999-base:1.2
	netbsd-1-4-PATCH001:1.2
	netbsd-1-4-RELEASE:1.2
	netbsd-1-4:1.2.0.2
	netbsd-1-4-base:1.2
	texinfo-3-12:1.1.1.1
	FSF:1.1.1;
locks; strict;
comment	@# @;


1.11
date	2016.01.14.00.41.44;	author christos;	state dead;
branches;
next	1.10;
commitid	5Plxct6IJ6dFLPQy;

1.10
date	2013.08.30.16.24.06;	author riastradh;	state Exp;
branches;
next	1.9;
commitid	6f8EbwlL0ppmPu3x;

1.9
date	2008.09.02.08.00.24;	author christos;	state Exp;
branches
	1.9.2.1
	1.9.4.1
	1.9.20.1
	1.9.24.1;
next	1.8;

1.8
date	2004.07.12.23.41.53;	author wiz;	state Exp;
branches
	1.8.26.1;
next	1.7;

1.7
date	2003.07.03.15.35.34;	author wiz;	state Exp;
branches;
next	1.6;

1.6
date	2003.07.03.15.09.21;	author wiz;	state Exp;
branches;
next	1.5;

1.5
date	2003.02.13.08.57.28;	author wiz;	state Exp;
branches;
next	1.4;

1.4
date	2003.01.17.15.25.57;	author wiz;	state Exp;
branches;
next	1.3;

1.3
date	2001.07.25.16.46.20;	author assar;	state Exp;
branches;
next	1.2;

1.2
date	99.02.11.15.21.18;	author tv;	state Exp;
branches;
next	1.1;

1.1
date	99.02.11.03.57.24;	author tv;	state Exp;
branches
	1.1.1.1;
next	;

1.9.2.1
date	2014.05.22.11.36.29;	author yamt;	state Exp;
branches;
next	;
commitid	2J3tdvkBDla2KwBx;

1.9.4.1
date	2013.10.20.14.01.10;	author bouyer;	state Exp;
branches;
next	;
commitid	VhvohbNEzit9q2ax;

1.9.20.1
date	2013.10.20.13.14.31;	author bouyer;	state Exp;
branches;
next	;
commitid	1adlTuyEsQ49a2ax;

1.9.24.1
date	2014.08.20.00.01.54;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.8.26.1
date	2008.09.18.04.48.30;	author wrstuden;	state Exp;
branches;
next	;

1.1.1.1
date	99.02.11.03.57.24;	author tv;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2001.07.25.16.21.24;	author assar;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2003.01.17.14.54.37;	author wiz;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	2003.02.13.08.50.57;	author wiz;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	2003.07.03.14.58.50;	author wiz;	state Exp;
branches;
next	1.1.1.6;

1.1.1.6
date	2004.07.12.23.26.46;	author wiz;	state Exp;
branches;
next	1.1.1.7;

1.1.1.7
date	2008.09.02.07.51.06;	author christos;	state Exp;
branches;
next	;


desc
@@


1.11
log
@Texinfo has moved.
@
text
@#! /bin/sh
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources.
# Id: texi2dvi,v 1.34 2004/12/01 18:35:36 karl Exp
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
# 2002, 2003, 2004 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 2, 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, you can either send email to this
# program's maintainer or write to: The Free Software Foundation,
# Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
#
# Original author: 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.

# This string is expanded by rcs automatically when this file is checked out.
rcs_revision='Revision: 1.34'
rcs_version=`set - $rcs_revision; echo $2`
program=`echo $0 | sed -e 's!.*/!!'`
version="texi2dvi (GNU Texinfo 4.8) $rcs_version

Copyright (C) 2004 Free Software Foundation, Inc.
There is NO warranty.  You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."

usage="Usage: $program [OPTION]... FILE...

Run each Texinfo or LaTeX 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 (LaTeX or Texinfo).

Makeinfo is used to perform Texinfo macro expansion before running TeX
when needed.

Operation modes:
  -b, --batch         no interaction
  -c, --clean         remove all auxiliary files
  -D, --debug         turn on shell debugging (set -x)
  -h, --help          display this help and exit successfully
  -o, --output=OFILE  leave output in OFILE (implies --clean);
                      Only one input FILE may be specified in this case
  -q, --quiet         no output unless errors (implies --batch)
  -s, --silent        same as --quiet
  -v, --version       display version information and exit successfully
  -V, --verbose       report on what is done

TeX tuning:
  -@@                   use @@input instead of \input; for preloaded Texinfo
  -e, -E, --expand     force macro expansion using makeinfo
  -I DIR               search DIR for Texinfo files
  -l, --language=LANG  specify the LANG of FILE (LaTeX or Texinfo)
  -p, --pdf            use pdftex or pdflatex for processing
  -r, --recode         call recode before TeX to translate input characters
  -t, --command=CMD    insert CMD in copy of input file
   or --texinfo=CMD    multiple values accumulate

The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO,
TEX (or PDFTEX), TEXINDEX, and THUMBPDF environment variables are used
to run those commands, if they are set.  Any CMD strings are added
after @@setfilename for Texinfo input, in the first line for LaTeX input.

Email bug reports to <bug-texinfo@@gnu.org>,
general questions and discussion to <help-texinfo@@gnu.org>.
Texinfo home page: http://www.gnu.org/software/texinfo/"

# 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.
batch=false     # eval for batch mode
clean=
debug=
escape='\'
expand=         # t for expansion via makeinfo
miincludes=     # makeinfo include path
oformat=dvi
oname=          # --output
quiet=          # by default let the tools' message be displayed
recode=false
set_language=
textra=         # Extra TeX commands to insert in the input file.
textra_cmd=     # sed command to insert TEXTRA where appropriate
tmpdir=${TMPDIR:-/tmp}/t2d$$  # avoid collisions on 8.3 filesystems.
txincludes=     # TEXINPUTS extensions, with trailing colon
txiprereq=19990129 # minimum texinfo.tex version with macro expansion
verbose=false   # echo for verbose mode

orig_pwd=`pwd`

# Systems which define $COMSPEC or $ComSpec use semicolons to separate
# directories in TEXINPUTS.
if test -n "$COMSPEC$ComSpec"; then
  path_sep=";"
else
  path_sep=":"
fi

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

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

# return true if program $1 is somewhere in PATH, else false.
#
findprog () {
  foundprog=false
  for dir in `echo $PATH | tr "$path_sep" " "`; do
    if test -x "$dir/$1"; then  # does anyone still need test -f?
      foundprog=true
      break
    fi
  done
  $foundprog
}

# Report an error and exit with failure.
fatal () {
  echo "$0: $*" >&2
  exit 1
}

# Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
# Likewise for bibtex and makeindex.
tex_envvars="BIBINPUTS BSTINPUTS INDEXSTYLE TEXINPUTS"
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

# 
# Parse command line arguments.
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

  # This recognizes --quark as --quiet.  So what.
  case "$1" in
    -@@ ) escape=@@;;
    # Silently and without documentation accept -b and --b[atch] as synonyms.
    -b | --b*) batch=true;;
    -c | --c*) clean=t;;
    -D | --d*) debug=t;;
    -e | -E | --e*) expand=t;;
    -h | --h*) echo "$usage"; exit 0;;
    -I | --I*)
      shift
      miincludes="$miincludes -I $1"
      txincludes="$txincludes$1$path_sep"
      ;;
    -l | --l*) shift; set_language=$1;;
    -o | --o*)
      shift
      clean=t
      case "$1" in
        /* | ?:/*) oname=$1;;
                *) oname="$orig_pwd/$1";;
      esac;;
    -p | --p*) oformat=pdf;;
    -q | -s | --q* | --s*) quiet=t; batch=true;;
    -r | --r*) recode=true;;
    -t | --tex* | --com* ) shift; textra="$textra\\
"`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;;
    -v | --vers*) echo "$version"; exit 0;;
    -V | --verb*) verbose=echo;;
    --) # What remains are not options.
      shift
      while test x"$1" != x"$arg_sep"; do
        set dummy ${1+"$@@"} "$1"; shift
        shift
      done
      break;;
    -*)
      echo "$0: Unknown or ambiguous option \`$1'." >&2
      echo "$0: Try \`--help' for more information." >&2
      exit 1;;
    *) set dummy ${1+"$@@"} "$1"; shift;;
   esac
   shift
done
# Pop the token
shift

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


# We can't do much without tex.
#
if findprog ${TEX:-tex}; then :; else cat <<EOM
You don't have a working TeX binary (${TEX:-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://www.tug.org.  If
you happen to be using Debian, you can get it with this command:
  apt-get install tetex-bin
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.
#
# End up with the TEX and PDFTEX variables set to what we are going to use.
if test -z "$TEX"; then
  if findprog etex; then TEX=etex; else TEX=tex; fi
fi
#
if test -z "$PDFTEX"; then
  if findprog pdfetex; then PDFTEX=pdfetex; else PDFTEX=pdftex; fi
fi


# Prepare the temporary directory.  Remove it at exit, unless debugging.
if test -z "$debug"; then
  trap "cd / && rm -rf $tmpdir" 0 1 2 15
fi

# Create the temporary directory with strict rights
(umask 077 && mkdir $tmpdir) || exit 1

# Prepare the tools we might need.  This may be extra work in some
# cases, but improves the readability of the script.
utildir=$tmpdir/utils
mkdir $utildir || exit 1

# A sed script that 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.
# Unfortunately makeinfo --iftex --no-ifinfo doesn't work well enough
# (yet), makeinfo can't parse the TeX commands, so work around with sed.
#
comment_iftex_sed=$utildir/comment.sed
cat <<EOF >$comment_iftex_sed
/^@@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)/
}
/^@@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/
EOF
# Uncommenting is simple: Remove any leading `@@c texi2dvi'.
uncomment_iftex_sed=$utildir/uncomment.sed
cat <<EOF >$uncomment_iftex_sed
s/^@@c texi2dvi//
EOF

# Compute the list of xref files.
# Takes the filename (without extension) of which we look for xref
# files as argument.  The index files must be reported last.
get_xref_files ()
{
  # Get list of xref files (indexes, tables and lists).
  # Find all files having root filename with a two-letter extension,
  # saves the ones that are really Texinfo-related files.  .?o? catches
  # many files: .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
  for this_file in "$1".?o? "$1".aux "$1".?? "$1".idx; do
    # If file is empty, skip it.
    test -s "$this_file" || continue
    # 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.
    first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
    if (test "x$first_character" = "x\\" \
        && sed 1q $this_file | grep -v '^\\input *texinfo' >/dev/null) \
       || test "x$first_character" = "x'" \
       || test "x$first_character" = "x@@"; then
      xref_files="$xref_files ./$this_file"
    fi
  done
  echo "$xref_files"
}

# 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)

# Tools' output.  If quiet, discard, else redirect to the message flow.
if test "$quiet" = t; then
  exec 5>/dev/null
else
  exec 5>&1
fi

# Enable tracing
if test "$debug" = t; then
  exec 6>&1
  set -x
else
  exec 6>/dev/null
fi

# 
# TeXify files.

for command_line_filename in ${1+"$@@"}; do
  $verbose "Processing $command_line_filename ..."

  # 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" | $EGREP '^(/|[A-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.
  if test ! -r "$command_line_filename"; then
    echo "$0: Could not read $command_line_filename, skipping." >&2
    continue
  fi

  # Get the name of the current directory.  We want the full path
  # because in clean mode we are in tmp, in which case a relative
  # path has no meaning.
  filename_dir=`echo $command_line_filename | sed 's!/[^/]*$!!;s!^$!.!'`
  filename_dir=`cd "$filename_dir" >/dev/null && pwd`

  # Strip directory part but leave extension.
  filename_ext=`basename "$command_line_filename"`
  # Strip extension.
  filename_noext=`echo "$filename_ext" | sed 's/\.[^.]*$//'`
  ext=`echo "$filename_ext" | sed 's/^.*\.//'`

  # _src.  Use same basename since we want to generate aux files with
  # the same basename as the manual.  If --expand, then output the
  # macro-expanded file to here, else copy the original file.
  tmpdir_src=$tmpdir/src
  filename_src=$tmpdir_src/$filename_noext.$ext

  # _xtr.  The file with the user's extra commands.
  tmpdir_xtr=$tmpdir/xtr
  filename_xtr=$tmpdir_xtr/$filename_noext.$ext

  # _rcd.  The Texinfo file recoded in 7bit.
  tmpdir_rcd=$tmpdir/rcd
  filename_rcd=$tmpdir_rcd/$filename_noext.$ext

  # _bak.  Copies of the previous xref files (another round is run if
  # they differ from the new one).
  tmpdir_bak=$tmpdir/bak

  # Make all those directories and give up if we can't succeed.
  mkdir $tmpdir_src $tmpdir_xtr $tmpdir_rcd $tmpdir_bak || exit 1

  # Source file might include additional sources.
  # We want `.:$orig_pwd' before anything else.  (We'll add `.:' later
  # after all other directories have been turned into absolute paths.)
  # `.' goes first to ensure that any old .aux, .cps,
  # etc. files in ${directory} don't get used in preference to fresher
  # files in `.'.  Include orig_pwd in case we are in clean mode, where
  # we've cd'd to a temp directory.
  common="$orig_pwd$path_sep$filename_dir$path_sep$txincludes"
  for var in $tex_envvars; do
    eval ${var}="\$common\$${var}_orig"
    export $var
  done

  # Convert relative paths to absolute paths, so we can run in another
  # directory (e.g., in --clean mode, or during the macro-support detection.)
  #
  # 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.
  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:/g'"
   TEXINPUTS=`echo $TEXINPUTS  | eval sed $replace_empty`
  INDEXSTYLE=`echo $INDEXSTYLE | eval sed $replace_empty`
  save_IFS=$IFS
  IFS=$path_sep
  set x $TEXINPUTS; shift
  TEXINPUTS=.
  for dir
  do
    case $dir in
      EMPTY)
        TEXINPUTS=$TEXINPUTS$path_sep
        ;;
      [\\/]* | ?:[\\/]*)        # Absolute paths don't need to be expanded.
        TEXINPUTS=$TEXINPUTS$path_sep$dir
        ;;
      *)
        abs=`cd "$dir" && pwd` && TEXINPUTS=$TEXINPUTS$path_sep$abs
        ;;
    esac
  done
  set x $INDEXSTYLE; shift
  INDEXSTYLE=.
  for dir
  do
    case $dir in
      EMPTY)
        INDEXSTYLE=$INDEXSTYLE$path_sep
        ;;
      [\\/]* | ?:[\\/]*)        # Absolute paths don't need to be expansed.
        INDEXSTYLE=$INDEXSTYLE$path_sep$dir
        ;;
      *)
        abs=`cd "$dir" && pwd` && INDEXSTYLE=$INDEXSTYLE$path_sep$abs
        ;;
    esac
  done
  IFS=$save_IFS

  # 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
    language=$set_language
  elif sed 1q "$command_line_filename" | grep 'input texinfo' >&6; then
    language=texinfo
  else
    language=
  fi

  # 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 ${language:-$filename_ext} in
    [lL]a[tT]e[xX] | *.ltx | *.tex)
      # Assume a LaTeX file.  LaTeX needs bibtex and uses latex for
      # compilation.  No makeinfo.
      language=latex
      bibtex=${BIBTEX:-bibtex}
      makeinfo= # no point in running makeinfo on latex source.
      texindex=${MAKEINDEX:-makeindex}
      textra_cmd=1i
      if test $oformat = dvi; then
        tex=${LATEX:-latex}
      else
        tex=${PDFLATEX:-pdflatex}
      fi
      thumbpdf=${THUMBPDF:-thumbpdf}
      ;;

    *)
      # Assume a Texinfo file.  Texinfo files need makeinfo, texindex and tex.
      language=texinfo
      bibtex=
      texindex=${TEXINDEX:-texindex}
      textra_cmd='/^@@setfilename/a'
      if test $oformat = dvi; then
        # MetaPost also uses the TEX environment variable.  If the user
        # has set TEX=latex for that reason, don't bomb out.
        if echo $TEX | grep 'latex$' >/dev/null; then
          tex=tex  # don't bother trying to find etex
        else
          tex=$TEX
        fi
      else
        tex=$PDFTEX
      fi
      # Unless required by the user, makeinfo expansion is wanted only
      # if texinfo.tex is too old.
      if test "$expand" = t; 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 the tmpdir to avoid leaving files.
	(
           cd $tmpdir
	   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
	) >$tmpdir/txiversion.out 2>$tmpdir/txiversion.err
	if test $? != 0; then
	  cat $tmpdir/txiversion.out
	  cat $tmpdir/txiversion.err >&2
	  fatal "texinfo.tex appears to be broken, quitting."
        fi
	eval `sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p' $tmpdir/txiversion.out`
        $verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' ..."
        if test "$txiprereq" -le "$txiversion" >/dev/null 2>&1; then
          makeinfo=
        else
          makeinfo=${MAKEINFO:-makeinfo}
        fi
        # As long as we had to run TeX, offer the user this convenience:
        test "$txiformat" = Texinfo && escape=@@
      fi
      thumbpdf=${THUMBPDF:-thumbpdf}
      ;;
  esac

  # Go to $tmpdir to try --help, since old versions that don't accept
  # --help will generate a texput.log.
  tex_help=`cd $tmpdir >/dev/null && $tex --help </dev/null 2>&1`

  # If possible, make TeX report error locations in GNU format.
  tex_args=
  case $tex_help in
    *file-line-error*) tex_args="$tex_args --file-line-error";;
  esac

  # Tell TeX to be batch if requested.  (\batchmode does not show
  # terminal output at all, so we don't want that.)
  $batch && tex_args="$tex_args ${escape}nonstopmode ${escape}input"

  # 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.
  if test -n "$makeinfo"; then
    $verbose "Macro-expanding $command_line_filename to $filename_src ..."
    sed -f $comment_iftex_sed "$command_line_filename" \
      | $makeinfo --footnote-style=end -I "$filename_dir" $miincludes \
        -o /dev/null --macro-expand=- \
      | sed -f $uncomment_iftex_sed >"$filename_src"
    filename_input=$filename_src
  fi

  # If makeinfo failed (or was not even run), use the original file as input.
  if test $? -ne 0 \
     || test ! -r "$filename_src"; then
    $verbose "Reverting to $command_line_filename ..."
    filename_input=$filename_dir/$filename_ext
  fi

  # Used most commonly for @@finalout, @@smallbook, etc.
  if test -n "$textra"; then
    $verbose "Inserting extra commands: $textra"
    sed "$textra_cmd\\
$textra" "$filename_input" >"$filename_xtr"
    filename_input=$filename_xtr
  fi

  # If this is a Texinfo file with a specified input encoding, and
  # recode is available, then recode to plain 7 bit Texinfo.
  if test $language = texinfo; then
    pgm='s/\(^\|.* \)@@documentencoding  *\([^ ][^ ]*\)\( .*\|$\)/\2/
	t found
	d
	:found
	q'
    encoding=`sed -e "$pgm" "$filename_input"`
    if $recode && test -n "$encoding" && findprog recode; then
      $verbose "Recoding from $encoding to Texinfo."
      if recode "$encoding"..texinfo <"$filename_input" >"$filename_rcd" \
         && test -s "$filename_rcd"; then
        filename_input=$filename_rcd
      else
        $verbose "Recoding failed, using original input."
      fi
    fi
  fi

  # If clean mode was specified, then move to the temporary directory.
  if test "$clean" = t; then
    $verbose "cd $tmpdir_src"
    cd "$tmpdir_src" || exit 1
  fi

  while :; do # will break out of loop below
    orig_xref_files=`get_xref_files "$filename_noext"`

    # Save copies of originals for later comparison.
    if test -n "$orig_xref_files"; then
      $verbose "Backing up xref files: `echo $orig_xref_files | sed 's|\./||g'`"
      cp $orig_xref_files $tmpdir_bak
    fi

    # Run bibtex on current file.
    # - If its input (AUX) exists.
    # - If AUX contains both `\bibdata' and `\bibstyle'.
    # - If some citations are missing (LOG contains `Citation').
    #   or the LOG complains of a missing .bbl
    #
    # We run bibtex first, because I can see reasons for the indexes
    # to change after bibtex is run, but I see no reason for the
    # converse.
    #
    # Don't try to be too smart.  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.  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 to match false messages.
    if test -n "$bibtex" \
       && test -r "$filename_noext.aux" \
       && test -r "$filename_noext.log" \
       && (grep '^\\bibdata[{]'  "$filename_noext.aux" \
           && grep '^\\bibstyle[{]' "$filename_noext.aux" \
           && (grep 'Warning:.*Citation.*undefined' "$filename_noext.log" \
               || grep 'No file .*\.bbl\.' "$filename_noext.log")) \
          >&6 2>&1; \
    then
      $verbose "Running $bibtex $filename_noext ..."
      $bibtex "$filename_noext" >&5 ||
        fatal "$bibtex exited with bad status, quitting."
    fi

    # What we'll run texindex on -- exclude non-index files.
    # Since we know index files are last, it is correct to remove everything
    # before .aux and .?o?.  But don't really do <anything>o<anything>
    # -- don't match whitespace as <anything>.
    # Otherwise, if orig_xref_files contains something like
    #   foo.xo foo.whatever
    # the space after the o will get matched.
    index_files=`echo "$orig_xref_files" \
                 | sed "s!.*\.aux!!g;
                        s!./$filename_noext\.[^ ]o[^ ]!!g;
                        s/^[ ]*//;s/[ ]*$//"`
    # Run texindex (or makeindex) 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.
    if test -n "$texindex" && test -n "$index_files"; then
      $verbose "Running $texindex $index_files ..."
      $texindex $index_files 2>&5 1>&2 ||
         fatal "$texindex exited with bad status, quitting."
    fi

    # Finally, run TeX.
    cmd="$tex $tex_args"
    $verbose "Running $cmd ..."
    if $cmd "$filename_input" >&5; then :; else
      echo "$0: TeX failed. If the above said 'tex: not found', " >&2
      echo "$0: you may need to install TeX;" >&2
      echo "$0: it is available from the pkgsrc system in print/teTeX." >&2
      echo "$0: If TeX is installed, make sure it is in your $PATH, or" >&2
      echo "$0: set the environment variable $TEX to its location." >&2
      echo "$0: $tex exited with bad status, quitting." >&2
      echo "$0: see $filename_noext.log for errors." >&2
      test "$clean" = t \
        && cp "$filename_noext.log" "$orig_pwd"
      exit 1
    fi


    # Decide if looping again is needed.
    finished=t

    # 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" "$filename_noext.log" >&6 2>&1; then
      finished=
    fi

    # Check if xref files changed.
    new_xref_files=`get_xref_files "$filename_noext"`
    $verbose "Original xref files = `echo $orig_xref_files | sed 's|\./||g'`"
    $verbose "New xref files      = `echo $new_xref_files | sed 's|\./||g'`"

    # If old and new lists don't at least have the same file list,
    # then one file or another has definitely changed.
    test "x$orig_xref_files" != "x$new_xref_files" && finished=

    # File list is the same.  We must compare each file until we find
    # a difference.
    if test -n "$finished"; then
      for this_file in $new_xref_files; 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" "$tmpdir_bak/$this_file"; then :; else
          # We only need to keep comparing until we find one that
          # differs, because we'll have to run texindex & tex again no
          # matter how many more there might be.
          finished=
          $verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..."
          test "$debug" = t && diff -c "$tmpdir_bak/$this_file" "$this_file"
          break
        fi
      done
    fi

    # If finished, exit the loop, else rerun the loop.
    test -n "$finished" && break
  done # while :;

  # If we were using thumbpdf and producing PDF, then run thumbpdf
  # and TeX one last time.
  if test $oformat = pdf \
     && test -r "$filename_noext.log" \
     && grep 'thumbpdf\.sty'  "$filename_noext.log" >&6 2>&1; \
  then
    $verbose "Running $thumbpdf $filename_noext ..."
    $thumbpdf "$filename_noext" >&5 ||
      fatal "$thumbpdf exited with bad status, quitting."

    $verbose "Running $cmd $filename_input..."
    if $cmd "$filename_input" >&5; then :; else
      echo "$0: $tex exited with bad status, quitting." >&2
      echo "$0: see $filename_noext.log for errors." >&2
      test "$clean" = t \
	&& cp "$filename_noext.log" "$orig_pwd"
      exit 1
    fi
  fi


  # If we were in clean mode, compilation was in a tmp directory.
  # Copy the DVI (or PDF) file into the directory where the compilation
  # has been done.  (The temp dir is about to get removed anyway.)
  # We also return to the original directory so that
  # - the next file is processed in correct conditions
  # - the temporary file can be removed
  if test -n "$clean"; then
    if test -n "$oname"; then
       dest=$oname
    else
       dest=$orig_pwd
    fi
    $verbose "Copying $oformat file from `pwd` to $dest"
    cp -p "./$filename_noext.$oformat" "$dest"
    cd / # in case $orig_pwd is on a different drive (for DOS)
    cd $orig_pwd || exit 1
  fi

  # Remove temporary files.
  if test "x$debug" = "x"; then
    $verbose "Removing $tmpdir_src $tmpdir_xtr $tmpdir_bak ..."
    cd /
    rm -rf $tmpdir_src $tmpdir_xtr $tmpdir_bak
  fi
done

$verbose "$0: done."
exit 0 # exit successfully, not however we ended the loop.
@


1.10
log
@Remove trailing whitespace in texi2dvi which confuses sed.

XXX pull up to 5, 6?
@
text
@@


1.9
log
@resolve conflicts.
@
text
@d608 4
a611 4
    pgm='s/\(^\|.* \)@@documentencoding  *\([^ ][^ ]*\)\( .*\|$\)/\2/  
	t found                                                
	d                                                     
	:found                                               
@


1.9.24.1
log
@Rebase to HEAD as of a few days ago.
@
text
@d608 4
a611 4
    pgm='s/\(^\|.* \)@@documentencoding  *\([^ ][^ ]*\)\( .*\|$\)/\2/
	t found
	d
	:found
@


1.9.2.1
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d608 4
a611 4
    pgm='s/\(^\|.* \)@@documentencoding  *\([^ ][^ ]*\)\( .*\|$\)/\2/
	t found
	d
	:found
@


1.9.4.1
log
@Pull up following revision(s) (requested by riastradh in ticket #1882):
	gnu/dist/texinfo/util/texi2dvi: revision 1.10
Remove trailing whitespace in texi2dvi which confuses sed.
XXX pull up to 5, 6?
@
text
@d608 4
a611 4
    pgm='s/\(^\|.* \)@@documentencoding  *\([^ ][^ ]*\)\( .*\|$\)/\2/
	t found
	d
	:found
@


1.9.20.1
log
@Pull up following revision(s) (requested by riastradh in ticket #962):
	gnu/dist/texinfo/util/texi2dvi: revision 1.10
Remove trailing whitespace in texi2dvi which confuses sed.
XXX pull up to 5, 6?
@
text
@d608 4
a611 4
    pgm='s/\(^\|.* \)@@documentencoding  *\([^ ][^ ]*\)\( .*\|$\)/\2/
	t found
	d
	:found
@


1.8
log
@Merge with 4.7.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.3 2004/02/17 16:59:46 karl Exp
d30 1
a30 1
rcs_revision='Revision: 1.3'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.7) $rcs_version
d68 2
a69 1
  -t, --command=CMD    insert CMD in copy of input file;
d93 1
d119 1
a119 1
# 
a174 1
    -q | -s | --q* | --s*) quiet=t; batch=true;;
d193 2
d235 1
a235 1
# 
d255 1
a255 1
# 
d316 1
a316 1
# A shell script that computes the list of xref files.
d319 23
a341 25
get_xref_files=$utildir/get_xref.sh
cat <<\EOF >$get_xref_files
#! /bin/sh

# Get list of xref files (indexes, tables and lists).
# Find all files having root filename with a two-letter extension,
# saves the ones that are really Texinfo-related files.  .?o? catches
# many files: .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
for this_file in "$1".?o? "$1".aux "$1".?? "$1".idx; do
  # If file is empty, skip it.
  test -s "$this_file" || continue
  # 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, as long as the first line isn't
  # \input texinfo.
  first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
  if (test "x$first_character" = "x\\" \
      && sed 1q $this_file | grep -v '^\\input *texinfo' >/dev/null) \
     || test "x$first_character" = "x'"; then
    xref_files="$xref_files ./$this_file"
  fi
done
echo "$xref_files"
EOF
chmod 500 $get_xref_files
d408 4
d417 1
a417 1
  mkdir $tmpdir_src $tmpdir_xtr $tmpdir_bak || exit 1
d496 1
d511 1
d516 7
a522 1
        tex=$TEX
d570 1
a570 1
    *file-line-error-style*) tex_args="$tex_args --file-line-error-style";;
d601 1
a601 1
$textra" "$filename_input" >$filename_xtr
d605 20
d632 1
a632 1
    orig_xref_files=`$get_xref_files "$filename_noext"`
d693 1
a693 1
    cmd="$tex $tex_args $filename_input"
d695 6
a700 5
    if $cmd >&5; then :; else
      echo 1>&2 'TeX failed.  If the above said "tex: not found", you may need to install TeX;'
      echo 1>&2 'it is available from the pkgsrc system in print/teTeX.'
      echo 1>&2 'If TeX is installed, make sure it is in your $PATH, or set the environment'
      echo 1>&2 'variable $TEX to its location.'
d722 1
a722 1
    new_xref_files=`$get_xref_files "$filename_noext"`
d762 2
a763 2
    $verbose "Running $cmd ..."
    if $cmd >&5; then :; else
@


1.8.26.1
log
@Sync with wrstuden-revivesa-base-2.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.34 2004/12/01 18:35:36 karl Exp
d30 1
a30 1
rcs_revision='Revision: 1.34'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.8) $rcs_version
d68 1
a68 2
  -r, --recode         call recode before TeX to translate input characters
  -t, --command=CMD    insert CMD in copy of input file
a91 1
recode=false
d117 1
a117 1
#
d173 1
a191 2
    -q | -s | --q* | --s*) quiet=t; batch=true;;
    -r | --r*) recode=true;;
d232 1
a232 1
#
d252 1
a252 1
#
d313 1
a313 1
# Compute the list of xref files.
d316 25
a340 23
get_xref_files ()
{
  # Get list of xref files (indexes, tables and lists).
  # Find all files having root filename with a two-letter extension,
  # saves the ones that are really Texinfo-related files.  .?o? catches
  # many files: .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
  for this_file in "$1".?o? "$1".aux "$1".?? "$1".idx; do
    # If file is empty, skip it.
    test -s "$this_file" || continue
    # 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.
    first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
    if (test "x$first_character" = "x\\" \
        && sed 1q $this_file | grep -v '^\\input *texinfo' >/dev/null) \
       || test "x$first_character" = "x'" \
       || test "x$first_character" = "x@@"; then
      xref_files="$xref_files ./$this_file"
    fi
  done
  echo "$xref_files"
}
a406 4
  # _rcd.  The Texinfo file recoded in 7bit.
  tmpdir_rcd=$tmpdir/rcd
  filename_rcd=$tmpdir_rcd/$filename_noext.$ext

d412 1
a412 1
  mkdir $tmpdir_src $tmpdir_xtr $tmpdir_rcd $tmpdir_bak || exit 1
a490 1
      language=latex
a504 1
      language=texinfo
d509 1
a509 7
        # MetaPost also uses the TEX environment variable.  If the user
        # has set TEX=latex for that reason, don't bomb out.
        if echo $TEX | grep 'latex$' >/dev/null; then
          tex=tex  # don't bother trying to find etex
        else
          tex=$TEX
        fi
d557 1
a557 1
    *file-line-error*) tex_args="$tex_args --file-line-error";;
d588 1
a588 1
$textra" "$filename_input" >"$filename_xtr"
a591 20
  # If this is a Texinfo file with a specified input encoding, and
  # recode is available, then recode to plain 7 bit Texinfo.
  if test $language = texinfo; then
    pgm='s/\(^\|.* \)@@documentencoding  *\([^ ][^ ]*\)\( .*\|$\)/\2/  
	t found                                                
	d                                                     
	:found                                               
	q'
    encoding=`sed -e "$pgm" "$filename_input"`
    if $recode && test -n "$encoding" && findprog recode; then
      $verbose "Recoding from $encoding to Texinfo."
      if recode "$encoding"..texinfo <"$filename_input" >"$filename_rcd" \
         && test -s "$filename_rcd"; then
        filename_input=$filename_rcd
      else
        $verbose "Recoding failed, using original input."
      fi
    fi
  fi

d599 1
a599 1
    orig_xref_files=`get_xref_files "$filename_noext"`
d660 1
a660 1
    cmd="$tex $tex_args"
d662 5
a666 6
    if $cmd "$filename_input" >&5; then :; else
      echo "$0: TeX failed. If the above said 'tex: not found', " >&2
      echo "$0: you may need to install TeX;" >&2
      echo "$0: it is available from the pkgsrc system in print/teTeX." >&2
      echo "$0: If TeX is installed, make sure it is in your $PATH, or" >&2
      echo "$0: set the environment variable $TEX to its location." >&2
d688 1
a688 1
    new_xref_files=`get_xref_files "$filename_noext"`
d728 2
a729 2
    $verbose "Running $cmd $filename_input..."
    if $cmd "$filename_input" >&5; then :; else
@


1.7
log
@Reduce diff to texinfo-4.6.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.23 2003/06/10 20:50:03 karl Exp
d6 1
a6 1
# 2002, 2003 Free Software Foundation, Inc.
d23 1
a23 1
# Original author: Noah Friedman <friedman@@gnu.org>.
d30 1
a30 1
rcs_revision='Revision: 1.23'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.6) $rcs_version
d35 1
a35 1
Copyright (C) 2003 Free Software Foundation, Inc.
d71 4
a74 4
The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO, TEX
(or PDFTEX), and TEXINDEX environment variables are used to run those
commands, if they are set.  Any CMD strings are added after @@setfilename
for Texinfo input, in the first line for LaTeX input.
d97 1
a97 1
txiprereq=19990129 # minimum texinfo.tex version to have macro expansion
d116 19
d136 1
a136 1
# Unfortunately bibtex and makeindex do not read TEXINPUTS.
d143 1
d230 33
d272 1
a272 1
# cases, but improves the readibility of the script.
d277 7
a283 6
# 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.  Unfortunately makeinfo --iftex --no-ifhtml --no-ifinfo
# doesn't work well enough (yet) to use that, so work around with sed.
a294 6
/^@@html/,/^@@end html/{
  s/^/@@c (texi2dvi)/
}
/^@@ifhtml/,/^@@end ifhtml/{
  s/^/@@c (texi2dvi)/
}
d358 6
a363 1
test "$debug" = t && set -x
d373 1
a373 1
  echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >/dev/null \
d479 1
a479 1
  elif sed 1q "$command_line_filename" | grep 'input texinfo' >/dev/null; then
d500 1
d509 1
a509 1
        tex=${TEX:-tex}
d511 1
a511 1
        tex=${PDFTEX:-pdftex}
a522 2
        txiversion_tex=txiversion.tex
        echo '\input texinfo.tex @@bye' >$tmpdir/$txiversion_tex
d524 13
a536 3
        eval `cd $tmpdir >/dev/null &&
              $tex $txiversion_tex 2>/dev/null |
              sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p'`
d546 1
d550 4
d556 2
a557 2
  case `$tex --help </dev/null 2>&1` in
   *file-line-error-style*) tex_args='--file-line-error-style';;
d630 1
a630 1
          >/dev/null 2>&1; \
d633 2
a634 4
      if $bibtex "$filename_noext" >&5; then :; else
        echo "$0: $bibtex exited with bad status, quitting." >&2
        exit 1
      fi
d655 2
a656 4
      if $texindex $index_files 2>&5 1>&2; then :; else
         echo "$0: $texindex exited with bad status, quitting." >&2
         exit 1
      fi
d683 1
a683 1
    if grep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then
d716 22
a737 1
  done
d765 1
a765 1
$verbose "$0 done."
@


1.6
log
@Merge 4.6 (includes aclocal/autoheader/autoconf/automake run
for local AM_MAINTAINER_MODE change).
@
text
@d611 1
@


1.5
log
@Merge 4.5.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.14 2003/02/05 00:42:33 karl Exp
d30 1
a30 1
rcs_revision='Revision: 1.14'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.5) $rcs_version
d68 2
a69 2
  -t, --texinfo=CMD    insert CMD after @@setfilename in copy of input file
                       multiple values accumulate
d71 4
a74 3
The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO,
TEX (or PDFTEX), and TEXINDEX environment variables are used to run
those commands, if they are set.
d93 2
a94 1
textra=
d116 7
a122 5
# Save this so we can construct a new TEXINPUTS path for each file.
TEXINPUTS_orig="$TEXINPUTS"
# Unfortunately makeindex does not read TEXINPUTS.
INDEXSTYLE_orig="$INDEXSTYLE"
export TEXINPUTS INDEXSTYLE
d152 2
a153 2
    -b | --b*) batch=eval;;
    -q | -s | --q* | --s*) quiet=t; batch=eval;;
d172 2
a173 2
    -t | --t*) shift; textra="$textra\\
$1";;
d280 3
a282 2
  # process it.  The file can't be if its first character is not a
  # backslash or single quote.
d284 2
a285 1
  if test "x$first_character" = "x\\" \
d369 4
a372 2
   TEXINPUTS="$common$TEXINPUTS_orig"
  INDEXSTYLE="$common$INDEXSTYLE_orig"
d375 1
a375 2
  # directory (e.g., in --clean mode, or during the macro-support
  # detection.)
d379 6
a384 2
   TEXINPUTS=`echo $TEXINPUTS  |sed 's/^:/EMPTY:/;s/:$/:EMPTY/;s/::/:EMPTY:/g'`
  INDEXSTYLE=`echo $INDEXSTYLE |sed 's/^:/EMPTY:/;s/:$/:EMPTY/;s/::/:EMPTY:/g'`
d395 1
a395 1
      [\\/]* | ?:[\\/]*)        # Absolute paths don't need to be expansed.
d441 1
d453 1
d481 2
a482 4
        # As long as we had to run TeX, offer the user this convenience
        if test "$txiformat" = Texinfo; then
          escape=@@
        fi
d487 10
d520 2
a521 2
    sed '/^@@setfilename/a\
'"$textra" "$filename_input" >$filename_xtr
a596 3
    # Prevent $ESCAPE from being interpreted by the shell if it happens
    # to be `/'.
    $batch tex_args="\\${escape}nonstopmode\ \\${escape}input"
@


1.4
log
@Handle conflicts after 4.3 import.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.10 2002/11/14 21:10:37 karl Exp
d6 1
a6 1
# 2002 Free Software Foundation, Inc.
d30 1
a30 1
rcs_revision='Revision: 1.10'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.3) $rcs_version
d35 1
a35 1
Copyright (C) 2002 Free Software Foundation, Inc.
d111 3
d314 1
a314 1
  echo "$command_line_filename" | egrep '^(/|[A-z]:/)' >/dev/null \
d415 1
a415 1
  elif sed 1q "$command_line_filename" | fgrep 'input texinfo' >/dev/null; then
d601 1
a601 1
    if fgrep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then
@


1.3
log
@merge texinfo-4.0
@
text
@d3 1
a3 1
# $Id$
d5 2
a6 1
# Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
d30 1
a30 1
rcs_revision='$Revision$'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.0) $rcs_version
d35 1
a35 1
Copyright (C) 1999 Free Software Foundation, Inc.
d50 20
a69 16
Options:
  -@@                   Use @@input instead of \input; for preloaded Texinfo.
  -b, --batch          No interaction.
  -c, --clean          Remove all auxiliary files.
  -D, --debug          Turn on shell debugging (set -x).
  -e, --expand         Force macro expansion using makeinfo.
  -I DIR               Search DIR for Texinfo files.
  -h, --help           Display this help and exit successfully.
  -l, --language=LANG  Specify the LANG of FILE: LaTeX or Texinfo.
  -p, --pdf            Use pdftex or pdflatex for processing.
  -q, --quiet          No output unless errors (implies --batch).
  -s, --silent         Same as --quiet.
  -t, --texinfo=CMD    Insert CMD after @@setfilename in copy of input file.
                       Multiple values accumulate.
  -v, --version        Display version information and exit successfully.
  -V, --verbose        Report on what is done.
d76 2
a77 1
general questions and discussion to <help-texinfo@@gnu.org>."
a81 1
escape='\'
d85 1
d87 1
d89 2
a91 1
miincludes=     # makeinfo include path
d94 1
a94 1
txincludes=     # TEXINPUTS extensions
a95 1
quiet=          # by default let the tools' message be displayed
d108 3
d149 1
a149 1
    -e | --e*) expand=t;;
d154 1
a154 1
      txincludes="$txincludes$path_sep$1"
d157 7
d188 2
a189 1
if test $# = 0; then
d193 9
a201 1
fi
d234 9
a242 3
/^@@html/,/^@@end html/d
/^@@ifhtml/,/^@@end ifhtml/d
/^@@ifnottex/,/^@@end ifnottex/d
d246 2
a247 1
  d
d249 2
d268 1
a268 1
# LaTeX tables and lists.
d352 4
a355 3
  # Source file might include additional sources.  Put `.' and
  # directory where source file(s) reside in TEXINPUTS before anything
  # else.  `.' goes first to ensure that any old .aux, .cps,
d359 1
a359 1
  common=".$path_sep$orig_pwd$path_sep$filename_dir$path_sep$txincludes$path_sep"
d363 44
d456 3
a458 3
        eval `cd $tmpdir >/dev/null \
                    && $tex $txiversion_tex 2>/dev/null \
| sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p'`
d550 5
a554 1
    # before .aux and .?o?.
d557 1
a557 1
                        s!./$filename_noext\..o.!!g;
d576 1
a577 1
    cmd="$tex $tex_args $filename_input"
d640 7
a646 2
    $verbose "Copying $oformat file from `pwd` to $orig_pwd"
    cp -p "./$filename_noext.$oformat" "$orig_pwd"
@


1.2
log
@If TeX fails, suggest placing it in $PATH or $TEX, or fetching it from
pkgsrc/print/teTeX if it's not installed.
@
text
@d2 2
a3 2
# texi2dvi --- smartly produce DVI files from texinfo sources
# $Id: texi2dvi,v 1.1.1.1 1999/02/11 03:57:24 tv Exp $
d5 1
a5 1
# Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
d22 1
a22 3
# Commentary:
#
# Author: Noah Friedman <friedman@@gnu.org>
a26 14
#
# In the interest of general portability, some common bourne shell
# constructs were avoided because they weren't guaranteed to be available
# in some earlier implementations.  I've tried to make this program as
# portable as possible.  Welcome to unix, where the lowest common
# denominator is rapidly diminishing.
#
# Among the more interesting lossages I noticed among Bourne shells:
#     * No shell functions.
#     * No `unset' builtin.
#     * `shift' cannot take a numeric argument, and signals an error if
#       there are no arguments to shift.
#
# Code:
d28 10
a37 2
# Name by which this script was invoked.
progname=`echo "$0" | sed -e 's/[^\/]*\///g'`
d39 1
a39 3
# This string is expanded by rcs automatically when this file is checked out.
rcs_revision='$Revision: 1.1.1.1 $'
version=`set - $rcs_revision; echo $2`
d41 4
a44 3
# To prevent hairy quoting and escaping later.
bq='`'
eq="'"
d46 2
a47 2
usage="Usage: $0 [OPTION]... FILE...
Run a Texinfo document through TeX.
d50 19
a68 10
-b, --batch          No interaction (\nonstopmode in TeX).
-c, --clean          Remove all auxiliary files.
-D, --debug          Turn on shell debugging ($bq${bq}set -x$eq$eq).
-t, --texinfo CMD    Insert CMD after @@setfilename before running TeX.
--verbose            Report on what is done.
-h, --help           Display this help and exit.
-v, --version        Display version information and exit.

The values of the TEX, TEXINDEX, and MAKEINFO environment variables are
used to run those commands, if they are set.
d70 2
a71 1
Email bug reports to bug-texinfo@@gnu.org."
d73 1
a73 1
# Initialize variables.
d76 2
a77 3
# Some of these, like TEX and TEXINDEX, may be inherited from the environment.
backup_extension=.bak # these files get deleted if all goes well.
batch=
d80 4
a83 1
orig_pwd="`pwd`"
d85 15
a99 4
verbose=false
makeinfo="${MAKEINFO-makeinfo}"
texindex="${TEXINDEX-texindex}"
tex="${TEX-tex}"
d103 13
a115 1
export TEXINPUTS
d117 1
d119 3
a121 7
# Make sure that all wildcarded options are long enough to be unambiguous.
# It's a good idea to document the full long option name in each case.
# Long options which take arguments will need a `*' appended to the
# canonical name to match the value appended after the `=' character.
while :; do
  test $# -eq 0 && break
  
d123 30
a152 15
    -b | --batch | --b* ) batch=t; shift ;;
    -c | --clean | --c* ) clean=t; shift ;;
    -D | --debug | --d* ) debug=t; shift ;;
    -h | --help | --h* )   echo "$usage"; exit 0 ;;
    # OK, we should do real option parsing here, but be lazy for now.
    -t | --texinfo | --t*) shift; textra="$textra $1"; shift ;; 
    -v | --vers* )
      echo "$progname (GNU Texinfo 3.12) $version"
      echo "Copyright (C) 1998 Free Software Foundation, Inc.
There is NO warranty.  You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
      exit 0 ;;
    --verb* )            verbose=echo; shift ;;
    -- )     # Stop option processing
d154 10
a163 11
      break ;;
    -* )
      case "$1" in
        --*=* ) arg=`echo "$1" | sed -e 's/=.*//'` ;;
        * )     arg="$1" ;;
      esac
      exec 1>&2
      echo "$progname: Unknown or ambiguous option $bq$arg$eq."
      echo "$progname: Try $bq--help$eq for more information."
      exit 1 ;;
    * ) break ;;
d165 1
d167 2
d170 4
a173 6
# See if there are any command line args left (which will be interpreted as
# filename arguments).
if test $# -eq 0; then
  exec 1>&2
  echo "$progname: At least one file name is required as an argument."
  echo "$progname: Try $bq--help$eq for more information."
d177 89
d268 3
a270 1
# Texify files
d274 6
a279 1
  # See if file exists.  If it doesn't we're in trouble since, even
d282 3
a284 3
  # be able to find the right index files and so forth.
  if test ! -r "${command_line_filename}"; then
    echo "$0: Could not read ${command_line_filename}." >&2
d288 48
a335 26
  # Roughly equivalent to `dirname ...`, but more portable
  directory="`echo ${command_line_filename} | sed 's/\/[^\/]*$//'`"
  filename_texi="`basename ${command_line_filename}`"
  # Strip off the last extension part (probably .texinfo or .texi)
  filename_noext="`echo ${filename_texi} | sed 's/\.[^.]*$//'`"

  # Use same basename since we want to generate aux files with the same
  # basename as the manual.  Use extension .texi for the temp file so
  # that TeX will ignore it.  Thus, we must use a subdirectory.
  #
  # Output the macro-expanded file to here.  The vastly abbreviated
  # temporary directory name is so we don't have collisions on 8.3 or
  # 14-character filesystems.
  tmp_dir=${TMPDIR-/tmp}/txi2d.$$
  filename_tmp=$tmp_dir/$filename_noext.texi
  # Output the file with the user's extra commands to here.
  tmp_dir2=${tmp_dir}.2
  filename_tmp2=$tmp_dir2/$filename_noext.texi
  mkdir $tmp_dir $tmp_dir2
  # Always remove the temporary directories.
  trap "rm -rf $tmp_dir $tmp_dir2" 1 2 15

  # If directory and file are the same, then it's probably because there's
  # no pathname component.  Set dirname to `.', the current directory.
  if test "z${directory}" = "z${command_line_filename}"; then
    directory=.
d338 54
a391 5
  # Source file might @@include additional texinfo sources.  Put `.' and
  # directory where source file(s) reside in TEXINPUTS before anything
  # else.  `.' goes first to ensure that any old .aux, .cps, etc. files in
  # ${directory} don't get used in preference to fresher files in `.'.
  TEXINPUTS=".:${directory}:${TEXINPUTS_orig}"
d393 1
a393 2
  # Expand macro commands in the original source file using Makeinfo;
  #   the macro syntax bfox implemented is impossible to implement in TeX.
d397 12
a408 9
  # Redirect output to /dev/null to throw away `Making info file...' msg.
  $verbose "Macro-expanding $command_line_filename to $filename_tmp ..."
  $makeinfo --footnote-style=end -E $filename_tmp -o /dev/null \
    $command_line_filename >/dev/null

  # But if there were no macros, or makeinfo failed for some reason,
  # just use the original file.  (It shouldn't make any difference, but
  # let's be safe.)
  if test $? -ne 0 || cmp -s $filename_tmp $command_line_filename; then
d410 1
a410 1
    cp -p $command_line_filename $filename_tmp
a411 2
  filename_input=$filename_tmp
  dirname_input=$tmp_dir
d415 1
a415 1
    $verbose "Inserting extra commands: $textra."
d417 2
a418 3
'"$textra" $filename_input >$filename_tmp2
   filename_input=$filename_tmp2
   dirname_input=$tmp_dir2
d423 2
a424 3
    $verbose "cd $dirname_input"
    cd $dirname_input || exit 1
    filename_input=`basename $filename_input`
d427 58
a484 20
  while true; do # will break out of loop below
    # "Unset" variables that might have values from previous iterations and
    # which won't be completely reset later.
    definite_index_files=

    # Find all files having root filename with a two-letter extension,
    # determine whether they're really index files, and save them.  Foo.aux
    # is actually the cross-references file, but we need to keep track of
    # that too.
    possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`"
    for this_file in ${possible_index_files}; do
      # If file is empty, forget it.
      test -s "${this_file}" || continue

      # Examine first character of file.  If it's not suitable to be an
      # index or xref file, don't process it.
      first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`"
      if test "x${first_character}" = "x\\" \
         || test "x${first_character}" = "x'"; then
        definite_index_files="${definite_index_files} ${this_file}"
a485 20
    done
    orig_index_files="${definite_index_files}"
    orig_index_files_sans_aux="`echo ${definite_index_files} \
                                 | sed 's/'${filename_noext}'\.aux//;
                                        s/^[ ]*//;s/[ ]*$//;'`"

    # Now save copies of original index files so we have some means of
    # comparison later.
    $verbose "Backing up current index files: $orig_index_files ..."  
    for index_file_to_save in ${orig_index_files}; do
      cp "${index_file_to_save}" "${index_file_to_save}${backup_extension}"
    done

    # Run texindex 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.
    if test -n "${orig_index_files_sans_aux}"; then
      $verbose "Running $texindex $orig_index_files_sans_aux ..."
      ${texindex} ${orig_index_files_sans_aux}
d489 15
a503 4
    if test "$batch" = t; then
      tex_mode='\nonstopmode'
    else
      tex_mode=
d505 35
a539 55
    $verbose "Running $tex $filename_input ..."
    cmd="$tex $tex_mode \\input $filename_input"
    $cmd || ( echo 1>&2 ''
echo 1>&2 'TeX failed.  If the above said "tex: not found", you may need to install TeX;'
echo 1>&2 'it is available from the pkgsrc system in print/teTeX.'
echo 1>&2 'If TeX is installed, make sure it is in your $PATH, or set the environment'
echo 1>&2 'variable $TEX to its location.'
)

    # Check if index files changed.
    # 
    definite_index_files=
    # Get list of new index files.
    possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`"
    for this_file in ${possible_index_files}; do
       # If file is empty, forget it.
       test -s "${this_file}" || continue

       # Examine first character of file.  If it's not a backslash or
       # single quote, then it's definitely not an index or xref file.
       # (Will have to check for @@ when we switch to Texinfo syntax in
       # all these files...)
       first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`"
       if test "x${first_character}" = "x\\" \
          || test "x${first_character}" = "x'"; then
         definite_index_files="${definite_index_files} ${this_file}"
       fi
    done
    new_index_files="${definite_index_files}"
    new_index_files_sans_aux="`echo ${definite_index_files} \
                               | sed 's/'${filename_noext}'\.aux//;
                                      s/^[ ]*//;s/[ ]*$//;'`"

    # If old and new list don't at least have the same file list, then one
    # file or another has definitely changed.
    $verbose "Original index files =$orig_index_files"
    $verbose "New index files =$new_index_files"
    if test "z${orig_index_files}" != "z${new_index_files}"; then
      index_files_changed_p=t
    else
      # File list is the same.  We must compare each file until we find a
      # difference.
      index_files_changed_p=
      for this_file in ${new_index_files}; do
        $verbose "Comparing index file $this_file ..."
        # cmp -s will return nonzero exit status if files differ.
        cmp -s "${this_file}" "${this_file}${backup_extension}"
        if test $? -ne 0; then
          # We only need to keep comparing until we find *one* that
          # differs, because we'll have to run texindex & tex no
          # matter what.
          index_files_changed_p=t
          $verbose "Index file $this_file differed:"
          test $verbose = echo \
          && diff -c "${this_file}${backup_extension}" "${this_file}"
d545 2
a546 6
    # If index files have changed since TeX has been run, or if the aux
    # file wasn't present originally, run texindex and TeX again.
    if test "${index_files_changed_p}"; then :; else
      # Nothing changed.  We're done with TeX.
      break
    fi
d550 1
a550 1
  # Copy the DVI file into the directory where the compilation
d556 3
a558 2
    $verbose "Copying DVI file from `pwd` to $orig_pwd"
    cp -p $filename_noext.dvi $orig_pwd
d562 5
a566 10
  # Generate list of files to delete, then call rm once with the entire
  # list.  This is significantly faster than multiple executions of rm.
  file_list=
  for file in ${orig_index_files}; do
    file_list="${file_list} ${file}${backup_extension}"
  done
  if test -n "${file_list}"; then
    $verbose "Removing $file_list $tmp_dir $tmp_dir2 ..."
    rm -f ${file_list}
    rm -rf $tmp_dir $tmp_dir2
d571 1
a571 1
true # exit successfully.
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
# $Id: texi2dvi,v 0.8 1998/02/26 21:13:13 karl Exp $
d48 1
a48 1
rcs_revision='$Revision: 0.8 $'
d275 6
a280 1
    $cmd
@


1.1.1.1
log
@Import texinfo 3.12.
@
text
@@


1.1.1.2
log
@Import texinfo 4.0
@
text
@d2 2
a3 2
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources.
# $Id: texi2dvi,v 0.43 1999/09/28 19:36:53 karl Exp $
d5 1
a5 1
# Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
d22 3
a24 1
# Original author: Noah Friedman <friedman@@gnu.org>.
d29 17
d48 2
a49 9
rcs_revision='$Revision: 0.43 $'
rcs_version=`set - $rcs_revision; echo $2`
program=`echo $0 | sed -e 's!.*/!!'`
version="texi2dvi (GNU Texinfo 4.0) $rcs_version

Copyright (C) 1999 Free Software Foundation, Inc.
There is NO warranty.  You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
d51 3
a53 1
usage="Usage: $program [OPTION]... FILE...
d55 2
a56 4
Run each Texinfo or LaTeX 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 (LaTeX or Texinfo).
d58 8
a65 2
Makeinfo is used to perform Texinfo macro expansion before running TeX
when needed.
d67 2
a68 20
Options:
  -@@                   Use @@input instead of \input; for preloaded Texinfo.
  -b, --batch          No interaction.
  -c, --clean          Remove all auxiliary files.
  -D, --debug          Turn on shell debugging (set -x).
  -e, --expand         Force macro expansion using makeinfo.
  -I DIR               Search DIR for Texinfo files.
  -h, --help           Display this help and exit successfully.
  -l, --language=LANG  Specify the LANG of FILE: LaTeX or Texinfo.
  -p, --pdf            Use pdftex or pdflatex for processing.
  -q, --quiet          No output unless errors (implies --batch).
  -s, --silent         Same as --quiet.
  -t, --texinfo=CMD    Insert CMD after @@setfilename in copy of input file.
                       Multiple values accumulate.
  -v, --version        Display version information and exit successfully.
  -V, --verbose        Report on what is done.

The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO,
TEX (or PDFTEX), and TEXINDEX environment variables are used to run
those commands, if they are set.
d70 1
a70 2
Email bug reports to <bug-texinfo@@gnu.org>,
general questions and discussion to <help-texinfo@@gnu.org>."
d72 1
a72 1
# Initialize variables for option overriding and otherwise.
d75 3
a77 2
escape='\'
batch=false     # eval for batch mode
d80 1
a80 4
expand=         # t for expansion via makeinfo
oformat=dvi
set_language=
miincludes=     # makeinfo include path
d82 4
a85 15
tmpdir=${TMPDIR:-/tmp}/t2d$$  # avoid collisions on 8.3 filesystems.
txincludes=     # TEXINPUTS extensions
txiprereq=19990129 # minimum texinfo.tex version to have macro expansion
quiet=          # by default let the tools' message be displayed
verbose=false   # echo for verbose mode

orig_pwd=`pwd`

# Systems which define $COMSPEC or $ComSpec use semicolons to separate
# directories in TEXINPUTS.
if test -n "$COMSPEC$ComSpec"; then
  path_sep=";"
else
  path_sep=":"
fi
d89 1
a89 13
# Unfortunately makeindex does not read TEXINPUTS.
INDEXSTYLE_orig="$INDEXSTYLE"
export TEXINPUTS INDEXSTYLE

# 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
a90 1
# 
d92 7
a98 3
while test x"$1" != x"$arg_sep"; do

  # Handle --option=value by splitting apart and putting back on argv.
d100 15
a114 3
    --*=*)
      opt=`echo "$1" | sed -e 's/=.*//'`
      val=`echo "$1" | sed -e 's/[^=]*=//'`
d116 11
a126 37
      set dummy "$opt" "$val" ${1+"$@@"}; shift
      ;;
  esac

  # This recognizes --quark as --quiet.  So what.
  case "$1" in
    -@@ ) escape=@@;;
    # Silently and without documentation accept -b and --b[atch] as synonyms.
    -b | --b*) batch=eval;;
    -q | -s | --q* | --s*) quiet=t; batch=eval;;
    -c | --c*) clean=t;;
    -D | --d*) debug=t;;
    -e | --e*) expand=t;;
    -h | --h*) echo "$usage"; exit 0;;
    -I | --I*)
      shift
      miincludes="$miincludes -I $1"
      txincludes="$txincludes$path_sep$1"
      ;;
    -l | --l*) shift; set_language=$1;;
    -p | --p*) oformat=pdf;;
    -t | --t*) shift; textra="$textra\\
$1";;
    -v | --vers*) echo "$version"; exit 0;;
    -V | --verb*) verbose=echo;;
    --) # What remains are not options.
      shift
      while test x"$1" != x"$arg_sep"; do
        set dummy ${1+"$@@"} "$1"; shift
        shift
      done
      break;;
    -*)
      echo "$0: Unknown or ambiguous option \`$1'." >&2
      echo "$0: Try \`--help' for more information." >&2
      exit 1;;
    *) set dummy ${1+"$@@"} "$1"; shift;;
a127 1
   shift
a128 2
# Pop the token
shift
d130 6
a135 4
# Interpret remaining command line args as filenames.
if test $# = 0; then
  echo "$0: Missing file arguments." >&2
  echo "$0: Try \`--help' for more information." >&2
a138 89
# Prepare the temporary directory.  Remove it at exit, unless debugging.
if test -z "$debug"; then
  trap "cd / && rm -rf $tmpdir" 0 1 2 15
fi

# Create the temporary directory with strict rights
(umask 077 && mkdir $tmpdir) || exit 1

# Prepare the tools we might need.  This may be extra work in some
# cases, but improves the readibility of the script.
utildir=$tmpdir/utils
mkdir $utildir || exit 1

# A sed script that 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.  Unfortunately makeinfo --iftex --no-ifhtml --no-ifinfo
# doesn't work well enough (yet) to use that, so work around with sed.
comment_iftex_sed=$utildir/comment.sed
cat <<EOF >$comment_iftex_sed
/^@@tex/,/^@@end tex/{
  s/^/@@c texi2dvi/
}
/^@@iftex/,/^@@end iftex/{
  s/^/@@c texi2dvi/
  /^@@c texi2dvi@@macro/,/^@@c texi2dvi@@end macro/{
    s/^@@c texi2dvi//
  }
}
/^@@html/,/^@@end html/d
/^@@ifhtml/,/^@@end ifhtml/d
/^@@ifnottex/,/^@@end ifnottex/d
/^@@ifinfo/,/^@@end ifinfo/{
  /^@@node/p
  /^@@menu/,/^@@end menu/p
  d
}
EOF
# Uncommenting is simple: Remove any leading `@@c texi2dvi'.
uncomment_iftex_sed=$utildir/uncomment.sed
cat <<EOF >$uncomment_iftex_sed
s/^@@c texi2dvi//
EOF

# A shell script that computes the list of xref files.
# Takes the filename (without extension) of which we look for xref
# files as argument.  The index files must be reported last.
get_xref_files=$utildir/get_xref.sh
cat <<\EOF >$get_xref_files
#! /bin/sh

# Get list of xref files (indexes, tables and lists).
# Find all files having root filename with a two-letter extension,
# saves the ones that are really Texinfo-related files.  .?o? catches
# LaTeX tables and lists.
for this_file in "$1".?o? "$1".aux "$1".?? "$1".idx; do
  # If file is empty, skip it.
  test -s "$this_file" || continue
  # If the file is not suitable to be an index or xref file, don't
  # process it.  The file can't be if its first character is not a
  # backslash or single quote.
  first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
  if test "x$first_character" = "x\\" \
     || test "x$first_character" = "x'"; then
    xref_files="$xref_files ./$this_file"
  fi
done
echo "$xref_files"
EOF
chmod 500 $get_xref_files

# 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)

# Tools' output.  If quiet, discard, else redirect to the message flow.
if test "$quiet" = t; then
  exec 5>/dev/null
else
  exec 5>&1
fi

# Enable tracing
d141 1
a141 3
# 
# TeXify files.

d145 1
a145 6
  # 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" | egrep '^(/|[A-z]:/)' >/dev/null \
  || command_line_filename="./$command_line_filename"

  # See if the file exists.  If it doesn't we're in trouble since, even
d148 3
a150 3
  # be able to find the right xref files and so forth.
  if test ! -r "$command_line_filename"; then
    echo "$0: Could not read $command_line_filename, skipping." >&2
d154 27
a180 28
  # Get the name of the current directory.  We want the full path
  # because in clean mode we are in tmp, in which case a relative
  # path has no meaning.
  filename_dir=`echo $command_line_filename | sed 's!/[^/]*$!!;s!^$!.!'`
  filename_dir=`cd "$filename_dir" >/dev/null && pwd`

  # Strip directory part but leave extension.
  filename_ext=`basename "$command_line_filename"`
  # Strip extension.
  filename_noext=`echo "$filename_ext" | sed 's/\.[^.]*$//'`
  ext=`echo "$filename_ext" | sed 's/^.*\.//'`

  # _src.  Use same basename since we want to generate aux files with
  # the same basename as the manual.  If --expand, then output the
  # macro-expanded file to here, else copy the original file.
  tmpdir_src=$tmpdir/src
  filename_src=$tmpdir_src/$filename_noext.$ext

  # _xtr.  The file with the user's extra commands.
  tmpdir_xtr=$tmpdir/xtr
  filename_xtr=$tmpdir_xtr/$filename_noext.$ext

  # _bak.  Copies of the previous xref files (another round is run if
  # they differ from the new one).
  tmpdir_bak=$tmpdir/bak

  # Make all those directories and give up if we can't succeed.
  mkdir $tmpdir_src $tmpdir_xtr $tmpdir_bak || exit 1
d182 1
a182 1
  # Source file might include additional sources.  Put `.' and
d184 3
a186 34
  # else.  `.' goes first to ensure that any old .aux, .cps,
  # etc. files in ${directory} don't get used in preference to fresher
  # files in `.'.  Include orig_pwd in case we are in clean mode, where
  # we've cd'd to a temp directory.
  common=".$path_sep$orig_pwd$path_sep$filename_dir$path_sep$txincludes$path_sep"
   TEXINPUTS="$common$TEXINPUTS_orig"
  INDEXSTYLE="$common$INDEXSTYLE_orig"

  # 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
    language=$set_language
  elif sed 1q "$command_line_filename" | fgrep 'input texinfo' >/dev/null; then
    language=texinfo
  else
    language=
  fi

  # 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 ${language:-$filename_ext} in
    [lL]a[tT]e[xX] | *.ltx | *.tex)
      # Assume a LaTeX file.  LaTeX needs bibtex and uses latex for
      # compilation.  No makeinfo.
      bibtex=${BIBTEX:-bibtex}
      makeinfo= # no point in running makeinfo on latex source.
      texindex=${MAKEINDEX:-makeindex}
      if test $oformat = dvi; then
        tex=${LATEX:-latex}
      else
        tex=${PDFLATEX:-pdflatex}
      fi
      ;;
d188 2
a189 40
    *)
      # Assume a Texinfo file.  Texinfo files need makeinfo, texindex and tex.
      bibtex=
      texindex=${TEXINDEX:-texindex}
      if test $oformat = dvi; then
        tex=${TEX:-tex}
      else
        tex=${PDFTEX:-pdftex}
      fi
      # Unless required by the user, makeinfo expansion is wanted only
      # if texinfo.tex is too old.
      if test "$expand" = t; 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.
        txiversion_tex=txiversion.tex
        echo '\input texinfo.tex @@bye' >$tmpdir/$txiversion_tex
        # Run in the tmpdir to avoid leaving files.
        eval `cd $tmpdir >/dev/null \
                    && $tex $txiversion_tex 2>/dev/null \
| sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p'`
        $verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' ..."
        if test "$txiprereq" -le "$txiversion" >/dev/null 2>&1; then
          makeinfo=
        else
          makeinfo=${MAKEINFO:-makeinfo}
        fi
        # As long as we had to run TeX, offer the user this convenience
        if test "$txiformat" = Texinfo; then
          escape=@@
        fi
      fi
      ;;
  esac

  # Expand macro commands in the original source file using Makeinfo.
d193 9
a201 12
  if test -n "$makeinfo"; then
    $verbose "Macro-expanding $command_line_filename to $filename_src ..."
    sed -f $comment_iftex_sed "$command_line_filename" \
      | $makeinfo --footnote-style=end -I "$filename_dir" $miincludes \
        -o /dev/null --macro-expand=- \
      | sed -f $uncomment_iftex_sed >"$filename_src"
    filename_input=$filename_src
  fi

  # If makeinfo failed (or was not even run), use the original file as input.
  if test $? -ne 0 \
     || test ! -r "$filename_src"; then
d203 1
a203 1
    filename_input=$filename_dir/$filename_ext
d205 2
d210 1
a210 1
    $verbose "Inserting extra commands: $textra"
d212 3
a214 2
'"$textra" "$filename_input" >$filename_xtr
    filename_input=$filename_xtr
d219 3
a221 2
    $verbose "cd $tmpdir_src"
    cd "$tmpdir_src" || exit 1
d224 20
a243 58
  while :; do # will break out of loop below
    orig_xref_files=`$get_xref_files "$filename_noext"`

    # Save copies of originals for later comparison.
    if test -n "$orig_xref_files"; then
      $verbose "Backing up xref files: `echo $orig_xref_files | sed 's|\./||g'`"
      cp $orig_xref_files $tmpdir_bak
    fi

    # Run bibtex on current file.
    # - If its input (AUX) exists.
    # - If AUX contains both `\bibdata' and `\bibstyle'.
    # - If some citations are missing (LOG contains `Citation').
    #   or the LOG complains of a missing .bbl
    #
    # We run bibtex first, because I can see reasons for the indexes
    # to change after bibtex is run, but I see no reason for the
    # converse.
    #
    # Don't try to be too smart.  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.  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 to match false messages.
    if test -n "$bibtex" \
       && test -r "$filename_noext.aux" \
       && test -r "$filename_noext.log" \
       && (grep '^\\bibdata[{]'  "$filename_noext.aux" \
           && grep '^\\bibstyle[{]' "$filename_noext.aux" \
           && (grep 'Warning:.*Citation.*undefined' "$filename_noext.log" \
               || grep 'No file .*\.bbl\.' "$filename_noext.log")) \
          >/dev/null 2>&1; \
    then
      $verbose "Running $bibtex $filename_noext ..."
      if $bibtex "$filename_noext" >&5; then :; else
        echo "$0: $bibtex exited with bad status, quitting." >&2
        exit 1
      fi
    fi

    # What we'll run texindex on -- exclude non-index files.
    # Since we know index files are last, it is correct to remove everything
    # before .aux and .?o?.
    index_files=`echo "$orig_xref_files" \
                 | sed "s!.*\.aux!!g;
                        s!./$filename_noext\..o.!!g;
                        s/^[ ]*//;s/[ ]*$//"`
    # Run texindex (or makeindex) 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.
    if test -n "$texindex" && test -n "$index_files"; then
      $verbose "Running $texindex $index_files ..."
      if $texindex $index_files 2>&5 1>&2; then :; else
         echo "$0: $texindex exited with bad status, quitting." >&2
         exit 1
d245 20
d268 4
a271 11
    # Prevent $ESCAPE from being interpreted by the shell if it happens
    # to be `/'.
    $batch tex_args="\\${escape}nonstopmode\ \\${escape}input"
    $verbose "Running $cmd ..."
    cmd="$tex $tex_args $filename_input"
    if $cmd >&5; then :; else
      echo "$0: $tex exited with bad status, quitting." >&2
      echo "$0: see $filename_noext.log for errors." >&2
      test "$clean" = t \
        && cp "$filename_noext.log" "$orig_pwd"
      exit 1
d273 50
a322 36


    # Decide if looping again is needed.
    finished=t

    # 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 fgrep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then
      finished=
    fi

    # Check if xref files changed.
    new_xref_files=`$get_xref_files "$filename_noext"`
    $verbose "Original xref files = `echo $orig_xref_files | sed 's|\./||g'`"
    $verbose "New xref files      = `echo $new_xref_files | sed 's|\./||g'`"

    # If old and new lists don't at least have the same file list,
    # then one file or another has definitely changed.
    test "x$orig_xref_files" != "x$new_xref_files" && finished=

    # File list is the same.  We must compare each file until we find
    # a difference.
    if test -n "$finished"; then
      for this_file in $new_xref_files; 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" "$tmpdir_bak/$this_file"; then :; else
          # We only need to keep comparing until we find one that
          # differs, because we'll have to run texindex & tex again no
          # matter how many more there might be.
          finished=
          $verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..."
          test "$debug" = t && diff -c "$tmpdir_bak/$this_file" "$this_file"
d328 6
a333 2
    # If finished, exit the loop, else rerun the loop.
    test -n "$finished" && break
d337 1
a337 1
  # Copy the DVI (or PDF) file into the directory where the compilation
d343 2
a344 3
    $verbose "Copying $oformat file from `pwd` to $orig_pwd"
    cp -p "./$filename_noext.$oformat" "$orig_pwd"
    cd / # in case $orig_pwd is on a different drive (for DOS)
d348 10
a357 5
  # Remove temporary files.
  if test "x$debug" = "x"; then
    $verbose "Removing $tmpdir_src $tmpdir_xtr $tmpdir_bak ..."
    cd /
    rm -rf $tmpdir_src $tmpdir_xtr $tmpdir_bak
d362 1
a362 1
exit 0 # exit successfully, not however we ended the loop.
@


1.1.1.3
log
@Import of texinfo-4.3.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.10 2002/11/14 21:10:37 karl Exp
d5 1
a5 2
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
# 2002 Free Software Foundation, Inc.
d29 1
a29 1
rcs_revision='Revision: 1.10'
d32 1
a32 1
version="texi2dvi (GNU Texinfo 4.3) $rcs_version
d34 1
a34 1
Copyright (C) 2002 Free Software Foundation, Inc.
d49 16
a64 20
Operation modes:
  -b, --batch         no interaction
  -c, --clean         remove all auxiliary files
  -D, --debug         turn on shell debugging (set -x)
  -h, --help          display this help and exit successfully
  -o, --output=OFILE  leave output in OFILE (implies --clean);
                      Only one input FILE may be specified in this case
  -q, --quiet         no output unless errors (implies --batch)
  -s, --silent        same as --quiet
  -v, --version       display version information and exit successfully
  -V, --verbose       report on what is done

TeX tuning:
  -@@                   use @@input instead of \input; for preloaded Texinfo
  -e, -E, --expand     force macro expansion using makeinfo
  -I DIR               search DIR for Texinfo files
  -l, --language=LANG  specify the LANG of FILE (LaTeX or Texinfo)
  -p, --pdf            use pdftex or pdflatex for processing
  -t, --texinfo=CMD    insert CMD after @@setfilename in copy of input file
                       multiple values accumulate
d71 1
a71 2
general questions and discussion to <help-texinfo@@gnu.org>.
Texinfo home page: http://www.gnu.org/software/texinfo/"
d76 1
a79 1
escape='\'
a80 1
miincludes=     # makeinfo include path
a81 2
oname=          # --output
quiet=          # by default let the tools' message be displayed
d83 1
d86 1
a86 1
txincludes=     # TEXINPUTS extensions, with trailing colon
d88 1
a100 3
# Pacify verbose cds.
CDPATH=${ZSH_VERSION+.}$path_sep

d139 1
a139 1
    -e | -E | --e*) expand=t;;
d144 1
a144 1
      txincludes="$txincludes$1$path_sep"
a146 7
    -o | --o*)
      shift
      clean=t
      case "$1" in
        /* | ?:/*) oname=$1;;
                *) oname="$orig_pwd/$1";;
      esac;;
d171 1
a171 2
case $# in
 0)
d175 1
a175 9
  ;;
 1) ;;
 *)
  if test -n "$oname"; then
    echo "$0: Can't use option \`--output' with more than one argument." >&2
    exit 2
  fi
  ;;
esac
d208 3
a210 9
/^@@html/,/^@@end html/{
  s/^/@@c (texi2dvi)/
}
/^@@ifhtml/,/^@@end ifhtml/{
  s/^/@@c (texi2dvi)/
}
/^@@ifnottex/,/^@@end ifnottex/{
  s/^/@@c (texi2dvi)/
}
d214 1
a214 2
  t
  s/^/@@c (texi2dvi)/
a215 2
s/^@@ifnotinfo/@@c texi2dvi@@ifnotinfo/
s/^@@end ifnotinfo/@@c texi2dvi@@end ifnotinfo/
d233 1
a233 1
# many files: .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
d317 3
a319 4
  # Source file might include additional sources.
  # We want `.:$orig_pwd' before anything else.  (We'll add `.:' later
  # after all other directories have been turned into absolute paths.)
  # `.' goes first to ensure that any old .aux, .cps,
d323 1
a323 1
  common="$orig_pwd$path_sep$filename_dir$path_sep$txincludes"
a326 44
  # Convert relative paths to absolute paths, so we can run in another
  # directory (e.g., in --clean mode, or during the macro-support
  # detection.)
  #
  # Empty path components are meaningful to tex.  We rewrite them
  # as `EMPTY' so they don't get lost when we split on $path_sep.
   TEXINPUTS=`echo $TEXINPUTS  |sed 's/^:/EMPTY:/;s/:$/:EMPTY/;s/::/:EMPTY:/g'`
  INDEXSTYLE=`echo $INDEXSTYLE |sed 's/^:/EMPTY:/;s/:$/:EMPTY/;s/::/:EMPTY:/g'`
  save_IFS=$IFS
  IFS=$path_sep
  set x $TEXINPUTS; shift
  TEXINPUTS=.
  for dir
  do
    case $dir in
      EMPTY)
        TEXINPUTS=$TEXINPUTS$path_sep
        ;;
      [\\/]* | ?:[\\/]*)        # Absolute paths don't need to be expansed.
        TEXINPUTS=$TEXINPUTS$path_sep$dir
        ;;
      *)
        abs=`cd "$dir" && pwd` && TEXINPUTS=$TEXINPUTS$path_sep$abs
        ;;
    esac
  done
  set x $INDEXSTYLE; shift
  INDEXSTYLE=.
  for dir
  do
    case $dir in
      EMPTY)
        INDEXSTYLE=$INDEXSTYLE$path_sep
        ;;
      [\\/]* | ?:[\\/]*)        # Absolute paths don't need to be expansed.
        INDEXSTYLE=$INDEXSTYLE$path_sep$dir
        ;;
      *)
        abs=`cd "$dir" && pwd` && INDEXSTYLE=$INDEXSTYLE$path_sep$abs
        ;;
    esac
  done
  IFS=$save_IFS

d376 3
a378 3
        eval `cd $tmpdir >/dev/null &&
              $tex $txiversion_tex 2>/dev/null |
              sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p'`
d470 1
a470 5
    # before .aux and .?o?.  But don't really do <anything>o<anything>
    # -- don't match whitespace as <anything>.
    # Otherwise, if orig_xref_files contains something like
    #   foo.xo foo.whatever
    # the space after the o will get matched.
d473 1
a473 1
                        s!./$filename_noext\.[^ ]o[^ ]!!g;
d492 1
a493 1
    $verbose "Running $cmd ..."
d553 2
a554 7
    if test -n "$oname"; then
       dest=$oname
    else
       dest=$orig_pwd
    fi
    $verbose "Copying $oformat file from `pwd` to $dest"
    cp -p "./$filename_noext.$oformat" "$dest"
@


1.1.1.4
log
@Import of texinfo-4.5.
Major changes since 4.3:
* Language:
  . The ' (ASCII apostrophe/right quote) character is finally allowed in
    node and anchor names.  Thus, after installing this texinfo.tex,
    existing .aux files will cause errors!  Remove them and rerun TeX to
    generate good ones.
  . @@value constructs are now expanded in the filename arguments to
    @@include and @@verbatiminclude.
* texinfo.tex:
  . @@smallexample and the like now output in a smaller font (9pt) in all
    paper formats, not just @@smallbook and @@afourpaper.
  . new translation txi-tr.tex.
* info:
  . CTRL-H is treated like DEL in incremental search.
  . arrow keys once again work in isearch contexts under Solaris.
* infokey:
  . use .info key bindings before defaults.
  . allow prefix keys to be disabled.
Bug fixes all around.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.14 2003/02/05 00:42:33 karl Exp
d6 1
a6 1
# 2002, 2003 Free Software Foundation, Inc.
d30 1
a30 1
rcs_revision='Revision: 1.14'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.5) $rcs_version
d35 1
a35 1
Copyright (C) 2003 Free Software Foundation, Inc.
a110 3
# In case someone crazy insists on using grep -E.
: ${EGREP=egrep}

d311 1
a311 1
  echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >/dev/null \
d412 1
a412 1
  elif sed 1q "$command_line_filename" | grep 'input texinfo' >/dev/null; then
d595 1
a595 1
    if grep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then
@


1.1.1.5
log
@Import of texinfo-4.6.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.23 2003/06/10 20:50:03 karl Exp
d30 1
a30 1
rcs_revision='Revision: 1.23'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.6) $rcs_version
d68 2
a69 2
  -t, --command=CMD    insert CMD in copy of input file;
   or --texinfo=CMD    multiple values accumulate
d71 3
a73 4
The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO, TEX
(or PDFTEX), and TEXINDEX environment variables are used to run those
commands, if they are set.  Any CMD strings are added after @@setfilename
for Texinfo input, in the first line for LaTeX input.
d92 1
a92 2
textra=         # Extra TeX commands to insert in the input file.
textra_cmd=     # sed command to insert TEXTRA where appropriate
d114 5
a118 7
# Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
# Unfortunately bibtex and makeindex do not read TEXINPUTS.
tex_envvars="BIBINPUTS BSTINPUTS INDEXSTYLE TEXINPUTS"
for var in $tex_envvars; do
  eval ${var}_orig=\$$var
  export $var
done
d148 2
a149 2
    -b | --b*) batch=true;;
    -q | -s | --q* | --s*) quiet=t; batch=true;;
d168 2
a169 2
    -t | --tex* | --com* ) shift; textra="$textra\\
"`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;;
d276 2
a277 3
  # process it.  It's suitable if the first character is a
  # backslash or right quote, as long as the first line isn't
  # \input texinfo.
d279 1
a279 2
  if (test "x$first_character" = "x\\" \
      && sed 1q $this_file | grep -v '^\\input *texinfo' >/dev/null) \
d363 2
a364 4
  for var in $tex_envvars; do
    eval ${var}="\$common\$${var}_orig"
    export $var
  done
d367 2
a368 1
  # directory (e.g., in --clean mode, or during the macro-support detection.)
d372 2
a373 6
  # Hopefully no one will have an actual directory named EMPTY.
  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:/g'"
   TEXINPUTS=`echo $TEXINPUTS  | eval sed $replace_empty`
  INDEXSTYLE=`echo $INDEXSTYLE | eval sed $replace_empty`
d384 1
a384 1
      [\\/]* | ?:[\\/]*)        # Absolute paths don't need to be expanded.
a429 1
      textra_cmd=1i
a440 1
      textra_cmd='/^@@setfilename/a'
d468 4
a471 2
        # As long as we had to run TeX, offer the user this convenience:
        test "$txiformat" = Texinfo && escape=@@
a475 10
  # If possible, make TeX report error locations in GNU format.
  tex_args=
  case `$tex --help </dev/null 2>&1` in
   *file-line-error-style*) tex_args='--file-line-error-style';;
  esac

  # Tell TeX to be batch if requested.  (\batchmode does not show
  # terminal output at all, so we don't want that.)
  $batch && tex_args="$tex_args ${escape}nonstopmode ${escape}input"

d499 2
a500 2
    sed "$textra_cmd\\
$textra" "$filename_input" >$filename_xtr
d576 3
@


1.1.1.6
log
@Import of texinfo-4.7, as prepared by texinfo2netbsd.

Changes since 4.6:

4.7 (9 April 2004)
* Language:
  . new commands @@float, @@caption, @@shortcaption, @@listoffloats for
    initial implementation of floating material (figures, tables, etc).
    Ironically, they do not yet actually float anywhere.
  . new commands @@docbook, @@ifdocbook, @@ifnotdocbook for conditional Docbook.
  . new commands @@ordf{} and @@ordm{} for Spanish feminine/masculine ordinals.
  . new commands @@deftypecv[x] for class variables in typed OO languages.
  . new command @@registeredsymbol for the r-in-a-circle symbol.
  . new command @@headitem to make a heading row in @@multitable.
  . new command @@LaTeX{} for the LaTeX logo.
  . new command @@comma{} to avoid comma-parsing problems.
  . @@url is now a synonym for @@uref; new command @@indicateurl has the
    old meaning of just displaying a url as text.
  . @@quotation now accepts an optional argument for labelling the text
      as a `Note', `Tip', etc.
  . @@defun (et al.) heading lines can now be continued with a lone @@.
  . @@acronym accepts an optional argument for the meaning of the acronym.
* makeinfo:
  . New environment variable TEXINFO_OUTPUT_FORMAT determines the output
    format at runtime, if no options are specified.
  . New option --plaintext, equivalent to --no-headers with Info output.
  . All outputs:
    - sections are numbered by default.
  . Info output:
    - punctuation is inserted after @@pxref and @@ref, if needed to make
      cross-references valid.
    - line numbers included in index menus, so Info readers can go to
      the exact line of an entry, not just a node.  Also in plaintext output.
    - ^@@^H[index^@@^H] cookie included in index menus, so Info readers
      can handle the ] etc. commands better.
  . HTML output:
    - new algorithm for cross-references to other manuals, for maximum
      portability and stability.
    - include node name in <title> with split output.
    - @@multicolumn fractions become percentages.
    - entities used for bullets, quotes, dashes, and others.
    - index entries are links to the exact locations.
    - <h4> and <h5> used for @@sub and @@subsubsections again.
    - accented dotless i supported.
  . XML output: many new tags and structure to preserve more source features.
  . Docbook output:
    - upgraded DTD to Docbook XML 4.2, no longer using Docbook SGML.
    - improved translation in general, for instance:
    - line annotations and marked quotations.
* texi2dvi:
  . if available, use etex (pdfetex if --pdf) by default.
  . if the input file includes thumbpdf.sty (for LaTeX), then run thumbpdf.
  . more output if --debug.
* texinfo.tex:
  . @@defun names are now printed in typewriter (instead of bold), and
    within the arguments, @@var text is printed in slanted typewriter.
  . @@tex code is executed inside a TeX group, so that any changes must
    be prefixed with \global (or the equivalent) to be effective.  (This
    change was actually made years ago, but never made it into the NEWS.)
* info:
  . new option --where (aka --location, -w) to report where an Info file
    would be found, instead of reading it.
  . by default, output ANSI terminal escape sequences as-is; new option
    --no-raw-escapes overrides this.
  . use the newly-generated index line numbers.
* Distribution:
  . new script gendocs.sh (not installed), for use by GNU maintainers in
    getting their manuals on the GNU web site.  Documented in
    maintain.texi (http://www.gnu.org/prep/maintain_toc.html).
  . Most code uses ANSI C prototypes, to some extent.
  . New translation: nb.
  . automake 1.8.3, autoconf 2.59, gettext 0.14.1.
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.3 2004/02/17 16:59:46 karl Exp
d6 1
a6 1
# 2002, 2003, 2004 Free Software Foundation, Inc.
d23 1
a23 1
# Original author: Noah Friedman.
d30 1
a30 1
rcs_revision='Revision: 1.3'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.7) $rcs_version
d35 1
a35 1
Copyright (C) 2004 Free Software Foundation, Inc.
d71 4
a74 4
The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO,
TEX (or PDFTEX), TEXINDEX, and THUMBPDF environment variables are used
to run those commands, if they are set.  Any CMD strings are added
after @@setfilename for Texinfo input, in the first line for LaTeX input.
d97 1
a97 1
txiprereq=19990129 # minimum texinfo.tex version with macro expansion
a115 19
# return true if program $1 is somewhere in PATH, else false.
# 
findprog () {
  foundprog=false
  for dir in `echo $PATH | tr "$path_sep" " "`; do
    if test -x "$dir/$1"; then  # does anyone still need test -f?
      foundprog=true
      break
    fi
  done
  $foundprog
}

# Report an error and exit with failure.
fatal () {
  echo "$0: $*" >&2
  exit 1
}

d117 1
a117 1
# Likewise for bibtex and makeindex.
a123 1

a209 33

# We can't do much without tex.
# 
if findprog ${TEX:-tex}; then :; else cat <<EOM
You don't have a working TeX binary (${TEX:-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://www.tug.org.  If
you happen to be using Debian, you can get it with this command:
  apt-get install tetex-bin
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.
# 
# End up with the TEX and PDFTEX variables set to what we are going to use.
if test -z "$TEX"; then
  if findprog etex; then TEX=etex; else TEX=tex; fi
fi
#
if test -z "$PDFTEX"; then
  if findprog pdfetex; then PDFTEX=pdfetex; else PDFTEX=pdftex; fi
fi


d219 1
a219 1
# cases, but improves the readability of the script.
d224 6
a229 7
# 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.
# Unfortunately makeinfo --iftex --no-ifinfo doesn't work well enough
# (yet), makeinfo can't parse the TeX commands, so work around with sed.
#
d241 6
d310 1
a310 6
if test "$debug" = t; then
  exec 6>&1
  set -x
else
  exec 6>/dev/null
fi
d320 1
a320 1
  echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >&6 \
d426 1
a426 1
  elif sed 1q "$command_line_filename" | grep 'input texinfo' >&6; then
a446 1
      thumbpdf=${THUMBPDF:-thumbpdf}
d455 1
a455 1
        tex=$TEX
d457 1
a457 1
        tex=$PDFTEX
d469 2
d472 3
a474 13
	(
           cd $tmpdir
	   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
	) >$tmpdir/txiversion.out 2>$tmpdir/txiversion.err
	if test $? != 0; then
	  cat $tmpdir/txiversion.out
	  cat $tmpdir/txiversion.err >&2
	  fatal "texinfo.tex appears to be broken, quitting."
        fi
	eval `sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p' $tmpdir/txiversion.out`
a483 1
      thumbpdf=${THUMBPDF:-thumbpdf}
a486 4
  # Go to $tmpdir to try --help, since old versions that don't accept
  # --help will generate a texput.log.
  tex_help=`cd $tmpdir >/dev/null && $tex --help </dev/null 2>&1`

d489 2
a490 2
  case $tex_help in
    *file-line-error-style*) tex_args="$tex_args --file-line-error-style";;
d563 1
a563 1
          >&6 2>&1; \
d566 4
a569 2
      $bibtex "$filename_noext" >&5 ||
        fatal "$bibtex exited with bad status, quitting."
d590 4
a593 2
      $texindex $index_files 2>&5 1>&2 ||
         fatal "$texindex exited with bad status, quitting."
d616 1
a616 1
    if grep "Rerun to get" "$filename_noext.log" >&6 2>&1; then
d649 1
a649 22
  done # while :;

  # If we were using thumbpdf and producing PDF, then run thumbpdf
  # and TeX one last time.
  if test $oformat = pdf \
     && test -r "$filename_noext.log" \
     && grep 'thumbpdf\.sty'  "$filename_noext.log" >&6 2>&1; \
  then
    $verbose "Running $thumbpdf $filename_noext ..."
    $thumbpdf "$filename_noext" >&5 ||
      fatal "$thumbpdf exited with bad status, quitting."

    $verbose "Running $cmd ..."
    if $cmd >&5; then :; else
      echo "$0: $tex exited with bad status, quitting." >&2
      echo "$0: see $filename_noext.log for errors." >&2
      test "$clean" = t \
	&& cp "$filename_noext.log" "$orig_pwd"
      exit 1
    fi
  fi

d677 1
a677 1
$verbose "$0: done."
@


1.1.1.7
log
@import last gplv2 version
@
text
@d3 1
a3 1
# Id: texi2dvi,v 1.34 2004/12/01 18:35:36 karl Exp
d30 1
a30 1
rcs_revision='Revision: 1.34'
d33 1
a33 1
version="texi2dvi (GNU Texinfo 4.8) $rcs_version
d68 1
a68 2
  -r, --recode         call recode before TeX to translate input characters
  -t, --command=CMD    insert CMD in copy of input file
a91 1
recode=false
d117 1
a117 1
#
d173 1
a191 2
    -q | -s | --q* | --s*) quiet=t; batch=true;;
    -r | --r*) recode=true;;
d232 1
a232 1
#
d252 1
a252 1
#
d313 1
a313 1
# Compute the list of xref files.
d316 25
a340 23
get_xref_files ()
{
  # Get list of xref files (indexes, tables and lists).
  # Find all files having root filename with a two-letter extension,
  # saves the ones that are really Texinfo-related files.  .?o? catches
  # many files: .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
  for this_file in "$1".?o? "$1".aux "$1".?? "$1".idx; do
    # If file is empty, skip it.
    test -s "$this_file" || continue
    # 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.
    first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
    if (test "x$first_character" = "x\\" \
        && sed 1q $this_file | grep -v '^\\input *texinfo' >/dev/null) \
       || test "x$first_character" = "x'" \
       || test "x$first_character" = "x@@"; then
      xref_files="$xref_files ./$this_file"
    fi
  done
  echo "$xref_files"
}
a406 4
  # _rcd.  The Texinfo file recoded in 7bit.
  tmpdir_rcd=$tmpdir/rcd
  filename_rcd=$tmpdir_rcd/$filename_noext.$ext

d412 1
a412 1
  mkdir $tmpdir_src $tmpdir_xtr $tmpdir_rcd $tmpdir_bak || exit 1
a490 1
      language=latex
a504 1
      language=texinfo
d509 1
a509 7
        # MetaPost also uses the TEX environment variable.  If the user
        # has set TEX=latex for that reason, don't bomb out.
        if echo $TEX | grep 'latex$' >/dev/null; then
          tex=tex  # don't bother trying to find etex
        else
          tex=$TEX
        fi
d557 1
a557 1
    *file-line-error*) tex_args="$tex_args --file-line-error";;
d588 1
a588 1
$textra" "$filename_input" >"$filename_xtr"
a591 20
  # If this is a Texinfo file with a specified input encoding, and
  # recode is available, then recode to plain 7 bit Texinfo.
  if test $language = texinfo; then
    pgm='s/\(^\|.* \)@@documentencoding  *\([^ ][^ ]*\)\( .*\|$\)/\2/  
	t found                                                
	d                                                     
	:found                                               
	q'
    encoding=`sed -e "$pgm" "$filename_input"`
    if $recode && test -n "$encoding" && findprog recode; then
      $verbose "Recoding from $encoding to Texinfo."
      if recode "$encoding"..texinfo <"$filename_input" >"$filename_rcd" \
         && test -s "$filename_rcd"; then
        filename_input=$filename_rcd
      else
        $verbose "Recoding failed, using original input."
      fi
    fi
  fi

d599 1
a599 1
    orig_xref_files=`get_xref_files "$filename_noext"`
d660 3
a662 3
    cmd="$tex $tex_args"
    $verbose "Running $cmd $filename_input ..."
    if $cmd "$filename_input" >&5; then :; else
d684 1
a684 1
    new_xref_files=`get_xref_files "$filename_noext"`
d724 2
a725 2
    $verbose "Running $cmd $filename_input..."
    if $cmd "$filename_input" >&5; then :; else
@
