home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG104.ARC
/
MAC.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1979-12-31
|
5KB
|
171 lines
********************** MAC.PRG *********************************
****************************************************************
*** COPYRIGHT 1984 Data Based ADVISOR
*** ALL RIGHTS RESERVED
*** Author: Larry Eitel
*** Data Based Solutions
*** 1975 Fifth Avenue
*** San Diego, CA. 92101
*** Date: May 16, 1984
*** Purpose: Remember up to the last 10 commands issued at the dot
*** prompt and have the ability to list them, re-execute them or edit
*** and re-execute them. THIS UTILITY HAS LITTLE ERROR TRAPPING IN
*** ORDER TO LEAVE FLEXIBILITY FOR APPLICATIONS PROGRAMMERS.
***
*** NOTE: THIS PROGRAM WILL NOT WORK WITH RUNTIME PACKAGES
***
*** DISCLAIMER: THE AUTOR MAKES NOR IMPLIES NO WARRANTIES
*** REGARDING THE OPERATION OR USEFULNESS OF THIS PROGRAM. THE
*** AUTHOR RECOMMENDS BEFORE USING ANY NEW PROGRAM, THE USER
*** BACKUP ANY PERTINENT FILES.
***
****************************************************************
* I didn't use a CLEAR as you normally would because you have the
* ability to restart this program and still have access to the
* last 10 commands issued at the dot prompt
ERASE
SET TALK OFF
SET INTENSITY OFF
SET BELL OFF
* If this is being started again, it will remember the last 10
* commands you gave
IF 0=test(last)
STORE 0 TO com:num
STORE STR(com:num,1) TO no,last
ELSE
IF com:num=11
STORE com:num-1 TO com:num
ENDIF
IF com:num<10
STORE STR(com:num,1) TO no,last
ELSE
STORE STR(com:num,2) TO no,last
ENDIF
ENDIF
STORE ' ' to com&no
* Start main loop
DO WHILE t
* reset environmental settings
SET COLON OFF
SET TALK OFF
SET INTENSITY OFF
SET BELL OFF
?
* If you are issuing another command and have already filled
* the command "BUFFER" with 10 prior commands, it has to
* re-number the commands
IF com:num=11
SET RAW ON
STORE 1 TO old
STORE 0 TO new
DO WHILE new<=10
IF old<10
STORE STR(old,1) TO s:old
ELSE
STORE STR(old,2) TO s:old
ENDIF
IF new<10
STORE STR(new,1) TO s:new
ELSE
STORE STR(new,2) TO s:new
ENDIF
STORE com&s:old TO com&s:new
STORE old+1 TO old
STORE new+1 to new
?? '.'
ENDDO
SET RAW OFF
STORE '10' TO no
STORE 10 TO com:num
ENDIF
* Store a blank to the next command number unless you are editing
* a command number
IF !(com&no)='E'
STORE $(com&no,2,1) TO no
STORE $(com&no+$(STR(0,239),1,238-LEN(com&no)),1,238) TO com&no
ELSE
STORE $(STR(0,239),1,238) TO com&no
?
?
@ 24,00 SAY ' '
? '(D#)o, (L)ist, (E#)dit & Do, RETURN OR QUIT. '+;
'To start again type DO MAC <RET>.'
?
?
?
?
ENDIF
* Display dot prompt and get next command. Remember, you have
* full editing abilities while entering a command
CLEAR GETS
@ 21,00 SAY '. ' GET com&no
READ
CLEAR GETS
* Because dBASE is sometimes inconsistent in the way it executes a
* macro of a macro, I decided to store the value to X
STORE TRIM(com&no) TO x,com&no
DO CASE
* If you would like to execute one of the last 10 commands
* again, you can type "D" and the command number e.g. "D2"
CASE !(x)='D'.AND.LEN(x)=2
STORE $(com&no,2,1) TO no
STORE com&no TO x
&x
IF last='11'
STORE '10' TO no,last
ELSE
STORE last TO no
ENDIF
LOOP
* If you would like to edit and execute on of the last 10 commands
* you can type "E" and the command number e.g. "E2"
CASE !(x)='E'.AND.LEN(TRIM(x))=2
STORE com:num-1 TO com:num
LOOP
* You can list up to 10 of the last 10 commands
CASE !(x)='L'.AND.LEN(TRIM(x))=1
?
STORE 0 TO com:num
STORE STR(com:num,1) TO no
DO WHILE VAL(last)#VAL(no).AND.no#'10'
? no+'>',com&no
STORE com:num+1 TO com:num
IF com:num<10
STORE STR(com:num,1) TO no
ELSE
STORE STR(com:num,2) TO no
ENDIF
ENDDO
* Otherwise save and execute issued command
OTHERWISE
&x
STORE com:num+1 TO com:num
IF com:num<10
STORE STR(com:num,1) TO no,last
ELSE
STORE STR(com:num,2) TO no,last
ENDIF
STORE ' ' TO com&no
ENDCASE
SET COLON ON
ENDDO WHILE t
RETURN
* EOF