Changeset 349 for 1.7.5/utils/update.pl
- Timestamp:
- 08/12/06 03:48:41 (2 years ago)
- Files:
-
- 1.7.5/utils/update.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.7.5/utils/update.pl
r335 r349 13 13 # 14 14 # Here's how it works. 15 # First, we make a backup of your old-file to old-file.bak16 # Then we read all the #def's in the old-file, and their15 # 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 17 17 # associated comments. Associated comments means comments 18 18 # on the same line, after the define, or comments on lines 19 19 # preceding the define. We store the names of all the defines, 20 20 # 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 22 27 # that wasn't in the old-file, we show the user the comment 23 28 # and ask them how they want it set. Every time we write out 24 29 # 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 in30 # 5. Finally, if there's anything left from old-file that's not in 26 31 # new-file, we ask if the user would like to retain each one. 27 32 # Presumably users want to retain their custom defines, but don't … … 112 117 113 118 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. 121 if ($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 } 132 if ($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 115 141 # match the old file. If we come across a definition that 116 142 # isn't in the old file, ask the user about it. … … 179 205 close(NEW); 180 206 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, 182 208 # offer to delete them (or not) 183 209 print "\n*** Checking for leftover defines from $old...\n";
