Version ifhp-3.5.17 - Tue Feb 3 17:25:42 PST 2004

  GCC extensions are unloved by some ANSI compilers.
    (Fix and Patches Courtesy: Jim Trocki <trockij@transmeta.com>)

  Patch for ifhp which separates generation of jobnames
  from generation of display names. I see no reason why
  displaynames shouldn't contain for example ':'
  (Handy for displaying times...)
   (Patch from: Hermann Lauer <hermann.lauer@IWR.Uni-Heidelberg.De>)
  
  Added:
    Phaser 7700 (with amendments to to SNMP monitoring)
	(Courtesy of: Stuart Marshall <stuart@igpp.ucllnl.org>)

Version ifhp-3.5.16 - Fri Jan 2 07:28:39 PST 2004

  The file conversion table for the 'DEFAULT'
  printer had a2ps producing PCL output.  This should have
  been PostScript output.

Version ifhp-3.5.15 - Wed Dec 17 16:48:50 PST 2003

  ifhp.conf file was missing default ps_converter entry.

  Typeo in command argument parsing fixed.


Version ifhp-3.5.14 - Tue Dec 2 15:43:20 PST 2003

   If a printcap entry is provided as the PRINTCAP_ENTRY environment
   variable, it is used to initialize the IFHP configuration options.
   It turns out that the only option in conflict is the IFHP 'ps'
   (postscript) option and the LPD ps (printer status file) option.
   Only the 'lp' and options longer than two characters are used.
   
   You still need to use 'ifhp=...' for specifying options page
   control or other options that are order sensitive.  You can put
   all of the other IFHP options that normally are in the ifhp.conf
   entry into the printcap file.

   The order of processing of options is:
    a) printcap - config extracted
    b) printcap - ifhp=... from printcap processed
    b) command line -T options extracted
    c) value of 'config' and 'model' found from current set of options
    d) ifhp.conf read for model information
    e) printcap (options > 2 chars long), ifhp=... and -T options reprocessed

   The page and formatting options must still be specified in the
   :ifhp entry for proper processing.

    OLD:
     lp:...:ifhp=model=hp5si,status@,letter
    OLD:
     lp:...:model=hp5si:status@:ifhp=letter
   

   Added a fixup so that a PJL value of '1' matches 'on' and
   '0' matches 'off'.

   Discovered that the Fix_option_str value was being discarded
   rather than used when looking up options of the form: xx=\%s{key}
   Also, expansions of the form name = [ value_\%s{id} ] were not
   being handled correctly.

   Added the baseline code for using ifhp options found in PPD files.

   Added support for Sharp AR-507 and other printers

Version ifhp-3.5.13 - Mon Nov 17 08:40:15 PST 2003
  
   The ifhp-3.5.12 distributions that were put up on various web
   sites were incomplete.  Rather than try find and update them
   this version is simply a repackaging of the old version.


Version ifhp-3.5.12 - Fri Nov 14 13:54:02 PST 2003

  changed (char **) casts to (void *) casts

  ** SEE README.SNMP for details **
  Added snmp_printer_status to get printer status via SNMP.  Based
  on original check_printer_status script by John Perkins
  <john@cs.wisc.edu>. Tested with several printers.  Added README.SNMP
  to the top level README files.  This can be used to help in
  reporting page counts for HP4100i printers, among others.

  WARNING: if you plan to use SNMP monitoring, then use the APPSOCKET
  option as well.  This will cause connections to the printer to close
  and the SNMP agent will then indicate that the printer is 'idle'.  If
  the connection is open,  then several test printers reported their
  status as 'busy' rather than 'idle'.

    # if you want to use SNMP monitoring then use the snmp_printer_status
    # program.  This program will report the status of a printer
    # by polling it using SNMP.  Status will be read from both the
    # back channel (i.e. - connection to printer) and from the SNMP
    # monitoring program.  The 'snmp_dev' device is determinded by the
    # ifhp program; it depends on the appsocket and other options

    snmp_monitor@
    snmp_program=@FILTER_DIR@/snmp_printer_status -h "\%s{snmp_dev}" \
         -m "\%s{snmp_model}" -f "\%s{snmp_program_conf}"
    snmp_program_conf=@FILTER_DIR@/snmp_printer_status.conf

    # the snmp_dev is a 'pseudo-variable'.  If it is set
    # explictily by -Tsnmp_dev=IPADDR, else a printcap
    # :ifhp=...,snmp_dev=IPADDR,  option, and finally the
    # printcap :lp=IPADDR%port value is used.  The first one
    # found sets snmp_dev to IPADDR.

    # The snmp_printer_status.conf file has entries to specify the
    # SNMP Object Identifiers (OIDs) for variuos printers
    # The [model default] entry specifies a standard set of Printer MIB
    # OIDs to for status.
    # See the sample snmp_printer_status.conf file or the snmp_printer_status
    # man page for details.

    snmp_model=default

    # when we get status, we look for the following words in the
    # status to indicate that the printer is ready and/or idle.
    # Spaces in the status are replaced by underscores if necessary

    snmp_sync_status=ready power_save_mode
    snmp_end_status=ready idle

    # There are some totally brain dead printers that will NOT report
    # status correctly until a timeout period after the last close or
    # job sent.  These are evil and ugly,  but we love them anyways.
    # Delay snmp_wait_after_close seconds when you are using Appsocket
    # 
    snmp_wait_after_close=1

    # to use SNMP for sync purposes, set:
    # sync=snmp
    # to use SNMP for pagecount purposes, set:
    # pagecount=snmp
    # to use SNMP for waitend purposes, set:
    # waitend=snmp

  The snmp_printer_status program assumes that the device has some basic
  Printer-MIB functionality.  If it does not,  then you cannot obtain
  status reliably.

  Added the 'close_connection' option that closes appsocket connections
  after a transfer.  Apparently needed for some printers that do not
  recognize an end of job until they get a closed connection.

  In order to handle broken PJL status reporting from some printers, added
  the status_ignore and status_translate options. From the ifhp.conf file:
	## Status information is converted into strings of the form
	##  key=statusvalue.
	## The following keys are assumed to be valuable:
	##   status  - current device status
	##   error   - device error
	##   warn    - device error
	##   pagecount - device pagecount
	## Other status will be shown in the log file but not used,
    ## and only when it changes.
	## Ignore status reported with the following keys. 
	## These match the first characters of the keys.  You can
	## use _ to stand for blanks.  Match is done using globmatch
	## status_ignore=  markerlifecount prt*stuff
	## 
	##
	## Under some very bizzare circumstances such as broken PJL
	## implementations, you may need to translate the status keys from
	## the vendor supplied to the ones needed above.
	## Use status_translate to do the translation.  The entries have the
	##   oldvalue=newvalue
	## These match the first characters of the keys.  You can
	## use _ to stand for blanks.  Match is done using globmatch
	## status_translate= id=hostid *status=status
	## 


  Added foomatic support:

   lp:
     :ifhp=foomatic
     :ppd=/usr/share.../ppdfile
   OR
   lp:
     :ifhp=foomatic,ppd=/usr/share/.../ppdfile
   This will use the foomatic-rip program to process PostScript files.
   This is preliminary support and will be extended in later releases.

  Updated the ifhp.conf file for HP4100:
     [ hp4100 hp4200 hp4300 ]
     tc=hp4000_pcl
     pjl_waitend_byjobname
   (Thanks to: qiang lee <shijialist@yahoo.ca>)

    Added the ability to specify the PJL SET variable values.
        MANUALFEED=ENUMERATED;OFF,ON
        ORIENTATION=PORTRAIT!ENUMERATED;PORTRAIT,LANDSCAPE


Version ifhp-3.6.0 - Fri Sep  5 10:36:39 PDT 2003
 Fixed up the 'ifhpXXXX' temp file problem and added HPGL2 support.
 (Thanks to Sam Lown <samuel.lown@cern.ch>)

  There is now a 'send_job_rw_timeout' option that sets a maximum
 non-responding/non-accepting data time for a printer.  This allows
 you to set a timeout for the maximum time that you expect a normal
 job to take and gives you a way to try to manage printers that
 will lock up with an hard error when fed a bad PostScript, PCL file,
 network overload, or SNMP packet.

 However, it also will cause printers which, when they are off line or
 or when they have an out of paper condition, etc., perhaps to be
 identified as a bad printer.  It is a compromise and should only
 be used for this particuar situation.

 Fixed configure so that it now handles 'enable-OPTION'
 and 'disable-OPTION' correctly.

 Added the 'pjl_waitend_byjobname' patch.  Briefly,  this patch
 causes IFHP not to send a dummy job and to wait for the end of
 the original job using the PJL JOB facility.  This may not work
 for some printers that do job spooling,  and will send the end
 of job before the job is finished.  It may be useful on other
 printers where this is not a problem.
  (Clever idea by: "Raymond M. Reskusich" <reskusic@uiuc.edu>)


 Added some more agressive 64 bit file system support as suggested.
 (Neat suggestion by: Ben Woodard <woodard@redhat.com>)

 HP DesignJet 800ps support by
 Lars Kellogg-Stedman <lars@deas.harvard.edu>


