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