From f02ab0ca9a8a29b44be3880e0ea324bce3aced21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 19 Sep 2004 21:21:26 +0000 Subject: [PATCH] Recognize options with values. If an option is present in both GENERIC and the custom kernel, but its value has been modified, it will now be kept in its correct spot instead of being moved to the bottom. --- tools/tools/genericize/genericize.pl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tools/tools/genericize/genericize.pl b/tools/tools/genericize/genericize.pl index 6a74f86c932..5c8f0253610 100755 --- a/tools/tools/genericize/genericize.pl +++ b/tools/tools/genericize/genericize.pl @@ -32,6 +32,8 @@ use strict; use Getopt::Std; +sub EMPTY() {} + MAIN:{ my %opts; getopts('c', \%opts); @@ -51,10 +53,11 @@ MAIN:{ $machine = $value; } elsif ($keyword eq 'ident') { $ident = $value; + } elsif ($keyword eq 'options' && $value =~ m/(\w+)=(.+)/) { + $config{$keyword}->{$1} = $2; } else { - $config{$keyword}->{$value} = 1; + $config{$keyword}->{$value} = \∅ } - #print "$keyword $value\n"; } } @@ -83,7 +86,17 @@ MAIN:{ unless ($value eq $machine); } elsif ($keyword eq 'ident') { $line =~ s/$value/$ident/; - } elsif ($config{$keyword}->{$value}) { + } elsif ($keyword eq 'options' && $value =~ m/(\w+)=(.+)/ && + $config{$keyword}->{$1} != \&EMPTY) { + $value = $1; + if ($config{$keyword}->{$value} ne $2) { + my ($old, $new) = ($2, $config{$keyword}->{$value}); + $line =~ s{=$old}{=$new}; + } + delete($config{$keyword}->{$value}); + delete($config{$keyword}) + unless %{$config{$keyword}}; + } elsif (defined($config{$keyword}->{$value})) { delete($config{$keyword}->{$value}); delete($config{$keyword}) unless %{$config{$keyword}}; @@ -108,7 +121,10 @@ MAIN:{ } elsif (length($keyword) == 7) { print " "; } - print "\t$value\n"; + print "\t$value"; + print "=$config{$keyword}->{$value}" + unless $config{$keyword}->{$value} == \∅ + print "\n"; } } }