Version ifhp-3.5.10 - Fri Jul 12 16:21:49 PDT 2002
  The top level install (make install) did not install
  the utilities correctly on systems that did not have a
  BSD install. 
   (Reported first by: Jason Keltz <jas@cs.yorku.ca>)

  Pdf2gs_converter should be pdf2ps_converter in ifhp.conf.in
   file.

  The code for += did not handle tc= inclusions correctly.
   (Side effect of this reported by: Jason Keltz <jas@cs.yorku.ca>)

  Updated some PostScript definitions for some printers.

  configure now uses AC_MSG_WARN.  The check for /dev/fd/xx
  now issues warning that PDF conversion may not work for
  the default PDF to PostScript conversion.

  The \%s{inputfile} option expands to:
    command line -e value (compatible with LPRng passing file
       name as the value of the -e option)
    OR /dev/fd/0 if -e value not defined
    OR - if /dev/fd facility is not available.
  This solves a problem with PDF to PostScript conversion, where
  the PDF conversion was done using GhostScript and GhostScript
  needed to perform a file seek operation, and the '-' (stdinput)
  specifier was deemed to be 'unseekable'.  Sigh... So we have
  this fix in ifhp.

  Updated the CREATE_CONFIGURE and STANDARD_configuration scripts.
  Using the automake, autoconf facilities.

Version ifhp-3.5.9 - Sat Jun 22 14:11:15 PDT 2002
  Fixed up tc parsing so it handles tc= [ xx ] by not expanding
  the xx entries (and tc=[xx], etc. as well).

  The configure tests for detecting the version of ghostscript
  were incorrect.  This really screwed up conversions.

  Installing the UTILS in FILTER_DIR/UTILS.  This makes them
  available for use.

  Added a README.TESTING file.  This contains notes on how to use
  the sendhp.sh script for testing.

  Missing initialization for 'pagecount_prog' in main();
  Fixed up problem with ifhp error message printing.
   (Found and patched by: Thierry Besancon <Thierry.Besancon@paris4.sorbonne.fr>)

  Added '-dPARANOIDSAFER' to ghostscript flags and made the security
  check cause an abort.  The ghostscript problems should be fixed
  by now.

  Added Canon imageRUNNER 550/600 ifhp.conf entry.  This printer is
  REALLY unusual.  May extend the printcap entry in the future.

  Couple of minor fixes to ifhp.conf
  (Patches by: Steven J. Birt <sbirt@sedona.ch.intel.com>)

Version ifhp-3.5.8 - Mon Apr 1 17:14:06 PST 2002

  New 'Appsocket' support and configuration
   lp:
     :lp=host%port
     :ifhp=model=xxx,appsocket
     :filter=/.../ifhp
     #:of=/.../ifhp

   You do not need to have /dev/null now,  you can have LPD
   open the connection, and then IFHP will simply use the
   connection information.  This greatly simplifies things.
   Note that you MUST use ifhp 3.5.8 or later for this to work.

   The 'Read_status' code has been savagely attacked,
  once again,  and the varous insane combinations of
  devices that have read return 0 or -1 when there is
  no data has been worked at again.
   Also, the code for parsing return status has been
  looked at and the odd case of PostScript printers that
  return a 'print' value WITHOUT a CR/LF has been attempted
  to be solved... I hope this is the last time we go around
  the rose bush on this one.  

   Also, the Xerox/Phaser 5400 has been added.  This device
  has the obnoxious habit of returning a JOB ID whose key (ID)
  conflicts with the INFO ID key (ID).  So we ignore any
  ID keys/value pairs unless they are returned by the 'PJL INFO'
  status.

  hp4l entry modified, Using 'laserjet', the printed area is shifted
  to the right on a 'portrait letter' piece of paper.  Using 'ljet4',
  it prints centered.  I.e., it looks better.
    (From: Luca Filipozzi <lfilipoz@debian.org>)

  ps_eoj, ps_eoj_at_start, ps_eoj_at_end now work correctly

  Once again the 'Appsocket' stuff rears its ugly head.
  Added a 'shutdown(1,SHUT_RW)' to FORCE the &*()()*& connection
  to the printer to be clobbered.  Grrrr..  Also, added a check
  for the special case when appsocket is specified and you
  are using the OF filter (banner printing).

   STATUS HELPERS
    sync=|/path_to_program
    pagecount=|/path_to_program
    waitend=|/path_to_program

   The sync, pagecount, and waitend functions can be implemented by
   running a 'status helper' program.  These programs are run with:
    STDIN = printing device
    STDOUT = STDERR = status
   
   Information written to STDOUT/STDERR should have the format: key=value
   as for PJL status information.  The same processing is done for this
   information as for the PJL USTATUS information,  so you can return
   an error code (CODE=xxxx) value that will be treated as a PJL USTATUS
   error.

   The following are 'special' keys:
     KEY     VALUE
     sync    1 (or nonzero)  - sync is done
     waitend 1 (or nonzero)  - waitend is done
     pagecount nnn           - pagecounter value

   Note: you can use a single program to do all 3 operations,
   in which case simply write 3 lines with sync, waitend, and pageount
   values, i.e:
      sync=1
      pagecount=205667
      waitend=1
   
   Alternatively,  if the sync,waitend, or pagecount
   program exits with 0 status, then success is assumed,
   otherwise IFHP will exit with an error status.
   Exit code:
     JSUCC - 0  - success
     JFAIL - 1  - fail with retry later
     JABORT - any other code

  Added special case parsing for PostScript printers
  that do not put NL (\n) at the end of error messages.
  Now handles %%[ status: xxx ]%%%%[ stuff: xxx ]%%
  correctly as
   %%[ status: xxx ]%%
   %%[ stuff: xxx ]%%
  (Pointed out by a Netatalk user: 
     Rob Joyce <robjoyce@ee.princeton.edu)

  I have added some fine grain control to pagecount_poll
  operations:
   The page count will be sampled 'pagecount_poll' times (0 or 1 is once)
   until it is stable, at pagecount_interval seconds.
   The pagecount_poll is for desperation only
     - default is pagecount_poll
        - pagecount_poll_start specifies number of polls at start
        - pagecount_poll_end specifies number of polls at end
    You can specify a non-zero pagecount timeout that will limit
    the amount of time that you try to get pagecounts
    This is dangerous if you are trying to get status by polling
    However, if your printer goes off line,  then you may have
    similar problems.
    #  pagecount_poll=5       default
    #  pagecount_poll_end=5   number of polls at start
    #  pagecount_poll_start=1 number of polls at end
    #  pagecount_interval=1   interval to poll
    #  pagecount_timeout=0    timeout for pagecount

  Added a new device: ps_appletalk
   This handles the case where you talk to a PostScript
  printer via the netatlk 'pap' routine.  The connected printer
  seems to not handle ^D or ^T, so you have to not put them there.
  It also seems that the printers may/will get pagecount and status
  information BUT they do not correctly indicate end of job.
  In this case you need to do pagecounting via polling:
   lp:ifhp=model=ps,ps_eoj@,ps_ctrl_t@,pagecount_poll_start=1,pagecount_poll_end=5

Version ifhp-3.5.7 - Tue Mar 5 20:46:29 PST 2002

  Lots of typos in the HOWTO fixed.
  (Mistakes pointed out and suggested changes by:
    Hans Peter Verne <h.p.verne@usit.uio.no>)

  Fixed up STRIP in configure.in so that it does not collide
   with autoconf STRIP

  Added a '--with-pagesize' option to allow you to specify default
   page size.  Currently only selects default size with PCL.
 
  Added a '--with-fontdir' to specify the font directories.
    The default directories are now:
       default:  FONT_DIR=${libexecdir}/fonts OR
            /usr/libexec/fonts/
       pcl_fontdir = ${FONT_DIR}/pcl 
       ps_fontdir = ${FONT_DIR}/ps 
       pjl_fontdir = ${FONT_DIR}/pjl 
 
   Note:  you can always add these to the END of ifhp.conf file:
     [default]
     ps_fontdir=/...
     pcl_fontdir=/...
     pjl_fontdir=/...

   Discovered a stupid typeo that somehow crept in via the joys of
   cut and paste.  Now the xx += stuff works again. Grrrr....
   (Nudged into looking at the right place by:
     "Steven J. Birt" <sbirt@sedona.ch.intel.com> )
      Note: this also solves the core dump problem reported by
      Christoph Beyer <christoph.beyer@desy.de>
   
   Found a possible core dump problem.
   Added safestrlen() to the paranoid string stuff.
   Fixed up a slew of casts so that gcc -W stops nattering.

   Changed GhostScript driver from ljet2 to ljet2p in ifhp.conf.

Version ifhp-3.5.6 - Sat Feb 23 07:36:20 PST 2002

  display@ option disables/enables display of console message
  display_size=nnn   sets size of display
    - lp:ifhp=display@   or ifhp -Tdisplay@
    - lp:ifhp=display_size=20 of ifhp -Tdisplay_size=20
   (Suggested by: Nick Bruton <Nick.Bruton@bristol.ac.uk)

  HOWTO correction: 'sduplex' is alias for 'duplexshort'
  (Correction by: Hans-Werner Paulsen <hans@MPA-Garching.MPG.DE>)

