Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!acorn!moncam!harry From: harry@moncam.co.uk (Jangling Neck Nipper) Newsgroups: comp.unix.questions Subject: What's the return status of a pipeline??? Keywords: lpr,pipe,filter,status Message-ID: <186@marvin.moncam.co.uk> Date: 9 May 89 20:45:24 GMT Organization: Monotype ADG, Cambridge, UK Lines: 92 I wrote a filter for lpr some time ago, but it's never worked properly, and I was wondering if somebody might be able to help me out. The printcap entry is: lp|ps|apple|lwriter|Apple Laserwriter:\ :lp=/dev/null:if=/usr/local/bin/IF_lwriter:lf=/usr/adm/lprlog:\ :sd=/usr/spool/lpd/apple:af=/usr/adm/lprlog:\ :pw#102:pl#78:mx#0: The filter program IF_lwriter is: ------------------------------------- #!/bin/csh # # [-c] -w -l -i -n -h # # filter used by lpr -P[ps|apple] &c. setenv LWRITER "LaserWriter Plus" set BIN = /usr/local/bin if ("$1" == "-c") then set user = $6 set host = $8 set acct = $9 else set user = $5 set host = $7 set acct = $8 endif # # Log this print... # echo "" >> $acct date >> $acct echo $user@$host printing to $LWRITER >> $acct # # catch signals... # onintr quit # # DO IT!!! # $BIN/psfilter -b $* | $BIN/lwriter -pI "$LWRITER" $* >>& $acct # # Say what happened # quit: set printer_status = $status switch ($printer_status) case 0: echo job was sucessful >> $acct breaksw case 1: echo job failed and will be reprinted >> $acct breaksw case 2: echo job deleted >> $acct breaksw default: echo unknown status $printer_status >> $acct breaksw endsw exit $printer_status ------------------------------------- It is the `lwriter' filter that *should* be determining the status, namely 0, 1 or 2, and I've tried dummy shell scripts and found that it's always the filter at the *end* of the pipe that determines the status, so this should be okay, but in fact all I ever get is status `0', no matter *what* return status I made `psfilter' or `lwriter' return. Is there anything fundamentally wrong with the filter??? -- ,---.'\ ( /@ )/ Nothing is true. /( _/ ) Everything is permitted. \,`---'