*BSD News Article 28521


Return to BSD News archive

Xref: sserve comp.sys.sun.admin:27347 comp.unix.bsd:13623
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!pipex!sunic!ugle.unit.no!ravn.runit.sintef.no!rolfh
From: rolfh@runit.sintef.no (Rolf Petter Halle)
Newsgroups: fa.sun-manager,comp.sys.sun.admin,comp.unix.bsd
Subject: Solution: OF/IF filter problems with lpr
Date: 16 Mar 1994 08:57:33 GMT
Organization: Computing center at the University of Trondheim, Norway
Lines: 26
Distribution: world
Message-ID: <2m6hlt$392@ugle.unit.no>
References: <2m3qrn$jtc@ugle.unit.no>
NNTP-Posting-Host: ravn.runit.sintef.no
Keywords: lpd,lpr,filters

I got this solution from Tor Egge (tegge@idt.unit.no), it appears to
work, but the pseduo-code below is written by me, so any errors are due
to me :-)

The question was basically: How to get a banner page for every print job when
using if/of together?

The following pseudo-code part of the of filter shows the solution:

sub handle_banner{
  while(!eof(stdin) && not read \031\1) {
    read input and save/convert to file for further treatment;
  }
  if (eof(stdin)) {
    return;
  } else {
    suspend myself;
    handle_banner;   # Handle next banner from stdin when resumed
  }
}

I've promised him a Pizza for this...

Thanx to the others who responded.

Rolf