Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site sauron.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ittatc!dcdwest!sdcsvax!ncr-sd!ncrcae!sauron!wescott From: wescott@sauron.UUCP (Michael Wescott) Newsgroups: net.sources Subject: Laserjet+ interface and printer script Message-ID: <627@sauron.UUCP> Date: Fri, 21-Mar-86 11:34:06 EST Article-I.D.: sauron.627 Posted: Fri Mar 21 11:34:06 1986 Date-Received: Tue, 25-Mar-86 02:59:04 EST Reply-To: wescott@sauron.UUCP (Michael Wescott) Organization: NCR Corp., Advanced System Development, Columbia, SC Lines: 214 Keywords: laserjet There are two shell scripts here. hplp.sh is an program that goes into /usr/bin or /usr/local or ... hplp is an LP spooler interface program. It is set up for parallel port operation but should be easily modified for serial port operation. Hplp.sh is the program that handles setting up the data sent to the Laserjet for various options like changing fonts, portrait or landscape selection etc. It is invoked on the command line and automatically invokes "lp -dhplp ..." Sorry, no man page. pr -l110 file1 file2 file3 | hplp -Flp -l110 puts 100 lines of text (from the files) plus 5 line headers and trailers. It specifies portrait orientation and the line printer font. # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # hplp hplp.sh echo x - hplp cat > "hplp" << '//E*O*F hplp//' # #lp interface for hp laser jet #staight cat of file - no banner # x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" echo "\\033E\\c" echo "\\033&k2G\\c" echo "$x\n$x\n$x\n$x\n" banner "$2" echo "\n" user=`grep "^$2:" /etc/passwd | line | cut -d: -f5` if [ -n "$user" ] then echo "User: $user\n" else echo "\n" fi echo "Request id: $1 Printer: `basename $0`\n" date echo "\n" if [ -n "$3" ] then banner $3 fi copies=$4 echo "\n Copies: ${copies}" #reset echo "\\033E\\c" shift; shift; shift; shift; shift files="$*" i=1 while [ $i -le $copies ] do for file in $files do cat $file 2>&1 done i=`expr $i + 1` done #reset echo "\\033E\\c" exit 0 //E*O*F hplp// echo x - hplp.sh cat > "hplp.sh" << '//E*O*F hplp.sh//' #! /bin/sh # filter to set up for feeding data to the hp laserjet+ # -L = landscape -P = portrait # -m = margins off; use "pr -l## -f -t" instead of cat # -c ## = # of copies # -F xx = set font (for now only lp has effect, only in portrait mode) # -l xxx = set number of printed lines per page (used to calc VMI) # -a = set auto feed # -h = set hand feed # -n no conv of nl to cr + nl # -t no tabs expanded # -T xxxx -> title # defaults -Pa -l66 -c1 destination=hplp portrait=1 copies=1 lines=0 margin=1 autofeed=1 autocrnl=1 font=courier tabs=1 CAT=/bin/cat NEWF="newform -i -l200" set -- `getopt nPLc:ahl:mF:T: $*` if [ $? != 0 ] then echo "usage: hplp [-[PLFmaht] [-l##] [-c##]] [files]" exit 2 fi for i in $* do case $i in -L) portrait=0; shift;; -P) portrait=1; shift;; -m) margin=0; shift;; -h) autofeed=0; shift;; -a) autofeed=1; shift;; -F) shift; font=$1; shift;; -T) shift; title=$1; shift;; -l) shift; lines=$1; shift;; -c) shift; copies=$1; shift;; -n) autocrnl=0; shift;; -t) tabs=0; shift;; --) shift; break;; esac done if [ ${portrait} = 1 ] then if [ ${lines} = 0 ] then lines=66 fi if [ ${margin} = 1 ] then pagelength=10.0 else pagelength=10.5 CAT="/bin/pr -l${lines} -t -f" fi else if [ ${lines} = 0 ] then lines=48 fi if [ ${margin} = 1 ] then pagelength=7.5 else pagelength=8.0 CAT="/bin/pr -l${lines} -t -f" fi fi if [ -z "${title}" ] then title=$LOGNAME fi if [ -z "${title}" ] then title="Laserjet" fi # set VMI VMI=`dc <