From: utzoo!decvax!microsof!uw-beave!jim Newsgroups: net.unix-wizards,net.bugs.4bsd Title: Re: a summary of bugs in lpd.c on 4.1 Article-I.D.: uw-beave.268 Posted: Thu Dec 30 10:40:38 1982 Received: Fri Dec 31 07:55:53 1982 References: linus.1233 While we are on the subject of line printers ... A lot of people seem to be using Printronix printers, and the standard lpf doesn't handle underlining or plot mode correctly for a Printronix. Here is my diff listing to lpf.c to make them work. *** lpf.c_o Tue Sep 15 08:02:34 1981 --- lpf.c Tue Sep 7 16:44:43 1982 *************** *** 1,6 static char *sccsid = "@(#)lpf.c 4.5 (Berkeley) 81/06/10"; /* * lpf -- Line printer filter */ #include --- 1,11 ----- static char *sccsid = "@(#)lpf.c 4.5 (Berkeley) 81/06/10"; /* * lpf -- Line printer filter + * + * Jim Rees Added baud rate to ttyb + * 8 July 82 Jim Rees Fixed underlining for Printronix + * 23 Aug 82 Jim Rees Fixed plot mode for Printronix + * 7 Sept 82 Joe Kelsey Fixed formfeed for Printronix */ #include *************** *** 7,12 #include #include #define LINELN 132 #define EJLINE 66 #define SKPLINE 0 --- 12,19 ----- #include #include + #define PRINTRONIX /* Special modes for Printronix */ + #define LINELN 132 #define EJLINE 66 #define SKPLINE 0 *************** *** 14,19 int anydone; char linebuf[LINELN+2]; int ov; char ovbuf[LINELN]; FILE *in = {stdin}; FILE *out; --- 21,27 ----- int anydone; char linebuf[LINELN+2]; int ov; + int plotmode; char ovbuf[LINELN]; FILE *in = {stdin}; FILE *out; *************** *** 122,127 register int col, maxcol, c; ov = 0; for (col=0; col= LINELN) + maxcol = LINELN; + linebuf[maxcol] = 0; + return 1; + #else continue; #endif PRINTRONIX case ' ': *************** *** 150,156 case '\f': lineno = EJLINE; continue; ! case ' ': col++; continue; --- 172,178 ----- return 1; #else continue; ! #endif PRINTRONIX case ' ': col++; continue; *************** *** 201,215 int i, j; errno = 0; ! /* ! if (ov) do { ! for (ep= &ovbuf[LINELN-1]; *ep == 0; ep--) ! continue; ! for (lp=ovbuf; lp <= ep; lp++) ! output(*lp ? *lp : ' ', out); ! }; ! */ ! again: if (ff >= 0) { lp = linebuf; while (c = *lp++) --- 223,229 ----- int i, j; errno = 0; ! if (ff >= 0) { lp = linebuf; #ifdef PRINTRONIX *************** *** 212,217 again: if (ff >= 0) { lp = linebuf; while (c = *lp++) output(c,out); } --- 226,235 ----- if (ff >= 0) { lp = linebuf; + #ifdef PRINTRONIX + if (plotmode) + output('\05', out); + #endif PRINTRONIX while (c = *lp++) output(c,out); } *************** *** 215,220 while (c = *lp++) output(c,out); } if (ff > 0) { putc('\014', out); putc('\r', out); --- 233,249 ----- while (c = *lp++) output(c,out); } + + #ifdef PRINTRONIX + if (ov) { + output('\r', out); + for (ep= &ovbuf[LINELN-1]; *ep == 0; ep--) + continue; + for (lp=ovbuf; lp <= ep; lp++) + output(*lp ? *lp : ' ', out); + } + #endif PRINTRONIX + if (ff > 0) { putc('\014', out); putc('\r', out); *************** *** 298,304 if (c == -1) return; c &= 0177; ! if (c == 0177) putc('^',fp), c = '?'; if (c == 033) c = '$'; --- 327,333 ----- if (c == -1) return; c &= 0177; ! if (c == 0177 && !plotmode) putc('^',fp), c = '?'; if (c == 033) c = '$'; *************** *** 311,316 case '\b': case '\t': case '\r': break; default: --- 340,348 ----- case '\b': case '\t': case '\r': + #ifdef PRINTRONIX + case '\05': + #endif PRINTRONIX break; default: