Patch #: 156 Type: operational change Priority: none Modification: add support for printing on both sides if supported by printer Modification: add support for TranScript 3.0 'psdman' (rather than 'pstext') Submitted: Dan Mosedale Archived: munnari.OZ.AU mac/cap.patches/cap60.patch156 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch156' Summary: add -2 flag to papif, recognise printer name -dup* suffix File: cap60/applications/papif/README File: cap60/applications/papif/papif.c File: cap60/man/papif.8 File: cap60/Configure *** applications/papif/README.orig Thu Feb 28 23:44:10 1991 --- applications/papif/README Mon Sep 6 13:29:35 1993 *************** *** 95,100 **** --- 95,115 ---- text to PostScript. This is a standard part of Transcript. The default is none. + * TRANS3: defined in m4.features + + TranScript 3.0 compatibility. Assumes that psdman will be used + instead of pstext, and so it automatically gives psdman the required + -P printer argument. Also assumes that RUTGERS is not defined. + + * DUPLEXMODE: defined in m4.features + + support full-duplex printing. This code was written and tested with + an HP LaserJet IIIsi with a PostScript card. What it does is if papif is + given the -2 switch, or if the printer name ends in -dup* (e.g. lw-duplex, + lj-dup, lpr-dupsomething), it will add the following bit of PostScript code + to the prolog: + + statusdict begin true setduplexmode end OTHER NON Transcript OPTIONS ---------------------------- *** applications/papif/papif.c.orig Fri Aug 6 01:52:38 1993 --- applications/papif/papif.c Mon Sep 6 13:51:44 1993 *************** *** 1,6 **** ! static char rcsid[] = "$Author: djh $ $Date: 1993/08/05 15:52:31 $"; ! static char rcsident[] = "$Header: /mac/src/cap60/applications/papif/RCS/papif.c,v 2.13 1993/08/05 15:52:31 djh Rel djh $"; ! static char revision[] = "$Revision: 2.13 $"; /* * papif - UNIX AppleTalk test program: simple line printer input filter --- 1,6 ---- ! static char rcsid[] = "$Author: djh $ $Date: 1993/09/06 03:51:26 $"; ! static char rcsident[] = "$Header: /mac/src/cap60/applications/papif/RCS/papif.c,v 2.14 1993/09/06 03:51:26 djh Rel djh $"; ! static char revision[] = "$Revision: 2.14 $"; /* * papif - UNIX AppleTalk test program: simple line printer input filter *************** *** 20,30 **** * */ - /* PATCH: papif.c.reverse, djh@munnari.OZ.AU, 15/11/90 */ - /* PATCH: papif.c.atpresponse, djh@munnari.OZ.AU, 20/11/90 */ - /* PATCH: papif.c.variousbugs, djh@munnari.OZ.AU, 20/11/90 */ - /* PATCH: XENIX/file.3, djh@munnari.OZ.AU, 20/11/90 */ - char copyright[] = "Copyright (c) 1986, 1987, 1988 by The Trustees of Columbia University in the City of New York"; #include --- 20,25 ---- *************** *** 204,209 **** --- 199,207 ---- int Rotate = FALSE; /* Rutgers - print in portrait mode */ char rot[2]; /* Rutgers - option for pstext */ #endif RUTGERS + #ifdef DUPLEXMODE + int duplex = FALSE; /* Print on both sides of the page? */ + #endif DUPLEXMODE /* declarations */ char *ptime(); *************** *** 414,419 **** --- 412,420 ---- char *pp; char *getenv(); #endif MACUSER + #ifdef DUPLEXMODE + char *tmpdup; /* temporary var to check for "-dup*" */ + #endif DUPLEXMODE extern boolean dochecksum; *printer = *user = *host = '\0'; /* init to nothing */ *************** *** 423,428 **** --- 424,434 ---- p = argv[i]; if (p[0] == '-') { switch (p[1]) { + #ifdef DUPLEXMODE + case '2': + duplex = TRUE; /* turn on 2-sided printing */ + break; + #endif DUPLEXMODE case 'd': dbugarg(p+2); break; *************** *** 492,497 **** --- 498,515 ---- if (*printer == '\0') /* no printer name? */ if (strcmp(pgmname, "papif") != 0 && strcmp(pgmname, "psif") != 0) strcpy(printer, pgmname); + + #ifdef DUPLEXMODE + /* + * if the printer name ends in -dup* then we + * want to print on both sides of the paper. + * + */ + if (tmpdup = rindex(printer, '-')) + if (strncmp(tmpdup, "-dup", 4) == 0) + duplex = TRUE; + #endif DUPLEXMODE + #ifdef MACUSER if (strcmp(user, "root") == 0 && (p = getenv("LPD_JOB")) && strncmp(p, "MacUser: ", 9) == 0) { *************** *** 935,941 **** --- 953,966 ---- } else execl(fp, fn, 0); #else RUTGERS + #ifdef TRANS3 + if (strcmp(fn, "psdman") == 0) + execl(fp, fn, "-P", printer, 0); + else + execl(fp, fn, 0); + #else TRANS3 execl(fp, fn, 0); + #endif TRANS3 #endif RUTGERS /* if we are here again, then... */ perror("filter setup: child exec"); *************** *** 1040,1045 **** --- 1065,1074 ---- strcat(ps_buf, ":"); strcat(ps_buf, user); strcat(ps_buf, ") put} if\n"); + #ifdef DUPLEXMODE + if (duplex) + strcat(ps_buf, "statusdict begin true setduplexmode end"); + #endif DUPLEXMODE if ((paperr=PAPWrite(cno, ps_buf,strlen(ps_buf), FALSE, &wcomp)) < 0) { log_e("papif: sendfile: 1st PAPWrite: call error %d\n", paperr); PAPClose(cno); *** man/papif.8.orig Mon Aug 3 02:03:16 1992 --- man/papif.8 Mon Sep 6 13:58:49 1993 *************** *** 111,116 **** --- 111,122 ---- Plus:LaserWriter@*" (LaserWriter named "LaserWriter Plus" in the local zone). See the section "Example printcap entries" for an example printcap entry. + .PP + If the printer name ends in -dup* (e.g. has a name such as lw-dup or + lj-duplex), and papif was compiled with the DUPLEXMODE option, papif will + assume that this printer has the capability to print on both sides of a + page. The printer is then directed (by the addition of some PostScript + code) to use this ability. .SH ARGUMENTS .PP .I papif *************** *** 133,138 **** --- 139,149 ---- .BI \-P " " is a TranScript compatible option that specifies the UNIX printer name. .TP 10 + .BI \-2 + directs the printer to print this job in 2-sided mode. Only use this if + your printer has the hardware to support this. This switch only exists + if papif has been compiled with the DUPLEXMODE feature. + .TP 10 .BI \-p " " is a TranScript compatible option that specifies the program name. .TP 10 *************** *** 389,395 **** .SH NOTES .I papif - TranScript compatibility is only known to work for version 2.0 of TranScript. TranScript is available under license from Adobe Systems Incorporated. .SH BUGS .I papif --- 400,405 ---- *** Configure.orig Mon Aug 16 23:09:10 1993 --- Configure Mon Sep 6 14:05:53 1993 *************** *** 1,7 **** #!/bin/sh ! # $Author: djh $ $Date: 1993/08/16 13:09:01 $ ! # $Header: /local/mulga/mac/src/cap60/RCS/Configure,v 2.60 1993/08/16 13:09:01 djh Rel djh $ ! # $Revision: 2.60 $ # CAP configuration shell script. This ain't perfect, but it's a start. # Execute with /bin/sh Configure if your system won't run it (ksh is okay too) # --- 1,7 ---- #!/bin/sh ! # $Author: djh $ $Date: 1993/09/06 04:05:36 $ ! # $Header: /mac/src/cap60/RCS/Configure,v 2.61 1993/09/06 04:05:36 djh Rel djh $ ! # $Revision: 2.61 $ # CAP configuration shell script. This ain't perfect, but it's a start. # Execute with /bin/sh Configure if your system won't run it (ksh is okay too) # *************** *** 825,830 **** --- 825,840 ---- # # + USER_REQUIRED (requires RUN_AS_USER) refuse printing if Chsr name invalid # define(`lwflags',concat(lwflags,` -DUSER_REQUIRED')) + # + # + # PAPIF options + # + # + DUPLEXMODE tell suitably equipped printer to print on both sides of a page + # define(`specialcflags',concat(specialcflags,` -DDUPLEXMODE')) + # + # + TRANS3 add support for TranScript 3.0 'psdman' (instead of pstext) + # define(`specialcflags',concat(specialcflags,` -DTRANS3')) + # # EOT0 result=0 *** lib/cap/abversion.c.orig Mon Sep 6 12:48:34 1993 --- lib/cap/abversion.c Mon Sep 6 14:06:45 1993 *************** *** 31,37 **** myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 155; myversion.cv_rmonth = "August"; myversion.cv_ryear = "1993"; switch (lap_proto) { --- 31,37 ---- myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 156; myversion.cv_rmonth = "August"; myversion.cv_ryear = "1993"; switch (lap_proto) { *** README.orig Mon Sep 6 12:49:48 1993 --- README Mon Sep 6 14:08:02 1993 *************** *** 2,8 **** CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 155, August 1993 Notice ------ --- 2,8 ---- CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 156, August 1993 Notice ------