DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T f

⟦c32f67ab1⟧ TextFile

    Length: 52103 (0xcb87)
    Types: TextFile
    Names: »fix2«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/ditroff-fix/fix2« 

TextFile


See the article ``titroff/ditroff (1.0) enhancements and fixes: first part''
for details.  That is part one, this is part two, there are others, the last is
called ``last part''.

diffa, diffb, diffc and diffd should be concatenated (cat diff[abcd] > diffs)
and fed to patch.

Russell

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	diffa
# This archive created: Thu Nov 20 21:49:53 1986
export PATH; PATH=/bin:$PATH
echo shar: extracting "'diffa'" '(48695 characters)'
if test -f 'diffa'
then
	echo shar: will not over-write existing file "'diffa'"
else
sed 's/^X//' << \SHAR_EOF > 'diffa'
Xdiff -rbc titroff/README /distribution/dwb/text/troff.d/README
X*** titroff/README	Fri Jul 16 22:27:13 1982
X--- /distribution/dwb/text/troff.d/README	Fri Sep  9 18:44:29 1983
X***************
X*** 1,5
X  
X! The troff in this directory (known as a.out)
X  is a troff that produces machine-independent output.
X  It requires a file of descriptive information about
X  the particular typesetter you have in mind, and produces
X
X--- 1,5 -----
X  
X! The troff in this directory
X  is a troff that produces machine-independent output.
X  It requires a file of descriptive information about
X  the particular typesetter you have in mind, and produces
X***************
X*** 6,13
X  output parameterized for that device.
X  
X  Thus:
X! 	a.out -T202 ...
X! produces output for the mergenthaler linotron 202.
X  (This is the default.)
X  
X  To make this work, one needs to create a set of
X
X--- 6,13 -----
X  output parameterized for that device.
X  
X  Thus:
X! 	troff -Taps ...
X! produces output for the Autologic APS-5.
X  (This is the default.)
X  
X  To make this work, one needs to create a set of
X***************
X*** 15,23
X  	/usr/lib/font/devxxx
X  where "xxx" is your device name.
X  Currently supported devices are
X! 	202	mergenthaler 202 using our software
X! 	aps	autologic aps5
X! 	cat	gsi cat (not really working at present)
X  
X  The file "DESC" contains information about the
X  device itself and the character set.  The file dev202/DESC
X
X--- 15,21 -----
X  	/usr/lib/font/devxxx
X  where "xxx" is your device name.
X  Currently supported devices are
X! 	aps	Autologic APS-5
X  
X  The file "DESC" contains information about the
X  device itself and the character set.  The file devaps/DESC
X***************
X*** 20,26
X  	cat	gsi cat (not really working at present)
X  
X  The file "DESC" contains information about the
X! device itself and the character set.  The file dev202/DESC
X  is a good example; follow the format closely.
X  
X  In addition, each font needs a description of its
X
X--- 18,24 -----
X  	aps	Autologic APS-5
X  
X  The file "DESC" contains information about the
X! device itself and the character set.  The file devaps/DESC
X  is a good example; follow the format closely.
X  
X  In addition, each font needs a description of its
X***************
X*** 25,31
X  
X  In addition, each font needs a description of its
X  characters, width and device-driving codes;
X! see dev202/R and S for typical examples.
X  
X  The program "makedev" will convert these text
X  descriptions into a binary form that the a.out can
X
X--- 23,29 -----
X  
X  In addition, each font needs a description of its
X  characters, width and device-driving codes;
X! see devaps/R and S for typical examples.
X  
X  The program "makedev" will convert these text
X  descriptions into a binary form that the troff can
X***************
X*** 28,34
X  see dev202/R and S for typical examples.
X  
X  The program "makedev" will convert these text
X! descriptions into a binary form that the a.out can
X  slurp up in a single gulp during initialization;
X  these wind up in dev202/DESC.out (which includes
X  default font info) and XX.out for info about font XX.
X
X--- 26,32 -----
X  see devaps/R and S for typical examples.
X  
X  The program "makedev" will convert these text
X! descriptions into a binary form that the troff can
X  slurp up in a single gulp during initialization;
X  these wind up in devaps/DESC.out (which includes
X  default font info) and XX.out for info about font XX.
X***************
X*** 30,36
X  The program "makedev" will convert these text
X  descriptions into a binary form that the a.out can
X  slurp up in a single gulp during initialization;
X! these wind up in dev202/DESC.out (which includes
X  default font info) and XX.out for info about font XX.
X  
X  The second half of the job is to write a post-processor
X
X--- 28,34 -----
X  The program "makedev" will convert these text
X  descriptions into a binary form that the troff can
X  slurp up in a single gulp during initialization;
X! these wind up in devaps/DESC.out (which includes
X  default font info) and XX.out for info about font XX.
X  
X  The second half of the job is to write a post-processor
X***************
X*** 34,40
X  default font info) and XX.out for info about font XX.
X  
X  The second half of the job is to write a post-processor
X! that converts the more or less machine-independent a.out
X  output into specific codes for your favorite typesetter.
X  d202.c is the driver for the 202;
X  it will serve as a useful prototype.  In particular,
X
X--- 32,38 -----
X  default font info) and XX.out for info about font XX.
X  
X  The second half of the job is to write a post-processor
X! that converts the more or less machine-independent troff
X  output into specific codes for your favorite typesetter.
X  daps.c is the driver for the APS-5;
X  it will serve as a useful prototype.  In particular,
X***************
X*** 36,42
X  The second half of the job is to write a post-processor
X  that converts the more or less machine-independent a.out
X  output into specific codes for your favorite typesetter.
X! d202.c is the driver for the 202;
X  it will serve as a useful prototype.  In particular,
X  it contains a precise description of the output language.
X  Other postprocessors are
X
X--- 34,40 -----
X  The second half of the job is to write a post-processor
X  that converts the more or less machine-independent troff
X  output into specific codes for your favorite typesetter.
X! daps.c is the driver for the APS-5;
X  it will serve as a useful prototype.  In particular,
X  it contains a precise description of the output language.
X  Other postprocessors are
X***************
X*** 40,47
X  it will serve as a useful prototype.  In particular,
X  it contains a precise description of the output language.
X  Other postprocessors are
X- 	daps	aps5
X- 	dcat	graphic systems CAT (not really up to date)
X  	tc	tektronix 4014
X  	hc	hp2621 (mainly for crude graphics)
X  	ta	prints ascii on ordinary terminals (crudely)
X
X--- 38,43 -----
X  it will serve as a useful prototype.  In particular,
X  it contains a precise description of the output language.
X  Other postprocessors are
X  	tc	tektronix 4014
X  	hc	hp2621 (mainly for crude graphics)
X  	ta	prints ascii on ordinary terminals (crudely)
X***************
X*** 45,52
X  	tc	tektronix 4014
X  	hc	hp2621 (mainly for crude graphics)
X  	ta	prints ascii on ordinary terminals (crudely)
X- 	dcan	driver for Imagen/Canon laser printer
X- 	d8400	untested driver for compugraphics 8400
X  
X  The 202 driver writes onto /dev/202 in the same way that
X  old troff writes on /dev/cat; to get its output on the std output,
X
X--- 41,46 -----
X  	tc	tektronix 4014
X  	hc	hp2621 (mainly for crude graphics)
X  	ta	prints ascii on ordinary terminals (crudely)
X  
X  The aps driver writes onto /dev/aps in the same way that
X  old troff writes on /dev/cat; to get its output on the std output,
X***************
X*** 48,54
X  	dcan	driver for Imagen/Canon laser printer
X  	d8400	untested driver for compugraphics 8400
X  
X! The 202 driver writes onto /dev/202 in the same way that
X  old troff writes on /dev/cat; to get its output on the std output,
X  use, e.g., d202 -t ... >file.
X  
X
X--- 42,48 -----
X  	hc	hp2621 (mainly for crude graphics)
X  	ta	prints ascii on ordinary terminals (crudely)
X  
X! The aps driver writes onto /dev/aps in the same way that
X  old troff writes on /dev/cat; to get its output on the std output,
X  use, e.g., daps -t ... >file.
X  
X***************
X*** 50,56
X  
X  The 202 driver writes onto /dev/202 in the same way that
X  old troff writes on /dev/cat; to get its output on the std output,
X! use, e.g., d202 -t ... >file.
X  
X  One can always simply run
X  	a.out
X
X--- 44,50 -----
X  
X  The aps driver writes onto /dev/aps in the same way that
X  old troff writes on /dev/cat; to get its output on the std output,
X! use, e.g., daps -t ... >file.
X  
X  One can always simply run
X  	troff
X***************
X*** 53,59
X  use, e.g., d202 -t ... >file.
X  
X  One can always simply run
X! 	a.out
X  and look at the output; it is guaranteed to be ascii text
X  and thus safe to edit, grep, etc.
X  (Since it is ascii, it is also guaranteed to be quite voluminous.)
X
X--- 47,53 -----
X  use, e.g., daps -t ... >file.
X  
X  One can always simply run
X! 	troff
X  and look at the output; it is guaranteed to be ascii text
X  and thus safe to edit, grep, etc.
X  (Since it is ascii, it is also guaranteed to be quite voluminous.)
X***************
X*** 57,86
X  and look at the output; it is guaranteed to be ascii text
X  and thus safe to edit, grep, etc.
X  (Since it is ascii, it is also guaranteed to be quite voluminous.)
X! On our system, /usr/bin/troff is actually a shell program
X! that detects -Txxx arguments;  the current default is 202.
X! 
X! Putting output codes into the font description files
X! seems like the right thing to do but I'm not happy yet.
X! Accordingly, the formats of any or all of the files
X! described here are subject to drastic change; hang loose.
X! 
X! To clear up one potential misapprehension, the code in this
X! directory has not been retrofitted to make an nroff. 
X! That would require major surgery, primarily on n6.c and n10.c.
X! 
X! As it says in the Unix warranty:
X! 	"There is no warranty of merchantability nor any warranty
X! 	of fitness for a particular purpose nor any other warranty,
X! 	either express or implied, as to the accuracy of the
X! 	enclosed materials or as to their suitability for any
X! 	particular purpose.  Accordingly, Bell Telephone
X! 	Laboratories assumes no responsibility for their use by the
X! 	recipient.   Further, Bell Laboratories assumes no obligation
X! 	to furnish any assistance of any kind whatsoever, or to
X! 	furnish any additional information or documentation."
X! 
X! Nevertheless, I will try to answer questions in cases of
X! dire necessity.  Suggestions and other comments would be appreciated.
X! 
X! Brian W. Kernighan
X
X--- 51,54 -----
X  and look at the output; it is guaranteed to be ascii text
X  and thus safe to edit, grep, etc.
X  (Since it is ascii, it is also guaranteed to be quite voluminous.)
X! SCCS @(#)README	1.3
Xdiff -rbc titroff/d.h /distribution/dwb/text/troff.d/d.h
X*** titroff/d.h	Sun Feb 21 15:07:44 1982
X--- /distribution/dwb/text/troff.d/d.h	Fri Sep  9 18:44:31 1983
X***************
X*** 1,2
X  struct d {filep op; int dnl,dimac,ditrap,ditf,alss,blss,nls,mkline,
X  		maxl,hnl,curd;} d[NDI], *dip;
X
X--- 1,3 -----
X+ /*      @(#)d.h	1.1     */
X  struct d {filep op; int dnl,dimac,ditrap,ditf,alss,blss,nls,mkline,
X  		maxl,hnl,curd;} d[NDI], *dip;
Xdiff -rbc titroff/dev.h /distribution/dwb/text/troff.d/dev.h
X*** titroff/dev.h	Mon Sep 15 22:29:14 1986
X--- /distribution/dwb/text/troff.d/dev.h	Fri Sep  9 18:44:35 1983
X***************
X*** 1,3
X  /*
X  	dev.h: characteristics of a typesetter
X  */
X
X--- 1,4 -----
X+ /*      @(#)dev.h	1.1     */
X  /*
X  	dev.h: characteristics of a typesetter
X  */
X***************
X*** 18,26
X  	short	lchname;	/* length of chname table */
X  	short	spare1;		/* in case of expansion */
X  	short	spare2;
X- #ifdef DESCHASNAME
X- 	char dname[10];		/* name of troff device (eg. APS, cat) */
X- #endif DESCHASNAME
X  };
X  
X  struct font {		/* characteristics of a font */
X
X--- 19,24 -----
X  	short	lchname;	/* length of chname table */
X  	short	spare1;		/* in case of expansion */
X  	short	spare2;
X  };
X  
X  struct font {		/* characteristics of a font */
Xdiff -rbc titroff/draw.c /distribution/dwb/text/troff.d/draw.c
X*** titroff/draw.c	Thu Mar 15 14:35:46 1984
X--- /distribution/dwb/text/troff.d/draw.c	Fri Sep  9 18:44:42 1983
X***************
X*** 1,3
X  #include	<stdio.h>
X  #include	<math.h>
X  #define	PI	3.141592654
X
X--- 1,4 -----
X+ /*      @(#)draw.c	1.1     */
X  #include	<stdio.h>
X  #include	<math.h>
X  #define	PI	3.141592654
Xdiff -rbc titroff/ext.h /distribution/dwb/text/troff.d/ext.h
X*** titroff/ext.h	Tue Nov 11 15:17:15 1986
X--- /distribution/dwb/text/troff.d/ext.h	Fri Sep  9 18:44:47 1983
X***************
X*** 1,3
X  extern	char	**argp;
X  extern	char	*chname;
X  extern	char	*eibuf;
X
X--- 1,4 -----
X+ /*      @(#)ext.h	1.1     */
X  extern	char	**argp;
X  extern	char	*chname;
X  extern	char	*eibuf;
X***************
X*** 10,15
X  extern	char	*unlkp;
X  extern	char	*xbufp;
X  extern	char	*xeibuf;
X  extern	char	codetab[];
X  extern	char	devname[];
X  extern	char	fontfile[];
X
X--- 11,17 -----
X  extern	char	*unlkp;
X  extern	char	*xbufp;
X  extern	char	*xeibuf;
X+ extern	char	cfname[NSO][NS];
X  extern	char	codetab[];
X  extern	char	devname[];
X  extern	char	fontfile[];
X***************
X*** 230,245
X  extern	tchar	oline[];
X  extern	tchar	rchar;
X  extern	tchar	word[];
X- #ifdef LOCALWARN
X- #ifdef WARNLEVELREG
X- /* warning level is taken from v.h instead -- v.wl --- req */
X- #else !WARNLEVELREG
X- extern	int	warninglevel;
X- #endif WARNLEVELREG
X- #endif LOCALWARN
X- #ifdef REPORTERRS
X- extern int	reporterrs;	/* < 0 means no warnings given */
X- #endif REPORTERRS
X- #ifdef TCHARTOS
X- extern char *tchartos();	/* gives a string representation of a tchar */
X- #endif TCHARTOS
X
X--- 232,234 -----
X  extern	tchar	oline[];
X  extern	tchar	rchar;
X  extern	tchar	word[];
XOnly in titroff: local.c
XOnly in titroff: local.h
Xdiff -rbc titroff/makedev.c /distribution/dwb/text/troff.d/makedev.c
X*** titroff/makedev.c	Mon Nov 10 21:09:29 1986
X--- /distribution/dwb/text/troff.d/makedev.c	Fri Sep  9 18:45:10 1983
X***************
X*** 1,3
X  /*
X    makedev:
X  	read text info about a particular device
X
X--- 1,4 -----
X+ /*      @(#)makedev.c	1.2     */
X  /*
X    makedev:
X  	read text info about a particular device
X***************
X*** 17,25
X  		creates files F.out.
X  
X  	DESC.out contains:
X- #ifdef DESCHASNAME
X- 	dev structure with fundamental sizes & typesetter name
X- #else !DESCHASNAME
X  	dev structure with fundamental sizes
X  #endif DESCHASNAME
X  	list of sizes (nsizes+1) terminated by 0, as short's
X
X--- 18,23 -----
X  		creates files F.out.
X  
X  	DESC.out contains:
X  	dev structure with fundamental sizes
X  	list of sizes (nsizes+1) terminated by 0, as short's
X  	indices of char names (nchtab * sizeof(short))
X***************
X*** 21,27
X  	dev structure with fundamental sizes & typesetter name
X  #else !DESCHASNAME
X  	dev structure with fundamental sizes
X- #endif DESCHASNAME
X  	list of sizes (nsizes+1) terminated by 0, as short's
X  	indices of char names (nchtab * sizeof(short))
X  	char names as hy\0em\0... (lchname)
X
X--- 19,24 -----
X  
X  	DESC.out contains:
X  	dev structure with fundamental sizes
X  	list of sizes (nsizes+1) terminated by 0, as short's
X  	indices of char names (nchtab * sizeof(short))
X  	char names as hy\0em\0... (lchname)
X***************
X*** 66,79
X  char	kern[FSIZE];	/* ascender+descender info */
X  char	code[FSIZE];	/* actual device codes for a physical font */
X  
X! #ifndef NFONT
X! #ifdef MOREPREFONTS
X! #define	NFONT	40	/* max number of default fonts */
X! /* would like to get this from tdef.h, but then have problems with stdio.. */
X! #else !MOREPREFONTS
X! #define	NFONT	10	/* max number of default fonts */
X! #endif MOREPREFONTS
X! #endif !NFONT
X  char	fname[NFONT][10];	/* temp space to hold default font names */
X  
X  int	fflag	= 0;	/* on if font table to be written */
X
X--- 63,69 -----
X  char	kern[FSIZE];	/* ascender+descender info */
X  char	code[FSIZE];	/* actual device codes for a physical font */
X  
X! #define	NFONT	60	/* max number of default fonts */
X  char	fname[NFONT][10];	/* temp space to hold default font names */
X  
X  int	fflag	= 0;	/* on if font table to be written */
X***************
X*** 86,93
X  	FILE *fin;
X  	char cmd[100], *p;
X  	int i, totfont, v;
X- #ifdef DESCHASNAME
X- 	char devname[10];
X  
X  	dev.dname[0] = dev.dname[1] = '\0';	/* paranoia */
X  #endif DESCHASNAME
X
X--- 76,81 -----
X  	FILE *fin;
X  	char cmd[100], *p;
X  	int i, totfont, v;
X  
X  	if ((fin = fopen("DESC", "r")) == NULL) {
X  		fprintf(stderr, "makedev: can't open %s\n", argv[1]);
X***************
X*** 89,97
X  #ifdef DESCHASNAME
X  	char devname[10];
X  
X- 	dev.dname[0] = dev.dname[1] = '\0';	/* paranoia */
X- #endif DESCHASNAME
X- 
X  	if ((fin = fopen("DESC", "r")) == NULL) {
X  		fprintf(stderr, "makedev: can't open %s\n", argv[1]);
X  		exit(1);
X
X--- 77,82 -----
X  	char cmd[100], *p;
X  	int i, totfont, v;
X  
X  	if ((fin = fopen("DESC", "r")) == NULL) {
X  		fprintf(stderr, "makedev: can't open %s\n", argv[1]);
X  		exit(1);
X***************
X*** 98,111
X  	}
X  	while (fscanf(fin, "%s", cmd) != EOF) {
X  		if (cmd[0] == '#')	/* comment */
X- #ifdef DESCHASNAME
X- 		{
X- 			if (strcmp(cmd, "##name") == 0) {
X- 				fscanf(fin, "%10s", dev.dname);
X- 				dev.dname[9] = '\0';
X- 				fprintf(stderr, "Makedev: DESC for %s\n",
X- 								dev.dname);
X- 			} else {
X  				skipline(fin);
X  			}
X  		}
X
X--- 83,88 -----
X  	}
X  	while (fscanf(fin, "%s", cmd) != EOF) {
X  		if (cmd[0] == '#')	/* comment */
X  			skipline(fin);
X  		else if (strcmp(cmd, "res") == 0) {
X  			fscanf(fin, "%hd", &dev.res);
X***************
X*** 107,117
X  								dev.dname);
X  			} else {
X  				skipline(fin);
X- 			}
X- 		}
X- #else !DESCHASNAME
X- 			skipline(fin);
X- #endif DESCHASNAME
X  		else if (strcmp(cmd, "res") == 0) {
X  			fscanf(fin, "%hd", &dev.res);
X  		} else if (strcmp(cmd, "hor") == 0) {
X
X--- 84,89 -----
X  	while (fscanf(fin, "%s", cmd) != EOF) {
X  		if (cmd[0] == '#')	/* comment */
X  			skipline(fin);
X  		else if (strcmp(cmd, "res") == 0) {
X  			fscanf(fin, "%hd", &dev.res);
X  		} else if (strcmp(cmd, "hor") == 0) {
X***************
X*** 153,164
X  			fprintf(stderr, "makedev: unknown command %s\n", cmd);
X  	}
X  	if (argc > 0 && strcmp(argv[1], "DESC") == 0) {
X- #ifdef DESCHASNAME
X- 		if (dev.dname[0] == '\0') {
X- 			fprintf(stderr, "makedev: no \"##name xxx\" entry in DESC\n");
X- 			exit(1);
X- 		}
X- #endif DESCHASNAME
X  		fdout = creat(fout, 0666);
X  		if (fdout < 0) {
X  			fprintf(stderr, "makedev: can't open %s\n", fout);
X
X--- 125,130 -----
X  			fprintf(stderr, "makedev: unknown command %s\n", cmd);
X  	}
X  	if (argc > 0 && strcmp(argv[1], "DESC") == 0) {
X  		fdout = creat(fout, 0666);
X  		if (fdout < 0) {
X  			fprintf(stderr, "makedev: can't open %s\n", fout);
X***************
X*** 249,260
X  				/* so leave previous values intact
X  				*/
X  				if (strlen(ch) == 1)	/* it's ascii */
X- 				{
X- #ifdef CHECKDESCFILES
X- 					if (fitab[i]) {
X- 						fprintf(stderr, "makedev: warning: duplicate entries for \"%s\"\n", ch);
X- 					}
X- #endif CHECKDESCFILES
X  					fitab[ch[0] - 32] = nw;	/* fitab origin omits non-graphics */
X  				}
X  				else {		/* it has a funny name */
X
X--- 215,220 -----
X  				/* so leave previous values intact
X  				*/
X  				if (strlen(ch) == 1)	/* it's ascii */
X  					fitab[ch[0] - 32] = nw;	/* fitab origin omits non-graphics */
X  				else {		/* it has a funny name */
X  					for (i = 0; i < dev.nchtab; i++)
X***************
X*** 256,262
X  					}
X  #endif CHECKDESCFILES
X  					fitab[ch[0] - 32] = nw;	/* fitab origin omits non-graphics */
X- 				}
X  				else {		/* it has a funny name */
X  					for (i = 0; i < dev.nchtab; i++)
X  						if (strcmp(&chname[chtab[i]], ch) == 0) {
X
X--- 216,221 -----
X  				*/
X  				if (strlen(ch) == 1)	/* it's ascii */
X  					fitab[ch[0] - 32] = nw;	/* fitab origin omits non-graphics */
X  				else {		/* it has a funny name */
X  					for (i = 0; i < dev.nchtab; i++)
X  						if (strcmp(&chname[chtab[i]], ch) == 0) {
X***************
X*** 260,270
X  				else {		/* it has a funny name */
X  					for (i = 0; i < dev.nchtab; i++)
X  						if (strcmp(&chname[chtab[i]], ch) == 0) {
X- #ifdef CHECKDESCFILES
X- 							if (fitab[i]) {
X- 								fprintf(stderr, "makedev: warning: duplicate entries for \"%s\"\n", ch);
X- 							}
X- #endif CHECKDESCFILES
X  							fitab[i + 128-32] = nw;	/* starts after the ascii */
X  							break;
X  						}
X
X--- 219,224 -----
X  				else {		/* it has a funny name */
X  					for (i = 0; i < dev.nchtab; i++)
X  						if (strcmp(&chname[chtab[i]], ch) == 0) {
X  							fitab[i + 128-32] = nw;	/* starts after the ascii */
X  							break;
X  						}
XOnly in titroff: makefile
Xdiff -rbc titroff/n1.c /distribution/dwb/text/troff.d/n1.c
X*** titroff/n1.c	Sat Nov 15 19:08:13 1986
X--- /distribution/dwb/text/troff.d/n1.c	Tue Oct 25 17:24:09 1983
X***************
X*** 1,3
X  #include <ctype.h>
X  #include <sys/types.h>
X  #include <sys/stat.h>
X
X--- 1,5 -----
X+ char xxxn1v[] = "@(#)n1.c	1.5";
X+ 
X  #include <ctype.h>
X  #include <sys/types.h>
X  #include <sys/stat.h>
X***************
X*** 2,10
X  #include <sys/types.h>
X  #include <sys/stat.h>
X  #include "tdef.h"
X- #ifdef BSD42
X- #include <sys/time.h>
X- #endif BSD42
X  extern
X  #include "d.h"
X  extern
X
X--- 4,9 -----
X  #include <sys/types.h>
X  #include <sys/stat.h>
X  #include "tdef.h"
X  extern
X  #include "d.h"
X  extern
X***************
X*** 28,39
X  
X  char	*sprintf();
X  tchar	inchar[LNSIZE], *pinchar = inchar;	/* XXX */
X- #ifdef COMMENT
X- /* ioff, ipl[] and offl[] are also used in local.c, where they're decalred
X-  * as extern.
X-  * - req
X-  */
X- #endif COMMENT
X  filep ipl[NSO];
X  long	offl[NSO];
X  long	ioff;
X
X--- 27,32 -----
X  
X  char	*sprintf();
X  tchar	inchar[LNSIZE], *pinchar = inchar;	/* XXX */
X  filep ipl[NSO];
X  long	offl[NSO];
X  long	ioff;
X***************
X*** 38,50
X  long	offl[NSO];
X  long	ioff;
X  char	*ttyp;
X! #ifdef USEFONTPATH
X! extern char *fontpath;	/* from t6.c */
X! #endif USEFONTPATH
X! 
X! #ifdef COMMENT
X! /* control table... rq is request name */
X! #endif COMMENT
X  extern struct contab {
X  	int	rq;
X  	union {
X
X--- 31,38 -----
X  long	offl[NSO];
X  long	ioff;
X  char	*ttyp;
X! char	cfname[NSO][NS] = "<standard input>";	/*file name stack*/
X! int	cfline[NSO];		/*input line count stack*/
X  extern struct contab {
X  	int	rq;
X  	union {
X***************
X*** 52,59
X  		unsigned	mx;
X  	} x;
X  } contab[NM];
X- #ifdef REPORTERRS
X- extern char *progname;
X  
X  #endif REPORTERRS
X  
X
X--- 40,45 -----
X  		unsigned	mx;
X  	} x;
X  } contab[NM];
X  
X  main(argc, argv)
X  int	argc;
X***************
X*** 55,62
X  #ifdef REPORTERRS
X  extern char *progname;
X  
X- #endif REPORTERRS
X- 
X  main(argc, argv)
X  int	argc;
X  char	**argv;
X
X--- 41,46 -----
X  	} x;
X  } contab[NM];
X  
X  main(argc, argv)
X  int	argc;
X  char	**argv;
X***************
X*** 78,91
X  	signal(SIGTERM, kcatch);
X  	oargc = argc;
X  	oargv = argv;
X- #ifdef REPORTERRS
X- 	/* save progname for local.c:errmsg() error reporting */
X- 	for (p = argv[0]; *p; p++)
X- 		;
X- 	while (p > *argv && *p != '/')
X- 		p--;
X- 	progname = (p && *p == '/') ? ++p : argv[0];
X- #endif REPORTERRS
X  	init0();
X  options:
X  #ifdef ENVIRONMENT
X
X--- 62,67 -----
X  	signal(SIGTERM, kcatch);
X  	oargc = argc;
X  	oargv = argv;
X  	init0();
X  options:
X  	while (--argc > 0 && (++argv)[0][0] == '-')
X***************
X*** 88,107
X  #endif REPORTERRS
X  	init0();
X  options:
X- #ifdef ENVIRONMENT
X- 	/* no point making nroff look at the ditroff DESC files... */
X- #ifndef NROFF
X-       {	extern char *getenv();
X- 	char *p = getenv("TYPESETTER");
X- 
X- 	if (p != (char *) 0) {
X- 		strcpy(devname, p);
X- 		dotT++;
X- 	}
X-       }
X- #endif NROFF
X- #endif ENVIRONMENT
X- 
X  	while (--argc > 0 && (++argv)[0][0] == '-')
X  		switch (argv[0][1]) {
X  
X
X--- 64,69 -----
X  	oargv = argv;
X  	init0();
X  options:
X  	while (--argc > 0 && (++argv)[0][0] == '-')
X  		switch (argv[0][1]) {
X  
X***************
X*** 105,125
X  	while (--argc > 0 && (++argv)[0][0] == '-')
X  		switch (argv[0][1]) {
X  
X- #ifdef LOCALWARN
X- #ifndef WARN_ALL
X- #include "local.h"
X- #endif WARN_ALL
X- 		case 'W':
X- 			/* print out warnings -- see local.h, local.c
X- 			 * --- REQ 16/9/86
X- 			 */
X- #ifdef WARNLEVELREG
X- 			v.wl = WARN_ALL;
X- #else !WARNLEVELREG
X- 			warninglevel = WARN_ALL;
X- #endif WARNLEVELREG
X- 			continue;
X- #endif LOCALWARN
X  		case 'F':	/* switch font tables from default */
X  			if (argv[0][2] != '\0') {
X  				strcpy(termtab, &argv[0][2]);
X
X--- 67,72 -----
X  	while (--argc > 0 && (++argv)[0][0] == '-')
X  		switch (argv[0][1]) {
X  
X  		case 'F':	/* switch font tables from default */
X  			if (argv[0][2] != '\0') {
X  				strcpy(termtab, &argv[0][2]);
X***************
X*** 124,132
X  			if (argv[0][2] != '\0') {
X  				strcpy(termtab, &argv[0][2]);
X  				strcpy(fontfile, &argv[0][2]);
X- #ifdef USEFONTPATH
X- 				fontpath = &argv[0][2];
X- #endif USEFONTPATH
X  			} else {
X  				argv++; argc--;
X  #ifdef NOOPTARGFIX
X
X--- 71,76 -----
X  			if (argv[0][2] != '\0') {
X  				strcpy(termtab, &argv[0][2]);
X  				strcpy(fontfile, &argv[0][2]);
X  			} else {
X  				argv++; argc--;
X  				strcpy(termtab, argv[0]);
X***************
X*** 129,151
X  #endif USEFONTPATH
X  			} else {
X  				argv++; argc--;
X- #ifdef NOOPTARGFIX
X- #ifdef REPORTERRS
X- 				if (argc <= 0) {
X- 					errmsg(done, 02,
X- 					"-F option must be followed by a %s",
X- #ifdef FONTFAMILIES
X- 							"font path"
X- #else !FONTFAMILIES
X- 							"directory name"
X- #endif FONTFAMILIES
X- 									);
X- #else !REPORTERRS
X- 					fprintf(stderr, "troff: -F needs an argument");
X- 					edone(02);
X- #endif REPORTERRS
X- #endif NOOPTARGFIX
X- 				}
X  				strcpy(termtab, argv[0]);
X  				strcpy(fontfile, argv[0]);
X  #ifdef USEFONTPATH
X
X--- 73,78 -----
X  				strcpy(fontfile, &argv[0][2]);
X  			} else {
X  				argv++; argc--;
X  				strcpy(termtab, argv[0]);
X  				strcpy(fontfile, argv[0]);
X  			}
X***************
X*** 148,156
X  				}
X  				strcpy(termtab, argv[0]);
X  				strcpy(fontfile, argv[0]);
X- #ifdef USEFONTPATH
X- 				fontpath = argv[0];
X- #endif USEFONTPATH
X  			}
X  			continue;
X  #ifdef COMMENT
X
X--- 75,80 -----
X  				argv++; argc--;
X  				strcpy(termtab, argv[0]);
X  				strcpy(fontfile, argv[0]);
X  			}
X  			continue;
X  		case 0:
X***************
X*** 153,161
X  #endif USEFONTPATH
X  			}
X  			continue;
X- #ifdef COMMENT
X- 		/* - : read stdin */
X- #endif COMMENT
X  		case 0:
X  			goto start;
X  #ifdef COMMENT
X
X--- 77,82 -----
X  				strcpy(fontfile, argv[0]);
X  			}
X  			continue;
X  		case 0:
X  			goto start;
X  		case 'i':
X***************
X*** 158,166
X  #endif COMMENT
X  		case 0:
X  			goto start;
X- #ifdef COMMENT
X- 		/* -i : read stdin after all i/p files have been exhausted */
X- #endif COMMENT
X  		case 'i':
X  			stdi++;
X  			continue;
X
X--- 79,84 -----
X  			continue;
X  		case 0:
X  			goto start;
X  		case 'i':
X  			stdi++;
X  			continue;
X***************
X*** 164,172
X  		case 'i':
X  			stdi++;
X  			continue;
X- #ifdef COMMENT
X- 		/* -q : simultaneous i/o mode of .rd */
X- #endif COMMENT
X  		case 'q':
X  			quiet++;
X  			if (gtty(0, &ttys) >= 0)
X
X--- 82,87 -----
X  		case 'i':
X  			stdi++;
X  			continue;
X  		case 'q':
X  			quiet++;
X  			if (gtty(0, &ttys) >= 0)
X***************
X*** 172,180
X  			if (gtty(0, &ttys) >= 0)
X  				ttysave = ttys.sg_flags;
X  			continue;
X- #ifdef COMMENT
X- 		/* -nM : 1st page to be numbered M */
X- #endif COMMENT
X  		case 'n':
X  			npn = ctoi(&argv[0][2]);
X  			continue;
X
X--- 87,92 -----
X  			if (gtty(0, &ttys) >= 0)
X  				ttysave = ttys.sg_flags;
X  			continue;
X  		case 'n':
X  			npn = ctoi(&argv[0][2]);
X  			continue;
X***************
X*** 182,192
X  			bdtab[3] = ctoi(&argv[0][2]);
X  			if (bdtab[3] < 0 || bdtab[3] > 50)
X  				bdtab[3] = 0;
X- #ifdef REPORTERRS
X- 			if (bdtab[3] == 0) {
X- 				errmsg(EWARN, "-u option must be followed by a number in the range 0 - 50; using 0");
X- 			}
X- #endif REPORTERRS
X  			continue;
X  #ifdef COMMENT
X  		/* -s -- stop every n pages */
X
X--- 94,99 -----
X  			bdtab[3] = ctoi(&argv[0][2]);
X  			if (bdtab[3] < 0 || bdtab[3] > 50)
X  				bdtab[3] = 0;
X  			continue;
X  		case 's':
X  			if (!(stop = ctoi(&argv[0][2])))
X***************
X*** 188,196
X  			}
X  #endif REPORTERRS
X  			continue;
X- #ifdef COMMENT
X- 		/* -s -- stop every n pages */
X- #endif COMMENT
X  		case 's':
X  			if (!(stop = ctoi(&argv[0][2])))
X  				stop++;
X
X--- 95,100 -----
X  			if (bdtab[3] < 0 || bdtab[3] > 50)
X  				bdtab[3] = 0;
X  			continue;
X  		case 's':
X  			if (!(stop = ctoi(&argv[0][2])))
X  				stop++;
X***************
X*** 195,203
X  			if (!(stop = ctoi(&argv[0][2])))
X  				stop++;
X  			continue;
X- #ifdef COMMENT
X- 		/* -rA=n --- set register A to n */
X- #endif COMMENT
X  		case 'r':
X  			eibuf = sprintf(ibuf+strlen(ibuf), ".nr %c %s\n",
X  				argv[0][2], &argv[0][3]);
X
X--- 99,104 -----
X  			if (!(stop = ctoi(&argv[0][2])))
X  				stop++;
X  			continue;
X  		case 'r':
X  			eibuf = sprintf(ibuf+strlen(ibuf), ".nr %c %s\n",
X  				argv[0][2], &argv[0][3]);
X***************
X*** 202,210
X  			eibuf = sprintf(ibuf+strlen(ibuf), ".nr %c %s\n",
X  				argv[0][2], &argv[0][3]);
X  			continue;
X! #ifdef COMMENT
X! 		/* -mxxx -- read macro package /usr/lib/tmac/tmac.xxx */ 
X! #endif COMMENT
X  		case 'm':
X  			p = &nextf[nfi];
X  			q = &argv[0][2];
X
X--- 103,109 -----
X  			eibuf = sprintf(ibuf+strlen(ibuf), ".nr %c %s\n",
X  				argv[0][2], &argv[0][3]);
X  			continue;
X! 		case 'c':
X  		case 'm':
X  			p = &nextf[nfi];
X  			q = &argv[0][2];
X***************
X*** 212,220
X  				;
X  			mflg++;
X  			continue;
X- #ifdef COMMENT
X- 		/* -opagelist */
X- #endif COMMENT
X  		case 'o':
X  			getpn(&argv[0][2]);
X  			continue;
X
X--- 111,116 -----
X  				;
X  			mflg++;
X  			continue;
X  		case 'o':
X  			getpn(&argv[0][2]);
X  			continue;
X***************
X*** 234,244
X  			continue;
X  #endif
X  #ifndef NROFF
X- #ifdef COMMENT
X- 		/* -Txxx -- read the DESC.out for typesetter xxx from
X- 		 * /usr/lib/troff/descs/devxxx
X- 		 */
X- #endif COMMENT
X  		case 'T':
X  			strcpy(devname, &argv[0][2]);
X  			dotT++;
X
X--- 130,135 -----
X  			continue;
X  #endif
X  #ifndef NROFF
X  		case 'T':
X  			strncpy(devname, &argv[0][2], 11);
X  			devname[11] = 0;	/*directory name is char[14]*/
X***************
X*** 240,246
X  		 */
X  #endif COMMENT
X  		case 'T':
X! 			strcpy(devname, &argv[0][2]);
X  			dotT++;
X  			continue;
X  #ifdef COMMENT
X
X--- 131,138 -----
X  #endif
X  #ifndef NROFF
X  		case 'T':
X! 			strncpy(devname, &argv[0][2], 11);
X! 			devname[11] = 0;	/*directory name is char[14]*/
X  			dotT++;
X  			continue;
X  		case 'z':
X***************
X*** 243,251
X  			strcpy(devname, &argv[0][2]);
X  			dotT++;
X  			continue;
X- #ifdef COMMENT
X- 		/* -z --- efficiently suppress output */
X- #endif COMMENT
X  		case 'z':
X  			no_out++;
X  #ifdef COMMENT
X
X--- 135,140 -----
X  			devname[11] = 0;	/*directory name is char[14]*/
X  			dotT++;
X  			continue;
X  		case 'z':
X  			no_out++;
X  		case 'a':
X***************
X*** 248,258
X  #endif COMMENT
X  		case 'z':
X  			no_out++;
X- #ifdef COMMENT
X- 		/* -a -- provide ascii approximation to o/p.  Doesn't seem
X- 		 * to work too well
X- 		 */
X- #endif COMMENT
X  		case 'a':
X  			ascii = 1;
X  			nofeed++;
X
X--- 137,142 -----
X  			continue;
X  		case 'z':
X  			no_out++;
X  		case 'a':
X  			ascii = 1;
X  			nofeed++;
X***************
X*** 258,266
X  			nofeed++;
X  		case 't':
X  			ptid = 1;
X- #ifdef COMMENT
X- 		/* -f --- suppress final page-throw? */
X- #endif COMMENT
X  			continue;
X  		case 'f':
X  			nofeed++;
X
X--- 142,147 -----
X  			nofeed++;
X  		case 't':
X  			ptid = 1;
X  			continue;
X  		case 'f':
X  			nofeed++;
X***************
X*** 270,284
X  			fprintf(stderr, "troff: unknown option %s\n", argv[0]);
X  			done(02);
X  		}
X- #ifndef NROFF
X- #ifdef USEFONTPATH
X- 	/*
X- 	if (fontpath && devname && *devname) {
X- 		sprintf(fontpath, FONTPATH, devname);
X- 	}
X- 	*/
X- #endif USEFONTPATH
X- #endif NROFF
X  
X  start:
X  	init1(oargv[0][0]);
X
X--- 151,156 -----
X  			fprintf(stderr, "troff: unknown option %s\n", argv[0]);
X  			done(02);
X  		}
X  
X  start:
X  	init1(oargv[0][0]);
X***************
X*** 298,306
X  	if (pendt)
X  		goto lt;
X  	if ((j = cbits(i)) == XPAR) {
X- #ifdef COMMENT
X- 		/* transparent mode line... */
X- #endif COMMENT
X  		copyf++;
X  		tflg++;
X  		while (cbits(i) != '\n')
X
X--- 170,175 -----
X  	if (pendt)
X  		goto lt;
X  	if ((j = cbits(i)) == XPAR) {
X  		copyf++;
X  		tflg++;
X  		while (cbits(i) != '\n')
X***************
X*** 310,318
X  		goto loop;
X  	}
X  	if (j == cc || j == c2) {
X- #ifdef COMMENT
X- 		/* macro request... */
X- #endif COMMENT
X  		if (j == c2)
X  			nb++;
X  #ifdef COMMENT
X
X--- 179,184 -----
X  		goto loop;
X  	}
X  	if (j == cc || j == c2) {
X  		if (j == c2)
X  			nb++;
X  		copyf++;
X***************
X*** 315,323
X  #endif COMMENT
X  		if (j == c2)
X  			nb++;
X- #ifdef COMMENT
X- 			/* suppress line-break */
X- #endif COMMENT
X  		copyf++;
X  #ifdef COMMENT
X  		/* read macro args in copy mode */
X
X--- 181,186 -----
X  	if (j == cc || j == c2) {
X  		if (j == c2)
X  			nb++;
X  		copyf++;
X  		while ((j = cbits(i = getch())) == ' ' || j == '\t')
X  			;
X***************
X*** 319,329
X  			/* suppress line-break */
X  #endif COMMENT
X  		copyf++;
X- #ifdef COMMENT
X- 		/* read macro args in copy mode */
X- 
X- 		/* skip blanks between . and macro-name */
X- #endif COMMENT
X  		while ((j = cbits(i = getch())) == ' ' || j == '\t')
X  			;
X  		ch = i;
X
X--- 182,187 -----
X  		if (j == c2)
X  			nb++;
X  		copyf++;
X  		while ((j = cbits(i = getch())) == ' ' || j == '\t')
X  			;
X  		ch = i;
X***************
X*** 352,363
X  }
X  
X  
X- #ifdef COMMENT
X- /* init0 is called once, before any args are parsed (except that progname is
X-  * defined)
X-  * - req
X-  */
X- #endif COMMENT
X  init0()
X  {
X  	eibuf = ibufp = ibuf;
X
X--- 210,215 -----
X  }
X  
X  
X  init0()
X  {
X  	eibuf = ibufp = ibuf;
X***************
X*** 363,371
X  	eibuf = ibufp = ibuf;
X  	ibuf[0] = 0;
X  	v.nl = -1;
X- #ifdef WARNLEVELREG
X- 	v.wl = WARN_ONCE;
X- #endif WARNLEVELREG
X  }
X  
X  
X
X--- 215,220 -----
X  	eibuf = ibufp = ibuf;
X  	ibuf[0] = 0;
X  	v.nl = -1;
X  }
X  
X  
X***************
X*** 369,379
X  }
X  
X  
X- #ifdef COMMENT
X- /* init1 is called once after the arguments have been parsed and before
X-  * main processing - req
X-  */
X- #endif COMMENT
X  init1(a)
X  char	a;
X  {
X
X--- 218,223 -----
X  }
X  
X  
X  init1(a)
X  char	a;
X  {
X***************
X*** 382,388
X  	register i;
X  
X  	p = mktemp("/usr/tmp/trtmpXXXXX");
X- #ifdef USEDOTFORTMPIFA
X  	if (a == 'a')
X  		p = &p[9];
X  #endif USEDOTFORTMPIFA
X
X--- 226,231 -----
X  	register i;
X  
X  	p = mktemp("/usr/tmp/trtmpXXXXX");
X  	if (a == 'a')
X  		p = &p[9];
X  	if ((close(creat(p, 0600))) < 0) {
X***************
X*** 385,399
X  #ifdef USEDOTFORTMPIFA
X  	if (a == 'a')
X  		p = &p[9];
X- #endif USEDOTFORTMPIFA
X- #ifdef COMMENT
X- 	/* i.e., if troff's name begins with "a", use the current directory
X- 	 * for tmp files.  The 9 refers to the string passed to mktemp.
X- 	 * Presumable this is for testing, when titroff is complied as
X- 	 * a.out
X- 	 * REQ
X- 	 */
X- #endif COMMENT
X  	if ((close(creat(p, 0600))) < 0) {
X  #ifdef REPORTERRS
X  		extern void exit();	/* ! */
X
X--- 228,233 -----
X  	p = mktemp("/usr/tmp/trtmpXXXXX");
X  	if (a == 'a')
X  		p = &p[9];
X  	if ((close(creat(p, 0600))) < 0) {
X  		fprintf(stderr, "troff: cannot create temp file.\n");
X  		exit(-1);
X***************
X*** 395,405
X  	 */
X  #endif COMMENT
X  	if ((close(creat(p, 0600))) < 0) {
X- #ifdef REPORTERRS
X- 		extern void exit();	/* ! */
X- 
X- 		errmsg(exit, -1, "cannot create temp file \"%s\"", p);
X- #else !REPORTERRS
X  		fprintf(stderr, "troff: cannot create temp file.\n");
X  		exit(-1);
X  #endif REPORTERRS
X
X--- 229,234 -----
X  	if (a == 'a')
X  		p = &p[9];
X  	if ((close(creat(p, 0600))) < 0) {
X  		fprintf(stderr, "troff: cannot create temp file.\n");
X  		exit(-1);
X  	}
X***************
X*** 402,408
X  #else !REPORTERRS
X  		fprintf(stderr, "troff: cannot create temp file.\n");
X  		exit(-1);
X- #endif REPORTERRS
X  	}
X  	ibf = open(p, 2);
X  	unlkp = p;
X
X--- 231,236 -----
X  	if ((close(creat(p, 0600))) < 0) {
X  		fprintf(stderr, "troff: cannot create temp file.\n");
X  		exit(-1);
X  	}
X  	ibf = open(p, 2);
X  	unlkp = p;
X***************
X*** 412,422
X  }
X  
X  
X- #ifdef COMMENT
X- /* init2 is called once, after init1, and after saving arg[cv] in oarg[cv]
X-  * - req
X-  */
X- #endif COMMENT
X  init2()
X  {
X  	register i, j;
X
X--- 240,245 -----
X  }
X  
X  
X  init2()
X  {
X  	register i, j;
X***************
X*** 468,477
X  	long	tt;
X  	register i;
X  	static int ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
X- #ifdef BSD42
X- 	struct timeval t;
X- 	struct timezone tz;
X- #endif BSD42
X  
X  #ifdef BSD42
X  	gettimeofday(&t, &tz);
X
X--- 291,296 -----
X  	long	tt;
X  	register i;
X  	static int ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
X  
X  	time(&tt);
X  	tt -= 3600 * ZONE;	/* 5hrs for EST */
X***************
X*** 473,483
X  	struct timezone tz;
X  #endif BSD42
X  
X- #ifdef BSD42
X- 	gettimeofday(&t, &tz);
X- 	t.tv_sec -+ 60 * tz.tz_minuteswest;	/* 0 for GMT, 5h for EST */
X- 	v.dy = (t.tv_sec/86400L) + 1;		/* day of the year */
X- #else !BSD42
X  	time(&tt);
X  	tt -= 3600 * ZONE;	/* 5hrs for EST */
X  	v.dy = (tt / 86400L) + 1;
X
X--- 292,297 -----
X  	register i;
X  	static int ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
X  
X  	time(&tt);
X  	tt -= 3600 * ZONE;	/* 5hrs for EST */
X  	v.dy = (tt / 86400L) + 1;
X***************
X*** 481,487
X  	time(&tt);
X  	tt -= 3600 * ZONE;	/* 5hrs for EST */
X  	v.dy = (tt / 86400L) + 1;
X- #endif BSD42
X  	v.dw = (v.dy + 3) % 7 + 1;
X  	for (v.yr = 70; ; v.yr++) {
X  		if ((v.yr) % 4)
X
X--- 295,300 -----
X  	time(&tt);
X  	tt -= 3600 * ZONE;	/* 5hrs for EST */
X  	v.dy = (tt / 86400L) + 1;
X  	v.dw = (v.dy + 3) % 7 + 1;
X  	for (v.yr = 70; ; v.yr++) {
X  		if ((v.yr) % 4)
X***************
X*** 694,702
X  register int	a, b;
X  {
X  	register int	j;
X- #ifdef BUILTINCONTROLFIX
X- 	int i = 0;
X- #endif BUILTINCONTROLFIX
X  
X  	if (a == 0 || (j = findmn(a)) == -1)
X  #ifdef REPORTERRS
X
X--- 507,512 -----
X  register int	a, b;
X  {
X  	register int	j;
X  
X  	if (a == 0 || (j = findmn(a)) == -1)
X  		return(0);
X***************
X*** 699,712
X  #endif BUILTINCONTROLFIX
X  
X  	if (a == 0 || (j = findmn(a)) == -1)
X- #ifdef REPORTERRS
X- 	{
X- 		extern char *realname();  /* defined in local.c */
X- 
X- 		if (a && a != PAIR(RIGHT, 0)) {
X- 			errmsg(EWARN, "Call to unknown macro (%s) ignored",
X- 								realname(a));
X- 		}
X  		return(0);
X  	}
X  #else !REPORTERRS
X
X--- 509,514 -----
X  	register int	j;
X  
X  	if (a == 0 || (j = findmn(a)) == -1)
X  		return(0);
X  	if (contab[j].rq & MMASK) {
X  		nxf->nargs = 0;
X***************
X*** 708,717
X  								realname(a));
X  		}
X  		return(0);
X- 	}
X- #else !REPORTERRS
X- 		return(0);
X- #endif REPORTERRS
X  	if (contab[j].rq & MMASK) {
X  		nxf->nargs = 0;
X  #ifdef BUILTINCONTROLFIX
X
X--- 510,515 -----
X  
X  	if (a == 0 || (j = findmn(a)) == -1)
X  		return(0);
X  	if (contab[j].rq & MMASK) {
X  		nxf->nargs = 0;
X  		if (b)
X***************
X*** 714,722
X  #endif REPORTERRS
X  	if (contab[j].rq & MMASK) {
X  		nxf->nargs = 0;
X- #ifdef BUILTINCONTROLFIX
X- 		if (b > 0)
X- #else !BUILTINCONTROLFIX
X  		if (b)
X  #endif BUILTINCONTROLFIX
X  			collect();
X
X--- 512,517 -----
X  		return(0);
X  	if (contab[j].rq & MMASK) {
X  		nxf->nargs = 0;
X  		if (b)
X  			collect();
X  		flushi();
X***************
X*** 718,724
X  		if (b > 0)
X  #else !BUILTINCONTROLFIX
X  		if (b)
X- #endif BUILTINCONTROLFIX
X  			collect();
X  		flushi();
X  		return(pushi((filep)contab[j].x.mx));
X
X--- 513,518 -----
X  	if (contab[j].rq & MMASK) {
X  		nxf->nargs = 0;
X  		if (b)
X  			collect();
X  		flushi();
X  		return(pushi((filep)contab[j].x.mx));
X***************
X*** 723,740
X  		flushi();
X  		return(pushi((filep)contab[j].x.mx));
X  	} else if (b)
X- #ifdef BUILTINCONTROLFIX
X- 	{
X- 		if (b < 0) {
X- 			/* don't want built-in macro to read input */
X- 			/* this is from callsp() in n7.c */
X- 			if (flss)
X- 				i = flss; 
X- 			else 
X- 				i = lss;
X- 			flss = 0;
X- 			return((*contab[j].x.f)(i));
X- 		} else {
X  			return((*contab[j].x.f)(0));
X  		}
X  	}
X
X--- 517,522 -----
X  		flushi();
X  		return(pushi((filep)contab[j].x.mx));
X  	} else if (b)
X  		return((*contab[j].x.f)(0));
X  	else
X  		return(0);
X***************
X*** 736,746
X  			return((*contab[j].x.f)(i));
X  		} else {
X  			return((*contab[j].x.f)(0));
X- 		}
X- 	}
X- #else !BUILTINCONTROLFIX
X- 		return((*contab[j].x.f)(0));
X- #endif BUILTINCONTROLFIX
X  	else
X  		return(0);
X  }
X
X--- 518,523 -----
X  		return(pushi((filep)contab[j].x.mx));
X  	} else if (b)
X  		return((*contab[j].x.f)(0));
X  	else
X  		return(0);
X  }
X***************
X*** 763,771
X  	register int	k;
X  	tchar i, j;
X  	tchar setht(), setslant();
X- #ifdef REPORTERRS
X- 	static int leftcount = 0;	/* how many more \{ than \} in input */
X- #endif REPORTERRS
X  
X  	level++;
X  g0:
X
X--- 540,545 -----
X  	register int	k;
X  	tchar i, j;
X  	tchar setht(), setslant();
X  
X  	level++;
X  g0:
X***************
X*** 825,837
X  	switch (k) {
X  
X  	case '\n':	/* concealed newline */
X- #ifdef LINENUMFIX
X- 		/* current input line in this file */
X- 		if (ip == 0) {
X- 			/* reading from file rather than macro */
X- 			v.cd++;
X- 		}
X- #endif LINENUMFIX
X  		goto g0;
X  	case 'n':	/* number register */
X  		setn();
X
X--- 599,604 -----
X  	switch (k) {
X  
X  	case '\n':	/* concealed newline */
X  		goto g0;
X  	case 'n':	/* number register */
X  		setn();
X***************
X*** 844,852
X  		goto g0;
X  	case '{':	/* LEFT */
X  		i = LEFT;
X- #ifdef REPORTERRS
X- 		leftcount++;
X- #endif REPORTERRS
X  		goto gx;
X  	case '}':	/* RIGHT */
X  		i = RIGHT;
X
X--- 611,616 -----
X  		goto g0;
X  	case '{':	/* LEFT */
X  		i = LEFT;
X  		goto gx;
X  	case '}':	/* RIGHT */
X  		i = RIGHT;
X***************
X*** 850,861
X  		goto gx;
X  	case '}':	/* RIGHT */
X  		i = RIGHT;
X- #ifdef REPORTERRS
X- 		if (--leftcount < 0) {
X- 			errmsg(EWARN, "\\} without a matching \\{");
X- 			leftcount = 0;
X- 		}
X- #endif REPORTERRS
X  		goto gx;
X  	case '"':	/* comment */
X  		while (cbits(i = getch0()) != '\n')
X
X--- 614,619 -----
X  		goto gx;
X  	case '}':	/* RIGHT */
X  		i = RIGHT;
X  		goto gx;
X  	case '"':	/* comment */
X  		while (cbits(i = getch0()) != '\n')
X***************
X*** 934,947
X  		case 'S':	/* slant */
X  			i = setslant();
X  			break;
X- #ifdef ANYBASESTR
X- 		case 'R':	/* \R'drawing function'string' --
X- 				 * use 'drawing function' as baseline for text
X- 				 * - req
X- 				 */
X- 			i = setbasestr();
X- 			break;
X- #endif ANYBASESTR
X  		case 'f':	/* font indicator */
X  			setfont(0);
X  			goto g0;
X
X--- 692,697 -----
X  		case 'S':	/* slant */
X  			i = setslant();
X  			break;
X  		case 'f':	/* font indicator */
X  			setfont(0);
X  			goto g0;
X***************
X*** 978,988
X  			if ((k = findr(getsn())) != -1) {
X  				vlist[k] = v.hp = sumhp();
X  			}
X- #ifdef REPORTERRS
X- 			else {
X- 				errmsg(EWARN, "\\k must be follwed by a valid number register name");
X- 			}
X- #endif REPORTERRS
X  			goto g0;
X  		case '0':	/* number space */
X  			i = makem(width('0' | chbits));
X
X--- 728,733 -----
X  			if ((k = findr(getsn())) != -1) {
X  				vlist[k] = v.hp = sumhp();
X  			}
X  			goto g0;
X  		case '0':	/* number space */
X  			i = makem(width('0' | chbits));
X***************
X*** 998,1006
X  			break;
X  		default:
X  			i = j;
X- #ifdef REPORTERRS
X- 			errmsg(EWARN, "Unknown inline escape \"\\%s\"", tchartos(j));
X- #endif REPORTERRS
X  		}
X  	else {
X  		ch0 = j;
X
X--- 743,748 -----
X  			break;
X  		default:
X  			i = j;
X  		}
X  	else {
X  		ch0 = j;
X***************
X*** 1056,1078
X  		return(rchar);
X  	}
X  
X- #ifdef COMMENT
X- 	/* this is where input push-back is done for number registers,
X- 	 * strings, macros & diversions.
X- 	 * For a number register, \n(xx is expanded into cbuf[], and cp is
X- 	 * set equal to cbuf.
X- 	 *
X- 	 * for macro arguments and strings, ap is used (Arg Pointer ?);
X- 	 *
X- 	 * for macros and diversions, ip is set.
X- 	 *
X- 	 * For single-char push-back, ch is set (all over the place!) --
X- 	 * this is used at the start of getch()
X- 	 *
X- 	 * -- req
X- 	 *
X- 	 */
X- #endif COMMENT
X  again:
X  	if (cp) {
X  		if ((i = *cp++) == 0) {
X
X--- 798,803 -----
X  		return(rchar);
X  	}
X  
X  again:
X  	if (cp) {
X  		if ((i = *cp++) == 0) {
X***************
X*** 1158,1163
X  n1:
X  	if ((p[0] == '-') && (p[1] == 0)) {
X  		ifile = 0;
X  	} else if ((ifile = open(p, 0)) < 0) {
X  		fprintf(stderr, "troff: cannot open %s\n", p);
X  		nfo -= mflg;
X
X--- 883,889 -----
X  n1:
X  	if ((p[0] == '-') && (p[1] == 0)) {
X  		ifile = 0;
X+ 		strcpy(cfname[ifi],"<standard input>");
X  	} else if ((ifile = open(p, 0)) < 0) {
X  		fprintf(stderr, "troff: cannot open %s\n", p);
X  		nfo -= mflg;
X***************
X*** 1162,1168
X  		fprintf(stderr, "troff: cannot open %s\n", p);
X  		nfo -= mflg;
X  		done(02);
X! 	}
X  	nfo++;
X  	v.cd = 0;
X  	ioff = 0;
X
X--- 888,895 -----
X  		fprintf(stderr, "troff: cannot open %s\n", p);
X  		nfo -= mflg;
X  		done(02);
X! 	} else
X! 		strcpy(cfname[ifi],p);
X  	nfo++;
X  	v.cd = 0;
X  	ioff = 0;
X***************
X*** 1166,1191
X  	nfo++;
X  	v.cd = 0;
X  	ioff = 0;
X- #ifdef REPORTERRS
X- 	{
X- 		extern char *ifilename;
X- 
X- 		/* set the filename so that local.c:errmsg() can use it */
X- 
X- 		ifilename = p;
X- 		if (! strcmp(p, "-")) {
X- 			ifilename = "stdin";
X- 		}
X- 		/* potential bug if the storage for nextf that p points to
X- 		 * doesn't persist.  But as far as I can see it does.  Don't
X- 		 * really want to invent a fixed-sized buffer.  If I get time,
X- 		 * though, there will be a troff string that will contain
X- 		 * the filename, and then storage won't be a problem.
X- 		 * --- req, 6/10/86
X- 		 */
X- 		 /* BUG2: no easy way to change progname on a .so */
X- 	}
X- #endif REPORTERRS
X  	return(0);
X  n2:
X  	if ((nfo -= mflg) && !stdi)
X
X--- 893,898 -----
X  	nfo++;
X  	v.cd = 0;
X  	ioff = 0;
X  	return(0);
X  n2:
X  	if ((nfo -= mflg) && !stdi)
X***************
X*** 1192,1197
X  		done(0);
X  	nfo++;
X  	v.cd = ifile = stdi = mflg = 0;
X  	ioff = 0;
X  	return(0);
X  }
X
X--- 899,905 -----
X  		done(0);
X  	nfo++;
X  	v.cd = ifile = stdi = mflg = 0;
X+ 	strcpy(cfname[ifi],"<standard input>");
X  	ioff = 0;
X  	return(0);
X  }
X***************
X*** 1204,1209
X  	extern char	*ttyname();
X  
X  	ioff = offl[--ifi];
X  	ip = ipl[ifi];
X  	if ((ifile = ifl[ifi]) == 0) {
X  		p = xbuf;
X
X--- 912,918 -----
X  	extern char	*ttyname();
X  
X  	ioff = offl[--ifi];
X+ 	v.cd = cfline[ifi];		/*restore line counter*/
X  	ip = ipl[ifi];
X  	if ((ifile = ifl[ifi]) == 0) {
X  		p = xbuf;
X***************
X*** 1302,1318
X  
X  	lgf++;
X  	nextf[0] = 0;
X- #ifdef FONTFAMILIES
X- 	if (skip() || !getname()) {
X- #ifdef REPORTERRS
X- 		errmsg(EWARN, "Call to .so with no arguments ignored");
X- #else !REPORTERRS
X- 		fprintf(stderr, "troff: Call to .so with no args ignored");
X- #endif REPORTERRS
X- 		return 0;
X- 	}
X- 	dosofile(".so");
X- #else !FONTFAMILIES
X  	if (skip() || !getname() || ((i = open(nextf, 0)) < 0) || (ifi >= NSO)) {
X  #ifdef REPORTERRS
X  		errmsg(done, 02, ".so: can't open file %s", nextf);
X
X--- 1011,1016 -----
X  
X  	lgf++;
X  	nextf[0] = 0;
X  	if (skip() || !getname() || ((i = open(nextf, 0)) < 0) || (ifi >= NSO)) {
X  		fprintf(stderr, "troff: can't open file %s\n", nextf);
X  		done(02);
X***************
X*** 1314,1322
X  	dosofile(".so");
X  #else !FONTFAMILIES
X  	if (skip() || !getname() || ((i = open(nextf, 0)) < 0) || (ifi >= NSO)) {
X- #ifdef REPORTERRS
X- 		errmsg(done, 02, ".so: can't open file %s", nextf);
X- #else !REPORTERRS
X  		fprintf(stderr, "troff: can't open file %s\n", nextf);
X  		done(02);
X  #endif REPORTERRS
X
X--- 1012,1017 -----
X  	lgf++;
X  	nextf[0] = 0;
X  	if (skip() || !getname() || ((i = open(nextf, 0)) < 0) || (ifi >= NSO)) {
X  		fprintf(stderr, "troff: can't open file %s\n", nextf);
X  		done(02);
X  	}
X***************
X*** 1319,1325
X  #else !REPORTERRS
X  		fprintf(stderr, "troff: can't open file %s\n", nextf);
X  		done(02);
X- #endif REPORTERRS
X  	}
X  	flushi();
X  	ifl[ifi] = ifile;
X
X--- 1014,1019 -----
X  	if (skip() || !getname() || ((i = open(nextf, 0)) < 0) || (ifi >= NSO)) {
X  		fprintf(stderr, "troff: can't open file %s\n", nextf);
X  		done(02);
X  	}
X  	strcpy(cfname[ifi+1], nextf);
X  	cfline[ifi] = v.cd;		/*hold line counter*/
X***************
X*** 1321,1326
X  		done(02);
X  #endif REPORTERRS
X  	}
X  	flushi();
X  	ifl[ifi] = ifile;
X  	ifile = i;
X
X--- 1015,1023 -----
X  		fprintf(stderr, "troff: can't open file %s\n", nextf);
X  		done(02);
X  	}
X+ 	strcpy(cfname[ifi+1], nextf);
X+ 	cfline[ifi] = v.cd;		/*hold line counter*/
X+ 	v.cd = 0;
X  	flushi();
X  	ifl[ifi] = ifile;
X  	ifile = i;
X***************
X*** 1338,1344
X  		while (p < eibuf)
X  			*q++ = *p++;
X  	}
X- #endif FONTFAMILIES
X  }
X  
X  
X
X--- 1035,1040 -----
X  		while (p < eibuf)
X  			*q++ = *p++;
X  	}
X  }
X  
X  
X***************
X*** 1393,1401
X  	register int n, neg;
X  
X  	if (*a == 0)
X- #ifdef REPORTERRS
X- 	{
X- 		errmsg(EWARN, "-o: usage is -oLIST; no LIST of pagenumbers found");
X  		return;
X  	}
X  #else !REPORTERRS
X
X--- 1089,1094 -----
X  	register int n, neg;
X  
X  	if (*a == 0)
X  		return;
X  	neg = 0;
X  	for ( ; *a; a++)
X***************
X*** 1397,1406
X  	{
X  		errmsg(EWARN, "-o: usage is -oLIST; no LIST of pagenumbers found");
X  		return;
X- 	}
X- #else !REPORTERRS
X- 		return;
X- #endif REPORTERRS
X  	neg = 0;
X  	for ( ; *a; a++)
X  		switch (*a) {
X
X--- 1090,1095 -----
X  
X  	if (*a == 0)
X  		return;
X  	neg = 0;
X  	for ( ; *a; a++)
X  		switch (*a) {
X***************
X*** 1422,1430
X  			*pnp++ = neg ? -n : n;
X  			neg = 0;
X  			if (pnp >= &pnlist[NPN-2]) {
X- #ifdef REPORTERRS
X- 				errmsg(done2, -3, "too many pagenumbers (maximum is %d)", NPN);
X- #else !REPORTERRS
X  				fprintf(stderr, "troff: too many page numbers\n");
X  				done3(-3);
X  #endif REPORTERRS
X
X--- 1111,1116 -----
X  			*pnp++ = neg ? -n : n;
X  			neg = 0;
X  			if (pnp >= &pnlist[NPN-2]) {
X  				fprintf(stderr, "troff: too many page numbers\n");
X  				done3(-3);
X  			}
X***************
X*** 1427,1433
X  #else !REPORTERRS
X  				fprintf(stderr, "troff: too many page numbers\n");
X  				done3(-3);
X- #endif REPORTERRS
X  			}
X  		}
X  	if (neg)
X
X--- 1113,1118 -----
X  			if (pnp >= &pnlist[NPN-2]) {
X  				fprintf(stderr, "troff: too many page numbers\n");
X  				done3(-3);
X  			}
X  		}
X  	if (neg)
XOnly in titroff: n10.c
SHAR_EOF
if test 48695 -ne "`wc -c < 'diffa'`"
then
	echo shar: error transmitting "'diffa'" '(should have been 48695 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
ARPA		req%uu.warwick.ac.uk@ucl-cs.arpa
EARN/BITNET	req%UK.AC.WARWICK.UU@AC.UK
JANET		req@uk.ac.warwick.uu
UUCP		seismo!mcvax!ukc!warwick!req  (req@warwick.UUCP)
PHONE		+44 203 523485
For mail.frplist, use "frplist" instead of "req" in the above lines.
The BITNET path only works from sites that have AC.UK in their tables.  Sorry.