Initialize: PROC = INLINE {RepeatCommand[cmd.out]};
Finalize: PROC = INLINE {};
[inputName, commandArgs, results, switches] ←
CommandUtil.Parse[cmd.commandLine
! CommandUtil.Failed => {GO TO badSyntax}];
IF inputName = NIL AND switches = NIL THEN EXIT; -- done listing
cmd.out.PutRope["\nCommand: "];
CommandUtil.Echo[
d: cmd.out, operator: inputName, argList: commandArgs,
resultList: results, switches: switches];
IF inputName = NIL THEN GO TO globalSwitches;
SELECT CommandUtil.ListLength[results]
FROM
0 => outputName ← NIL;
1 => outputName ← CommandUtil.GetNth[list: results, n: 0];
ENDCASE => GO TO badSemantics;
rootName ← CommandUtil.GetRootName[inputName];
localSwitches ← CommandUtil.GetSwitches[switches, defaultSwitches];
IF outputName = NIL THEN outputName ← rootName;
outputName ← CommandUtil.SetExtension[outputName, "sl"];
Initialize[];
ListerOps.ListSymbols[rootName, outputName,
localSwitches['s], localSwitches['t]
! UNWIND => Finalize[]];
Finalize[];
IF cmd.in.UserAbort[] THEN EXIT;
EXITS
globalSwitches => {
defaultSwitches ← CommandUtil.GetSwitches[switches, defaultSwitches];
switches ← NIL; results ← NIL};
badSemantics => {
results ← NIL;
cmd.out.PutRope["\n -- Illegal command"]}};
REPEAT
badSyntax => {cmd.out.PutRope["-- Illegal syntax"]};
ENDLOOP;