#!/bin/sh PATH=/v/bin:/bin:/usr/bin MPLIB=/usr/lib/mp ERRLOG=mpxerr.log # file for an error log, if necessary TRERR=mpxerr # file for erroneous troff input, if any OUTERR=mpxerr.t # file for troublesome troff output, if any MPFILE=$1 # input file MPXFILE=$2 # output file DOTR=${TROFF:-'eqn -d\$\$ | troff -Tpost'} NL=' ' trap "rm -f mpx$$.* $ERRLOG; exit 4" 1 2 15 if newer $MPFILE $MPXFILE then $MPLIB/mptotr $MPFILE >mpx$$.i 2>$ERRLOG case $? in 0) ;; *) echo $NL'Command failed: ' $MPLIB/mptotr $MPFILE cat $ERRLOG rm -f mpx$$.i exit 1 ;; esac cat mpx$$.i | eval $DOTR >mpx$$.t case $? in 0) ;; *) mv -f mpx$$.i $TRERR echo $NL'Command failed:' cat $TRERR '|' $DOTR rm -f mpx$$.t exit 2 ;; esac $MPLIB/dmp mpx$$.t $MPXFILE 2>$ERRlOG case $? in 0) ;; *) mv -f mpx$$.t $OUTERR mv -f mpx$$.i $TRERR echo $NL'Command failed:' $MPLIB/dmp $OUTERR $MPXFILE cat $ERRLOG rm -f mpx$$.* exit 3 ;; esac rm -f $ERRLOG mpx$$.* fi