Remote Print Despooler 1.96 =========================== Originals by ARBS 1989, Rob Cowell 1990 Rewrite by J.G.Harston 1998-2000 70 Camm Street, Walkley, Sheffield, S6 3TR jgh@mdfs.net The Remote Print Despooler is a program that can be run on any 6502-based computer on the network to provide printing facilities. It periodically examines the %PRINTQ directory for print jobs which have a particular printer name attached and prints these jobs to a local printer. This in effect gives you another physical printer with print spooling anywhere on the network. Setting up the despooler ======================== The despooler needs to have access to the %PRINTQ directory in order to read data from the print job and also to delete it when the job is finished. If you have not done so already you should allocate an account number to %PRINTQ and credit this account with a large amount of space. The recommended account number is &3F. Some installations come with the %PRINTQ set to account 0. Leaving it this way would mean that any user wishing to run the despooler would need to have access to account 0! You should create a user, such as DESPOOL, and give this user access to the %PRINTQ account only, ie account &3F. You may want to give this user a password to prevent other users from starting up the despooler software themselves. You can specify on startup or with command line options which logical printers to despool, and which printer ports to print them to. Each logical printer can be sent to a different port, including the NULL port to just throw output away. You should create a new logical printer using EDITPRINT. The name you choose for this printer should be the name you wish users to select when wishing to access the remote despooler. This new printer can be set up in the normal manner, ie you can set account ownership required, anonymous users allowed, etc. The difference is that you should make sure that the filer server will not print jobs sent to this printer name. For File Servers prior to version 1.00 this means setting the 'Printing enabled' field to 'No'. For version 1.00 or later this means specifying the status of the printer as 'Hold'. Running the despooler ===================== The simplest way of running the despooler is to create a !Boot file that is run when the despooler user logs on. The !Boot file needs to CHAIN "RemDespl" and can also pass parameters to specify which printers to print. Below is an example of a typical !Boot file: *Basic CHAIN "RemDespl DRAFT:1 NLQ:1 LASER:2 SINK:0" This will take print jobs for the printers called DRAFT, NLQ, LASER and SINK. It will print the DRAFT and NLQ jobs to printer port 1 - the parallel port, LASER to port 2 - the serial port, and SINK to port 0 - the null port. If no printers are specified in the command line, then the despooler program prompts for a list to be entered. If a printer port is not specified for a printer, then it's output will go to the currently selected printer output port. This will be the same as whichever port the previously processed print job went to. It is much better to fully specify all the printer ports for all the printers. Flushing print jobs and quitting the despooler ============================================== When the status line indicates that printing is in progress, pressing Escape will flush that job. Pressing 'Q' will quit the despooler after the current print job is completed, or immediately if the depooler is idle. Time between polls ================== The despooler does not constantly examine %PRINTQ as this would result in too much network traffic. By default the print queue is scanned once every 30 seconds. You can change this by passing a different poll delay in the startup command with the -poll switch, eg: CHAIN "RemDespl DRAFT:1 -poll 10" would poll every 10 seconds. Prodding ======== Prodding the despooler means making it examine the print queue immediately. This can be done locally by pressing the space bar on the computer running the despooler software. It can be done remotely by using the *Prod command supplied with the despooler software. The syntax is: *Prod ((.)) () *Prod can take the station number to be prodded, and a specified logical printer name. If the station number is omitted, *Prod broadcasts to all servers. If the name is omitted, *Prod transmits to 'PRINT', which all servers respond to. The *Prod command should be placed in your library directory. Two files are supplied. Prod is the 6502 version, and should be placed in the BBC/Master network library. ArcProd is the ARM version and should be placed in the Archimedes network library and renamed to Prod. Despooling more than one printer name ===================================== It is possible to despool more than one logical printer, and to any combination of printer ports. This is done by supplying a list of printer names. Printer banner files ==================== The despooler uses the same banner files as the fileserver despooler, in the BANNERS directory on the first drive on the system. All the tokens supported by the MDFS despooler are supported, as well as the following extras: - prints the century number, used in conjuction with will print the four-digit year with - filename of files submitted with *PRINTOUT, or 'spooled output' if not a printout job. - specifies that any *PRINTOUT jobs are to be sent direct to the printer with no interpretation. is the default state. - specifies that any *PRINTOUT jobs are to be interpreted as text; tabs are expanded and files are examined to determine the correct end-of-line terminator. - lines are printed single-spaced. If the printer's physical setup is not as expected, then this will cause lines to be printed on top of each other. is the default state. - lines are printed double-spaced. If the printer's physical setup is not as expected, then this will cause lines to be printed single-spaced. - the specified command is used to print out print jobs. For example, will cause the command "*lp.nlq filename" to be issued to print a job. *PRINTOUT ========= The despooler will also attempt to print jobs submitted by the *PRINTOUT command. This requires the despooler to open the file and hence successful processing of *PRINTOUT jobs is subject to all the usual access rights. The despooler must be able to locate the file in the directory, and must be able to open it for reading. The only way to guarantee sucess is if the despooler had access to all accounts! This is obviously undesirable so it is wisest to to educate users who wish to use *PRINTOUT to a despooling printer to make sure that the file they print is accessible by a public user. The simplest way of doing this is to set the auxilary account of the document to be printed to the recommended %PRINTQ account of &03F with *ACCOUNT (3F) The beginning of files submitted by *PRINTOUT are scanned to determine what end-of-line sequence they use, whether , , or . Recovery from errors ==================== Often it is convenient for the despooler to be a dedicated machine which supplies print spooling facilities to a room remote from the File Server. In this situation the despooler will frequently be left untended for long periods of time and hence an error could be irritating to users requiring printer output. The despooler software will make an attempt to recover from errors such as 'No clock' or 'Line jammed'. The attempt to restart cannot be guaranteed to work in all circumstances. Points to note ============== The computer running the despooler is best protected as otherwise users might interfere with it in some way, eg *REMOTE. This is very undesirable as, if a user has control of the despooler user then they have full ownership of %PRINTQ and could cause problems by deleting other users' print jobs, renaming their own print jobs or inspecting the contents of print jobs containing sensitive information. It is for this reason that it is desirable for the computer running the despooler software to be either under supervision or physically inaccessible to ordinary users. The despooler detects if the computer it is running on is REMOTEd. If it is, then just after starting up it disconnects the remote connection with *ROFF. This way the despooler can be started up remotely using *REMOTE. You will notice that the despooler creates a directory in %PRINTQ starting the the characters 'rps'. This directory is used as temporary space and is deleted when the despooler is shut down correctly. The numbers after 'rps' are the network and station number of the computer running the despooler, eg rps000!002 for station 2 on network 0. This makes it possible to run several despoolers at once should you so desire. It is possible to despool a logical printer which has 'Printing enabled' or is not a 'Hold' printer, or is being despooled by another computer running the despooler software. Under these circumstances you will not be able to predict exactly where a particular print job will be printed. You are most likely to want to set up the despooler in this way in order to speed up the printing of a large number of items in the print queue. Banner printing is currently fairly slow. It is intended to speed this up in future versions. The despooler is also supplied with manual pages in the directory ManPages that should be put in the system ManPages directory. Command line options ==================== The despooler can be passed the following command line parameters on startup: (:)... List of logical printers to despool, with the port to print to. -audit File to output audit information to. If not specfified, no audit information is generated. -poll The delay between polling. If not specified, defaults to 30 seconds. -runfor Tells the despooler to quit after running for the specified time. This way, the despooler can be run as one process amongst others, with a controlling process running subsidary processes. If not specified, runs until manually terminated by pressing 'Q'. -quit command Command to execute on finishing. If the command starts with a '*', it is passed to OSCLI, otherwise it is CHAINed. The switches can be abbreviated to the first letter, but must be in lower case. Technical information ===================== Printer queue file formats -------------------------- Spooled print files 'spl', submitted through NetPrint system: 0000: End time 0005: Start time 000A: ???? time 000F: User Name 0019: Start of print data Printout reference file 'prt', submitted with *PRINTOUT: 0000: End time 0005: Start time 000A: ???? time 000F: User Name 0019: 0100: Pathname of *Printout file, stored as: Disk name, Directory name, (possible multiple 'directory, 's) File name, , 0308: -1 030C: 0320: Account number of submitting user 0322: 03FF: end of file bytes are set to zero Examining %PrintQ entries with OSFILE returns the following information: XY+02 (LOAD) : &00007AAA XY+06 (EXEC) : &pp000000 where pp is logical printer number XY+0A (LENGTH): file length XY+0E (ATTRS) : -----/-er for /spl files : -----/wer for /prt files XY+0F (DATE) : station number printed from XY+11 : &00 Examining %PrintQ entries with FSOp returns the ATTRS byte as: --D---/-r for /spl files and --D---/wr for /prt files Prod protocol ------------- Some servers can be 'prodded' to request that they attempt to process jobs immediately. To do this they listen to port &9F for a Prod command. The Prod protocol is effectively a NetPrint command: Client -> Server port: &9F control byte: &80 data: name of server in upper case, space padded to six characters. The despooler responds to 'PRINT' and the names of the printers it is despooling. data+5,6: command. The prod command is &FFFF. Server -> Client There is no reply to a prod. As there is no reply, a Prod can be broadcast without any problem of multiple replies. Version History =============== v1.00 ??-???-1989 ????: Development? v1.02 28-Jul-1989 ARBS: Initial release (?) v1.02d 11-Feb-1990 RobCowell: Printer type selection v1.02d2 10-Jun-1998 JGH: Y2K'96 Fixed, token for century number v1.90 03-Jul-1998 JGH: Completely rewritten v1.91 20-Jul-1998 JGH: Multiple ports allowed, parameters can be given in the command line. v1.92 20-Jul-1998 JGH: Uses %PrintQ.rpsNet!Stn, vdu2 sent after *fx5, *ROFFs if remoted. v1.93 26-Jun-1999 JGH: Proper file closing, Q to quit, -poll/-run/-quit options, status line says 'Idle' when idle, server reply status correctly terminated with a 0. V1.94 12-Jul-1999 JGH: Files submitted with *PRINTOUT have LFs sent after CRs. *Prod fixed to read station number parameter correctly. V1.95 28-Dec-1999 JGH: Extra banner file entries: , , and . Files submitted with *PRINTOUT are examined to determine CR/LF needs in TEXT mode. Tabs expanded in TEXT mode. Spooled printouts always sent in RAW mode. V1.96 02-Feb-2000 JGH: Fixed printing loop and bug, tidied errors, -audit switch added. Things to do ============ Recovery from errors is still a bit untidy, particularly if the server has been rebooted. Really needs to get rid of those GOTOs.