summaryrefslogtreecommitdiffstats
path: root/scripts/configcommon.pl
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2010-07-29 19:24:43 -0700
committerRoland McGrath <roland@redhat.com>2010-07-29 19:24:43 -0700
commit11487c5358c414c73bcfd9c850d469fba081f18c (patch)
tree37772c24c3e6aea1f9afc12f2ff89c9ae58e15cc /scripts/configcommon.pl
parent7f2b706ac8d669475df57714364a00361ae3072f (diff)
downloadkernel-11487c5358c414c73bcfd9c850d469fba081f18c.tar.gz
kernel-11487c5358c414c73bcfd9c850d469fba081f18c.tar.xz
kernel-11487c5358c414c73bcfd9c850d469fba081f18c.zip
Restore README.txt, scripts.
Diffstat (limited to 'scripts/configcommon.pl')
-rw-r--r--scripts/configcommon.pl82
1 files changed, 82 insertions, 0 deletions
diff --git a/scripts/configcommon.pl b/scripts/configcommon.pl
new file mode 100644
index 000000000..38bbe80dc
--- /dev/null
+++ b/scripts/configcommon.pl
@@ -0,0 +1,82 @@
+#! /usr/bin/perl
+
+my @args=@ARGV;
+my @configoptions;
+my @configvalues;
+my @common;
+my $configcounter = 0;
+
+# first, read the 1st file
+
+open (FILE,"$args[0]") || die "Could not open $args[0]";
+while (<FILE>) {
+ my $str = $_;
+ if (/\# ([\w]+) is not set/) {
+ $configoptions[$configcounter] = $1;
+ $configvalues[$configcounter] = $str;
+ $common[$configcounter] = 1;
+ $configcounter ++;
+ } else {
+ if (/([\w]+)=/) {
+ $configoptions[$configcounter] = $1;
+ $configvalues[$configcounter] = $str;
+ $common[$configcounter] = 1;
+ $configcounter ++;
+ } else {
+ $configoptions[$configcounter] = "foobarbar";
+ $configvalues[$configcounter] = $str;
+ $common[$configcounter] = 1;
+ $configcounter ++;
+ }
+ }
+};
+
+# now, read all configfiles and see of the options match the initial one.
+# if not, mark it not common
+my $cntr=1;
+
+
+while ($cntr < @ARGV) {
+ open (FILE,$args[$cntr]) || die "Could not open $args[$cntr]";
+ while (<FILE>) {
+ my $nooutput;
+ my $counter;
+ my $configname;
+
+ if (/\# ([\w]+) is not set/) {
+ $configname = $1;
+ } else {
+ if (/([\w]+)=/) {
+ $configname = $1;
+ }
+ }
+
+ $counter = 0;
+ $nooutput = 0;
+ while ($counter < $configcounter) {
+ if ("$configname" eq "$configoptions[$counter]") {
+ if ("$_" eq "$configvalues[$counter]") {
+ 1;
+ } else {
+ $common[$counter] = 0;
+ }
+ }
+ $counter++;
+ }
+ }
+
+ $cntr++;
+}
+
+# now print the common values
+my $counter = 0;
+
+while ($counter < $configcounter) {
+ if ($common[$counter]!=0) {
+ print "$configvalues[$counter]";
+ }
+ $counter++;
+}
+
+1;
+