Commit 3f0c5413 authored by Bill Pemberton's avatar Bill Pemberton Committed by Steven Rostedt

localmodconfig: Rework find_config in streamline_config.pl

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: default avatarBill Pemberton <wfp5p@virginia.edu>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 224a2571
...@@ -100,7 +100,7 @@ my @searchconfigs = ( ...@@ -100,7 +100,7 @@ my @searchconfigs = (
}, },
); );
sub find_config { sub read_config {
foreach my $conf (@searchconfigs) { foreach my $conf (@searchconfigs) {
my $file = $conf->{"file"}; my $file = $conf->{"file"};
...@@ -115,17 +115,15 @@ sub find_config { ...@@ -115,17 +115,15 @@ sub find_config {
print STDERR "using config: '$file'\n"; print STDERR "using config: '$file'\n";
open(CIN, "$exec $file |") || die "Failed to run $exec $file"; open(my $infile, '-|', "$exec $file") || die "Failed to run $exec $file";
return; my @x = <$infile>;
close $infile;
return @x;
} }
die "No config file found"; die "No config file found";
} }
find_config; my @config_file = read_config;
# Read in the entire config file into config_file
my @config_file = <CIN>;
close CIN;
# Parse options # Parse options
my $localmodconfig = 0; my $localmodconfig = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment