home *** CD-ROM | disk | FTP | other *** search
- :
- # @(#) imagen.sh 1.2 86/12/17
- #
- # Copyright (C) The Santa Cruz Operation, 1986.
- # This Module contains Proprietary Information of
- # The Santa Cruz Operation, Microsoft Corporation
- # and AT&T, and should be treated as Confidential.
- #
-
- :
- # IMAGEN SYSTEM V Spooler Interface
- # for spooling impress, text, troff input, and troff output files
- #
- # Install with:
- #
- # lpadmin -p$printer -v$device -iimagen.$type
- #
- # Where: $printer - name associated with printer
- # $device - physical device line
- # $type - communications interface:
- # sbs Serial Byte Stream.
- # pbs Parallel Byte Stream.
- # spp Sequence Packet Protocol.
- # Invoke with:
- #
- # lp -d$printer -n$copies -t$title [opts] files
- #
- # Legal opts values are:
- #
- # -oli - input file is language imPress
- # -olp - input file is text for line printing
- # -olt - input file is old style troff input
- # -olfi - input file is full imPress file
- # (already has document header)
- # -oldvi - input file is dvi format (TEX output)
- # -olc - input file is C/A/T format (old style troff output)
- # -ot$flags- options to be passed to troff
- # ( e.g. "-ot-ms" )
- # -ov$flags- options to be passed to dviimp
- # ( e.g. "-od-d" )
- # -oc$flags- options to be passed to catimp
- # ( e.g. "-od-v" )
- # -ob - toggle id banner generation
- # -ohname - host machine is <name>
- # -ouname - charge printing to user <name>
- # -oixxx - document header flags for impress where xxx is
- # 2 - print two forms per page
- # O - print outline on page
- # r - toggle page reversal
- # c - toggle page collation
- # J - toggle printing of job header page
- # R - print rules on page
- # m - toggle error message detail
- # j - toggle jam resistance
- #
- #####################################################################
- #
- # Portions Copyright (c) 1985 IMAGEN Corporation.
- # Portions Copyright (c) 1985,1986 The Santa Cruz Operation, Inc.
- # All rights reserved.
- # XENIX is a registered trademark of Microsoft Corporation.
- #
-
- PATH=/bin:/usr/bin
-
- comm=/usr/lib/ipbs
- stsfile=/usr/spool/lp/imagen.sts
- logfile=/usr/spool/lp/imagen.log
- account=/usr/adm/imagen
-
- #
- # programs and filters
- #
- itroff=itroff
- dviimp=dviimp
- catimp=catimp
-
- #
- # default settings
- #
-
- DFLFILE=/etc/default/imagen
- [ -r $DFLFILE ] && . $DFLFILE
- : ${JAMPROOF:=no}
-
- #
- # options for document control
- #
- ftype=printer
- forms=1
- outlines=off
- jobheader=on
- pagereversal=off
- pagecollation=on
- rules=off
- banner=on
- jamresistance=$JAMPROOF
- messages=on
-
- #
- # command line parameters
- #
- prntr=`basename $0`
- reqid=$1
- usrid=$2
- title=$3
- copies=$4
- options=$5
- fname=$6
-
- shift; shift; shift; shift; shift
- files="$*"
-
- if [ -r /etc/systemid ]; then
- host=`sed 1q /etc/systemid`
- else
- host=`uname -n`
- [ "$host" = "(empty)" ] && host=`uname`
- fi
- charge=$usrid
-
- #
- # parse the spooler device dependent options
- #
- tflags= cflags= dviflags=
- for i in $options
- do
- case "$i" in
- li)
- ftype=impress
- ;;
- lp)
- ftype=printer
- ;;
- lfi)
- ftype=fullimpress
- ;;
- lt)
- ftype=troff
- ;;
- ldvi)
- ftype=dvi
- ;;
- lc)
- ftype=cat
- ;;
- t*)
- temp=`echo "$i" | sed -e "1s/t//"`
- tflags="$tflags $temp"
- ;;
- c*)
- temp=`echo "$i" | sed -e "1s/c//"`
- cflags="$cflags $temp"
- ;;
- v*)
- temp=`echo "$i" | sed -e "1s/v//"`
- dviflags="$dviflags $temp"
- ;;
- i2)
- forms=2
- ;;
- iO)
- outlines=on
- ;;
- ir)
- pagereversal=on
- ;;
- ic)
- pagecollation=off
- ;;
- iR)
- rules=on
- ;;
- iJ)
- jobheader=off
- ;;
- im)
- messages=off
- ;;
- ij)
- jamresistance=on
- ;;
- b)
- banner=off
- ;;
- h*)
- host=`echo "$i" | cut -c2-`
- ;;
- u*)
- charge=`echo "$i" | cut -c2-`
- ;;
- esac
- done
-
- #
- # build the document header
- #
- iflags="jobheader $jobheader, copies $copies"
-
- if [ $banner = on ]
- then
- iflags="$iflags, owner \"$usrid\""
-
- user=`sed -n "s/^$usrid:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
- [ -n "$user" ] && iflags="$iflags, user \"$user\""
-
- iflags="$iflags, name \"$reqid\""
- [ -n "$title" ] && iflags="$iflags, title \"$title\""
- iflags="$iflags, printer \"$prntr\", date \"`date`\", machine \"$host\""
- fi
-
- iflags="pagereversal $pagereversal, $iflags"
- iflags="pagecollation $pagecollation, $iflags"
- iflags="messagedetail $messages, $iflags"
- iflags="jamresistance $jamresistance, $iflags"
-
- #
- # invoke the specified filter for input
- #
- case $ftype in
-
- fullimpress)
- echo "@Document($iflags)\c"
- cat $files 2>&1
- ;;
-
- impress)
- echo "@Document(language impress, $iflags)\c"
- cat $files 2>&1
- ;;
-
- troff)
- echo "@Document(language impress, $iflags)\c"
- $itroff $tflags -sc $files | $catimp $cflags -i -
- ;;
-
- cat)
- echo "@Document(language impress, $iflags)\c"
- cat $files | $catimp $cflags -i -
- ;;
-
- dvi)
- echo "@Document(language impress, $iflags)\c"
- cat $files | $dviimp $dviflags -i -
- ;;
-
- printer)
- [ $forms != 1 ] && iflags="formsperpage $forms, $iflags"
- [ $rules = on ] && iflags="rules, $iflags"
- [ $outlines = on ] && iflags="outlines, $iflags"
- echo "@Document(language printer, $iflags)\c"
- cat $files 2>&1
- ;;
-
- *)
- echo "@Document(language printer, $iflags)\c"
- echo "\n\n\nBAD DOCUMENT TYPE: $ftype"
- ;;
-
- esac | $comm -s -o -l $logfile -a $stsfile -A $account -n "$charge" -h "$host"
-