[comp.protocols.appletalk] lwsrv

jwk@SCRIPPS.EDU ("Two Sheds" Kupec) (09/28/89)

Thanks for your past help.  Here's a new one:

I'm running CAP on my Sun 3/180 and it works great so far.  Now I want
to add the lwsrv spooler to allow the Macs to print to an Imagen 3320
which is sitting on the Ethernet.

Past History:
-------------
I have loaded Imagen's replacement Apple Dictionary (dictv5.2) onto 
the 3320's hard disk.  I can create a postscript file on the Mac 
(cloverleaf-f), ftp it to the unix host, and then "lpr -Pimagen" it 
and I get the proper output- so I have that going for me.  (Imagen's
croak on print jobs headed by Apple's LaserPrep.  This has been doc-
umented here before. See below).

The Present:
------------
I have been unsuccessful with lwsrv.  Will this even do what I want it to
do (print directly from the Mac to the Imagen)?  

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 
ANY apple dictionary info to my print jobs.  How can I force the mac/lwsrv 
combo to just blast an undictionaried postscript file to my Imagen- and
use Imagen's dictionary? 

I hope this make sense.  All suggestions welcome.
TIA,

John Kupec	(jwk@scripps.edu)
		Scripps Clinic & Research Foundation
		Dept. of Molecular Biology
		(619) 554-4389

simpson@trwarcadia.uucp (Scott Simpson) (09/30/89)

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 <DictionaryDirectory> -f <FontFile>\n");
    fprintf(stderr,"usage:\t\t[-l <LogFile>] [-t <TraceFile>] [-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*<unix printer name> is the unix printer to print to\n");
    fprintf(stderr,"\t-n*<PrinterName> specifies the name lwsrv registers.\n");
    fprintf(stderr,"\t-a*<DictionaryDirectory> 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)