Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!ntg!dplatt From: dplatt@ntg.uucp (Dave Platt) Newsgroups: comp.protocols.appletalk Subject: Re: CAP and LaserWriter 6.1/7.0? Message-ID: <52@goblin.ntg.uucp> Date: 10 Apr 91 00:54:02 GMT References: <1991Apr8.033857.4061@m.cs.uiuc.edu> Reply-To: dplatt@ntg.UUCP (Dave Platt) Organization: New Technologies Group, Inc. Palo Alto CA Lines: 118 I've managed to modify lwsrv to work with the 6.1 LaserWriter driver. The changes are modest... a few lines to simple.c, and a small amount of hand-editing to the uploaded prep file. I found at least three separate problems which contributed to the inability of lwsrv to handle LaserWriter 6.1 output: - Apple has two prepfiles which announce themselves with the same AppleDict version number. One is a persistent "exitserver" job, the other is not. - When the LaserWriter 6.1 driver transmits the first (persistent) prep file, it sends an EOF without sending an %%EndProcSet comment first. - When lwsrv sees the EOF in the persistent procset, it closes the file to which it was capturing the procset. However, it fails to zero out the variable which was holding the procset file descriptor. Hence, when the LaserWriter driver tries to send up the "real" AppleDict 71, lwsrv mistakenly believes that a procset was already being uploaded, and flushes the new one. It then prepends the smaller "persistent" procset rather than the "real" one, and the print job fails due to missing dictionary entries. In order to fix these problems and make lwsrv compatible with the LaserWriter 6.1 driver, you'll need to apply the following patches to lwsrv and follow a simple procedure. *** simple.c.orig Tue Apr 9 16:34:36 1991 --- simple.c Tue Apr 9 17:03:05 1991 *************** *** 511,519 **** echo = FALSE; stripspaces(ts); /* clear off extra spaces */ if ((dl = GetProcSet(ts)) != NULL) { ! fprintf(stderr, "lwsrv: simple: procset already known\n"); break; } #ifdef xenix5 sprintf(tmpstr, "%s/Found.%d",dictdir,time(0)); #else xenix5 --- 511,520 ---- echo = FALSE; stripspaces(ts); /* clear off extra spaces */ if ((dl = GetProcSet(ts)) != NULL) { ! fprintf(stderr, "lwsrv: simple: procset %s already known\n", ts); break; } + sleep(1); /* raise odds of unique timestamp */ #ifdef xenix5 sprintf(tmpstr, "%s/Found.%d",dictdir,time(0)); #else xenix5 *************** *** 649,654 **** --- 650,656 ---- } if (procsetfile) { fclose(procsetfile); + procsetfile = NULL; if (dlnew) { unlink(dlnew->ad_fn); free(dlnew->ad_fn); /* free fn */ Now, for the procedure: - mkdir /tmp/procsets or some other temporary location. Make sure that this directory is empty. - Start up lwsrv. Run it in single-fork mode (-S), debugging the NBP packets (-dn), giving it a dummy printer name to proxy (-n test), pointing it to a real LaserWriter (-p MyPrinterName), specifying the usual font-dictionary file, running in trace mode (-t /tmp/tracefile) and pointing at the temporary procsets directory (-a /tmp/procsets). - On a Mac which has the LaserWriter 6.1 driver installed, fire up the Chooser, select the LaserWriter 6.1 driver, and select the "test" printer. Close the Chooser. - Open up a Finder window and do a "Print directory". On your Unix machine, lwsrv should report that it's uploading the procset "(AppleDict md)" 71 0. It should actually perform the upload twice, into two different FoundProcSet files. It will then receive, and dump to the trace file, the Finder's directory output. - After the job is finished uploading, hit control-C to terminate lwsrv. - Edit the first of the two FoundProcSet files in /tmp/procsets. Add the word "persistent" (or anything else, actually) at the end of the first (%%BeginProcSet) line, after the "71 0" identifier. Add a new line immediately after the %%BeginProcSet line: 0 serverdict begin exitserver thus replacing the exitserver which lwsrv had removed. - Move the two FoundProcSet files from /tmp/procsets into your real procset directory. Kill and then restart each of your real lwsrv processes. This should do the trick. When lwsrv starts up, it will see the two 6.1-based procsets, but it won't confuse the two (because you've changed the %%BeginProcSet line in the persistent procset). You can arrange to download the persistent procset to your printers periodically, so that it's installed whenever a printer reboots. This same approach should, I think, work OK with the LaserWriter drivers which come with System 7.0. I haven't tried it yet. In my brief experiments, I've been able to spool jobs from a 5.2 and 6.1 LaserWriter driver to the same lwsrv process without any problems whatsoever... they spooled OK and printed OK (on a printer which had already been prepped by a Mac running LaserWriter 5.2). -- Dave Platt VOICE: (415) 813-8917 UUCP: ...apple!ntg!dplatt USNAIL: New Technologies Group Inc. 2468 Embarcardero Way, Palo Alto CA 94303