localmodconfig: Rework find_config in streamline_config.pl
authorBill Pemberton <wfp5p@virginia.edu>
Thu, 9 Aug 2012 13:23:21 +0000 (09:23 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 16 Aug 2012 20:09:16 +0000 (16:09 -0400)
Change find_config function to read_config.  It now finds the config,
reads the config into an array, and returns the array.  This makes it
a little cleaner and changes the open to use perl's 3 option open.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
scripts/kconfig/streamline_config.pl

index e3687f98e0c8c9b5ffc931c4c434dadf094cf9d8..62d64ce5c5814c4b3601ed8f558b4987f93be2b9 100644 (file)
@@ -100,7 +100,7 @@ my @searchconfigs = (
        },
 );
 
-sub find_config {
+sub read_config {
     foreach my $conf (@searchconfigs) {
        my $file = $conf->{"file"};
 
@@ -115,17 +115,15 @@ sub find_config {
 
        print STDERR "using config: '$file'\n";
 
-       open(CIN, "$exec $file |") || die "Failed to run $exec $file";
-       return;
+       open(my $infile, '-|', "$exec $file") || die "Failed to run $exec $file";
+       my @x = <$infile>;
+       close $infile;
+       return @x;
     }
     die "No config file found";
 }
 
-find_config;
-
-# Read in the entire config file into config_file
-my @config_file = <CIN>;
-close CIN;
+my @config_file = read_config;
 
 # Parse options
 my $localmodconfig = 0;
This page took 0.050687 seconds and 5 git commands to generate.