[list.info-appletalk] Bug in REVERSE handling in papif

Mic Kaczmarczik <mic@emx.utexas.edu> (02/09/90)

I recently received the following bug report (and fix, thanks Robert!)
about papif's handling of the REVERSE filter option.  This is just a
guess, but I bet that at the time papif was written, LaserWriter II's
weren't out yet, so no one had needed to disable page reversal by
setting REVERSE to the empty string. :-)

Mic Kaczmarczik
Unix/VMS Services
UT Austin Computation Center
mic@emx.utexas.edu

-------------------------------------------------------------------

Date: Tue, 6 Feb 90 09:56:19 CST
From: root@navier.ae.utexas.edu (Operator)
Message-Id: <9002061556.AA19531@navier.ae.utexas.edu>
To: mic@emx.utexas.edu
Subject: papif not using REVERSE= (null) correctly

I found the problem with papif.c.  The problem is that when REVERSE is in the
environment with no value the variable v is a pointer to a zero length string
which was not checked for in the code.

Below is the differences.

Thanks for all your help.

Robert McLay
mclay@emx
_____ cut here _______________________________________________________________
*** papif.c.orig	Tue Feb  6 11:00:58 1990
--- papif.c	Sat Feb  3 07:46:47 1990
***************
*** 303,312 ****
    else
      log_w("papif: user specified cap.printers: %s not found, ignoring\n",v);
    if ((v = getenv("REVERSE")))
!     if (access(v, X_OK) == 0)
!       psreverse = v;		/* good enough I guess */
!     else
!       log_w("papif: specified psreverse filter %s not found, ignoring\n",v);
    if ((v = getenv("PSTEXT")))
      if (access(v, X_OK) == 0)
        pstext = v;
--- 303,320 ----
    else
      log_w("papif: user specified cap.printers: %s not found, ignoring\n",v);
    if ((v = getenv("REVERSE")))
!     {
!       if (*v == '\0')
! 	psreverse = NULL;
!       else
! 	{
! 	  if (access(v, X_OK) == 0)
! 	    psreverse = v;		/* good enough I guess */
! 	  else
! 	    log_w("papif: specified psreverse filter %s not found, ignoring\n",
! 		  v);
! 	}
!     }
    if ((v = getenv("PSTEXT")))
      if (access(v, X_OK) == 0)
        pstext = v;