Version ifhp-3.5.5 - Fri Feb 22 16:47:59 PST 2002

  Lexmark 4039 should be:
    ps_sync=
      serverdict begin 0 exitserver
      statusdict begin true setenginesync end
    ps_async=
      serverdict begin 0 exitserver
      statusdict begin false setenginesync end
  (Reported by: Johan Bengtsson <elijah@dd.chalmers.se>)

  On the alpha, cc insists that (the line of the beast):
    > cc: Error: ../../src/perlobj.c, line 666:
         In this statement, "p->info.array.value" and "len" cannot be added. (noadd)
    > memmove(p->info.array.value+len, p->info.array.value, olen+1 );
    > --------^
    > As far as I can tell, p->info.array.value is a void*, so adding an int to
    > it is not allowed.  I suggest you explicitly cast it to (char *), like in the
    > previous line, *((char *)(p->info.array.value)+olen) = 0;
    > This is also the case in lines 615, 713, 813, and 837.
  Fixed.  I wonder why GCC -warn did not catch this?
  (Reported by: Hans Peter Verne <h.p.verne@usit.uio.no>)

  HP8100 'ps_tabloid' selection should really be
   ps_ledger.
  (Patch from: Steven J. Birt <sbirt@sedona.ch.intel.com>)

  Replaced PDF2PS with the GhostScript conversion stuff.
   (Idea from:  Thies Meincke <rz4a016@uni-hamburg.de>)


Version ifhp-3.5.4 - Fri Feb  8 19:23:05 PST 2002

  Use the new OBJ library and debug options:
  debug=
    0-6  - displays details about job handling.
           bigger the number, more detail
    database, database+1 - database+4 - ifhp.conf parsing
         REALLY verbose
    utils, utils+1 - utils+4 - OBJ library, REALLY verbose
                
  Fixed up PostScript printer messages when the printer
  detects an error.  This problem appears when a bad PostScript
  job is sent to the printer and the printer returns status
  information.  Some of the fields are 'unusual' for some
  vendors.  Rather than just display the 'error' information,
  I now put out the whole PostScript status message.

  The 'gs_converter' values needed '|cat >&3'.
  (From the mystery poster: imacat@mail.imacat.idv.tw)

  GhostScript developers have added a -dPARANOIDSAFER flag
  to solve some security issues.  Added this to the gs_converter
  definitions.

  The 'pagesize' option has been merged into the papersize
  facility.  Now you can select the papersize from PCL and
  PostScript using the same facility.  This is, as they say,
  a one-size-fits-all approach.  You must modify the ifhp.conf
  file now if you want to add more paper sizes/changes.
  This is kinda reasonable...

    The method used was to add a translation table
    (pcl_papersize_index for PCL), and to use the
    %d{key,lookuptable} facility.  This does a lookup on the
    value for 'key' and then translates it using it as a key
    into the lookuptable.  The lookuptable has to be a value
    which hash the format:  k=value k=value and this is then
    split into a hash and used for the lookup.


Version ifhp-3.5.3 - Tue Jan 22 16:17:59 PST 2002

  changed a lot of strxxx to safestrxxx to avoid problems with
  strxxx coredumps when passed NULL strings.

  Missing check to see if output is to a file - if so,  then
  we set status@
    (Courtesy: Jim Trocki <trockij@transmeta.com>)

Version ifhp-3.5.2 - Fri Dec 21 11:08:36 PST 2001

  New parallel port birectional IO support.
  This has been tested on RedHat 7.2 linux (Kernel 2.4.7-10),
  FreeBSD 4.4-Release.  It is REALLY stupid,  but it seems to
  work.  If you turn the printer on and offline then you might
  get an IO error.  Note that the printer must be connected and
  detected by the kernel for bidirectional IO to work,  otherwise
  the IEEE nibble mode will not be enabled.  I wish there was a
  way to force this to be rescanned at open(),  but it does not
  appear to be easily done.  Of course,  if you turn your printer
  on,  then it may or may not work...

  New USB port birectional IO support.
  This has been tested on RedHat 7.2 linux (Kernel 2.4.7-10),
  FreeBSD 4.4-Release.  The parallel port code seems to also
  handle USB ports as well.  Amazing...

  I have also put in some friendly 'hints' why you may not be
  getting status.  This will help the folks who have problems.
  I have also update the ifhp man page to reflect this.

  Added @PJL RESET to the PJL setup commands.

  Note: Should I also add a PJL INITIALIZE as well?  This will
  control the sticky fingers on the control panel.  But 
  if this is the case then I suggest that the admins use
  a special job and lock the control panel.  See the PJL refence
  manual for Password and DEFAULT stuff.

  Job cancellation now handle gracefully... but you still have
  to send the entire job to the printer...  This is a bit of a
  pain,  but it seems to be the right thing to do.

  Update gs invocation,  using clever trick from the foomatic folks:
    Grant Taylor (www.linuxprinting.org).
   gs ... -sOutputFile=|cat >&3 3>&1 1>&2
  This causes the error messages and other things to be sent to STDERR.
  Ummm... This may fail,  so make sure that /bin/cat is fixed up.

Version ifhp-3.5.1 - Mon Dec 17 20:17:53 PST 2001

  The ifhp=option,option...  was being ignored.  It is
  now not ignored.  The processing is:
    printcap ifhp=option1,option2
    command line -Toption3,option4 -Zoption5,option6

    As the options are processed, they are put into a list:

    option order: option1,option2,option3,option4,option5,option6

    If they have form:  option=value,  the values are set as
    the list is constructed.  Next, they are scanned for effect,
    i.e. - simplex, duplex, etc.  and those which cause output
    have output generated.

  (Pointed out by: Akop Pogosian <akopps@CSUA.Berkeley.EDU>)


Version ifhp-3.5.0 - Tue Dec 11 17:19:24 PST 2001

  Fixed up configure, make files, DISTRIBUTIONS, stuff.
  
  sh STANDARD_configuration now install man pages in /usr/share/man
     if it is available.

  Updated man pages,  clarified default set of options.

  gs_hplj4 printer entry now accepts PJL as all of the associated
  printers accept PJL.

Version ifhp-3.4.9 - Wed Nov 28 10:10:25 PST 2001

  Added 'pjl_done_msg' to ifhp.conf:
  ## Set console message when job is done
  ##  Set this to empty string if you do not want a ready message
  ##  at end of job
  pjl_done_msg = Done: \%s{n} \%s{J}:\%s{P}

  Freeing memory already freed.
   (Reported by: imacat@mail.imacat.idv.tw)

Version ifhp-3.4.8 - Thu Oct 18 14:07:52 PDT 2001

  Modified configure messages for clarity.

  The PJL JOB START stuff was really messed up - missing buffer[0] = 0
  caused junk message to be sent to the printer (sometimes).
  (Found, reported with a gleeful cackle, and patch sent by:
      Jason Keltz <jas@cs.yorku.ca>)

  The PJL 'STARTPAGE' and 'ENDPAGE'  options need quotes around them.
  Now you can do 'lpr -Zstartpage=1,endpage=2' and it will work.

Version 3.4.7 Tue Oct 16 13:37:17 PDT 2001

  Added pdf2ps conversion support in ifhp.conf

Version 3.4.6 Fri Sep 14 12:45:11 PDT 2001

  Corrections and format errors in IFHP-HOWTO corrected.
  Thanks to Rick Cochran <rcc2@cornell.edu>
   (Patch by: Rick Cochran <rcc2@cornell.edu>)

  ifhp support for 'inet_ntop' used mystrncpy()
  (Patch supplied by: Dejan Ilic <svedja@lysator.liu.se>)

  Updates to the ifhp.conf file for HP 4050, LN15, LN16, LN17 printers.
  (Update by: Helmut Kreiser, <H.Kreiser@gsi.de>)

  Added SCO 5.5 patches:
    From: Paul Freeman <prf@eml.com.au>
    SCO doesn't define MAXPATHLEN in the 'normal' include files
    (it is in arpa/ftp.h). Instead they use PATHSIZE (in sys/param.h).
    SCO doesn't define the S_ISSOCK POSIX macro.
    My investigations reveal the mode of a socket is 0020000
    (same as a character special).  I have defined the S_ISSOCK macro
    This results in a duplicate test in lpd_jobs.c at lines
    2407-2409 but this is harmless.

  Added SCO 5.5 patches:
	From: Paul Freeman <prf@eml.com.au>
    SCO doesn't define MAXPATHLEN in the 'normal' include files
    (it is in arpa/ftp.h). Instead they use PATHSIZE (in sys/param.h).
    SCO doesn't define the S_ISSOCK POSIX macro.
    My investigations reveal the mode of a socket is 0020000
    (same as a character special).  I have defined the S_ISSOCK macro
    This results in a duplicate test in lpd_jobs.c at lines
    2407-2409 but this is harmless.

