PennMUSH Community
Show
Ignore:
Timestamp:
08/12/06 03:48:41 (2 years ago)
Author:
pennmush
Message:

PennMUSH 1.7.5p7 Archival

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.7.5/utils/update.pl

    r335 r349  
    1313# 
    1414# Here's how it works. 
    15 # First, we make a backup of your old-file to old-file.bak 
    16 # Then we read all the #def's in the old-file, and their 
     15# 1. We make a backup of your old-file to old-file.bak 
     16# 2. We read all the #def's in the old-file, and their 
    1717#  associated comments. Associated comments means comments 
    1818#  on the same line, after the define, or comments on lines 
    1919#  preceding the define. We store the names of all the defines, 
    2020#  their comments, and whether they're defined or not. 
    21 # Then we do the same for the new-file. If we find a define 
     21# 3. We check to see if there's are enviroment variables named DEFINE 
     22#  or UNDEFINE. If so we parse them. DEFINE may contain NAMEs or 
     23#  NAME=value pairs. UNDEFINE should contain only NAMEs. 
     24#  We consider these as if they were present in old-file.  
     25#  These override old-file. 
     26# 4. We read in the new-file. If we find a define 
    2227#  that wasn't in the old-file, we show the user the comment 
    2328#  and ask them how they want it set. Every time we write out 
    2429#  a define, we delete it from the list of defines from old-file 
    25 # Finally, if there's anything left from old-file that's not in 
     30# 5. Finally, if there's anything left from old-file that's not in 
    2631#  new-file, we ask if the user would like to retain each one. 
    2732#  Presumably users want to retain their custom defines, but don't 
     
    112117 
    113118 
    114 # Part 3 - read in the new file, modifying its definition lines to 
     119# Part 3 - Check to see if we have environment variable SETTINGS and 
     120#          use those settings as if they were in the old file. 
     121if ($settings = $ENV{'DEFINE'}) { 
     122  print "\n*** Found a DEFINE environment variable - applying settings...\n"; 
     123  @pairs = split ' ', $settings; 
     124  foreach (@pairs) { 
     125    if (($d,$v) = /(.+)=(.+)/) { 
     126      $defs{$d} = $v; 
     127    } else { 
     128      $defs{$_} = 'define'; 
     129    } 
     130  } 
     131
     132if ($settings = $ENV{'UNDEFINE'}) { 
     133  print "\n*** Found an UNDEFINE environment variable - applying settings...\n"; 
     134  @pairs = split ' ', $settings; 
     135  foreach (@pairs) { 
     136      $defs{$_} = 'undef'; 
     137  } 
     138
     139 
     140# Part 4 - read in the new file, modifying its definition lines to 
    115141#          match the old file. If we come across a definition that 
    116142#          isn't in the old file, ask the user about it.  
     
    179205close(NEW); 
    180206 
    181 # Part 4 - if there are any definitions left from the old file, 
     207# Part 5 - if there are any definitions left from the old file, 
    182208#          offer to delete them (or not) 
    183209print "\n*** Checking for leftover defines from $old...\n";