Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!wiley!trwarcadia!simpson
From: simpson@trwarcadia.uucp (Scott Simpson)
Newsgroups: comp.protocols.appletalk
Subject: Re: lwsrv
Summary: Getting CAP to work with UltraScript
Keywords: ultrascript, CAP, PostScript, lwsrv
Message-ID: <5593@wiley.UUCP>
Date: 29 Sep 89 20:53:11 GMT
References: <8909281639.AA26242@riscsm.scripps.edu..>
Sender: news@wiley.UUCP
Reply-To: simpson@trwarcadia.UUCP (Scott Simpson)
Organization: TRW Arcadia Project, Redondo Beach, CA
Lines: 132

In article <8909281639.AA26242@riscsm.scripps.edu..> jwk@SCRIPPS.EDU ("Two Sheds" Kupec) writes:
>The mac will find the Imagen, give me a "status" dialog box (which exits 
>too fast) and exit gracefully looking like everything worked.  However I 
>only get a banner page out of the printer which has a message about 
>"invalidaccess", etc. that Ed Arnold discussed in his "Imagen PostScript 
>Problems" posting.  So it looks like I want to prevent lwsrv from prepending 

I ran into the same problem.  I am running through a GatorBox.  I
assume you are running atis and lwsrv.  To solve your problem, first
start with a virgin copy of FoundProcSet.622934937 (The number will be
different on your machine).  This file is created automatically by
lwsrv the first time you try to queue a job from the Mac to the
Imagen.  It is put in the directory given to the -a option to lwsrv.
Once you have a virgin copy of this file, translate all the carriage
returns to line feeds using tr(1).

	% tr '\015' '\012' < FoundProcSet.622934937 > ,t
	% mv ,t FoundProcSet.622934937

Next, delete everything from the beginning of the file to the line
starting with "/av".  Now insert

%%BeginProcSet: "(AppleDict md)" 68 0
systemdict/currentpacking known{currentpacking true setpacking}if
/ok true def
/LW false def
/waittimeout 300 def
/fc {} def
/md 250 dict def md begin
/av 0 def

at the beginning of the file.  It should now work.
	Also, I modified lwsrv.c so it takes a -i option designating
output to an Ultrascript printer (i.e., ipr) rather than a LaserWriter.
Here is my /etc/start-cap-servers file:

#!/bin/sh
# Sample start servers file
/etc/atis
# allow atis to startup first
sleep 5
lwsrv -i -n imagen -p imagen -a /usr/arcadia/lib/cap -f \
/usr/arcadia/lib/tex/ps/psfonts.map -T crtolf

Notice the -i option to lwsrv.  You won't see this on the man page!
The psfonts.map file is the same one used by dvips(1).  Here are the
diffs to lwsrv.c (install the diffs by hand.  You'll need to change
your path for ipr):

*** lwsrv.c.orig	Tue Sep 26 09:00:38 1989
--- lwsrv.c	Wed Sep 27 13:40:58 1989
***************
*** 61,66 ****
--- 61,67 ----
  private int rflag = FALSE;		/* retain print file */
  private int hflag = TRUE;	/* default to print banner */
  private int singlefork = FALSE;
+ private int imagen = FALSE;	/* Use ipr rather than lpr */
  export PAPStatusRec statbuff;			/* status buffer */
  
  private char username[80],jobname[80];
***************
*** 83,88 ****
--- 84,90 ----
    fprintf(stderr,"usage:\t\t-a  -f \n");
    fprintf(stderr,"usage:\t\t[-l ] [-t ] [-r] [-h]\n");
    fprintf(stderr,"usage:\t\t[-T crtolf] [-T quote8bit]\n\n");
+   fprintf(stderr,"\t-i Use Imagen's ipr rather than lpr\n");
    fprintf(stderr,"\t-p* is the unix printer to print to\n");
    fprintf(stderr,"\t-n* specifies the name lwsrv registers.\n");
    fprintf(stderr,"\t-a* is the ProcSet directory.\n");
***************
*** 121,127 ****
    extern char *optarg;
    extern int optind;
    
!   while ((c = getopt(argc,argv,"a:f:l:p:P:t:d:n:rehT:A:S")) != EOF) {
      switch (c) {
      case 'a':
        if (index(optarg, '/') == NULL) {
--- 123,129 ----
    extern char *optarg;
    extern int optind;
    
!   while ((c = getopt(argc,argv,"a:f:l:p:P:t:d:n:reihT:A:S")) != EOF) {
      switch (c) {
      case 'a':
        if (index(optarg, '/') == NULL) {
***************
*** 134,139 ****
--- 136,144 ----
      case 'd':
        dbugarg(optarg);
        break;
+     case 'i':
+       imagen = TRUE;
+       break;
      case 'f':
        fontfile = optarg;		/* -f fontfile */
        break;
***************
*** 347,355 ****
        fprintf(stderr,"lwsrv: Preserving file in %s\n",tname);
      fprintf(stderr,"lwsrv: Printing job: %s; user %s; on %s\n",
  	    jobname,username,ctime(&t));
!     sprintf(buf,
  	"/usr/ucb/lpr -P%s %s %s -J 'MacUser: %s' %s\n", unixpname,
  	rflag ? "" : "-r",hflag ? "" : "-h", username,tname);
      system(buf);
    }
    p_cls(pf);				/* close out the pap connection */
--- 352,367 ----
        fprintf(stderr,"lwsrv: Preserving file in %s\n",tname);
      fprintf(stderr,"lwsrv: Printing job: %s; user %s; on %s\n",
  	    jobname,username,ctime(&t));
!     if (imagen == TRUE) {
!         sprintf(buf,
! "/usr/arcadia/bin/ipr -Lultrascript -P%s %s %s -D'name MacUser:%s' %s\n", 
! 	unixpname, rflag ? "" : "-r",hflag ? "" : "-D'jobheader off'", 
! 	username,tname);
!     } else {
!         sprintf(buf,
  	"/usr/ucb/lpr -P%s %s %s -J 'MacUser: %s' %s\n", unixpname,
  	rflag ? "" : "-r",hflag ? "" : "-h", username,tname);
+     }
      system(buf);
    }
    p_cls(pf);				/* close out the pap connection */
	Scott Simpson
	TRW Space and Defense Sector
	usc!trwarcadia!simpson  	(UUCP)
	trwarcadia!simpson@usc.edu	(Internet)