Version 3.4.5 Mon Aug  6 12:59:27 PDT 2001
  The pjl_ready_msg string was not being used for PJL JOB
  commands.  Thus,  the console message was not correct.
  (Noticed by: Jason L Tibbitts III <tibbs@math.uh.edu>)

  Much nicer console message support by:
      Hermann Lauer <Hermann.Lauer@iwr.uni-heidelberg.de>

  The following change/update/modification was inspired by
  a set of patches from
       "Daniel E. Singer" <des@cs.duke.edu> 
  who had some REALLY nice ideas.

  Added a 'no converter' and 'conversion error' to the
  file_output_match:
    file_output_match = [
       ...
       *       msg   no_converter
    ]
  The '* msg no_converter' is appended to the
  end of all of the 'non-empty' file_output_match
  entries.

  The 'no_converter' is used to lookup the message; if
  postscript enabled then ps_no_converter value, else if
  pcl enabled then pcl_no_converter value, else
  no_converter

  Here are the default values:

  ps_no_converter = %!PS-Adobe-3.0
    /Courier
    findfont 10 scalefont setfont
    72 500 moveto
    (No conversion available for type '\%s{file_output}') show
    showpage
  
  no_converter = No conversion available for type '\%s{file_output}'
  
  Similarly, if the conversion fails,  we use 'conversion_error'
  (we also define some some handy strings as well):
  ps_conversion_error = %!PS-Adobe-3.0
    /Courier
    findfont 10 scalefont setfont
    72 500 moveto
    (Conversion failed for type '\%s{file_output}') show
    72 480 moveto
    (Using '\%s{pgm}') show
    72 460 moveto
    (Error: '\%s{msg}') show
    showpage
  
  conversion_error =  Conversion failed for type '\%s{file_output}'
    Using '\%s{pgm}'
    Error: '\%s{msg}'

Version 3.4.4 Sun Dec 24 17:52:16 PST 2000

  Added ALL the user options to the ifhp.conf.in file so that
  you can use them.  You now have all the PostScript, PCL, and
  PJL options available for use.   Of course if your printer does
  not support this facility,  nothing will happen.

  Pagecounter polling now works as advertised, sort of,  most of the
  time,  (I hope).  You can specify a 'pagecount_poll' value and
  it will poll the printer for a 'non-changing' pagecounter value
  the specified number of times (default=1).

  Fixed up the ifhp.conf entries for HP Laserjet III aka LJ4
  # PRINTER % - HP LaserJet III (PCL and PostScript Interpreter)
  [ hpiiisi hp3si ljet3 lj3 ]
     This now assumes a PostScript interpreter on the printer
  # PRINTER % - HP LaserJet III (PCL, PostScript via GhostScript)
  [ hpiiisi.gs hp3si.gs ljet3.gs lj3.gs ]
     This now assumes you use GhostScript

  Added a section in the README for Solaris compilation.

  The dreaded GCC 2.95 check for character values as indexes
   got me again.
  (Reported by: Lots and lots of people,  including
    Jonas Olsson <lexicon@lysator.liu.se>)

  Added a 'pcl_term' and 'ps_term' option to allow PCL and PostScript
   strings to be send immediately after the job file and BEFORE the
   PCL EOJ or PostScript EOJ.
    (Inspired by: David E. Cross <crossd@cs.rpi.edu>)

  HPUX compilation without GCC had a gratuitious CFLAGS=-Aa.  I removed the flags.
   (Reported by: Ryan Novosielski <novosirj@umdnj.edu>)

Version 3.4.3 Thu Nov 30 09:28:33 PST 2000

 There is a total bizzarity of operation that seems happen
  with various printers.  If the printer goes 'offline' or
  fails to respond for a long time,  then the code tries to
  send command sequences that will force the printer
  to respond or retry the last operation.  These happen during:
	 SYNC sync_interval = 20 seconds default
	 PAGECOUNT pagecount_interval = 20 seconds default
	 WAITEND waitend_interval = 300 seconds default
  I have 'robustified' the code beyond all sensible levels...
  lets see if this works.

 Device Information for the 'appsocket' protocol is now obtained
   from the PRINTCAP_ENTRY environment variable.  This allows you
   to have a simple standard printer configuration.  IFHP-HOWTO
   updated as well.

 I have added a VERY odd formatting capability for options:
   value=ThisString
   %s{value}   -> ThisString
   %U{value}   -> THISSTRING
   %M{value}   -> Thisstring
   %L{value}   -> thisstring

   Ah,  the joys of various programs that want 'UPPERCASE'
   'Leading case' or 'lowercase' for option values.
   This now allows you to have
      lpr -Zpaper=legal
      -> Zlegal
      -> a2ps -M %M{paper}
      -> a2ps -M Legal
   which is truly a hack of the worst kind.  However,  the
   alternative is to support a modified version of GhostScript
   (yes... it is fussy as well),  mpage, a2ps, etc etc etc


 GhostScript now gets paper sizes passed to it if you use
 the standard 'letter legal ...' OR paper=letter OR
 papersize=XXX

 This is managed by a new configuration entry:
 papersize= a1 a2 ... letter legal
   - all the sizes that GhostScript can handle
 papersize_default= letter    - default value.

 The '\%s{papersize}' is a BUILT IN that handles this
 by searching the -Z and -T options for the last entry
 in the papersize list and using this as the size value.

 And of course, GhostScript conversion now has a
 -PAPERSIZE=\%M{papersize} entry.
   

Version 3.4.2 Mon Oct 16 09:29:53 PDT 2000

 unsetenv does not exist on some systems,  and I better
  check all the executables.
  (Spotted by: Christian Haul <haul@dvs1.informatik.tu-darmstadt.de>)
 The 'shutdown_app_socket' option is now made the default.  This will
  cause ifhp to do shutdown(1,1) and then read from the printer
  until EOF.  This solves the mysterious 'RST' packets that have
  terminated connections and caused the printer to abort printing.
  (Astute observeration by: Gerald Damian <gdamian@ford.com>)
 ifhp was exiting when it got an 'out of paper' message.  A bit
  too extreme, this one.
  (Reported by: Scott Schwartz <schwartz@bio.cse.psu.edu>)

Version 3.4.1 Sat Oct 14 13:37:40 PDT 2000

 Updated Internationalization

 Fixed up some errors in the ifhp.conf comments.
 (Spotted by the eagle eyes of: Pekka Savola <pekkas@netcore.fi>)

 Added a 'forceprocessing' flag as suggested by Brendon Hack.
  (Patch and suggestion by: Brendan Hack <bendy@bendys.com>)

 PostScript, CTRL-D and CTRL-T support
  There are many printers which do not like/allow the CTRL-D
  (Serial port 'end of job' indication) and/or the CTRL-T
  (Serial port 'request status' indication) over network or
  parallel port connections.  This is yet another attempt to
  handle this in a simple manner:

  ps_eoj           (default TRUE) - use ^D
  ps_eoj_at_start  (default TRUE) - use ^D at start of job
  ps_eoj_at_end    (default TRUE) - use ^D at end of job

  ps_ctrl_t        (default TRUE) - use ^T to solicit status
  end_status=busy:idle     use these keywords in the status
    indication solicited by CTRL-T or when there is an error
    to determine that the job is done.

  If your printer cannot handle ^D at all, set: ps_eoj@
  If your printer cannot handle ^D at job start,
    but requires it at job end, set: ps_eoj_at_start@
  If your printer cannot handle ^D at job end,
    but requires it at job start, set: ps_eoj_at_end@
    (I don't think this is possible, but it is included
    for completeness).

  If your printer cannot handle CTRL-T in the input stream
    or cannot return status when solicited, set: ps_ctrl_t@

Version 3.3.22 - Sun Aug 20 11:24:02 PDT 2000
 The 'read from parallel port' code caused status@
  to be ignored.  Just a tad aggressive on this,  I was.
 (Reported by: Godfrey <godfrey@hattaway-associates.com>)

