SUMMARY: Creating lpr input filter

From: Ashish Desai (U36842@uicvm.uic.edu)
Date: Sat Apr 18 1992 - 23:41:36 CDT


Sorry for posting the summary this late, here it is anyway:-

>Problem: Right now we have a shell script that created a header that is
>prefixed to a file before it is printed. That is, stick a header
>to the file and then do an lpr fname.
>I would like put the filter as a "printcap entry" input filter, which
>gets invoked when the file is printed using "lpr".
>I know that you can specify an input
>filter for a printer in the "printcap".
>The problem is I can't find documentation on how to write a filter
>such that "lpr" invokes it.
>
>System: SUN SPARCSTATION 1 and 1+.
>OS: 4.1.1

>Can anybody send me some suggestions.

----------------------------------------------------------
>From beldar@rimulac.microunity.com

A trivial example of what you want to do:

#!/bin/csh -f
cat /full/path/to/prefixfile
cat

----------------------------------------------------------
>From tom@uni-paderborn.de

There is some info in the Anserbook Rel 1 Issue 3

  System and Network Administration ( Book )
    12. Maintaining Printers and Print Servers ( Chapter )
      12.5 Output Filters ( Section )
        Output Filter Specifications ( Subsection )

-------------------------------------------------------
>From mills@ccu.UManitoba.CA

This was described in the Sys & Net Admin manual for 4.1, but was
omitted for 4.1.1. Here is a shell script we used for an if= filter.
It illustrates the calling conventions.

#!/bin/sh
#
# if filter for lpr
# filter [-c] -wwidth -llength -iindent -n login -h host acc_file
# files: 0 --> input data 1 --> printer 2 --> lf file
# return: 0: okay 1: reprint 2: discard
#

PATH=/usr/5bin:/usr/bin:/usr/ucb:/usr/local/bin
Z=`basename $0`
#
# parse options
#
for i in $*
do
        arg=`expr $1 : '..\(.*\)'`
        case $1 in
        -c) shift ;;
        -w*) form=$arg; shift;;
        -l*) length=$arg; shift;;
        -i*) indent=$arg; shift;;
        -n) shift; login=$1; shift;;
        -h) shift; host=$1; shift;;
        *) acc=$1;;
        esac
done

echo '\033%-12345X@PJL ENTER LANGUAGE=PostScript'
cat
echo '\033%-12345X\c'

exit 0

#!/end
-------------------------------------------------------------------------

Thanks to:

kalli!kevin@fourx.Aus.Sun.COM
mills@ccu.UManitoba.CA
eckhard@ikarus.ts.go.dlr.de
mario@wdc.sps.mot.com
kcurrans@CORDLEY.ORST.EDU
etnibsd!vsh@uunet.UU.NET
wls@cray.csd.uwm.edu
tom@uni-paderborn.de
beldar@rimulac.microunity.com



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:41 CDT