[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-tech
Subject:    diff's to deal with troff/diftroff/text Comments inline
From:       Chris Bennett <chrisbennett () bennettconstruction ! us>
Date:       2016-01-29 22:04:40
Message-ID: 20160129220440.GA1169 () bennettconstruction ! us
[Download RAW message or body]

common.c-troff-diff
pathnames.h-troff-diff
printjob.c-troff-diff

I don't see any problems with this first one. I also moved "/usr/bin/pr"
over to line up with rest of items, since I was changing this one
anyway.

Index: pathnames.h
===================================================================
RCS file: /cvs/src/usr.sbin/lpr/common_source/pathnames.h,v
retrieving revision 1.6
diff -u -p -u -r1.6 pathnames.h
--- pathnames.h	28 Oct 2015 13:25:55 -0000	1.6
+++ pathnames.h	29 Jan 2016 18:08:29 -0000
@@ -37,11 +37,6 @@
 #define	_PATH_DEFDEVLP		"/dev/lp"
 #define	_PATH_DEFSPOOL		"/var/spool/output/lpd"
 #define	_PATH_HOSTSLPD		"/etc/hosts.lpd"
-#define	_PATH_PR		"/usr/bin/pr"
+#define	_PATH_PR	    	"/usr/bin/pr"
 #define	_PATH_PRINTCAP		"/etc/printcap"
 #define	_PATH_SOCKETNAME	"/var/run/printer"
-#define	_PATH_VFONT		"/usr/libdata/vfont/"
-#define	_PATH_VFONTB		"/usr/libdata/vfont/B"
-#define	_PATH_VFONTI		"/usr/libdata/vfont/I"
-#define	_PATH_VFONTR		"/usr/libdata/vfont/R"
-#define	_PATH_VFONTS		"/usr/libdata/vfont/S"


Here I am getting rid of variables that deal with ditroff, troff and
tex.
These three items run together in printjob.c

Index: common.c
===================================================================
RCS file: /cvs/src/usr.sbin/lpr/common_source/common.c,v
retrieving revision 1.40
diff -u -p -u -r1.40 common.c
--- common.c	12 Jan 2016 23:35:13 -0000	1.40
+++ common.c	29 Jan 2016 18:07:32 -0000
@@ -64,7 +64,6 @@
 char	*AF;		/* accounting file */
 long	 BR;		/* baud rate if lp is a tty */
 char	*CF;		/* name of cifplot filter (per job) */
-char	*DF;		/* name of tex filter (per job) */
 long	 DU;		/* daemon user-id */
 char	*FF;		/* form feed string */
 char	*GF;		/* name of graph(1G) filter (per job) */
@@ -76,7 +75,6 @@ char	*LP;		/* line printer device name *
 long	 MC;		/* maximum number of copies allowed */
 char	*MS;		/* stty flags to set if lp is a tty */
 long	 MX;		/* maximum number of blocks to copy */
-char	*NF;		/* name of ditroff filter (per job) */
 char	*OF;		/* name of output filter (created once) */
 long	 PL;		/* page length */
 long	 PW;		/* page width */
@@ -94,7 +92,6 @@ char	*SD;		/* spool directory */
 long	 SF;		/* suppress FF on each print job */
 long	 SH;		/* suppress header page */
 char	*ST;		/* status file name */
-char	*TF;		/* name of troff filter (per job) */
 char	*TR;		/* trailer string to be output when Q empties */
 char	*VF;		/* name of vplot filter (per job) */
 


Index: printjob.c
===================================================================
RCS file: /cvs/src/usr.sbin/lpr/lpd/printjob.c,v
retrieving revision 1.56
diff -u -p -u -r1.56 printjob.c
--- printjob.c	12 Jan 2016 23:35:13 -0000	1.56
+++ printjob.c	29 Jan 2016 18:06:06 -0000
@@ -317,16 +317,6 @@ again:
 	goto again;
 }
 
-#define	FONTLEN	50
-char	fonts[4][FONTLEN];	/* fonts for troff */
-
-char ifonts[4][40] = {
-	_PATH_VFONTR,
-	_PATH_VFONTI,
-	_PATH_VFONTB,
-	_PATH_VFONTS,
-};
-

Above make sense since comes from removal of troff fonts.



 /*
  * The remaining part is the reading of the control file (cf)
  * and performing the various actions.
@@ -348,14 +338,6 @@ printit(char *file)
 			(void)close(fd);
 		return(OK);
 	}
-	/*
-	 * Reset troff fonts.
-	 */
-	for (i = 0; i < 4; i++)
-		strlcpy(fonts[i], ifonts[i], FONTLEN);
-	(void)snprintf(&width[2], sizeof(width) - 2, "%ld", PW);
-	indent[2] = '0';
-	indent[3] = '\0';
 