Version 3.3.21 - Fri Aug 11 12:49:40 PDT 2000
 After a deep look into parallel port IO and bidirectionality,
  I have come to the conclusion that it is possible to handle
  this,  at the cost of a high polling rate at the process level.

  To this end,  the Read_write_timeout() code has been rewritten,
  and now does polling.  This actually works BETTER than the
  original version in my tests.

  First, the device must be opened read/write.  This is done
  by LPRng when you set the :rw flag -
   lp:
     :rw:lp=/dev/tty0

  Next, if the device is a character device (S_ISCHR(statb.st_mode)
  is true AND not a tty (isatty(fd) returns 0) then ifhp will perform
  IO by doing a write followed by a read().  On Linux systems
  the read is done in blocking mode;  on non-Linux systems it is
  done in nonblocking mode. It is expected that the read will
  either terminate with a 0 value (nothing to read), -1 and
  errno set to 'EWOULDBLOCK' or 'ENOAVAIL' or an appropriate
  error code indicating no status,  or  N where N is the number
  of bytes read.  If this code is run on a non-linux system
  which has implemented bidirectional IO and this does not work,
  I would be interested in hearing about this.  Note that on
  these systems the 'nonblocking' and 'blocking' calls might need
  to be removed.  Please try this and tell me the results and I
  will update the ifhp filter.

  I have added a small flag for the convenience of people who have
  some very strange accounting requirements.  The 'wait_for_banner'
  flag causes the OF filter mode to wait for banner printing
  to be completed before suspending.  This will allow the accounting
  facility to correctly assign pages to banners, jobs, and so
  forth.

Version 3.3.20 - Fri Aug 11 08:03:39 PDT 2000
 Fixed up error message for 'file_output_match' parsing so the
  original line is printed.
 You can now handle key += [ ] correctly.
 More tracing statements added to allow you to trace what option
  value is being used where.
 Expanded option values and interpolated escapes.  This allows
  things like:  ps_cardstock = [ media=Card\040Stock ]
  This will now expand correctly and be interpolated as 'Card Stock'.
  (Problem discovered by: Lars Kellogg-Stedman <lars@larsshack.org>)
 You can try to do job nesting using things like:
    :ifhp=model=hp,pjl_job@,of_options=pjl_job
  This requires that you also use 'PJL ECHO' for end of job detection.

Version 3.3.19 - Sat Jul 15 17:08:42 PDT 2000
 Fixed the configure error message about the file utility so that
  it referenced the ftp://ftp.astron.com/pub/file/ site.
  (Note by: Raymond Lam <R.Lam@qmw.ac.uk>)
 Do write with timeout if the output device
  is not readable.  Also if the device is readable,  then it
  must not be a file, block device, or character device and not
  a tty.  Forced blocking mode on file descriptors before
  calling select.  This appears to solve the problem with 'select' failing
  on various devices.
 Statistics were bogusly computed, progress_k did not work
  correctly.
  (Patch by: Tom Fitzgerald <tfitz@MIT.EDU>)
 Tried to speed up output when an OF filter is being used by
  not having the OF filter confirm that the banner was output, but
  simply proceed with no checks. This, of course, results in a
  bogus page count by the IF filter.  But it seems to speed things
  up quite a bit.  This also now behaves like the older versions
  of ifhp that did not check for end of job when stopping of
  filters.  C'est dommage!

Version 3.3.18 Sat Jul  8 12:35:16 PDT 2000
 gs_unidriver entry had \%s{gs_device}.upp instead of
  \%s{gs_device}
 Found by: Mark Steph <mark.steph@ericsson.com>
 Added ps_eoj_at_start@ to HP 8550 printer entry,
   which does not like ^D at start of PostScript jobs.
  (Discovered and reported by: Micheler Klaus <Klaus.Micheler@infineon.com>)
 Update ifhp.conf with phaser360, phaser740, phaser550
  Need different PostScript than the Phaser 350 and 550
  (Supplied by: Michael J. Carter <mcarter@lanl.gov>)
 Modified the Is_readable() to use fcntl() to get the RD,RW,WR
  status of the file descriptor.
 Added options:
     pjl_ready_msg = \%s{n} \%s{J}:\%s{P}
     pjl_display_size = 20
  The 'ready_msg' is expanded and displayed on the printer
  console display.  The display has at most pjl_display_size
  characters.
  (Patch supplied by: John R Lane <lanejohn@cse.msu.edu>)

Version 3.3.17 Thu Jun 22 07:49:35 PDT 2000
 The ifhp.conf file references the GhostScript uniprint driver
  configuration file 'stc1520.upp' or 'stc1520'.  This was taken
  from the GhostScript documentation.  In reality,  this is the
  'stc1520h.upp' configuration file.  Corrected in the ifhp.conf
  file and email sent to the GhostScript support group.
  (Reported by: Gerald Damian <gdamian@ford.com>)
 The accounting information written to the accounting file did
  not include user and printer name.  The 'accounting_info' option
  now allows you to specify the additional command line options you
  want added to the line written to the accounting file.
  (Reported by: Jonathan Knight <jonathan@cs.keele.ac.uk>)
 The accounting script did not have any options passed to it.
  You now get the same options as with the 'accounting_info' added
  above.
  (Patch supplied by: Ian MacPhedran <Ian_MacPhedran@young.usask.ca>)

Version 3.3.16 Mon Jun 19 09:38:40 PDT 2000
 If the status file is not open and an error message
  needs to be put out,  it is now put out on STDERR.
 All fatal messages are also put out on STDERR as well,  so
  you can see the information in the printer log file.
  This solves the problem of the 'silently vanishing filter'.
 The DISTRIBUTIONS/FreeBSD Makefile updated.

Version 3.3.15 Fri Jun  2 18:01:36 PDT 2000
  Updated configuration file entries so that they
   match reality a bit better.
  Fixed up problems with using GhostScript and options
  If the model information is not found then an error is
   reported.
  Updated status reporting so it was not as verbose.
   (Patch by: Ian MacPhedran <Ian_MacPhedran@young.usask.ca>)

Version 3.3.14 Fri Jun  2 18:01:36 PDT 2000
  configure now checks to see that the file utility handles the
   file - option correctly.
  The ifhp.conf file now lists the HP8000 as a 'laserjet'
   (Spotted by: David Kerr Livingstone <davidl@cn.ca>)
  The test for pagecounting did not handle 'no status' correctly.
  Update the IFHP-HOWTO to use DocBook format.

Version 3.3.13 Wed May 24 09:45:32 PDT 2000

  added of_options option,  which are a set of options
  that are used if the filter is in OF mode.  This allows:

  :ifhp=pagecount@,sync@,waitend@,of_options=pagecount sync waitend

  So you can fling jobs at the printer as fast as possible and have
  the of filter do the dirty work of getting pagecounter values.

  I have modified the behavior of ifhp when it is running in OF mode.
  Previously, when running as an OF filter it would operate in
  'passthrough' only mode and not detect the type of file it was
  printing.  This would cause problems as usually the banner was
  the file it was printing and various 'setups' needed to be done
  to print the banner correctly.  Now when it runs in OF mode it
  reads the input into a file,  carefully looking for the '\033\001'
  sequence,  and when it finds it,  prints the file using the normal
  printing functions,  and then suspends itself.  This greatly
  improves the robustness of banner printing,  etc.,  as the whole
  9 yards^H^H^H24 meters of the ifhp filter processing is applied
  to the file.

  As far as I can tell,  this appears to break no existing applications,
  programs,  processing, etc.,  and now allows 'whacko' banner
  pages to be printed.  Sigh...

  The console now displays the userid even when ifhp is getting
  the pagecount stuff.

  Edited the IFHP-HOWTO and update the section on pagecounts.

  Added an lseek() in a couple of critical places to rewind the
  input.
    (Noticed by: Niklas Edmundsson <nikke@ing.umu.se>)

Version 3.3.12 Mon May 22 15:14:11 PDT 2000

  The 3.3.12 distribution was screwed up - the old Makefile
  rather than the new one was used... oh the joys of RCS version
  control.

  Added a 'pagecount_start' and 'pagecount_end' flag to allow you
  to skip pagecounts at job start or end.

  Discovered the 'no_ps_eoj' and 'no_pcl_eoj' flags were conflicting
  with other stuff,  and changed them to 'pcl_eoj_at_start' and
  'ps_eoj_at_start'.  Names are now compatible with rest of options.
  By the way,  these flags look really strange...  I wonder what
  horribly strange printer inpired them?  Sigh... got to flag
  changes with printers but then some manufacturers would get a bit
  annoyed.  "Its not a defect, it's a feature!"  Sigh.

Version 3.3.11 Sat May 20 09:37:02 PDT 2000

  Fixed up a couple of missing 'ps_user_opts' entries

  Added a tc=entry1,entry2,... facility to allow you to include
  entries.  WARNING:  this is a literal include facility, so the
  placement of the tc=... is critical.

  Model configuration selection:
    The ifhp.conf information is first scanned for the 'default'
    model information,  and then for model specific information.
    This allows you to add new 'default' values to the end of
    the ifhp.conf file and have them override the supplied
    ifhp.conf file.
    For example:
       #ifhp.conf - default
       forceconvesion@
       ...  more default values
       [ hp3* ]
        ....  values specific to hp3*

       #--- end of the supplied stuff
       # user supplies this
       [ default ]
       # overrides default forceconversion
       forceconversion
       [ hp3* ]
       # overrides hp3* values

  Makefile:  install -s on some system does now work with
    with script files,  so Makefile changed to accomodate this.

  You can now use key += value to append to an option value.
  For example:
    key = [ this that ]
    key += [ the other ]
      ->  [ this that the other ]
    key = value
    key += newvalue
      -> value newvalue
    key +=
      on a line
      -> value newvalue
        on a line

    You want to you can now add stuff to an existing entry.
    This makes things like the following possible:
    [ xx* ]
    key = [ basic ]
    [ xx1 ]
    key += [ morefor1 ]
    [ xx2 ]
    key += [ morefor2 ]

  The 'a2ps', 'enscript', and similar programs may exit with bogus
    error codes if they need to wrap lines, change fonts, etc.
    The use of a 'wrapper' script is documented in the ifhp.conf
    file and the HOWTO.

  The -Zstartpage=xxx and -Zendpage=xxx options were not implemented
    and documented correctly.
    (Patch by: Ingo Jauer <ij@math.uni-bremen.de>)

  Makefile.in did not have $(SRC)/ifhp.conf.template
   (Noted by: Bill Kamp <wdkamps@srpnet.com>)
  Makefile did not remove some files created during configure
   (Patch by:  George Lindholm <George.Lindholm@ubc.ca>)
  Fixed a problem with SIGCHLD handler - now sets the SIG_DFL
  Modified the 'Do_waitend' code to better handle appsocket and
   other printers that return strange error status.
  Modified the 'End_ctrl_t' option so that end_ctrl_t@ suppresses
   the use of CTRL_T to obtain status information.
  The Process_OF code did not reset the nonblocking mode of the
   output descriptor after restarting.  This could be a problem
   for devices that do not return status on time.
  The amount and size of files printed is now a double, making
   the progress when printing 2GByte files correctly reported.
   Amazing,  the size of files that people print...
  There was a very strange behavior of list variables that caused
   a memory leak.  If you had:
     xx=testxx
     pjl_yy=testyy
     pjl_nn=[  v\%s{xx}=value v\%s{yy}=value ]
    then the variable would be set to: 
       v\%s{xx} -> vtestxx (look up xx first, then pjl_xx)
       v\%s{yy} -> vtestyy (look up yy first, then pjl_yy)
    so you get the effect of:
     pjl_nn=[  vtestxx=value vtestyy=value ]
   This behavior has been modified to restrict the expansion to
     keys appearing in a list ( [ ... ]).
   I don't have the faintest idea why this was in the code,  and
   it appears to be a development coprolite.
  Read_write_timeout() code has been Turkey Proofed.  Now
   will exit with nasty message when called with inconsistent
   parameters.
  The Process_OF code was modified in order to make it more readable.
  A more rigorous check for option appsocket and a missing dev=
   option was put in.  A malformed printcap file prompted this check.
  Bad coding with the 'banner' stuff once more revisted.  Arrgghh...
   history and compatiblity is ugly.  The problem here is trying
   to be compatible with older releases of LPRng.
    -- we should have LPRng generate banners
    -- need to generate banners based on printer type
    -- thus ifhp needs a 'banner generation' mode
          bp=/..../ifhp -Tbanner_only
          bp=/..../banner  -> symlink to ifhp
  Added a 'set nonblocking' calls at the appropriate places
   to make sure that write will be done correctly.
  Did not terminate argv[] array with 0, caused execve problems.  Also
   fixed up '/bin/sh -c' passing of converters
  The ARGV, ZOPTS, and TOPTS were not being passed to converters correctly.
   (Discovered by: Johan Claesson <Johan.Claesson@uab.ericsson.se>)
  When using a converter, ZOPTS and TOPTS have been replaced by
   \%s{Z} and \%{T}, and you need to use \%s{ARGV}.  Duh!


  The lookup code for parameters, etc., was using 'strcasecmp' rather than
    'strcmp'.  This had the effect of folding options with names such as
    A4 and a4 to the same entry.  The code has been modified so that
    we lowercase the -Z and -T stuff, and lowercase strings where they
    are used to initialize a lookup table.  I wonder where my mind was at
    when I decided to make name lookup case insensitive.  Never again!
    Bad BAD idea.  This is OK for user interface options,  but HORRIBLE
    for internal lookups.
   (Original discrepancy noted by:  Willi Burmeister <wib@cs.uni-kiel.de>)
  For some very odd reason I was adding the ARGV arguments to the
   accounting information.  This caused problems when a -T argument was
   passed as the first -T argument was the elapsed time.
  The \%s{name} lookup was not looking in the -Zopts for values.
  Moved the 'ps_sync' and 'ps_asynch' entries in the ifhp.conf.template
   to the defaults area so that other models can use them.
  The close_on_exec() code failed on systems where the number of
   file descriptors returned by getdtablesize(0 was bogus.  Used the
   Get_max_fd() code.  Oh, for a 'max open fd' call...

  Removed banner printing ENTIRELY.  Banner printing support is
   now done by LPRng.  Should have done this LONG ago.  Breaking
   point reached when 'ld' string was used and this broke banner
   printing.  Grrr... 

  Fix up the format conversion program specification so that you can use
   \%s{name} parameters in the program list:

     file_output_match = [
       *pcl*        pcl \%s{pcl_converter}
       *ps*         ps  \%s{ps_converter}
       *postscript* ps  \%s{ps_converter}
       *pjl*        pjl \%s{pjl_converter}
      ]

     device=epson
     resolution=-r240x72
	 ps_converter= [ /usr/contrib/bin/gs -dSAFER -dBATCH -q -sDEVICE=\%s{device}
		\%s{resolution} -sOutputFile=- -
	  ]

   Added a 'ghostscript' device as well:

	# PRINTER gs_support - Printer with GhostScript conversion
	[ ghostscript ]
	pcl@
	pjl@
	ps
	text

	# device=epsonc
    # resolution=-r240x72
	ps_converter= [ /usr/contrib/bin/gs -dSAFER -dBATCH -q -sDEVICE=\%s{device}
	   \%s{resolution} -sOutputFile=- -
	 ]
	text_converter= [ /usr/contrib/bin/a2ps -q -B -1 -M Letter --borders=no -o-
	  | \%s{ps_converter}
	 ]

	file_output_match = [
	  *postscript*  raw  \%s{ps_converter}
	#  if your printer has PCL, use:
	  *text*  raw  \%s{text_converter}
	  ]
   This allows you to use a printcap with:

    lp:
      :lp=xxxx
      :ifhp=model=ghostscript,device=epsonc,resolution=-r240x72
      :if=/usr/local/libexec/filters/ifhp

   Makefile.in did not have default for UPDATE, and used $(SRC) - should
    have been ${SRC}.
      (Fix by: Willi Burmeister <wib@cs.uni-kiel.de>)

   Removed the 'UPDATE'

   Added DISTRIBUTIONS directory with testscripts for installation
    and package generation for various systems.

   Added the ability to send 'alerts' to operators or whatever
   based on filter activity.

	## PJL USTATUS information will include a lot of
	## codes that are just not interesting,  such as 'printer on line',
	## or 'power up'.  You can suppress reporting status for these codes
	## by putting their code numbers in this list

	pjl_quiet_codes=[
		10001
		40000
	  ]

	## Special error messages
	##  One per line
	##  The idea is that you may get an error code,  but you
	## it is not 'standard'.  You can add additional codes here
	## or override the default strings in the ifhp source.
	##
	pjl_error_codes=[
		10006=Toner Low
	  ]

	## Inform operator if this error number occurs
	pjl_alert_codes=[
	  15* 40* 41* 42* 44*
	  ]

	# use this program to write error to operator
	# error will be read from STDIN.  You can play games with
	# mail or whatever you want here.
	#  for example:
	pjl_alert_handler=/usr/local/libexec/filter/alert_handler

    The pjl_alert_handler program will read the error message on
    STDIN and is responsible for forwarding to the appropriate
    destination.

   Fixed up program forking and handling and put it in one spot.
    This was just a programming/debugging change.

   Went through the Appsocket code and ripped it out.  Fixed up the
    logical flow of things so that if you set the appsocket code you
    can use pagecount with 'ps' and have it work.  There is a
    workaround for the 'end of job' detection - if we have status
    enabled then we do the full 'idle detection' thing.  This will
    now cause us to exit correctly when we have Appsocket and get
    an EOF on the read.

   You can now have a 'filter' in the  file_output_match table:
	file_output_match = [
	  *postscript*  ps  \%s{ps_converter}
	  *pcl*         pcl  \%s{pcl_converter}
	  *pjl*         pjl  \%s{pjl_converter}
	  *printer*job*language* pjl
	  *text*  pcl  \%s{text_converter}
	  *gzip_compressed*  filter  \%s{gzip_decompress}
	  ]
    This will cause the indicated program to be used to decompress
    or recompress or whatever the input file.  This can be done add
    nauseum...  The mind boggles on what you can do with this.
    Courtesy of the a2ps and psfilter folks, who did a neat job...

   When Kyocera-FS1750 wakes up, it sends NULL PostScript status.
    This screws up or used to screw up 'waitend' operations.
    (Information and patch from:  Sebastian Wahl <wahl@id-pro.de>)

Version 3.3.10 Sun Oct 24 16:05:55 PDT 1999

  Updated 3.3.9 Change information with missing stuff.

  When using appsocket protocol,  the of filter was not opening the
  status file correctly and was sending junk to the printer.
  (Spotted by: John McCash <johnmc@rsch.comm.mot.com>)

  HP5SiMx (hp5simx) and similar printers with paper tray selection
   You should be aware that some HP and other manufacturers
  have a 'paper size' selection which OVERRIDES the normal tray
  selection.  If you are printing PostScript,  then by default
  the paper size is 'letter' and you will get paper fed from the
  tray with 'letter' paper in it.  If you have a4 or some other
  size you may get interesting results.  You should experiment with
  the various selection commands to determine if you need to have
  upper/lower or letter/ledger (a4/ledger) selection.  Very nasty,
  this.
    (Experimental results by:  John McCash <johnmc@rsch.comm.mot.com>)
   
  The -c (binary) flag was not setting any values and
  the RAW file type was not being handled correctly.
  (Reported by: Pavel Lisy <pali@tmapy.cz>)

  The 'file_output_match' value may now have the form '<pathname';
  the specified pathname will be opened and the contents used
  as the value of the match information.

  If the conversion filter specification contains the '|', '<', or
  '>' meta characters separated by single spaces,  then the filter
  is invoked using '/bin/sh -c "filter" This change allows us to
  put a pipe or other item in the filter specification.   Needless
  to say,  it also opens gaping security holes as well,  so the
  system adminstrator is warned to be careful.

Example:  (Note: lines have been broken for convenience -
  all conversion filter specification must be on a single line):

file_output_match = [
 # invoked via execve
 *postscript*  raw \
    gs -sDEVICE=epson \
        -sOutputFile=- -sPAPERSIZE=letter -q -
 # invoked via /bin/sh -c
 *text*  raw \
    /usr/local/bin/a2ps -q -B -1 -M Letter --borders=no -o- | \
    gs -sDEVICE=epson \
 	   -sOutputFile=- -sPAPERSIZE=letter -q -
]

OR
file_output_match = </usr/local/etc/ifhp.match

and /usr/local/etc/ifhp.match contains:

 # invoked vi execve
 *postscript*  raw \
    gs -sDEVICE=epson \
        -sOutputFile=- -sPAPERSIZE=letter -q -
 # invoked via /bin/sh -c
 *text*  raw \
    /usr/local/bin/a2ps -q -B -1 -M Letter --borders=no -o- | \
    gs -sDEVICE=epson \
 	   -sOutputFile=- -sPAPERSIZE=letter -q -

  Set SO_KEEPALIVE on sockets in order to try to handle defective TCP/IP
  implementations that do not handle connection RST correctly.

Version 3.3.9 Tue Sep 14 11:59:14 PDT 1999

  ---- Missing information from the Change Log
  *** WARNING:  configure strikes again
  ***
  *** ifhp.conf default location now
  ***  /usr/local/etc/ifhp.conf
  *** ifhp default location now
  ***  /usr/local/libexec/filters/ifhp.conf
  ***

  Why?  Because when trying to port this to XxxxBSD, BSDI, Solaris,
  SunOS, HPUX, DGUX,  etc etc etc I have run into so many inconsistencies
  that I have just given up.

  You might as well assume that the following is true for a default install.

  Updated configuration to be a little more consistent with other packages
   default installation directories:
     ${prefix}  is usually /usr/local
     ${libexecdir} is usually ${prefix}/libexec (/usr/local/libexec)
     ${sysconfdir} is usually ${prefix}/etc (/usr/local/etc)
     ${mandir} is usually ${prefix}/man     (/usr/local/man)

   We install the executables in:
     ${libexecdir}/filters/ifhp
     ${sysconfdir}/ifhp.conf
     ${mandir}/ man pages

   Suppose you wanted to put them in /usr/libexec/filters, and /etc:
     configure --prefix=/usr --sysconfdir=/etc

  ---


  Updated 'banner printing checking'
  There was a strange OF mode interaction between banner printing,
  leaders,  and flushing buffers.  This is a pain,  but here it is:

  a) if you want to have LPRng or the print spooler generate the banner,
     then you MUST:

      1. in ifhp.conf set banner@
         DO NOT examine input string for a 'generate banner line'
         Note that banner@ is the default.
      2. You can now generate a leader line (ld=\f\n)
      3. You can now generate banners using the :bp=/banner/printing/program/path

     THIS IS THE ASSUMED DEFAULT CONFIGURATION FOR LPRng and IFHP

  b)  if you want to use ifhp for banner generation you MUST:
      1. in ifhp.conf set banner or banner=(ps|pcl|text) - i.e.-
         examine input string for a 'generate banner line'
         Note that banner@ is the default
      2. in printcap set :sh@:sb   - i.e. - turn 'suppress header OFF' and
         'short_banner' on.  Note that :sh@:sb is the default
      3. DO NOT GENERATE A LEADER STRING  :ld=    (default)
      4. DO NOT HAVE A BANNER PRINTER PROGRAM :bp=   (default)

  c)  You can use ifhp to act as a banner printing program by using:

      :bp=/.../ifhp -Tbanner_only                   (uses first available type)
      :bp=/.../ifhp -Tbanner_only=(ps|pcl|text)     (uses specified type)

      Also,  /..../banner is a symbolic link to /.../ifhp, so you can use
      :bp=/.../banner                               (uses first avaiable type)
      :bp=/.../banner -Tbanner_only=(ps|pcl|text)   (uses specified type)

      Note that the effect of invoking ifhp with the name 'banner'
      is effectively the same as invoking it with the 'banner_only' flag.
      In fact,  it IS the same :-)

  Added 'no_udp_monitor' for the Appsocket protcol.  This prevents
   ifhp from using the UDP status port to determine if the print
   job is done.  This solves a problem with some Appsocket interface
   printers which do not respond correctly to the '\n\r' query for
   status.  You need to specify 'sync=ps' for these printers.
    i.e.:   -Tappsocket,sync=ps,no_udp_monitor,dev=xx.xx.xx.xx%35

  File type (language) detection and file conversion
  Unified the file type detection and conversion,  at the apparent cost
  of a bit of complexity.

   forceconversion   - forces file(1) utility to be used
   forceconversion@  - ifhp detects only PJL, PCL, PostScript,
         text and unknown

   # set to the default if you want
   default_language=unknown
   file_output_match = [
     *postscript*  ps
     *pcl*         pcl 
     *pjl*         pjl
   # if you need to convert to PostScript
     *text* ps /usr/local/bin/a2ps -q -B -1 -M Letter --borders=no -o-
   # if you can handle text, then simply change the type to pcl
     *text* pcl
   # match for '* gif *'
     *%20gif%20*  pcl /usr/local/bin/gif2pcl --autosize -x2400 -y3300 -d300 -o-
   # give up if you can't tell
     *             unknown
   # pass through if you can't tell
     *             raw
   ]

   # if the file type is TEXT and no converter,  then use the
   # text_converter and set the output to the text_converter_output value.

   text_converter=/usr/local/bin/a2ps -q -B -1 -M Letter --borders=no -o-
   text_converter_output=ps


   Note 1:  you can have spaces in patterns by using %20 (URL escape)
   Note 2:  if you do not have a converter,  then this simply changes
     the type.
   Note 3: you can have ZOPTS, TOPTS, or ARGV as an option, which is
   replaced by -Zzopts, -Ttopts, or the entire argument list for the filter.
   You can also use \%{name} to get the name option value.

   Banner printer alias (./banner -Tbanner=xxx) now accepts banner type
   on command line.

   Removed 'pclbanner' from distribution - really should be in LPRng

