🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.misc
Article #13

Official Patch #5 to thack (troff ->ps)

#13
From: Phill Everson
Date: Sat, 02 Sep 1989 09:53
164 lines
4057 bytes
Here are some more patches to thack. Thanks to Paul Eggert 
<eggert@twinsun.com> for these.

`pstr' is sometimes not set when it should be, putting garbage into the
output, or if pstr has never been set, dereferencing NULL and dumping core.

The partialdiff \(pd character should be \266, not \256.

An illegal font causes illegal PostScript to be output ("F" with no operand).

lint: `i' is defined but never used.  `cx' is defined and set but never used.

Phill Everson
Medical Imaging
Dept Comp Sci
University of Bristol, UK

===================================================================
RCS file: RCS/thack.c,v
retrieving revision 1.8
diff -c -r1.8 thack.c
*** /tmp/,RCSt1a22303	Tue Aug 29 11:52:27 1989
--- thack.c	Tue Aug 29 11:37:27 1989
***************
*** 1,7 ****
  #include "th.h"
  
  int npages;
! int xpos, ypos, cx, cy;
  int font, cfont, size, csize, tfont, tsize;
  char *pstr, *cstr();
  
--- 1,7 ----
  #include "th.h"
  
  int npages;
! int xpos, ypos, cy;
  int font, cfont, size, csize, tfont, tsize;
  char *pstr, *cstr();
  
***************
*** 22,28 ****
  
  main()
  {
! 	int c, i;
  	int sflag;
  	int hdist, vdist;
  	int esc, lead;
--- 22,28 ----
  
  main()
  {
! 	int c;
  	int sflag;
  	int hdist, vdist;
  	int esc, lead;
***************
*** 34,40 ****
  	tsize = size = 12;
  	esc = lead = 1;
  	cy = ypos = Y_INITIAL;
! 	cx = xpos = 0;
  	sflag = 0;
  	prolog();
  	newpage();
--- 34,40 ----
  	tsize = size = 12;
  	esc = lead = 1;
  	cy = ypos = Y_INITIAL;
! 	xpos = 0;
  	sflag = 0;
  	prolog();
  	newpage();
***************
*** 78,83 ****
--- 78,84 ----
  								break;	/* \(34 */
  							default:
  								fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
+ 								pstr = "?";
  							}
  						else
  							switch (c & 0x3f) {
***************
*** 125,130 ****
--- 126,132 ----
  								break;	/* square ? */
  							default:
  								fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
+ 								pstr = "?";
  							}
  					else if (fh == 0)
  						switch (c & 0x3f) {
***************
*** 186,192 ****
  							pstr = cstr('~');
  							break;	/* approximate */
  						case 59:
! 							pstr = "\\256";
  							break;	/* partial */
  						case 61:
  							pstr = "\\326";
--- 188,194 ----
  							pstr = cstr('~');
  							break;	/* approximate */
  						case 59:
! 							pstr = "\\266";
  							break;	/* partial */
  						case 61:
  							pstr = "\\326";
***************
*** 196,201 ****
--- 198,204 ----
  							break;	/* ~= */
  						default:
  							fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
+ 							pstr = "?";
  						}
  					else
  						switch (c & 0x3f) {
***************
*** 297,302 ****
--- 300,306 ----
  							break;	/* section */
  						default:
  							fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
+ 							pstr = "?";
  						}
  				}
  				else {
***************
*** 479,484 ****
--- 483,489 ----
  			break;
  		default:
  			fprintf(stderr, "Illegal Font %d\n", font);
+ 			fputs("TR", stdout);
  		}
  		fputs(" F\n", stdout);
  		cfont = font;
***************
*** 488,494 ****
  		printf("(%s)%d X\n", pstr, xpos);
  	else
  		printf("(%s)%d %d P\n", pstr, xpos, 3 * ypos);
- 	cx = xpos;
  	cy = ypos;
  }
  
--- 493,498 ----
***************
*** 503,508 ****
--- 507,513 ----
  illegal(s)
  char *s;
  {
+ 	pstr = s;
  	fprintf(stderr, "Sequence \\(%s is not allowed\n", s);
  }
  

Keywords: 
Technical Details
Message-ID: <922@csisles.Bristol.AC.UK>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!mcsun!ukc!reading!cf-cm!csisles!everson

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!mcsun!ukc!reading!cf-cm!csisles!everson
From: everson@CompSci.Bristol.AC.UK (Phill Everson )
Newsgroups: comp.bugs.misc
Subject: Official Patch #5 to thack (troff ->ps)
Message-ID: <922@csisles.Bristol.AC.UK>
Date: 2 Sep 89 09:53:00 GMT
Reply-To: everson@CompSci.Bristol.AC.UK ()
Organization: Dept of Computer Science, University of Bristol, UK.
Lines: 164