home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
netdor3.zip
/
DISK_13
/
IMAGE12.ZIP
/
CATALOG
/
TIMEXEC.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-08-23
|
5KB
|
158 lines
/*****************************************************************************
* TIMEXEC *
* CORE Development (CORE at WATSON) *
*****************************************************************************
* Licensed Materials-Property of IBM *
* 5604-472 (c) Copyright IBM Corporation, 1993 *
* All rights reserved. *
* US Government Users Restricted Rights - *
* Use, duplication or disclosure restricted *
* by GSA ADP Schedule Contract with IBM Corp. *
****************************************************************************/
/**********************************************************
* TIMEXEC *
* *
* Purpose: General ADD for TIMEXEC.EXE to userinit.cmd. *
* This can be used by any COREADD that needs *
* TIMEXEC detached from USERINIT.CMD. *
**********************************************************/
trace '0'
signal on syntax
signal on novalue
call on halt
call rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
Ver = 'CAddInit'()
if abbrev(Ver, 'ERROR:')
then exit 200
Title = RxCAdd.STitle 'Installation'
XCode = 0
Env = 'OS2ENVIRONMENT'
call rxfuncadd 'RXCOUINFO', 'COUENV', 'RXCOUINFO'
UserSystemDir = rxcouinfo('GET', 'SYSTEM')
UserSystemDir = strip(UserSystemDir, 'T', '\')||'\'
Dirty = 0
select
when RxCAdd.OpType = 'ADD'
then do
Resp = RxRead(UserSystemDir'USERINIT.CMD', 'file')
if Resp = 0
then do
call RxStemGrep 'TIMEXEC', 'file', 'hits', 'N'
if hits.0 = 0
then do
call RxStemGrep 'ECHO OFF', 'file', 'hits', 'N'
if hits.0 <> 0
then parse var hits.1 lnum .
else lnum = 0
call RxStemInsert 'file', lnum+1, '@DETACH TIMEXEC'
Dirty = 1
end
end
else if Resp = 3
then do
file.0 = 3
file.1 = '@ECHO OFF'
file.2 = '@DETACH TIMEXEC'
file.3 = 'EXIT'
Dirty = 1
end
else do
call 'MessageBox' Title, 'Could not read userinit.cmd file.'
XCode = 5
end
if Dirty
then do
if RxWrite(UserSystemDir'USERINIT.CMD', 'file', file.0) <> 0
then do
call 'MessageBox' Title, 'Unable to write file USERINIT.CMD.'
XCode = 6
end /* Do */
end
end
when RxCAdd.OpType = 'REMOVE'
then do
Resp = RxRead(UserSystemDir'USERINIT.CMD', 'file')
if Resp = 0
then do
call RxStemGrep 'TIMEXEC', 'file', 'hits', 'N'
do num = 1 to hits.0
parse var hits.num lnum .
call RxStemDelete 'file', lnum
Dirty = 1
end /* do */
if Dirty
then do
if RxWrite(UserSystemDir'USERINIT.CMD', 'file', file.0) <> 0
then do
call 'MessageBox' Title, 'Unable to write file USERINIT.CMD.'
XCode = 6
end /* Do */
end
end
end
otherwise do
call 'MessageBox' Title, 'Unexpected operation type "'RxCAdd.OpType'"'
XCode = 201
end
end
call AddExit XCode
exit
AddExit:
parse arg XCode, Msg
if XCode = ''
then XCode = 0
if Msg <> ''
then call 'MessageBox' Title, Msg
call 'CAddComplete' XCode
call 'CAddExit'
exit XCode
/***********************************************************************
* ERROR TRAPS *
***********************************************************************/
BugInit:
signal off error; signal off failure; signal off halt
signal off novalue; signal off notready; signal off syntax
parse upper source . . Me
if symbol('TITLE') = 'LIT'
then Title = 'COREADD Failure'
Me = Me':'||'0A'x
if symbol('GLOBALS') = 'LIT'
then do
Globals = 'TrVal'
TrVal = 'O'
end
return
Halt:
Where = SigL
call BugInit
call 'MessageBox' Title, Me||'Execution halted by user in line' Where
XXC = 204
signal DebugExit
Syntax:
Where = SigL
call BugInit
call 'MessageBox' Title,,
Me||'Syntax error' rc '('errortext(rc)') in line' Where'.'
XXC = 203
signal DebugExit
Novalue:
Where = SigL
call BugInit
call 'MessageBox' Title, Me||'NOVALUE error ('condition('D')') in line' Where'.'
XXC = 203
signal DebugExit
DebugExit:
call 'CAddComplete' XXC
call 'CAddExit'
exit XXC