Version 3.3.8 Thu Aug 26 20:32:18 PDT 1999
  If there is a config file (ifhp.conf) missing or unreadable,
  we termiante with an error.  This will help with the problem
  of missing or unreadable configuration files.

  Note:  I considered also adding a test for the ps, pjl, flags
  actually present in the file,  but I thougth this was overkill.

Version 3.3.7 Thu Aug 26 20:32:18 PDT 1999
  Configure was not installing things in the right places.  We now have:
   --with-configfile=path     ifhp.conf explicit locations
   --with-admindir=DIR     directory to install ifhp.conf, default:
        \${prefix}/etc
   --with-filterdir=DIR    where to install ifhp executables, default:
       \${prefix}/lib/filters,

   a. if you specify configfile,  then admindir is not used 
   b. if you specify admindir, then you get .../etc/ifhp.conf,./ifhp.conf as files

   defaults: prefix = /usr/local
     configfile would be /usr/local/etc/ifhp.conf
     filter directory would be /usr/local/lib/filters

   If you set prefix=/usr, you get
     configfile would be /usr/etc/ifhp.conf, which is
      probably not what you want

   If you set prefix=/usr, admindir=/etc
     configfile would be /etc/ifhp.conf
     filter directory would be /usr/lib/filters

Version 3.3.6 Fri Aug 20 16:14:27 PDT 1999
  Again,  the Appsocket protocol causes problems.  The Do_waitend
    code had to be redone.
  Added some more printer configurations.
  The end of the ifhp.conf file now has the line #### XXX END XXX #####
  This allows you to append your local stuff to the end of the standard
  ifhp.conf file.

  The [default] entry is used to provide overrides for default values.
  This should appear as your FIRST user addition if you use it at all.
  For example:
    .....  distributed ifhp.conf file
    #### XXX END XXX ####
    [ default ]
    xx@
    [ myprinter]
    xx

