[alt.sources.d] Dviselect & dvisplit

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

I posted a note in the newsgroup gnu.emacs.lisp.manual regarding splitting
up the 500+ page Emacs Lisp reference manual. In that note I included the
following short shell script and noted that I had made a one line change to
dviselect (authored by Chris Torek - it's a great program, Chris) to cause
it to exit with a status of 1 if no pages of output were generated.

I've had several requests for the modified dviselect, some from people who
seemed to not be able to get ahold of the original. I got dviselect from the
utilities subdirectory of the texx2.8 distribution and repackaged it
somewhat so that it is a standalone piece of software. It will be posted to
alt.sources (in six parts). If you can't get it from there, let me know and
I'll arrange to mail them pieces to you.

#!/bin/sh

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)