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

  1. /*****************************************************************************
  2.  *                    CATALOG backend for MAINT - 6/1/93                     *
  3.  *****************************************************************************
  4.  *                    Licensed Materials-Property of IBM                     *
  5.  *               5604-472 (c) Copyright IBM Corporation, 1993                *
  6.  *                           All rights reserved.                            *
  7.  *                  US Government Users Restricted Rights -                  *
  8.  *                 Use, duplication or disclosure restricted                 *
  9.  *                by GSA ADP Schedule Contract with IBM Corp.                *
  10.  ****************************************************************************/
  11. trace 'O'
  12. signal on syntax
  13. signal on novalue
  14. call on halt
  15. call rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
  16. Ver = 'CAddInit'()
  17. if abbrev(Ver, 'ERROR:')
  18.   then exit 200
  19. Title = RxCAdd.STitle 'Installation'
  20. XCode = 0
  21. select
  22.   when RxCAdd.OpType = 'ADD'
  23.     then do
  24.       RXCADD.BatchMode = 1
  25.       say 'Adding Maint Options icon...'
  26.       if 'AddProg'('MAINTO') <> 0
  27.         then call AddExit 2, 'Options object could not be created.'
  28.       say 'Adding Maint Status icon...'
  29.       if 'AddProg'('MAINTS') <> 0
  30.         then call AddExit 3, 'Status object could not be created.'
  31.     end
  32.   when RxCAdd.OpType = 'REMOVE'
  33.     then do
  34.       RXCADD.BatchMode = 1
  35.       if 'RemoveProg'('MAINTO') <> 0
  36.         then call 'MessageBox' Title, 'Warning: Options object could not be',
  37.             'removed.'
  38.       if 'RemoveProg'('MAINTS') <> 0
  39.         then call 'MessageBox' Title, 'Warning: Status object could not be',
  40.             'removed.'
  41.     end
  42.   otherwise do
  43.     call 'MessageBox' Title, 'Unexpected operation type "'RxCAdd.OpType'"'
  44.     XCode = 201
  45.   end
  46. end
  47. call AddExit XCode
  48.  
  49. RunItl: procedure expose RXCADD. Title
  50. parse arg ItlName
  51. CDr = rxCouInfo('GET', 'REMOTE')
  52. List = 'VERSION STITLE OPTYPE PREVIOUS'
  53. do I = 1 to words(List)
  54.   Name = 'RXCADD.'word(List, I)
  55.   call value Name, value(Name), 'OS2ENVIRONMENT'
  56. end I
  57. do I = 1 to RXCADD.PROGINFO.0
  58.   call value 'RXCADD.PROGINFO.'I, RXCADD.PROGINFO.I, 'OS2ENVIRONMENT'
  59. end I
  60. if pos('\', ItlName) = 0
  61.   then do
  62.     parse source . . Me
  63.     ItlName = left(Me, lastpos('\', Me))||ItlName
  64.   end
  65. '@CALL' CDr'IMPIT.CMD /R:'ItlName '/NOPAUSE'
  66. if rc <> 0
  67.   then call AddExit 205, 'Error' rc 'returned by ITL interpreter.'
  68. return rc
  69.  
  70. AddExit:
  71. parse arg XCode, Msg
  72. if XCode = ''
  73.   then XCode = 0
  74. if Msg <> ''
  75.   then call 'MessageBox' Title, Msg
  76. call 'CAddComplete' XCode
  77. /**
  78.  ** Uncomment this block if program is a TCP/IP app that requires TCP/IP
  79.  ** to be running before it can start.
  80. if XCode = 0 & rxOs2Ver() >= 2.0 & RxCAdd.OpType = 'ADD'
  81.   then do
  82.     call rxSleep 2
  83.     Handle = '<CORE_APP_'RxCAdd.STitle'>'
  84.     if \SysSetObjectData(Handle, 'ASSOCFILTER=TCPIP;')
  85.       then call 'MessageBox' Title, 'Warning: TCP/IP association could not',
  86.           'be set.'
  87.   end
  88. **/
  89. call 'CAddExit'
  90. exit XCode
  91.  
  92. /***********************************************************************
  93.  *                             ERROR TRAPS                             *
  94.  ***********************************************************************/
  95. BugInit:
  96. signal off error; signal off failure; signal off halt
  97. signal off novalue; signal off notready; signal off syntax
  98. parse upper source . . Me
  99. if symbol('TITLE') = 'LIT'
  100.   then Title = 'COREADD Failure'
  101. Me = Me':'||'0A'x
  102. if symbol('GLOBALS') = 'LIT'
  103.   then do
  104.     Globals = 'TrVal'
  105.     TrVal = 'O'
  106.   end
  107. return
  108.  
  109. Halt:
  110. Where = SigL
  111. call BugInit
  112. call 'MessageBox' Title, Me||'Execution halted by user in line' Where
  113. XXC = 204
  114. signal DebugExit
  115.  
  116. Syntax:
  117. Where = SigL
  118. call BugInit
  119. call 'MessageBox' Title,,
  120.     Me||'Syntax error' rc '('errortext(rc)') in line' Where'.'
  121. XXC = 203
  122. signal DebugExit
  123.  
  124. Novalue:
  125. Where = SigL
  126. call BugInit
  127. call 'MessageBox' Title, Me||'NOVALUE error ('condition('D')') in line' Where'.'
  128. XXC = 203
  129. signal DebugExit
  130.  
  131. DebugExit:
  132. call 'CAddComplete' XXC
  133. call 'CAddExit'
  134. exit XXC
  135.