PCRCmdGlue.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Demers, July 26, 1990 9:05 am PDT
Michael Plass, August 22, 1991 9:32 am PDT
DIRECTORY
CStrings
;
PCRCmdGlue: CEDAR DEFINITIONS
~ {
Stuff for executing PCR commands from the Commander
PutProc: TYPE ~ PROC [msg: CStrings.CString, nBytes: INT];
Command calls one of these (repeatedly) with its output.
Execute: PROC [cmd: CStrings.CString, proc: PutProc] RETURNS [CStrings.CString] ~ TRUSTED MACHINE CODE { "PCRCmdGlue$Execute" };
Execute the command, return NIL on success or an error message on failure.
If proc is NIL, the output goes on the PCR system console, wherever that is ...
Stuff for registering Commander commands with PCR
CommandLineProc: TYPE ~ PROC [cmdLine: CStrings.CString, putProc: PutProc, data: REF] RETURNS [result: REF];
Called with command line, should send output to putProc and return command result.
RegisterWithPCRCommandLoop: PROC [proc: CommandLineProc, data: REF, pcrName, replacementName, helpMsg: CStrings.CString] RETURNS [INT] ~ TRUSTED MACHINE CODE { "PCRCmdGlue$RegisterWithPCRCommandLoop" };
Register proc as a PCR command.
When user types command named pcrName at PCR command loop, the pcrName and all trailing spaces are replaced by replacementName, and the resulting string passed to proc for execution. (Note: in the normal case, this means replacementName should end with a space!).
A nonzero result indicates an error.
}.