1fbc94a17Sniklas#!/bin/sh 2fbc94a17Sniklas# Auxiliary script to work around TeX 3.0 bug. ---- tex3patch ---- 3fbc94a17Sniklas# patches texinfo.tex in current directory, or in directory given as arg. 4fbc94a17Sniklas 5fbc94a17SniklasANYVERSION=no 6fbc94a17Sniklas 7fbc94a17Sniklasfor arg in $1 $2 8fbc94a17Sniklasdo 9fbc94a17Sniklas case $arg in 10fbc94a17Sniklas --dammit | -d ) ANYVERSION=yes ;; 11fbc94a17Sniklas 12fbc94a17Sniklas * ) dir=$arg 13fbc94a17Sniklas esac 14fbc94a17Sniklasdone 15fbc94a17Sniklas 16fbc94a17Sniklasif [ -z "$dir" ]; then 17fbc94a17Sniklas dir='.' 18fbc94a17Sniklasfi 19fbc94a17Sniklas 20*a1acfa9bSespieif [ 2 -lt $# ] || [ ! -f "$dir/texinfo.tex" ]; then 21fbc94a17Sniklas echo "To patch texinfo.tex for peaceful coexistence with Unix TeX 3.0," 22fbc94a17Sniklas echo "run $0" 23fbc94a17Sniklas echo "with no arguments in the same directory as texinfo.tex; or run" 24fbc94a17Sniklas echo " $0 DIRECTORY" 25fbc94a17Sniklas echo "(where DIRECTORY is a path leading to texinfo.tex)." 26fbc94a17Sniklas exit 27fbc94a17Sniklasfi 28fbc94a17Sniklas 29fbc94a17Sniklasif [ -z "$TMPDIR" ]; then 30fbc94a17Sniklas TMPDIR=/tmp 31fbc94a17Sniklasfi 32fbc94a17Sniklas 33fbc94a17Sniklasecho "Checking for \`dummy.tfm'" 34fbc94a17Sniklas 35fbc94a17Sniklas( cd $TMPDIR; tex '\relax \batchmode \font\foo=dummy \bye' ) 36fbc94a17Sniklas 37fbc94a17Sniklasgrep -s '3.0' $TMPDIR/texput.log 38*a1acfa9bSespieif [ 1 = "$?" ] && [ "$ANYVERSION" != "yes" ]; then 39fbc94a17Sniklas echo "You probably do not need this patch," 40fbc94a17Sniklas echo "since your TeX does not seem to be version 3.0." 41fbc94a17Sniklas echo "If you insist on applying the patch, run $0" 42fbc94a17Sniklas echo "again with the option \`--dammit'" 43fbc94a17Sniklas exit 44fbc94a17Sniklasfi 45fbc94a17Sniklas 46fbc94a17Sniklasgrep -s 'file not found' $TMPDIR/texput.log 47fbc94a17Sniklasif [ 0 = $? ]; then 48fbc94a17Sniklas echo "This patch requires the dummy font metric file \`dummy.tfm'," 49fbc94a17Sniklas echo "which does not seem to be part of your TeX installation." 50fbc94a17Sniklas echo "Please get your TeX maintainer to install \`dummy.tfm'," 51fbc94a17Sniklas echo "then run this script again." 52fbc94a17Sniklas exit 53fbc94a17Sniklasfi 54fbc94a17Sniklasrm $TMPDIR/texput.log 55fbc94a17Sniklas 56fbc94a17Sniklasecho "Patching $dir/texinfo.tex" 57fbc94a17Sniklas 58fbc94a17Sniklassed -e 's/%%*\\font\\nullfont/\\font\\nullfont/' \ 59fbc94a17Sniklas $dir/texinfo.tex >$TMPDIR/texinfo.tex 60fbc94a17Sniklasmv $dir/texinfo.tex $dir/texinfo.tex-distrib; mv $TMPDIR/texinfo.tex $dir 61fbc94a17Sniklas 62fbc94a17Sniklasif [ 0 = $? ]; then 63fbc94a17Sniklas echo "Patched $dir/texinfo.tex to avoid TeX 3.0 bug." 64fbc94a17Sniklas echo "The original version is saved as $dir/texinfo.tex-distrib." 65fbc94a17Sniklaselse 66fbc94a17Sniklas echo "Patch failed. Sorry." 67fbc94a17Sniklasfi 68fbc94a17Sniklas----------------------------------------tex3patch ends 69fbc94a17Sniklas 70fbc94a17Sniklas 71