Version 3.3.5 Tue Aug  3 15:22:51 PDT 1999
  Re-arranged the file type detection code so that if you set
    forceconvert it will be handled more effectively.
  When you recognize a PostScript job,  will remove EXTRA ^D's at
    the beginning of a job.  This appears to be caused by some PostScript
    drivers gratuitously adding a ^D,  and then the spooling program
    adding another.  Up to 3 of these have been observed in practice.
  If you have a conversion of the type:
        pattern language      {i.e. - two entries}
    only the language is chosen.  This allows you to do:
        *postscript*  ps
        *pcl*         pcl
        *text*        ps   a2ps .....       

  Some HP5m's have a horrible problem with reporting True End of Job
    to get pagecount.  To fix this a bit,  the following method is used.
    1. you need to set waitend=ps,  i.e. - use PostScript to get the
       end of job.  
    2. Two additional options have been defined:  end_ctrl_t=busy:idle
       and waitend_ctrl_t_interval=2
       When the end_ctrl_t is defined,  then a CTRL-T is sent at the
       job end to force (ha ha ha... sigh... only if this was true)
       a ^T type of status message to be sent back from the printer.
       This status message has the form %%[ status: busy ]%% when then printer
       is not printing,  although %%[ status: idle ]%% has also been observed.
       If the status matches one of the values in the end_ctrl_t list,
       then we assume that the printer is done with the job and we can
       get the pagecount.  However (sigh),  we need to prod the printer
       periodically to send this status.  The waitend_ctrl_t_interval 
       sets how often we do this.  However (sigh sigh),  if we send the CTRL-T
       BEFORE the job ends,  then they actually get stacked up in the
       input buffer queue,  we can overflow the input buffer queue, and
       BAD THINGS happen.  So,  we also send a small PostScript job that
       will send a message of the form '%%[ echo: done ]%%',  and only
       when we get this message do we send the CTRL-T,  confident (or
       fairly confident) that the CTRL-T's will get processed.
    Testing this was truly an anal irritation experience.
  Sprinkled holy water on some places where a free() was being done but
    there was not test for a null value...


