.; CMD.IND - Control file to provide wild card file specifications .; in programs which don't accept them, and to provide .; for switches which some KMON commands do not have. .; .; The file is invoked by IND CMD[/Q] P1 P2 P3 P4 P5, where: .; .; P1 - The Command [/Directory_switches] .; P2 - The Input Filespec [/File_switches] .; P3 - The Output Filespec .; P4 - Execute switch .; P5 - Delete .COM file switch .; .; If you append the switch /Q to the CMD name, then the command file .; will not echo when it is executed. .; Directory_switches are any legal switch for the DIRECTORY command. .; This allows commands such as COPY/ALPHABETICAL. .; File_switches are switches to be applied to an input filespec, .; such as for COPY/ALPHA INFILE.*/PROTECT ... .; The Output Filespec may have switches appended to it, but these are .; just considered as being part of the string. .; If the Execute switch has the value "EXE", the command will be .; executed; otherwise this file will only build a command file to .; be executed later. .; If the Delete switch has the value "DEL", the .COM file will be .; deleted after execution. .; .; It is necessary to assign some device to be WF:. .; It is necessary that the file PARSE.IND be located on SY:. .; .; Written by: .; R. W. Barnard .; BIO/Comp Applications .; P. O. Box 18007 .; Albuquerque, NM 87185 .; .; Version 1.07, 16-Feb-88. .; .enable quiet .enable global .disable lowercase .disable prefix, suffix .enable escape .; .sets $DEFDV "" .;No default device. .sets $DEFXT ".*" .;Any extension. .sets NOECHO "NO" .;For SET TT QUIET. .sets SKPCHR "~" .;To specify only one file in UCL mode. .setf INTRAC .;Indicates if input has been interactive. .; .testdevice WF: .test "NSD" .if ne 0 .goto nodev .; .parse P0 "/ " CMD QUIET .if QUIET ne "Q" .goto start .sets NOECHO "" .;Now we say SET TT QUIET. .; .start: .sets RAWCMD P1 .;Get the command if not entered on .if RAWCMD ne "" .goto p10 .;command line. .asks P1 Enter the command or program name [/Dir_switches]: .sett INTRAC .goto start .; .p10: .parse RAWCMD "/" COMAND DIRSWS .open #2 WF:'COMAND'.COM .data #2 SET TT 'NOECHO'QUIET .close #2 .; .p20: .if DIRSWS eq "" .goto filesp .sets DIRSWS "/"+DIRSWS .;Make the switch look like one. .; .filesp: .sets RAWFIL P2 .if RAWFIL ne "" .goto d10 .;Get the input file. .asks P2 Enter the input filespec(s) for this command [File_switches]: .sett INTRAC .goto filesp .; .d10: .parse RAWFIL "/" FILSPC FILSWS @SY:PARSE.IND 'FILSPC' .if FILSWS eq "" .goto d20 .;Save these switches to apply to .sets FILSWS "/"+FILSWS .;the final input filespec. .d20: DIR/BRI/COL:1/OUT:WF:CMD.TMP'DIRSWS' '$FILSP' .; .target: .sets OUTFIL P3 .if OUTFIL ne SKPCHR .goto t10 .;No second file. .sets OUTFIL "" .goto t20 .t10: .if OUTFIL ne "" .goto t20 .asks P3 Enter the output string or filespec (or for no file): .sett INTRAC .ift .goto t20 .;No second file. .goto target .; .t20: .sets LLINE " "+OUTFIL .;This is the output filespec. .; .openr WF:CMD.TMP .read LINE .rdloop: .read LINE .test LINE "." .if eq 0 .goto execut .;We have read everything of interest. .parse LINE "." FILNAM EXT .test FILNAM " " .if eq 0 .goto d30 .;Need to trim trailing blanks. .sets FILNAM FILNAM[1:-1] .; .d30: .sets FLINE COMAND+" " .;This is the command. .sets MLINE $DEV+FILNAM+"."+EXT+FILSWS .;This is the input string. .sets CMDLIN FLINE+MLINE+LLINE .opena #2 WF:'COMAND'.COM .data #2 'CMDLIN' .close #2 .goto rdloop .; .execut: .if NOECHO ne "" .goto e10 .opena #2 WF:'COMAND'.COM .data #2 SET TT NOQUIET .close #2 .; .e10: .close .iff INTRAC .goto e20 .ask Q Do you want to execute this command now [N]: .ift Q .sets P4 "EXE" .; .e20: .sets EXECUT P4 .if EXECUT ne "EXE" .goto e30 $@WF:'COMAND'.COM .goto e40 .; .e30: ; ;The file WF:'COMAND'.COM may be executed when you wish .; .e40: DEL/NOQ WF:CMD.TMP .sets DELETE P5 .if DELETE eq "DEL" DEL/NOQ WF:'COMAND'.COM .; .exit .; .nodev: ; ;The device WF: has not been assigned! .exit