home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / ispeller.zip / Install.cmd < prev    next >
OS/2 REXX Batch file  |  1997-05-30  |  3KB  |  137 lines

  1. /* INSTALL.CMD: Install ISPELLER. */
  2.  
  3. '@Echo Off'
  4. 'CHCP 850'
  5.  
  6. /* Load REXXUTIL */
  7.  
  8. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  9. Call SysLoadFuncs
  10.  
  11.  
  12. /* Initialize */
  13.  
  14. Signal On Failure Name FAILURE
  15. Signal On Halt Name HALT
  16. Signal On Syntax Name SYNTAX
  17.  
  18. Call SysCls
  19. Say 'Installing ISPELLER...'
  20. Say ''
  21.  
  22.  
  23. /* Ask for the target directory name. */
  24.  
  25. ISpellPath = VALUE('ISPELL',,'OS2ENVIRONMENT')
  26.  
  27. Default = SysIni('USER', 'ISpeller', 'Path' )
  28. If Default = 'ERROR:' Then Do
  29.   Default = ISpellPath
  30.   if ISpellPath = "" Then Do
  31.     Default = 'c:\ISpeller'
  32.     End
  33.   End 
  34.  
  35. If SUBSTR(Default,LENGTH(Default),1) <= ' '
  36.   Then Default = SUBSTR(Default,1,LENGTH(Default)-1)
  37.  
  38. Say 'Please enter the full name of the directory to which'
  39. Say '  you want ISPELLER installed (default 'Default'): '
  40. Parse Pull Directory
  41. If Directory = "" Then Directory = Default
  42.  
  43.  
  44. /* Create the target directory if necessary. */
  45.  
  46. Result = SysFileTree( Directory, 'Dirs', 'D' )
  47. If Dirs.0 = 0 Then
  48.   Do
  49.   Result = SysMkDir( Directory )
  50.   if Result == 0 Then
  51.     Do
  52.     End
  53.   Else
  54.     Do
  55.     Say 'ERROR: Unable to create target directory.'
  56.     Signal DONE
  57.     End
  58.   End
  59. Say ''
  60.  
  61.  
  62. /* Save the target directory. */
  63.  
  64. SysIni( "USER", "ISpeller", "Path", Directory )
  65.  
  66.  
  67. /* Perform the installation. */
  68.  
  69. Say 'Copying ISPELLER to 'Directory' ...'
  70. 'Copy READ.ME       'Directory              '1>NUL'
  71. 'Copy ISPELLER.DLL  'Directory              '1>NUL'
  72. 'Copy RUNTIME.DLL   'Directory              '1>NUL'
  73. 'Copy ISP_*.DLL     'Directory              '1>NUL'
  74. 'Copy ISP_*.HLP     'Directory              '1>NUL'
  75. Result = SysFileTree( 'ISPELL.EXE', 'Files', 'F' )
  76. If Files.0 = 1 Then
  77.    'Copy ISPELL.EXE    'Directory              '1>NUL'
  78. Result = SysFileTree( 'BUILDHASH.EXE', 'Files', 'F' )
  79. If Files.0 = 1 Then
  80.    'Copy BUILDHASH.EXE 'Directory'\BUILDHAS.EXE 1>NUL'
  81. Result = SysFileTree( 'BUILDHAS.EXE', 'Files', 'F' )
  82. If Files.0 = 1 Then
  83.    'Copy BUILDHAS.EXE 'Directory'\BUILDHAS.EXE 1>NUL'
  84.  
  85.  
  86. /* Build each dictionary found. */
  87.  
  88. Result = SysFileTree( '*.AFF', 'Files', 'F' ) 
  89. If Files.0 > 0 Then 'Copy *.AFF' Directory '1>NUL'
  90. Result = SysFileTree( '*.DIC', 'Files', 'F' ) 
  91. If Files.0 > 0 Then 'Copy *.DIC' Directory '1>NUL'
  92. Result = SysFileTree( Directory"\*.AFF", 'Affix', 'FO' ) 
  93. Do Index=1 To Affix.0
  94.    LanguageName = SUBSTR(Affix.Index,1,LENGTH(Affix.Index)-4)
  95.    DictionaryPath = LanguageName".DIC"
  96.    Do While ( \ ( POS('\',LanguageName) = 0 ) )
  97.       LanguageName = SUBSTR(LanguageName,POS('\',LanguageName)+1)
  98.       End /* do */
  99.    Result = SysFileTree( DictionaryPath, 'Dictionary', 'FO' )
  100.    If Dictionary.0 = 1 Then Do
  101.       Say 'Building dictionary for' LanguageName'. . .'
  102.       Directory'\BUILDHAS -s' Dictionary.1 Affix.Index Directory'\'LanguageName'.HSH 1>NUL 2>NUL'
  103.       End /* if */
  104.    End /* do */
  105.  
  106. /* Update CONFIG.SYS with SET ISPELL=Directory */
  107.  
  108. if ( \ ( TRANSLATE(ISpellPath) = TRANSLATE(Directory) ) ) Then Do
  109.    Say ''
  110.    Say 'NOTE: You should update your CONFIG.SYS file to'
  111.    Say '  include the following statement:'
  112.    Say ''
  113.    Say '  SET ISPELL='Directory
  114.    Say ''
  115.    End /* do */
  116.  
  117. /* Announce completion. */
  118.  
  119. Say 'Installation complete.'
  120.  
  121. Signal DONE
  122.  
  123. FAILURE:
  124. Say 'REXX failure.'
  125. Signal DONE
  126.  
  127. HALT:
  128. Say 'REXX halt.'
  129. Signal DONE
  130.  
  131. SYNTAX:
  132. Say 'REXX syntax error.'
  133. Signal DONE
  134.  
  135. DONE:
  136. Exit
  137.