Patch #: 98 Type: operational change Priority: none Modification: add option to lwsrv to specify spool program Submitted: John J Chew Archived: munnari.OZ.AU mac/cap.patches/cap60.patch098 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch098' Summary: add -C flag to lwsrv File: cap60/applications/lwsrv/lwsrv.c File: cap60/contrib/lwsrv-relay *** applications/lwsrv/lwsrv.c.orig Sat Feb 22 22:08:42 1992 --- applications/lwsrv/lwsrv.c Sun Mar 8 19:25:04 1992 *************** *** 1,6 **** ! static char rcsid[] = "$Author: djh $ $Date: 1992/02/22 11:08:30 $"; ! static char rcsident[] = "$Header: /mac/src/cap60/applications/lwsrv/RCS/lwsrv.c,v 2.17 1992/02/22 11:08:30 djh Rel djh $"; ! static char revision[] = "$Revision: 2.17 $"; /* * lwsrv - UNIX AppleTalk spooling program: act as a laserwriter --- 1,6 ---- ! static char rcsid[] = "$Author: djh $ $Date: 1992/03/08 09:24:57 $"; ! static char rcsident[] = "$Header: /mac/src/cap60/applications/lwsrv/RCS/lwsrv.c,v 2.18 1992/03/08 09:24:57 djh Rel djh $"; ! static char revision[] = "$Revision: 2.18 $"; /* * lwsrv - UNIX AppleTalk spooling program: act as a laserwriter *************** *** 111,116 **** --- 111,133 ---- #ifdef NeXT char *nextdpi = NULL; /* NeXT printer resolution */ #endif NeXT + + #ifdef USESYSVLP + # ifndef LPRCMD + # define LPRCMD "/usr/bin/lp" + # endif LPRCMD + #endif USESYSVLP + + #ifndef LPRCMD + # ifdef xenix5 + # define LPRCMD "/usr/bin/lpr" + # else xenix5 + # define LPRCMD "/usr/ucb/lpr" + # endif xenix5 + #endif LPRCMD + + private char *lprcmd = LPRCMD; + #ifdef LPRARGS private char *lprargsbuf[16]; private char **lprargs = lprargsbuf; *************** *** 148,153 **** --- 165,171 ---- fprintf(stderr,"\t-A [on|off*] means to turn on or off Adobe document\n"); fprintf(stderr,"\tstructuring revision 2 compatibility\n"); fprintf(stderr,"\t(this can cause problems, *'ed item is default)\n"); + fprintf(stderr,"\t-C Specify print spooler rather than lp/lpr\n"); #ifdef LPRARGS fprintf(stderr,"\t-L Argument to pass to lpr (multiple use)\n"); #endif LPRARGS *************** *** 180,186 **** int c; extern char *optarg; extern int optind; ! static char optlist[64] = "a:f:l:p:t:d:n:rehNT:A:Sv"; #ifdef LWSRV_AUFS_SECURITY strcat(optlist, "X:"); --- 198,204 ---- int c; extern char *optarg; extern int optind; ! static char optlist[64] = "a:f:l:p:t:d:n:rehNT:A:C:Sv"; #ifdef LWSRV_AUFS_SECURITY strcat(optlist, "X:"); *************** *** 239,244 **** --- 257,265 ---- if (simple_dsc_option(optarg) < 0) usage(argv[0], NULL); break; + case 'C': + lprcmd = optarg; + break; #ifdef LPRARGS case 'L': *lprargs++ = optarg; *************** *** 628,647 **** fprintf(stderr,"lwsrv: Printing job: %s; user %s; on %s\n", jobname,username,ctime(&t)); - #ifdef USESYSVLP - # ifndef LPRCMD - # define LPRCMD "/usr/bin/lp" - # endif LPRCMD - #endif USESYSVLP - - #ifndef LPRCMD - # ifdef xenix5 - # define LPRCMD "/usr/bin/lpr" - # else xenix5 - # define LPRCMD "/usr/ucb/lpr" - # endif xenix5 - #endif LPRCMD - /* * this way lies madness ... */ --- 649,654 ---- *************** *** 775,793 **** * */ fprintf(stderr, "Invoking lpr as user %s using execv: %s", ! (requname) ? requname : "", LPRCMD); for ( i = 1 ; i < argc ; i++) fprintf(stderr," %s",childargv[i]); fprintf(stderr, "\n"); #endif LWSRV_LPR_LOG ! if (execv(LPRCMD,childargv)) { ! fprintf(stderr,"exec of %s failed\n", LPRCMD); perror("exec"); exit(-1); } break; case -1: ! fprintf(stderr,"fork failed trying to run %s\n", LPRCMD); perror("fork"); break; default: --- 782,800 ---- * */ fprintf(stderr, "Invoking lpr as user %s using execv: %s", ! (requname) ? requname : "", lprcmd); for ( i = 1 ; i < argc ; i++) fprintf(stderr," %s",childargv[i]); fprintf(stderr, "\n"); #endif LWSRV_LPR_LOG ! if (execv(lprcmd,childargv)) { ! fprintf(stderr,"exec of %s failed\n", lprcmd); perror("exec"); exit(-1); } break; case -1: ! fprintf(stderr,"fork failed trying to run %s\n", lprcmd); perror("fork"); break; default: *** contrib/lwsrv-relay.orig Sun Mar 8 19:38:39 1992 --- contrib/lwsrv-relay Sun Mar 8 19:39:53 1992 *************** *** 0 **** --- 1,35 ---- + #!/usr/bin/perl + + # lwsrv-relay - relay PostScript jobs received by lwsrv to other hosts + # + # This Perl script is an example of what you can do with the -C option for + # lwsrv. It invokes rcp to copy the received file to a directory on another + # host, renaming it as a cleaned up version of the job name with the process + # id attached to prevent collisions. We use it here to feed jobs to a + # (non-lpr) typesetter. + # + # John J. Chew + # 1991 12 10 + + $dest = 'desire1:/tmp'; # change this to send the file elsewhere + + require 'getopts.pl'; + $opt_s = '-'; + do Getopts('J:P:rs:'); + $dest .= '/' unless $dest =~ m!/$!; + ($job = $opt_J) =~ tr/-.A-Za-z0-9//dc; + $in = $opt_s; + $out = "$dest$job'.'$$"; + + print STDERR "lwsrv-relay: invoked as ", join(' ', $0, @ARGV), "\n"; + + sub system { + print STDERR "lwsrv-relay: ", join(' ', @_), "\n"; + print STDERR "lwsrv-relay: returned ", system(@_), "\n"; + } + + # change these two lines to do something else with the job + &system('/usr/ucb/rcp', $in, $out); + &system('/bin/rm', $in); + + exit 0; *** README.orig Sun Mar 8 19:25:40 1992 --- README Sun Mar 8 19:26:03 1992 *************** *** 3,9 **** (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 97, March 1992 Introduction ------------ --- 3,9 ---- (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 98, March 1992 Introduction ------------