#!/usr/bin/sh # (c) Copyright 1993,1994 Hewlett-Packard Company. All Rights Reserved. #@(#) $Header: /users/hpnp/odyssey/repository/sh/net_genericplotter.psh,v 1.10 1999/10/12 09:28:38 hpnp Exp $ # USER CAUTION: If any changes are desired, you should first make a copy # of this model under a new name. Changes can then be made to the copy #=======================================================================# # # # OPTIONS RECOGNIZED: # # # # Language Switch # # auto script determines the personality (PS or HPGLx) # # postscript print in PostScript mode # # hpgl send HPGL file to plotter wrapped with IN/PG # # hpgl2 send HPGL2 to plotter wrapped with IN/PG # # relay pass the data to the plotter without adding any # # options or personality switching statement # # or HPGLx commands # #=======================================================================# #[ For WJA use #version E.10.05 #supports Generic plotter # by Devu 1 oct 1999] PERSONALTY="AUTO" # CHANGE LANGUAGE BAUDRATE="9600" PRINTMODEL="genericplottor" # CHANGE PRINTER MODEL TEOJ="off" # CHANGE TRUE END OF JOB BANNER="na" # CHANGE BANNER PAGE PRINTING HPNPS=/opt/hpnp/bin/hpnps # for serial connection # [ Modified by Suresha on 26th Sep 99 to support JPIU HPNPS=/opt/hpnpl/bin/hpnps # end of change by suresha ] PATH="/usr/bin:/usr/lib" export PATH # set up redirection of stderr OS=`uname` if [ "$OS" = "HP-UX" ] then log=/var/adm/lp/log else if [ -w "/var/spool/lp/logs/lpsched" ] then log="/var/spool/lp/logs/lpsched" else log="/dev/null" fi fi exec 2>>$log # Save the arguments to the model printer=`basename $0` reqid=$1 user=$2 title=$3 # CHANGE TITLE copies=$4 # CHANGE COPIES options=$5 # CHANGE OPTIONS # Assume that the rest of the arguments are files shift; shift; shift; shift; shift files="$*" # Set up interface (parallel/serial, no effect on JetDirect) if [ -t 1 ] then stty raw $BAUDRATE -parenb cs8 ixon -istrip clocal <&1 2>/dev/null fi # Handle disable and cancel traps. trap "trap 15; kill -15 0; exit 0 " 15 # initialize the variables # Default Personality # Other possible lang_user/lang values: PCL/PCL, PS/PS, RELAY/RELAY, # HPGL/HPGL, HPGL2/HPGL2 lang_user=$PERSONALTY lang=$PERSONALTY # Determine which options have been invoked for i in $options do case "$i" in auto) lang="AUTO" lang_user="AUTO";; hpgl) lang="HPGL" lang_user="HPGL";; hpgl2) lang="HPGL2" lang_user="HPGL2";; postscript) lang="PS" lang_user="PS";; relay) for file in $files; do cat "$file" done exit 0;; esac done # ********** Start sending bytes out **************** echo "\033%-12345X@PJL" # Begin-of-Job #echo "@PJL JOB NAME = \"Job:$reqid; User: $user\"" # Print the spooled files i=1 while [ $i -le $copies ] do for file in $files do if [ $lang_user = "AUTO" ] then if [ -x $HPNPS ] then # file does exist $HPNPS -q <$file > /dev/null pers=$? if [ $pers -eq 1 ] then #PS lang="PS" elif [ $pers -eq 0 ] then #not PS and no ESC, this is text and should print RELAY not HPGL lang="HPGL2" elif [ $pers -eq 2 ] then #not PS and at least one ESC lang="HPGL2" elif [ $pers -eq 3 ] then #UEL and PJL at beginning of file lang="RELAY" fi else # file not exist lang_user="HPGL2" # no need to stay AUTO for next file lang="HPGL2" fi fi case "$lang" in HPGL) # echo "\033%-12345X@PJL enter language=HPGL" echo "IN;\n" cat "$file" 2>&1 # straight to the printer echo "PG;\n" echo "\033%-12345X\c";; HPGL2) # echo "\033%-12345X@PJL enter language=HPGL2" echo "IN;\n" cat "$file" 2>&1 # straight to the printer echo "PG;\n" echo "\033%-12345X\c";; PS) # echo "\033%-12345X@PJL enter language=postscript" cat "$file" 2>&1 # straight to the printer echo "\033%-12345X\c";; RELAY) cat "$file" 2>&1 # straight to the printer echo "\033%-12345X\c";; esac done i=`expr $i + 1` done # end of job echo "\033%-12345X\c" # RS-232 interface insure all buffers are flushed to printer if [ -t 1 ] then stty raw $BAUDRATE -parenb cs8 ixon -istrip clocal <&1 2>/dev/null fi exit 0