blob: 3d5a962eeae89e6aeaecb0709eaffbe593c6bff0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/sh -f
#
# Option processing first
OPTSTR="n:h:"
args=
while getopts $OPTSTR opt ; do
case $opt in
n ) LPUSER="$OPTARG" ;; # user name
h ) LPHOST="$OPTARG" ;; # originating host
esac
done
shift `expr $OPTIND - 1`
cat - > /tmp/scratch1/tex$PPID.tex
# Then we figure out where we are.
DIR=$PWD
# Then we move to a working directory
cd /tmp/scratch1
# Then we run LaTeX on the file. If the compile fails,
# we send the log file to the user and give up.
jlatex \\batchmode\\input tex$PPID.tex >/dev/null 2>&1 ||
{ cat /etc/lpdadmin/texerr1 tex$PPID.log | sendmail -oi $LPUSER; echo "BARF"; exit 0; }
#
# If it went okay, we check whether there were bibliographies
if test "`grep -c "There were undefined references" tex$PPID.log`" != "0" ; then
bibtex tex$PPID >/dev/null 2>&1
if test "`grep -c "error message.*)" tex$PPID.blg`" != "0" ; then
cat /etc/lpdadmin/biberr tex$PPID.blg | sendmail -oi $LPUSER
echo "BARF"
exit 0
fi
jlatex \\batchmode\\input tex$PPID.tex >/dev/null 2>&1 ||
{ cat /etc/lpdadmin/texerr2 tex$PPID.log | sendmail -oi $LPUSER; echo "BARF"; exit 0; }
jlatex \\batchmode\\input tex$PPID.tex >/dev/null 2>&1 ||
{ cat /etc/lpdadmin/texerr3 tex$PPID.log | sendmail -oi $LPUSER; echo "BARF"; exit 0; }
else
#
# Alternatively, we check whether there were labels and
# cross-references.
if test "`grep -c "Rerun to get cross-references right" tex$PPID.log`" != "0" ; then
jlatex \\batchmode\\input tex$PPID.tex >/dev/null 2>&1 ||
{ cat /etc/lpdadmin/texerr4 tex$PPID.log | sendmail -oi $LPUSER; echo "BARF"; exit 0; }
fi
fi
#
# If all's been done without error, we throw the DVI file
# through standard output and hope for the best!
cat tex$PPID.dvi
rm -f tex$PPID.*
|