Changeset 1144


Ignore:
Timestamp:
Sep 1, 2008, 11:21:40 PM (17 years ago)
Author:
John Small
Message:

Ticket 267: Further improvements and fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cfgmgr.cmd

    r1136 r1144  
    11/*
    2 ::      $Id$
     2   $Id$
    33
    44   CFGMGR.CMD - manage installation, maintenance and deinstallation
     
    8686                     nop
    8787               else
    88                   if (cfg.file.f.toolbar = 1) & (cfg.unattended = 1) then
     88                  if (cfg.file.f.toolbar = 1) & (cfg.unattended = 1) & (translate(right(cfg.file.f.name, 13, ' ')) \= '\QUICKTLS.DAT') then
    8989                     call Ticket267Fix cfg.file.f.name
    9090            end
     
    137137
    138138NormalExit:
    139 say
    140 say cfg.pgmname' has ended.'
    141 say 'Time elapsed:' time('e')
    142139n = endlocal()
    143140exit cfg.errorcode
     
    279276   cfg.file.f.desc.1  = 'FM/2 toolbar list'
    280277   cfg.file.f.desc.0  = 1
    281    cfg.file.f.toolbar = 0
     278   cfg.file.f.toolbar = 1
    282279
    283280   f = f + 1
     
    311308      thisdir = thisdir || '\'
    312309   call directory thisdir
     310   fm2ini = value('FM2INI',,'OS2ENVIRONMENT')
     311   if fm2ini = '' then
     312      if right(thisdir, 1) \= '\' then
     313        cfg.inifile = thisdir || '\' || 'FM3.INI'
     314      else
     315        cfg.inifile = thisdir || 'FM3.INI'
     316   else
     317      cfg.inifile = fm2ini
     318
    313319   /* edit for correct directory here? */
    314320
     
    320326
    321327ProcessArgs: procedure expose (globals)
     328   parse arg args
     329   if pos('/ToOlBaRsOnLy', args) > 0 then
     330      cfg.specialiconrun = 1
     331   else
     332      cfg.specialiconrun = 0
    322333   parse upper arg args
    323334   do while args \= '' & cfg.errorcode = 0
     
    454465
    455466Usage: procedure expose (globals)
    456    say 'Proper usage of 'cfg.pgmname':'
    457    say
    458    say cfg.pgmname' /INSTALL [/UNATTENDED]'
     467   say 'Proper usage of 'cfg.pgmname' (the order of the parameters is not important):'
     468   say
     469   say cfg.pgmname' /INSTALL [/UNATTENDED] [/TOOLBARSONLY]'
    459470   say '   This installs any missing configuration files with default values.'
    460471   say
    461    say cfg.pgmname' /INSTALL /DEFAULTS [/UNATTENDED]'
     472   say cfg.pgmname' /INSTALL /DEFAULTS [/UNATTENDED] [/TOOLBARSONLY]'
    462473   say '   This action backs up user-modified configuration files and replaces'
    463474   say '   them with default values. Unless /UNATTENDED, you are asked to confirm'
    464475   say '   this action.'
    465476   say
    466    say cfg.pgmname' /DEINSTALL /DEFAULTS [/UNATTENDED]'
     477   say cfg.pgmname' /DEINSTALL /DEFAULTS [/UNATTENDED] [/TOOLBARSONLY]'
    467478   say '   This reverses the action described above.'
    468479   say
    469    say cfg.pgmname' /DEINSTALL [/UNATTENDED]'
     480   say cfg.pgmname' /DEINSTALL [/UNATTENDED] [/TOOLBARSONLY]'
    470481   say '   This deletes all configuration files. Unless /UNATTENDED, you are asked'
    471482   say '   to confirm this action. (This is action is automatically done during'
     
    474485   say 'The optional parameter /UNATTENDED means there will be NO user interaction'
    475486   say '   or confirmation of the operation!!!'
    476    say 'The order of the parameters is not important.'
     487   say
     488   say 'The optional parameter /TOOLBARSONLY means only toolbar-related files will'
     489   say '   be processed.'
    477490return
    478491
     
    565578
    566579UpdateFM2Ini: procedure expose (globals)
    567    parse source . . thispgm
    568    thisdir = left(thispgm, lastpos('\', thispgm))
    569    inifile = thisdir || 'fm3.ini'
    570    EnvVarList = strip(SysIni(inifile, 'FM/3', 'TreeEnvVarList'))
     580   EnvVarList = strip(SysIni(cfg.inifile, 'FM/3', 'TreeEnvVarList'))
    571581   if EnvVarList = '' | EnvVarList = 'ERROR:' then
    572       call SysIni inifile, 'FM/3', 'TreeEnvVarList', 'PATH;DPATH;LIBPATH;HELP;BOOKSHELF;LIB;INCLUDE;LOCPATH;SMINCLUDE;LPATH;CODELPATH'
    573    LastToolbox = SysIni(inifile, 'FM/3', 'LastToolBox')
    574    LastToolbar = SysIni(inifile, 'FM/3', 'LastToolbar')
     582      call SysIni cfg.inifile, 'FM/3', 'TreeEnvVarList', 'PATH;DPATH;LIBPATH;HELP;BOOKSHELF;LIB;INCLUDE;LOCPATH;SMINCLUDE;LPATH;CODELPATH'
     583   LastToolbox = SysIni(cfg.inifile, 'FM/3', 'LastToolBox')
     584   LastToolbar = SysIni(cfg.inifile, 'FM/3', 'LastToolbar')
    575585   if LastToolbar = 'ERROR:' then
    576586      do
     
    579589         else
    580590                LastToolbar = LastToolbox
    581         call SysIni inifile, 'FM/3', 'LastToolbar', LastToolbar
    582       end
    583    if SysIni(inifile, 'FM/3', 'FM2Shutdown.Toolbar') = 'ERROR:' then
    584                 call SysIni inifile, 'FM/3', 'FM2Shutdown.Toolbar', LastToolbar
    585    if SysIni(inifile, 'FM/4', 'LastToolbar') = 'ERROR:' then
    586                 call SysIni inifile, 'FM/4', 'LastToolbar', LastToolbar
     591        call SysIni cfg.inifile, 'FM/3', 'LastToolbar', LastToolbar
     592      end
     593   if SysIni(cfg.inifile, 'FM/3', 'FM2Shutdown.Toolbar') = 'ERROR:' then
     594                call SysIni cfg.inifile, 'FM/3', 'FM2Shutdown.Toolbar', LastToolbar
     595   if SysIni(cfg.inifile, 'FM/4', 'LastToolbar') = 'ERROR:' then
     596                call SysIni cfg.inifile, 'FM/4', 'LastToolbar', LastToolbar
    587597return
    588598
    589599Ticket267Fix: procedure expose (globals)
    590         parse arg infile
    591         fix_string = 'Fixed: Ticket 267'
    592         abort_fix = 0
    593         outfile = SysTempFilename('cfgmgr??.fix')
    594         call lineout outfile, ';' fix_string
    595         /* Read file, if comment has "already repaired" message then stop */
    596         do while lines(infile) > 0
    597                 line = linein(infile)
    598                 if left(line, 1) = ';' then
    599                         if pos(fix_string, line) > 0 then
    600                                 do
    601                                         abort_fix = 1
    602                                         leave
    603                                 end
    604                         else
    605                                 call lineout outfile, line
    606                 else if word(line, 1) = ':spacer' then
    607                         call lineout outfile, ';' || substr(line, 2)
    608                 else
    609                         do
    610                                 tool.1 = line
    611                                 tool.2 = linein(infile)
    612                                 tool.3 = linein(infile)
    613                                 tool.4 = linein(infile)
    614                                 button_name = translate(tool.2)
    615                                 if (button.button_name.text \= '') & (tool.4 >= 4900) & (tool.4 < 4950) then
    616                                         do
    617                                                 call lineout outfile, button.button_name.helptext
    618                                                 call lineout outfile, button.button_name.text
    619                                                 call lineout outfile, tool.3
    620                                                 call lineout outfile, button.button_name.id
    621                                         end
    622                                 else
    623                                         do
    624                                                 call lineout outfile, tool.1
    625                                                 call lineout outfile, tool.2
    626                                                 call lineout outfile, tool.3
    627                                                 call lineout outfile, tool.4
    628                                         end
    629                         end
    630         end
    631         call stream infile, 'c', 'close'
    632         call stream outfile, 'c', 'close'
    633         if abort_fix = 0 then
    634                 do
     600   parse arg infile
     601   fix_string = 'Fixed: Ticket 267'
     602   abort_fix = 0
     603   outfile = SysTempFilename('cfgmgr??.fix')
     604   call lineout outfile, ';' fix_string
     605   /* Read file, if comment has "already repaired" message then stop */
     606   do while lines(infile) > 0
     607      line = linein(infile)
     608      if left(line, 1) = ';' then
     609         if pos(fix_string, line) > 0 then
     610            do
     611               abort_fix = 1
     612               leave
     613            end
     614         else
     615            call lineout outfile, line
     616      else if word(line, 1) = ':spacer' then
     617         call lineout outfile, ';' || substr(line, 2)
     618      else
     619         do
     620            tool.1 = line
     621            tool.2 = linein(infile)
     622            tool.3 = linein(infile)
     623            tool.4 = linein(infile)
     624            button_name = translate(tool.2)
     625            if (button.button_name.text \= '') & (tool.4 >= 4900) & (tool.4 < 4950) then
     626               do
     627                  call lineout outfile, button.button_name.helptext
     628                  call lineout outfile, button.button_name.text
     629                  call lineout outfile, tool.3
     630                  call lineout outfile, button.button_name.id
     631               end
     632            else
     633               do
     634                  call lineout outfile, tool.1
     635                  call lineout outfile, tool.2
     636                  call lineout outfile, tool.3
     637                  call lineout outfile, tool.4
     638               end
     639         end
     640   end
     641   call stream infile, 'c', 'close'
     642   call stream outfile, 'c', 'close'
     643   if abort_fix = 0 then
     644      do
    635645         'copy' infile cfg.backupdir         /* backup tls file */
    636                         'copy' outfile infile                   /* "install" new  tls file */
    637                         cfg.action_taken = 1
    638                 end
    639         call SysFileDelete outfile
     646         'copy' outfile infile                   /* "install" new  tls file */
     647         cfg.action_taken = 1
     648      end
     649   call SysFileDelete outfile
    640650return
    641651
     
    643653
    644654Error:
    645   say
    646   parse source . . cmd
    647   say 'CONDITION'('C') 'signaled at' cmd 'line' SIGL'.'
    648   if 'CONDITION'('D') \= '' then
    649     say 'REXX reason =' 'CONDITION'('D')'.'
    650   if 'CONDITION'('C') == 'SYNTAX' & 'SYMBOL'('RC') == 'VAR' then
    651     say 'REXX error =' RC '-' 'ERRORTEXT'(RC)'.'
    652   else if 'SYMBOL'('RC') == 'VAR' then
    653     say 'RC =' RC'.'
    654   say 'Source =' 'SOURCELINE'(SIGL)
    655 
    656   if 'CONDITION'('I') \== 'CALL' | 'CONDITION'('C') == 'NOVALUE' | 'CONDITION'('C') == 'SYNTAX' then do
    657     trace '?A'
    658     say 'Exiting.'
    659     call 'SYSSLEEP' 2
    660     exit 'CONDITION'('C')
    661   end
    662 
    663   return
     655   say
     656   parse source . . cmd
     657   say 'CONDITION'('C') 'signaled at' cmd 'line' SIGL'.'
     658   if 'CONDITION'('D') \= '' then
     659     say 'REXX reason =' 'CONDITION'('D')'.'
     660   if 'CONDITION'('C') == 'SYNTAX' & 'SYMBOL'('RC') == 'VAR' then
     661     say 'REXX error =' RC '-' 'ERRORTEXT'(RC)'.'
     662   else if 'SYMBOL'('RC') == 'VAR' then
     663     say 'RC =' RC'.'
     664   say 'Source =' 'SOURCELINE'(SIGL)
     665
     666   if 'CONDITION'('I') \== 'CALL' | 'CONDITION'('C') == 'NOVALUE' | 'CONDITION'('C') == 'SYNTAX' then do
     667     trace '?A'
     668     say 'Exiting.'
     669     call 'SYSSLEEP' 2
     670     exit 'CONDITION'('C')
     671   end
     672return
    664673
    665674/* end Error */
Note: See TracChangeset for help on using the changeset viewer.