Removal of for ... and next line seem proper.
Removal of next three lines also appear OK, but I would like some
feedback to be sure about them. (And they are in same section, so they
must be part of it :) Ha Ha.)



 	/*
 	 *      read the control file for work to do
@@ -367,28 +349,22 @@ printit(char *file)
 	 *		S -- "stat info" for symbolic link protection
 	 *		J -- "job name" on banner page
 	 *		C -- "class name" on banner page
-	 *              L -- "literal" user's name to print on banner
+	 *      L -- "literal" user's name to print on banner
 	 *		T -- "title" for pr
 	 *		H -- "host name" of machine where lpr was done
-	 *              P -- "person" user's login name
-	 *              I -- "indent" amount to indent output
+	 *      P -- "person" user's login name
+	 *      I -- "indent" amount to indent output
 	 *		R -- laser dpi "resolution"
-	 *              f -- "file name" name of text file to print
+	 *      f -- "file name" name of text file to print
 	 *		l -- "file name" text file with control chars
 	 *		p -- "file name" text file to print with pr(1)
-	 *		t -- "file name" troff(1) file to print
-	 *		n -- "file name" ditroff(1) file to print
 	 *		d -- "file name" dvi file to print
 	 *		g -- "file name" plot(1G) file to print
 	 *		v -- "file name" plain raster file to print
 	 *		c -- "file name" cifplot file to print
-	 *		1 -- "R font file" for troff
-	 *		2 -- "I font file" for troff
-	 *		3 -- "B font file" for troff
-	 *		4 -- "S font file" for troff
 	 *		N -- "name" of file (used by lpq)
-	 *              U -- "unlink" name of file to remove
-	 *                    (after we print it. (Pass 2 only)).
+	 *      U -- "unlink" name of file to remove
+	 *          (after we print it. (Pass 2 only)).
 	 *		M -- "mail" to user when done printing
 	 *
 	 *      get_line reads a line and expands tabs to blanks


Above I removed options for troff, ditroff and realigned to have options
line up in comments


@@ -453,14 +429,6 @@ printit(char *file)
 				banner(line+1, jobname);
 			continue;
 
-		case '1':	/* troff fonts */
-		case '2':
-		case '3':
-		case '4':
-			if (line[1] != '\0')
-				strlcpy(fonts[line[0]-'1'], line+1, FONTLEN);
-			continue;
-
 		case 'W':	/* page width */
 			strlcpy(width+2, line+1, sizeof(width) - 2);
 			continue;
@@ -524,7 +492,7 @@ pass2:


I removed cases for troff fonts.


 /*
  * Print a file.
- * Set up the chain [ PR [ | {IF, OF} ] ] or {IF, RF, TF, NF, DF, CF, VF}.
+ * Set up the chain [ PR [ | {IF, OF} ] ] or {IF, RF, CF, VF}.
  * Return -1 if a non-recoverable error occurred,
  * 2 if the filter detected some errors (but printed the job anyway),
  * 1 if we should try to reprint this job and
@@ -646,28 +614,6 @@ print(int format, char *file)
 		av[2] = length;
 		n = 3;
 		break;
-	case 't':	/* print troff output */
-	case 'n':	/* print ditroff output */
-	case 'd':	/* print tex output */
-		(void)unlink(".railmag");
-		if ((fo = open(".railmag", O_CREAT|O_WRONLY|O_EXCL, FILMOD)) < 0) {
-			syslog(LOG_ERR, "%s: cannot create .railmag", printer);
-			(void)unlink(".railmag");
-		} else {
-			for (n = 0; n < 4; n++) {
-				if (fonts[n][0] != '/')
-					(void)write(fo, _PATH_VFONT,
-					    sizeof(_PATH_VFONT) - 1);
-				(void)write(fo, fonts[n], strlen(fonts[n]));
-				(void)write(fo, "\n", 1);
-			}
-			(void)close(fo);
-		}
-		prog = (format == 't') ? TF : (format == 'n') ? NF : DF;
-		av[1] = pxwidth;
-		av[2] = pxlength;
-		n = 3;
-		break;
 	case 'c':	/* print cifplot output */
 		prog = CF;
 		av[1] = pxwidth;

Above I removed cases for troff ditroff and tex files.


@@ -1327,9 +1273,6 @@ init(void)
 	cgetstr(bp, "of", &OF);
 	cgetstr(bp, "if", &IF);
 	cgetstr(bp, "rf", &RF);
-	cgetstr(bp, "tf", &TF);
-	cgetstr(bp, "nf", &NF);
-	cgetstr(bp, "df", &DF);
 	cgetstr(bp, "gf", &GF);
 	cgetstr(bp, "vf", &VF);
 	cgetstr(bp, "cf", &CF);


Above I removed cgetstr for troff ditroff and tex files.


Compiles fine, but I don't have the printers and network to
serial/parallel boxes. Unless I threw them away, I have some really old
ones.

I think it might be best to have someone who uses really old stuff like
serial printers, etc. like in restaurants to test this first?

Chris

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic