home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume8 / thack.p5 < prev    next >
Text File  |  1989-09-06  |  4KB  |  178 lines

  1. Newsgroups: comp.sources.misc
  2. from: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  3. subject: v08i028: Official Patch #5 for thack (troff -> ps)
  4. Reply-To: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  5.  
  6. Posting-number: Volume 8, Issue 28
  7. Submitted-by: everson%compsci.bristol.ac.uk@NSFnet-Relay.AC.UK
  8. Archive-name: thack.p5
  9.  
  10. [ Also posted to comp.bugs.misc ]
  11.  
  12. Here are some more patches to thack. Thanks to Paul Eggert 
  13. <eggert@twinsun.com> for these.
  14.  
  15. `pstr' is sometimes not set when it should be, putting garbage into the
  16. output, or if pstr has never been set, dereferencing NULL and dumping core.
  17.  
  18. The partialdiff \(pd character should be \266, not \256.
  19.  
  20. An illegal font causes illegal PostScript to be output ("F" with no operand).
  21.  
  22. lint: `i' is defined but never used.  `cx' is defined and set but never used.
  23.  
  24. Phill Everson
  25. Medical Imaging
  26. Dept Comp Sci
  27. University of Bristol, UK
  28.  
  29. ===================================================================
  30. RCS file: RCS/thack.c,v
  31. retrieving revision 1.8
  32. diff -c -r1.8 thack.c
  33. *** /tmp/,RCSt1a22303    Tue Aug 29 11:52:27 1989
  34. --- thack.c    Tue Aug 29 11:37:27 1989
  35. ***************
  36. *** 1,7 ****
  37.   #include "th.h"
  38.   
  39.   int npages;
  40. ! int xpos, ypos, cx, cy;
  41.   int font, cfont, size, csize, tfont, tsize;
  42.   char *pstr, *cstr();
  43.   
  44. --- 1,7 ----
  45.   #include "th.h"
  46.   
  47.   int npages;
  48. ! int xpos, ypos, cy;
  49.   int font, cfont, size, csize, tfont, tsize;
  50.   char *pstr, *cstr();
  51.   
  52. ***************
  53. *** 22,28 ****
  54.   
  55.   main()
  56.   {
  57. !     int c, i;
  58.       int sflag;
  59.       int hdist, vdist;
  60.       int esc, lead;
  61. --- 22,28 ----
  62.   
  63.   main()
  64.   {
  65. !     int c;
  66.       int sflag;
  67.       int hdist, vdist;
  68.       int esc, lead;
  69. ***************
  70. *** 34,40 ****
  71.       tsize = size = 12;
  72.       esc = lead = 1;
  73.       cy = ypos = Y_INITIAL;
  74. !     cx = xpos = 0;
  75.       sflag = 0;
  76.       prolog();
  77.       newpage();
  78. --- 34,40 ----
  79.       tsize = size = 12;
  80.       esc = lead = 1;
  81.       cy = ypos = Y_INITIAL;
  82. !     xpos = 0;
  83.       sflag = 0;
  84.       prolog();
  85.       newpage();
  86. ***************
  87. *** 78,83 ****
  88. --- 78,84 ----
  89.                                   break;    /* \(34 */
  90.                               default:
  91.                                   fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  92. +                                 pstr = "?";
  93.                               }
  94.                           else
  95.                               switch (c & 0x3f) {
  96. ***************
  97. *** 125,130 ****
  98. --- 126,132 ----
  99.                                   break;    /* square ? */
  100.                               default:
  101.                                   fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  102. +                                 pstr = "?";
  103.                               }
  104.                       else if (fh == 0)
  105.                           switch (c & 0x3f) {
  106. ***************
  107. *** 186,192 ****
  108.                               pstr = cstr('~');
  109.                               break;    /* approximate */
  110.                           case 59:
  111. !                             pstr = "\\256";
  112.                               break;    /* partial */
  113.                           case 61:
  114.                               pstr = "\\326";
  115. --- 188,194 ----
  116.                               pstr = cstr('~');
  117.                               break;    /* approximate */
  118.                           case 59:
  119. !                             pstr = "\\266";
  120.                               break;    /* partial */
  121.                           case 61:
  122.                               pstr = "\\326";
  123. ***************
  124. *** 196,201 ****
  125. --- 198,204 ----
  126.                               break;    /* ~= */
  127.                           default:
  128.                               fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  129. +                             pstr = "?";
  130.                           }
  131.                       else
  132.                           switch (c & 0x3f) {
  133. ***************
  134. *** 297,302 ****
  135. --- 300,306 ----
  136.                               break;    /* section */
  137.                           default:
  138.                               fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  139. +                             pstr = "?";
  140.                           }
  141.                   }
  142.                   else {
  143. ***************
  144. *** 479,484 ****
  145. --- 483,489 ----
  146.               break;
  147.           default:
  148.               fprintf(stderr, "Illegal Font %d\n", font);
  149. +             fputs("TR", stdout);
  150.           }
  151.           fputs(" F\n", stdout);
  152.           cfont = font;
  153. ***************
  154. *** 488,494 ****
  155.           printf("(%s)%d X\n", pstr, xpos);
  156.       else
  157.           printf("(%s)%d %d P\n", pstr, xpos, 3 * ypos);
  158. -     cx = xpos;
  159.       cy = ypos;
  160.   }
  161.   
  162. --- 493,498 ----
  163. ***************
  164. *** 503,508 ****
  165. --- 507,513 ----
  166.   illegal(s)
  167.   char *s;
  168.   {
  169. +     pstr = s;
  170.       fprintf(stderr, "Sequence \\(%s is not allowed\n", s);
  171.   }
  172.   
  173.  
  174. Keywords: 
  175.  
  176.  
  177.  
  178.