Version 3.3.4 Tue Aug  3 15:22:51 PDT 1999
  Added a funny little option to handle options such as staple=on and have
  some code produced based on the 'on' value.
    # the %s{key}  inserts the value of key
    ps_staple=[ staple_%s{staple} ]
    ps_staple_off=currentpagedevice /Staple known
       { << /Staple 0 /StapleDetails << /Type 6 /StapleMode 0 >>
        >> setpagedevice } if
    ps_staple_front=<< /Staple 1 /StapleDetails << /Type 6 /StapleMode 0 >>
        >> setpagedevice
    ps_staple_rear=<< /Staple 1 /StapleDetails << /Type 6 /StapleMode 1 >>
        >> setpagedevice
    ps_staple_both=<< /Staple 1 /StapleDetails << /Type 6 /StapleMode 2 >>
        >> setpagedevice
    (Patches and idea by: Garrett D'Amore <garrett@yavin.org>)

  Modified ifhp.conf reading code to be more robust and efficient.
  Added a 'reopen_on_job' option to force appsocket to reopen connection
    to printer if there is a long delay sending job to printer.
    (Inspired by comments from: Isaac Hollander <hollande@ms.com>)
  configure now takes
      --with-admindir=DIR     where to install ifhp.conf, default: /etc
      --with-filterdir=DIR    where to install ifhp and other executables 
  Added FreeBSD ports template to distribution for tracking purposes.

Version 3.3.3 Fri Jun 11 11:44:23 PDT 1999
  ifhp.conf -
    added lexmark4039 entry, to do synchronizcation.
  accounting information - quotes added around options

Version 3.3.2 Mon Jun  7 15:52:55 PDT 1999
  File descriptor 3 was closed when forking accounting
   program.
   (Reported and fix by: Jesper Dangaard Brouer <hawk@diku.dk>)
  Fixed up minor problems with PostScript banner generation.
   (Reported by: Reinhard Zierke <zierke@informatik.uni-hamburg.de>)
  Added a 'forceconversion' flag to force the file utility and
   the conversion utilities to be used. 

Version 3.3.1
  BASELINE DISTRIBUTION

Version 3.2.10
 QMS printer support updated to try and handle appsocket a bit better.
 You now need a 'qms' flag to identify the printer as a qms printer.
   (Patches and suggestions by: Johan Claesson <Johan.Claesson@uab.ericsson.se>)

Version 3.2.9
  Removed '"' from ifhp.conf file that really messed things up.

Version 3.2.8
  Enabled PCL copies=nnn code
     (Missing operation reported by: Gerard Kok <kokg@geo.vu.nl>)
  Fixed pcl_linesperpage=...F instead of E
     (Reported by: Gerard Kok <kokg@geo.vu.nl>)
  When you are using the TEXT to XXX translation facility,
     the .... ZOPTS .... will get replaced with .... -Zzoptions ....
     and .... TOPTS .... will get replaced with .... -Ttoptions ....

  Updated ifhp.conf file,  added comments,  moved HP5SiMx PostScript
  to the HP5SiMx section.

  Modified the Pjl_console code to not be 'sticky'.  This was painful.
	(Suggested by: Olav Kolbu <olav.kolbu@usit.uio.no>)

  After extensive hand to hand combat with QMS printers,
  discovered that they apparently do NOT return status or PostScript
  output in a reliable manner.  Added/modified [qms1725] entry
  to reflect this.  Use appsocket protocol,  but WITHOUT status
  capability.  Also note that port 35 seems to be used by default,
  although this can be configured via the TCP/IP telnet interface.
  (Your milage may vary).

Version 3.2.7
  Rearranged code in Read_write_timeout() so that a read of status is
  attempted BEFORE exiting on a write error.

  added pclbanner to the distribution

  IFHP recognizes the PJL 'reset' sequence and treats it as a
  'raw' or unprocessed job.  This allows you to send PJL jobs to the printer
  and not have them interpreted as PCL.

Version 3.2.6
  Added a console message for Lexmark and HP Printers that
    will be 'sticky' and stay visible after the job has been
    printed.
  (Provided by: Jason L Tibbitts III <tibbs@uh.edu>)

  Fixed up 'progress' so that it prints Kbytes correctly... sigh.


Version 3.2.5
  changed the a2ps options in ifhp.conf:
   -q -B -1 -M Letter --borders=no -o-
  (Suggested by: Jeff Gostin <jgostin@best.com>)

Version 3.2.5
  Cleaned up documentation,  made sure the various
  configuration and installation defaults were consistent.
  Ummm... and also removed a core dump from the distribution.
   Sigh...

Version 3.2.4
  Cleaned up Makefile.in so that running configure in another directory
   will be possible.  That is,
		cd ifhp...
		where=`pwd`
		mkdir ...
		cd ...
		sh $where/configure
   will now work correctly, and you can do a make install in $where 

  Added README.utilities and updated ifhp.conf file so that it has URL
    and ftp sites for file, enscript and a2ps tools.

  The phaser support did not work with OF and IF filters.
    More 'shutdowns' and clean up added.

  Sync and waitend made separate operations.
    You can now skip 'syncing' at the start,  but you 
    can force 'waitend'.  This is side effect of phaser
    operation.  You need to read status back from the printer until it closes
    the reverse connnection.  If you have appsocket with waitend,
    you will read status back until the job finishes.  If you do
    appsocket with waitend@,  you will get no status information for job.
    This is not good,  but gives you very fast throughput.

Version 3.2.3
  Updated Makefile.in so that when you do $(path)/configure for
   building in a separate directory,  the right files are found.

Version 3.2.2
  Added support for Tektronixs Phaser Printers -  using the appsocket protocol

Version 3.2.1

  Most of the code seems pretty stable,  so we start a new major release.
  There are mostly minor changes in the code for this release.
  
  Added 'PseudoMagicFilter Support' and got text to PS conversion
  working correctly.

    #
    # text conversion control
    #
    # control text to whatever conversion
    #
    # if you cannot find type, then try this file utility
    #
    # if the type is text and not supported on your system, do a conversion
    #  Method 1 - set 'default_language' as text, and run
    #    the program through a text to known converter
    #
    default_language=text
    text_converter=/usr/local/bin/a2ps -q -B -o-
    # output of the converter is pcl, ps, or raw
    text_converter_output=ps

    #
    #  Method 2 -
    #    Use the file util and match the output
    # file reports format information
    #  glob text_output_format text_converter
    #  - you do a glob match against pattern and use the converter
    #
    default_language=unknown
    file_util_path=/usr/bin/file -
    file_output_match = [
     *text*  ps /usr/local/bin/a2ps -q -B -o-
     ]
    # you need a temp file location
    tempfile=/var/tmp/ifhp

  Added a horrible horrible kludge that allows multiple fonts to be
  loaded.  You need to use:
    ifhp -Zfont=this,font=that,...
  which gets translated into font=this,that and the font handling code
  then works OK.

  Added a QMS1725 entry that just might work.
  Fixed up a couple of minor PostScript quirks.
  Added PJL support for duplex.

Version 3.1.20
  Documentation.  More Documentation.  More ...
  Sigh...
  
Version 3.1.19
  Made status messages less verbose.
  'trace_on_stderr' is now just 'trace' ... Sigh...

Version 3.1.17
  Changed CRLF back to not effective... Sigh.

Version 3.1.16
  Fixed a problem with testing short files for file type.
  (Noted by: Mike Whitson <mwhitson@MIT.EDU>)

  Added ledger paper types.  HP printers are very odd...
    (John McCash thinks so too)

  Made CRLF the default in ifhp.conf

Version 3.1.15
   Not distributed

Version 3.1.14

 ifhp.conf:
  pcl_pagesize \033&l#A - set page size
    Thu Feb  4 16:52:58 PST 1999
  remove_control=xyz...
    if PostScript AND you have a ^x, ^y, ^z, etc., remove it.
    Suggested use:  remove_control=CT removes CTRL-C, CTRL-T
    (Suggested by Mike Whitson <mwhitson@MIT.EDU>)

Version 3.1.6 - 3.1.13
   Lots and lots and lots of changes in ifhp.conf, etc, etc.
   Stable version approaching.

Version 3.1.5
   Experiments with various printers showed that the ifhp.conf
   file needed modification.

   Added a 'banner_only' mode for banner printing only.
  

Version 3.1.4
   Sun Dec 27 18:22:44 PST 1998
   Total rewrite of the ifhp software using a clean room
   approach.
      Patrick Powell papowell@astart.com

$Id: CHANGES.OLD,v 1.20 2004/09/24 20:18:08 papowell Exp papowell $
