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