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

  1. /*****************************************************************************
  2.  *            IBM NetDoor Catalog - Sample Configuration Backend             *
  3.  *****************************************************************************/
  4. trace 'O'
  5. signal on syntax
  6. signal on novalue
  7. call on halt
  8. call rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
  9. Ver = 'CAddInit'()
  10. if abbrev(Ver, 'ERROR:')
  11.   then exit 200
  12. Title = RxCAdd.STitle 'Installation'
  13. XCode = 0
  14. if 'REGFUNC'('COUENV') <> 0
  15.   then call AddExit 206, 'Error registering COUENV.DLL.'
  16. if 'REGFUNC'('RXUTILS') <> 0
  17.   then call AddExit 206, 'Error registering RXUTILS.DLL.'
  18.  
  19. /*****************************************************************************
  20.  * Add any additional initialization code here.                              *
  21.  *****************************************************************************/
  22.  
  23. select
  24.   when RxCAdd.OpType = 'ADD'
  25.     then do
  26. /*****************************************************************************
  27.  * Add installation code here.                                              *
  28.  *****************************************************************************/
  29.     end
  30.   when RxCAdd.OpType = 'REMOVE'
  31.     then do
  32. /*****************************************************************************
  33.  * Add removal code here.                                                    *
  34.  *****************************************************************************/
  35.     end
  36.   otherwise do
  37.     call 'MessageBox' Title, 'Unexpected operation type "'RxCAdd.OpType'"'
  38.     XCode = 201
  39.   end
  40. end
  41.  
  42. /*****************************************************************************
  43.  * Add any general cleanup code (that applies to both installations and      *
  44.  * removals) here.                                                           *
  45.  *****************************************************************************/
  46.  
  47. call AddExit XCode
  48.  
  49. RunItl: procedure expose RXCADD. Title
  50. parse arg ItlName
  51. CDr = strip(rxCouInfo('GET', 'REMOTE'), 'T', '\')'\'
  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. call 'CAddExit'
  78. exit XCode
  79.  
  80. /***********************************************************************
  81.  *                             ERROR TRAPS                             *
  82.  ***********************************************************************/
  83. BugInit:
  84. signal off error; signal off failure; signal off halt
  85. signal off novalue; signal off notready; signal off syntax
  86. parse upper source . . Me
  87. if symbol('TITLE') = 'LIT'
  88.   then Title = 'Catalog Failure'
  89. Me = Me':'||'0A'x
  90. if symbol('GLOBALS') = 'LIT'
  91.   then do
  92.     Globals = 'TrVal'
  93.     TrVal = 'O'
  94.   end
  95. return
  96.  
  97. Halt:
  98. Where = SigL
  99. call BugInit
  100. call 'MessageBox' Title, Me||'Execution halted by user in line' Where
  101. XXC = 204
  102. signal DebugExit
  103.  
  104. Syntax:
  105. Where = SigL
  106. call BugInit
  107. call 'MessageBox' Title,,
  108.     Me||'Syntax error' rc '('errortext(rc)') in line' Where'.'
  109. XXC = 203
  110. signal DebugExit
  111.  
  112. Novalue:
  113. Where = SigL
  114. call BugInit
  115. call 'MessageBox' Title, Me||'NOVALUE error ('condition('D')') in line' Where'.'
  116. XXC = 203
  117. signal DebugExit
  118.  
  119. DebugExit:
  120. call 'CAddComplete' XXC
  121. call 'CAddExit'
  122. exit XXC
  123.