[comp.laser-printers] Unsticking LaserWriter under BSD

eggert@grand.sm.unisys.COM (Paul Eggert) (09/01/87)

Newsgroups: comp.laser-printers
Subject: Unsticking LaserWriter under BSD
Reply-To: eggert@grand.sm.unisys.com (Paul Eggert)
Distribution: world
Organization: Unisys Santa Monica R&D
Keywords: Sun Transcript Apple LaserWriter

In article <8708292043.AA24675@brillig.umd.edu> shprentz@bdmrrr.bdm.COM
(Joel Shprentz) writes:

|Our Sun 3/50 computer is connected to an Apple LaserWriter.  About three
|weeks ago, things started to get flakey.  The Transcript processes
|running pscomm get stuck.  Killing the stuck processes and restarting
|the lpd daemon usually results in another pair of stuck pscomm processes.

We had this problem.  It drove us crazy.  Sometimes we found files in the spool
directory with very long names that were error messages output by the
LaserWriter.  Inspecting the source found a bug in pscomm that trashes its
internal data structures, overwriting them with LaserWriter error messages.
If you have source to Transcript 2.0, try this fix.

3c3
< static char *RCSID="$Header: pscomm.bsd,v 2.1 85/11/24 11:50:16 shore Rel $";
---
> static char *RCSID="$Header: pscomm.bsd,v 2.1.1.1 87/04/23 17:48:28 eggert Exp $";
63a64,66
>  * Revision 2.1.1.1  87/04/23  17:48:28  eggert
>  * Don't let pbuf overflow.
>  * 
627a631
>       pbuf[sizeof(pbuf)-1] = '\0';	/* ensure null terminated */
652d655
<       *pb = '\0';
662a666,669
> 	  if (pb == pbuf+sizeof(pbuf)-1) {
> 	      strcpy(pbuf, pbuf + sizeof(pbuf)/2);
> 	      pb -= sizeof(pbuf)/2;
> 	  }
679d685
< 	*pb = '\0';
689a696,699
> 	  if (pb == pbuf+sizeof(pbuf)-1) {
> 	      strcpy(pbuf, pbuf + sizeof(pbuf)/2);
> 	      pb -= sizeof(pbuf)/2;
> 	  }
729c739
< 	*pb = '\0';	/* ignore the previous pagecount */
---
> 	/* ignore the previous pagecount */
739a750,753
> 	  if (pb == pbuf+sizeof(pbuf)-1) {
> 	      strcpy(pbuf, pbuf + sizeof(pbuf)/2);
> 	      pb -= sizeof(pbuf)/2;
> 	  }