home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- #
- # Copyright Novell Inc. 1991
- # (C) Unpublished Copyright of Novell, Inc. All Rights Reserved.
- #
- # No part of this file may be duplicated, revised, translated, localized
- # or modified in any manner or compiled, linked or uploaded or
- # downloaded to or from any computer system without the prior written
- # consent of Novell, Inc.
- #
- # NetWare Unix Client
- # Author: Gary B. Tomlinson
- # Created: 5/15/91
- #
- # SCCS ID: 1.5
- # delta: 2/14/92 15:34:15
- #
- # MODULE:
- # The PostScriptFilter - The NUC Client Network Printer NeXT2_0
- # lpd spooler PostScript filter program.
- # Component of the NUC PCLIENT Services.
- #
- # ABSTRACT:
- # The PostScriptFilter.c contains the NeXT platform dependent
- # printjob() PostScript filter interface program, which services all
- # NetWare PostScript Printers in behalf of printjob() in the lpd(8)
- # spooler. This shell script establishes a pipe which reads from the
- # print file mapped onto STDIN, any necessary print filter program,
- # and the printjob_nucps(1) shell backend command. The printjob()
- # function linked into the lpd(8), PrintPanel(GUI) programs calls
- # this program to spool print files to NetWare QMS print queues.
- #
- # NOTE:
- # The print system model implemented by Novell on NeXT platforms
- # follows the file system model for dependent file systems. The NetWare
- # NCP Printer Service Class is represented by the following dependent
- # shell commands:
- # PostScriptFilter (This Shell Script)
- # independentFilter (Parent Shell Script)
- # displayq_nucps (Related Shell Script)
- # printjob_nucps (This Scripts PIPE Child Program)
- # rmjob_nucps (Related Program)
- #
- #
-
- #
- # BEGIN_MANUAL_ENTRY(PostScriptFilter(1), \
- # ./man/shell/print/client/NeXT/PostScriptFilter)
- # NAME
- # PostScriptFilter, IF, GF, NF, TF, RF, VF, CF, DF
- # - Set up Spoolng PIPE of a NeXT print file to
- # NetWare QMS. Member of the NUC PCLIENT Suite.
- #
- # SYNOPSIS
- # ./PrinterFilters/PostScript/CF -xPxWidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/PostScript/DF -xPxWidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/PostScript/GF -xPxWidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/PostScript/IF [-c] -wChWidth -lChLength -iChIndent
- # [-f printFileName] -n userName -h hostName
- # [-R resolution] [-M] -p printerName accountingFileName
- #
- # ./PrinterFilters/PostScript/NF -xPxWidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/PostScript/RF -wChWidth -lChLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/PostScript/TF -xPxwidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # ./PrinterFilters/PostScript/VF -xPxwidth -yPxLength -n userName
- # -h hostName [-R resolution] [-M] -p printerName
- # accountingFileName
- #
- # OPTIONS
- # accountingFileName - Name of accounting file.
- # -c - Pass control characers through. Those in
- # addition to CR, LF, FF, and HT. Used with
- # ASCII files.
- # -f printFileName - Name of NeXT file being printed.
- # -h hostName - Name of host print file originated on.
- # -iChIndent - Left margin indentation in characters. Used
- # with ASCII files.
- # -lChLength - Length of page in lines. Used with
- # ASCII files.
- # -n userName - Name of User who spooled the file.
- # -p printerName - Name of printer known by on NeXT work station.
- # -wChWidth - Width of page in characters. Used with
- # ASCII files.
- # -xPxWidth - Width of page in pixels. Used for Bit Maps.
- # -yPxLength - Length of page in pixels. Used for Bit Maps.
- # -M - Printer is to be manually fed.
- # -R resolution - Resolution in Dots Per Inch of print
- # print resolution desired.
- #
- # INPUT
- # None.
- #
- # OUTPUT
- # Successfull - Silently exits back to printjob() in parent lpd(8)
- # Failure - Abort message formatted and displayed on
- # STDOUT.
- #
- # DESCRIPTION
- # The PostScriptFilter sets up the unspooling PIPE of a file being
- # scheduled for lpd[printjob.o] to a remote NetWare PostScript printer. It
- # is invoked by its filter name in printcap(5)/netinfo(5). This shell
- # script sets up a pipe to its printjob_nucps(1) NetWare handler with the
- # appropriate filter pushed. All filtering is done on the NeXT work
- # station prior to spooling it over the wire.
- #
- # Note:
- # All names are hard linked to the same shell script for
- # servicing. The called name indicates the filter setup
- # model to be used.
- #
- # FILES
- # /usr/netware/bin/PrinterFilters/PostScript/CF
- # /usr/netware/bin/PrinterFilters/PostScript/DF
- # /usr/netware/bin/PrinterFilters/PostScript/GF
- # /usr/netware/bin/PrinterFilters/PostScript/IF
- # /usr/netware/bin/PrinterFilters/PostScript/NF
- # /usr/netware/bin/PrinterFilters/PostScript/RF
- # /usr/netware/bin/PrinterFilters/PostScript/TF
- # /usr/netware/bin/PrinterFilters/PostScript/VF
- #
- # SEE ALSO
- # NWcpsIntroduction(3), printjob_nucps(1)
- #
- # END_MANUAL_ENTRY
- #
-
- #
- # Define the Adobe Transcript Filters
- #
- TRANSCRIPT_PATH="/usr/lib/transcript"
- PDITROFF="$TRANSCRIPT_PATH/psdit"
- PSENSCRIPT="/usr/bin/enscript"
- PTROFF="$TRANSCRIPT_PATH/pscat"
- PPLOT="$TRANSCRIPT_PATH/psplot"
-
- #
- # Define The PostScript Magic Word
- #
- PS_MAGIC="^\%\!"
- #
- # Default the Variables
- #
- fileName=""
- PENSCRIPT=""
- ifProgramName=`basename $0`
- DEFAULT_FILTER="/bin/cat"
-
- #
- # Note: The following was dervived from the Adobe Transcript psint.sh
- # shell script.
- #
- # Note:
- # The NeXT assumes its own printer, thus reversal desired. In NetWare
- # Many PostScript printers are supported, thus the .options will
- # determine client reversal filtering.
- # REVERSE=//usr/lib/transcript/psrv
-
- VERBOSELOG=1
- BANNERFIRST=0
- BANNERLAST=0
- BANNERPRO=$TRANSCRIPT_PATH/banner.pro
- # Note:
- # The pstext encoder assumes Transcript Driver, thus NetWare uses the
- # standard enscript encoder instead.
- # PSTEXT=$TRANSCRIPT_PATH/pstext
-
- # load the values from the .options file if present
- # NOTE:
- # Only the REVERSE= environment variable is supported at this time.
- # The BANNERFISRT, BANNERLAST, BANNERPRO, VERBOSELOG, and PSTEXT can
- # be implemented with varying degrees of conformance when time permits.
- #
- test -r ./.options && . ./.options
-
-
- #
- # Parse the command line to shell script
- #
- while [ $# != 0 ]
- do
- case "$1" in
-
- -c) # Pass Control Characters, Ignored!!
- ;;
-
- -f) # Name of print file
- fileName="$2";
- shift;
- ;;
-
- -h) # Host name of user who spooled, Ignored!!
- shift;
- ;;
-
- -i*) # Left margin indentation, Ignored!!
- ;;
-
- -l*) # Page Length in Character Lines, Ignored!!
- ;;
-
- -n) # User Name, Ignored!!
- shift;
- ;;
-
- -p) # Local Printer Name, Ignored!!
- shift
- ;;
-
- -w*) # Page Width in Characters, Ignored!!
- ;;
-
- -x*) # Page Width in Pixels, Ignored!!
- ;;
-
- -y*) # Page Length in Pixels, Ignored!!
- ;;
-
- -M) # Manual feed specified, Ignored!!
- ;;
-
- -R) # Printer Resolutin in DPI, Ignored!!
- shift;
- ;;
-
- *) # Accounting File, Ignored!!
- shift;
- ;;
-
- esac
- if [ $# != 0 ]
- then
- shift;
- fi
- done
-
- #
- # Decode the ifProgramName and set up the proper pipe
- #
- case $ifProgramName in
-
- gf)
- #
- # They need a PostScript PLOT graphic filter, use
- # the one provided by TransScript
- #
- if [ -n "$REVERSE" ]
- then
- # Run through Plot then page reversal
- $PPLOT | $REVERSE
- else
- # Simply unspool the PostScript
- $PPLOT
- fi
- ;;
-
- "if")
- #
- # They need a PostScript Text ENSCRIPT filter, use
- # the one provided by TransScript
- #
-
- if [ -n "$fileName" ]
- then
- #
- # Is the file alreay PostScript?
- #
- /usr/ucb/head -1 $fileName | grep $PS_MAGIC >/dev/null 2>&1
- if [ $? != 0 ]
- then
- #
- # No, setup for enscript encapsulation
- #
- if [ -z "$ENSCRIPT" ]
- then
- # Default to line printer style
- ENSCRIPT="-B -p-"
- fi
- PENSCRIPT="$PSENSCRIPT $ENSCRIPT"
- fi
- fi
-
- if [ -n "$PENSCRIPT" -a -n "$REVERSE" ]
- then
- # Encapsulate and run through page reversal
- $PENSCRIPT | $REVERSE
-
- elif [ -n "$PENSCRIPT" ]
- then
- # Run through encapsulation
- $PENSCRIPT
-
- elif [ -n "$REVERSE" ]
- then
- # Run through page reversal
- $REVERSE
- else
- # Simply unspool the PostScript
- $DEFAULT_FILTER
- fi
- ;;
-
- nf)
- #
- # They need a PostScript DITROFF phototypesetter filter, use
- # the one provided by TransScript
- #
- if [ -n "$REVERSE" ]
- then
- # Run through Plot then page reversal
- $PDITROFF | $REVERSE
- else
- # Simply unspool the PostScript
- $PDITROFF
- fi
- ;;
-
- tf)
- #
- # They need a PostScript TROFF phototypesetter filter, use
- # the one provided by TransScript
- #
- if [ -n "$REVERSE" ]
- then
- # Run through Plot then page reversal
- $PTROFF | $REVERSE
- else
- # Simply unspool the PostScript
- $PTROFF
- fi
- ;;
-
- *)
- #
- # How did we get called?
- #
- echo "$0: $ifProgramName Unknown print filter" >/dev/console;
- exit 2;
- ;;
- esac
-
- exit
-