home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Collection - Online Library - January 1996 / CKITOS2196.ISO / diskette / gg244043.dsk / unc.dsk / TAPE / BACKINI.CMD
OS/2 REXX Batch file  |  1993-02-12  |  2KB  |  82 lines

  1. /*****************************************************/
  2. /* Copy the content of USER and SYSTEM ini files to  */
  3. /* the files specified as arguments                  */
  4. /*****************************************************/
  5.  
  6. parse upper arg bootdrive userIni systemIni
  7.  
  8. /* Test arguments */
  9. if (( bootdrive = '') | (userIni = '') | (systemIni = '')) then do
  10.   call dspHelp
  11.   exit 9
  12. end
  13.  
  14. call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  15. call SysLoadFuncs
  16.  
  17. front = bootdrive || '\OS2\'
  18. userIniFile = bootdrive || '\OS2\' || userIni || '.INI'
  19. systemIniFile = bootdrive || '\OS2\' || systemIni || '.INI'
  20.  
  21. rc = SysFileDelete(systemIniFile)
  22. if ((rc = 5) | (rc = 32)) then do
  23.  say 'The file ' systemIniFile ' is in use. Can not be deleted'
  24.  exit 9
  25. end
  26.  
  27. rc = SysFileDelete(front || userIni || '.INI')
  28. if ((rc = 5) | (rc = 32)) then do
  29.  say 'The file ' userIniFile ' is in use. Can not be deleted'
  30.  exit 9
  31. end
  32.  
  33. /* Make backup ini files */
  34. 'MAKEINI ' userIniFile front || 'INI.RC'
  35. 'MAKEINI ' systemIniFile front || 'INISYS.RC'
  36.  
  37. /* Do it first for USER (OS2.INI). In fact can be any file */
  38. Result = SysIni('USER', 'All:', Apps.)
  39.  
  40. if Result \= 'ERROR:' then
  41. do i = 1 to Apps.0
  42.  call SysIni 'USER', Apps.i, 'All:', 'Keys'
  43.  if Result \= 'ERROR:' then
  44.   do j=1 to Keys.0
  45.    val = SysIni('USER', Apps.i, Keys.j)
  46.    rc  = SysIni(userIniFile, Apps.i, Keys.j, val)
  47.   end
  48. end
  49.  
  50. /* then for the SYSTEM Ini file (OS2SYS.INI) */
  51. Result = SysIni('SYSTEM', 'All:', Apps.)
  52.  
  53. if Result \= 'ERROR:' then
  54. do i = 1 to Apps.0
  55.  call SysIni 'SYSTEM', Apps.i, 'All:', 'Keys'
  56.  if Result \= 'ERROR:' then
  57.   do j=1 to Keys.0
  58.    val = SysIni('SYSTEM', Apps.i, Keys.j)
  59.    rc  = SysIni(systemIniFile, Apps.i, Keys.j, val)
  60.   end
  61. end
  62.  
  63. exit 0
  64.  
  65. /*****************************************************/
  66. /* Display Help                                      */
  67. /*****************************************************/
  68. dspHelp:
  69.  
  70.  say 'Backup OS2 and OS2SYS ini files. The syntax is:'
  71.  say
  72.  say 'BACKINI Bootdrive Userini Systemini'
  73.  say
  74.  say 'Userini   The name of the backup version of OS2.INI'
  75.  say 'Systemini The name of the backup version of the OS2SYS.INI'
  76.  say
  77.  say 'Use for example the following to backup OS2.INI and OS2SYS.INI'
  78.  say
  79.  say 'BACKINI C: BOS2 BOS2SYS'
  80.  
  81. return
  82.