v08i028: Official Patch #5 for thack (troff -> ps)

Brandon S. Allbery - comp.sources.misc allbery at uunet.UU.NET
Thu Sep 7 12:01:30 AEST 1989


Posting-number: Volume 8, Issue 28
Submitted-by: everson%compsci.bristol.ac.uk at NSFnet-Relay.AC.UK
Archive-name: thack.p5

[ Also posted to comp.bugs.misc ]

Here are some more patches to thack. Thanks to Paul Eggert 
<eggert at 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: 



More information about the Comp.sources.misc mailing list