[gnu.emacs.lisp.manual] Breaking up lispref.dvi

montnaro@sprite.crd.ge.com (Skip Montanaro) (11/12/89)

For those of you reading the Emacs Lisp Reference Manual with small paper
trays in their printers, or who must share your printer with other people,
here's a short shell script that uses Chris Torek's dviselect program to
split a dvi file into smaller chunks.

I modified dviselect slightly to exit with a 1 value if no pages of output
were generated. Let me know if you want it and I will mail it to you.

#!/bin/sh

# just a hack - invoke as
#	dvisplit NUM DVIFILE

NUM=$1
FIRST=1
LAST=$NUM
DOTSPERLINE=60
DOTS=0

dviselect -s -i $2 -o $2.$FIRST-$LAST $FIRST:$LAST

while [ $? = "0" ] ; do

    # a little feedback for the user
    echo -n "." ; DOTS=`expr $DOTS + 1`
    if [ $DOTS -ge $DOTSPERLINE ] ; then
	echo ""
	DOTS=0
    fi

    # select the pages
    FIRST=`expr $FIRST + $NUM`
    LAST=`expr $LAST + $NUM`
    dviselect -s -i $2 -o $2.$FIRST-$LAST $FIRST:$LAST

done

if [ $DOTS -gt 0 ] ; then
    echo ""
fi

rm -f $2.$FIRST-$LAST

exit 0

--
Skip Montanaro (montanaro@crdgw1.ge.com)