Changeset 1530 for trunk


Ignore:
Timestamp:
May 30, 2010, 3:22:29 PM (15 years ago)
Author:
John Small
Message:

Ticket 428: Support for Unzip v6. Code added to insert UNZIP v6 entry from
achiver.tmp into archiver.bb2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cfgmgr.cmd

    r1509 r1530  
    3232      12 Apr 10 JBS Ticket 429: Speed up the deletion of obsolete state-related FM3.INI keys.
    3333      12 Apr 10 JBS Ticket 429: Add code to delete obsolete "LastToolBox" key(s).
     34      30 May 10 JBS Ticket 428: Add support for UNZIP v6. This program was modified to:
     35         if not already done then
     36            backup existing .\ARCHIVER.BB2 file to .\USER_CONFIG_BACKUP\B4UNZIP6.BB2
     37            insert the UNZIP v6 entry from .\TMPLATES\ARCHVER.TMP into ,\ARCHIVER.BB2 (at the end)
    3438
    3539*/
     
    116120      end
    117121end
     122
     123if cfg.operation = 'INSTALL' then
     124   call UpdateArchiverBB2
    118125
    119126if cfg.errorcode \= 0 then
     
    703710return
    704711
     712UpdateArchiverBB2: procedure expose (globals)
     713   bb2_file = '.\ARCHIVER.BB2'
     714   bb2_v6_startline = FindUnzip6(bb2_file)
     715   if bb2_v6_startline = 0 then
     716      do
     717         tmp_file       = '.\Tmplates\archiver.tmp'
     718         tmp_v6_startline = FindUnzip6(tmp_file)
     719         if tmp_v6_startline \= 0 then
     720            do
     721               backup_file       = '.\User_Config_backup\B4Unzip6.bb2'
     722               if stream(backup_file, 'c', 'query exists') \= '' then
     723                  if cfg.unattended = 0 then
     724                     do
     725                        say 'This process has already been executed.'
     726                        if GetResponse("If you want to repeat this proceed, type 'Y': ") \= 'Y' then
     727                           return
     728                     end
     729                  else
     730                     return
     731               insert_line = FindEndOfDefinitions(bb2_file)
     732               if insert_line > 0 then
     733                  do
     734                     'copy' bb2_file backup_file '>NUL 2>NUL'
     735                     if rc \= 0 then
     736                        return
     737                     call SysFileDelete bb2_file
     738                     do i = 1 to insert_line
     739                        call lineout bb2_file, bb2_lines.i
     740                     end
     741                     do j = 1 to tmp_v6_startline
     742                        line = linein(tmp_file)
     743                     end
     744                     do 25 /* 21 lines of def + 3 prefix comment lines + 1 postfix comment */
     745                        line = linein(tmp_file)
     746                        call lineout bb2_file, line
     747                     end
     748                     call stream tmp_file, 'c', 'close'
     749                     do j = i to bb2_lines.0
     750                        call lineout bb2_file, bb2_lines.j
     751                     end
     752                     call stream bb2_file, 'c', 'close'
     753                  end
     754               else
     755                  if cfg.unattended = 0 then
     756                     say 'Unable to find place to insert definition.'
     757            end
     758         else
     759            if cfg.unattended = 0 then
     760               say 'Unable to find Unzip v6 definition'
     761      end
     762   else
     763      if cfg.unattended = 0 then
     764         say 'Unzip v6 definition is already installed.'
     765return
     766
     767FindUnzip6: procedure expose (globals)
     768   parse arg filename
     769   start_string   = '--------  ------  ------- ---- ---------- ----- --------  ----'
     770   end_string     = '--------          -------  ---                            -------'
     771   call SysFileSearch start_string, filename, 'start_lines.', 'N'
     772   call SysFileSearch end_string, filename, 'end_lines.', 'N'
     773   call stream filename, 'c', 'close'
     774   start_line = 0
     775   do i = 1 to start_lines.0
     776      do j = 1 to end_lines.0
     777         if word(end_lines.j, 1) = word(start_lines.i, 1) + 1 then
     778            do
     779               start_line = word(start_lines.i, 1) - 18
     780               i = start_lines.0
     781               j = end_lines.0
     782            end
     783      end
     784   end
     785   drop start_lines.
     786   drop end_lines.
     787return start_line
     788
     789FindEndOfDefinitions: procedure expose (globals) bb2_lines.
     790   parse arg bb2_file
     791   end_of_defs_line = 0
     792   i = 0
     793   do while lines(bb2_file) > 0
     794      i = i + 1
     795      bb2_lines.i = linein(bb2_file)
     796      if strip(bb2_lines.i) \= '' then
     797         if abbrev(bb2_lines.i, ';') then
     798            if end_of_defs_line = 0 then
     799               end_of_defs_line = i
     800            else
     801               nop
     802         else
     803            end_of_defs_line = 0
     804   end
     805   call stream bb2_file, 'c', 'close'
     806   bb2_lines.0 = i
     807return end_of_defs_line
     808
     809
    705810/*=== Error() Report ERROR, FAILURE etc. and exit ===*/
    706811
Note: See TracChangeset for help on using the changeset viewer.