DIRECTORY CHNameP2V0 USING [Name], Commander USING [CommandProc, Register], CommandTool USING [ArgumentVector, Failed, Parse], PrintingP4V3 USING [PrinterProperties], PrintingP4V3Aux USING [ExposePrinterProperties], IO USING [PutF, PutRope, rope, STREAM], Process USING [CheckForAbort], Rope USING [Concat, Length, ROPE], XNSPrintRequestManager USING [Context, ContextObject, GetDefaults, GetPrinterProperties]; GetPrintPropertiesImpl: CEDAR PROGRAM IMPORTS Commander, CommandTool, IO, PrintingP4V3Aux, Process, Rope, XNSPrintRequestManager ~ { OPEN CHName: CHNameP2V0, Printing: PrintingP4V3, PrintingAux: PrintingP4V3Aux; ROPE: TYPE ~ Rope.ROPE; GetPrintProperties: ROPE = "///Commands/GetPrintProperties"; doc: ROPE = "{Printer}*\nFind out the properties of an XNS based printer.\nSwitches: "; usage: ROPE = Rope.Concat["Usage: GetPrintProperties ", doc]; DecodeStatus: PROC [out: IO.STREAM, service: CHName.Name, status: Printing.PrinterProperties] ~ { msg: ROPE _ NIL; IO.PutF[out, " Service: [%g:%g:%g]\n ", IO.rope[service.object], IO.rope[service.domain], IO.rope[service.organization] ]; msg _ Rope.Concat[PrintingAux.ExposePrinterProperties[status, 1], "\n"]; -- nest 2 spaces IO.PutRope[out, msg]; }; GetPrintPropertiesProc: Commander.CommandProc ~ { argsProcessed: NAT _ 0; argv: CommandTool.ArgumentVector _ CommandTool.Parse[cmd: cmd, starExpand: FALSE ! CommandTool.Failed => {msg _ errorMsg; GO TO failed}]; out: IO.STREAM ~ cmd.out; CheckProperties: PROC [arg: ROPE] ~ { service: CHName.Name; status: Printing.PrinterProperties; argsProcessed _ argsProcessed + 1; Process.CheckForAbort[]; [service, status] _ XNSPrintRequestManager.GetPrinterProperties[arg]; DecodeStatus[out, service, status]; }; FOR i: NAT IN [1..argv.argc) DO printerName: ROPE ~ argv[i]; Process.CheckForAbort[]; IF (Rope.Length[printerName] = 0) THEN LOOP; CheckProperties[printerName]; ENDLOOP; SELECT argsProcessed FROM 0 => { context: XNSPrintRequestManager.Context _ NEW[XNSPrintRequestManager.ContextObject]; XNSPrintRequestManager.GetDefaults[context]; IF (context.printerName = NIL) THEN msg _ usage ELSE CheckProperties[context.printerName]; }; ENDCASE => { NULL }; EXITS failed => {result _ $Failure}; }; Init: PROC ~ { Commander.Register[GetPrintProperties, GetPrintPropertiesProc, doc]; }; Init[]; }... ώGetPrintPropertiesImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Russ Atkinson, April 2, 1985 4:22:08 pm PST Bill Jackson (bj) February 6, 1987 2:45:12 am PST Demers, June 6, 1986 3:09:39 pm PDT Commander Constants Procs Κ&˜codešœ™Kšœ Οmœ1™