home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netdor3.zip / DISK_13 / IMAGE12.ZIP / CATALOG / SHFTRNBE.CMD < prev    next >
OS/2 REXX Batch file  |  1993-09-21  |  4KB  |  119 lines

  1. /*****************************************************************************
  2.  *                    Licensed Materials-Property of IBM                     *
  3.  *               5604-472 (c) Copyright IBM Corporation, 1993                *
  4.  *                           All rights reserved.                            *
  5.  *                  US Government Users Restricted Rights -                  *
  6.  *                 Use, duplication or disclosure restricted                 *
  7.  *                by GSA ADP Schedule Contract with IBM Corp.                *
  8.  *****************************************************************************/
  9. /*****************************************************************************
  10.  * Configuration back-end for SHIFTRUN                                       *
  11.  *****************************************************************************/
  12. trace 'O'
  13. signal on syntax
  14. signal on novalue
  15. call on halt
  16. call rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
  17. Ver = 'CAddInit'()
  18. if abbrev(Ver, 'ERROR:')
  19.   then exit 200
  20. Title = RxCAdd.STitle 'Installation'
  21. XCode = 0
  22. if 'REGFUNC'('COUENV') <> 0
  23.   then call AddExit 206, 'Error registering COUENV.DLL.'
  24. select
  25.   when RxCAdd.OpType = 'ADD'
  26.     then do
  27.       if RxOs2Ver() < 2.00
  28.         then do
  29.            call 'MessageBox' Title, 'ShiftRun will only work on OS/2 2.0 or higher'
  30.            XCode = -1
  31.         end  /* Do */
  32.       else
  33.         XCode = RunItl('SHFTRNBE.ITL')
  34.     end
  35.   when RxCAdd.OpType = 'REMOVE'
  36.     then do
  37.       XCode = RunItl('SHFTRNBE.ITL')
  38.     end
  39.   otherwise do
  40.     call 'MessageBox' Title, 'Unexpected operation type "'RxCAdd.OpType'"'
  41.     XCode = 201
  42.   end
  43. end
  44. call AddExit XCode
  45.  
  46. RunItl: procedure expose RXCADD.
  47. parse arg ItlName
  48. CDr = RxCouInfo('GET', 'REMOTE')
  49. CDr = strip(CDr, 'T', '\')||'\'
  50. List = 'VERSION STITLE OPTYPE PREVIOUS'
  51. do I = 1 to words(List)
  52.   Name = 'RXCADD.'word(List, I)
  53.   call value Name, value(Name), 'OS2ENVIRONMENT'
  54. end I
  55. do I = 1 to RXCADD.PROGINFO.0
  56.   call value 'RXCADD.PROGINFO.'I, RXCADD.PROGINFO.I, 'OS2ENVIRONMENT'
  57. end I
  58. if pos('\', ItlName) = 0
  59.   then do
  60.     parse source . . Me
  61.     ItlName = left(Me, lastpos('\', Me))||ItlName
  62.   end
  63. '@CALL' CDr'IMPIT.CMD /R:'ItlName '/NOPAUSE'
  64. return rc
  65.  
  66. AddExit:
  67. parse arg XCode, Msg
  68. if XCode = ''
  69.   then XCode = 0
  70. if Msg <> ''
  71.   then call 'MessageBox' Title, Msg
  72. call 'CAddComplete' XCode
  73. call 'CAddExit'
  74. exit XCode
  75.  
  76. /***********************************************************************
  77.  *                             ERROR TRAPS                             *
  78.  ***********************************************************************/
  79. BugInit:
  80. signal off error; signal off failure; signal off halt
  81. signal off novalue; signal off notready; signal off syntax
  82. parse upper source . . Me
  83. if symbol('TITLE') = 'LIT'
  84.   then Title = 'COREADD Failure'
  85. Me = Me':'||'0A'x
  86. if symbol('GLOBALS') = 'LIT'
  87.   then do
  88.     Globals = 'TrVal'
  89.     TrVal = 'O'
  90.   end
  91. return
  92.  
  93. Halt:
  94. Where = SigL
  95. call BugInit
  96. call 'MessageBox' Title, Me||'Execution halted by user in line' Where
  97. XXC = 204
  98. signal DebugExit
  99.  
  100. Syntax:
  101. Where = SigL
  102. call BugInit
  103. call 'MessageBox' Title,,
  104.     Me||'Syntax error' rc '('errortext(rc)') in line' Where'.'
  105. XXC = 203
  106. signal DebugExit
  107.  
  108. Novalue:
  109. Where = SigL
  110. call BugInit
  111. call 'MessageBox' Title, Me||'NOVALUE error ('condition('D')') in line' Where'.'
  112. XXC = 203
  113. signal DebugExit
  114.  
  115. DebugExit:
  116. call 'CAddComplete' XXC
  117. call 'CAddExit'
  118. exit XXC
  119.