[comp.sources.bugs] troff2lj patches for SYSV

pim@ctisbv.UUCP (Pim Zandbergen) (08/08/88)

In article <2642@ucdavis.ucdavis.edu> cck@deneb.ucdavis.edu.UUCP (Earl H. Kinmonth) writes:
>Has anyone brought this up under SCO 286 Unix?  I compiled it in
>several flavors and got an overstruck mess down the left side of
>the paper.
>
>I suspect that one problem involves the choice of xexec structure
>(a.out, x.out, or whatever).

The problem is that troff font width files (apparently) do not have
same formats in BSD and System V. System V troff font width files
do not have any fileheaders preceding the actual information.

The following patches made troff2lj work on a 3B2/600
running Unix System V release 3.1.1. 

Apply only if you're running System V. Then recompile dewidth.c
with -DSYSV
________________________________________________________________________


*** orig/ccfont	Sun Aug  7 23:14:10 1988
--- new/ccfont	Mon Aug  8 01:11:31 1988
***************
*** 9,16 ****
  # David MacKenzie
  # Latest revision: 07/21/88
  
  for font
  do
      cc -c $font.c
!     mv $font.o $font
  done
--- 9,19 ----
  # David MacKenzie
  # Latest revision: 07/21/88
  
+ hdrbytes=`dewidth -h`
+ 
  for font
  do
      cc -c $font.c
!     dd skip=$hdrbytes bs=1 count=224 if=$font.o of=$font
!     rm $font.o
  done

______________________________________________________________________
ccfinfo:
In System V, you can't strip a relocatable object, so use the count
option in dd instead. Sizeof(struct hpfontinfo) may be 5, 6 or 8
on your system, but assuming 8 will work on any system (I think).

*** orig/ccfinfo	Sun Aug  7 23:14:44 1988
--- new/ccfinfo	Mon Aug  8 01:09:51 1988
***************
*** 10,20 ****
  # Latest revision: 07/24/88
  
  hdrbytes=`dewidth -h`
  
  for font
  do
      cc -c $font.c
!     strip $font.o
!     dd skip=$hdrbytes ibs=1 if=$font.o of=$font
      rm $font.o
  done
--- 10,20 ----
  # Latest revision: 07/24/88
  
  hdrbytes=`dewidth -h`
+ sizeofstructhpfontinfo=8
  
  for font
  do
      cc -c $font.c
!     dd skip=$hdrbytes bs=1 count=$sizeofstructhpfontinfo if=$font.o of=$font
      rm $font.o
  done

________________________________________________________________________
dewidth.c:
when compiled with -DSYSV, dewidth will correctly calculate the
the size of the object file header. This will now only be used
for dewidth -h, as hdrb will be set to 0 when decompiling
a font width table.

*** orig/dewidth.c	Sun Aug  7 23:14:40 1988
--- new/dewidth.c	Mon Aug  8 00:51:17 1988
***************
*** 67,74 ****
--- 67,78 ----
      hdrb = HDRBYTES;
  #else
      /* Calculate automatically. */
+ #ifdef SYSV
+     hdrb = sizeof(struct filehdr) + sizeof(struct aouthdr) + sizeof(struct scnhdr) + sizeof(struct reloc);
+ #else
      hdrb = sizeof(struct exec);
  #endif
+ #endif
  
      while ((c = getopt(argc, argv, "h")) != EOF)
  	switch (c) {
***************
*** 80,85 ****
--- 84,93 ----
  	}
      if (optind == argc)
  	usage(argv[0]);
+ #ifdef SYSV
+     /* Sys V troff font width files don't have garbage in the front */
+     hdrb = 0;
+ #endif
      for (; optind < argc; ++optind)
  	show(argv[optind]);
  
_____________________________________________________________________________
htroff:
htroff should call otroff, as troff is the device indepent troff
and otroff is the C/A/T troff.

*** orig/htroff	Sun Aug  7 23:14:11 1988
--- new/htroff	Sun Aug  7 23:50:03 1988
***************
*** 42,45 ****
  .lg 0"
  
  cat $files
! } | troff $options | $translate $ljopts | $printcmd
--- 42,45 ----
  .lg 0"
  
  cat $files
! } | otroff $options | $translate $ljopts | $printcmd
-- 
--------------------+------------------------------------+---------------------
Pim Zandbergen      | CTI Software BV                    | Phone: +31 70 542302 
pim@ctisbv.UUCP     | Laan Copes van Cattenburch 70      | Fax:   +31 70 512837
..!mcvax!ctisbv!pim | 2585 GD The Hague, The Netherlands | Telex: 32133 CTI NL