Skip to content

Commit

Permalink
localmodconfig: Use 3 parameter open in streamline_config.pl
Browse files Browse the repository at this point in the history
Convert remaining open calls to use the perl's preferred 3 parameter
open.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Bill Pemberton authored and Steven Rostedt committed Aug 16, 2012
1 parent 3f0c541 commit e0d2869
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions scripts/kconfig/streamline_config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ sub read_kconfig {
$source =~ s/\$$env/$ENV{$env}/;
}

open(KIN, "$source") || die "Can't open $kconfig";
while (<KIN>) {
open(my $kinfile, '<', $source) || die "Can't open $kconfig";
while (<$kinfile>) {
chomp;

# Make sure that lines ending with \ continue
Expand Down Expand Up @@ -249,7 +249,7 @@ sub read_kconfig {
$state = "NONE";
}
}
close(KIN);
close($kinfile);

# read in any configs that were found.
foreach $kconfig (@kconfigs) {
Expand Down Expand Up @@ -293,8 +293,8 @@ sub convert_vars {
my $line = "";
my %make_vars;

open(MIN,$makefile) || die "Can't open $makefile";
while (<MIN>) {
open(my $infile, '<', $makefile) || die "Can't open $makefile";
while (<$infile>) {
# if this line ends with a backslash, continue
chomp;
if (/^(.*)\\$/) {
Expand Down Expand Up @@ -341,10 +341,11 @@ sub convert_vars {
}
}
}
close(MIN);
close($infile);
}

my %modules;
my $linfile;

if (defined($lsmod_file)) {
if ( ! -f $lsmod_file) {
Expand All @@ -354,13 +355,10 @@ sub convert_vars {
die "$lsmod_file not found";
}
}
if ( -x $lsmod_file) {
# the file is executable, run it
open(LIN, "$lsmod_file|");
} else {
# Just read the contents
open(LIN, "$lsmod_file");
}

my $otype = ( -x $lsmod_file) ? '-|' : '<';
open($linfile, $otype, $lsmod_file);

} else {

# see what modules are loaded on this system
Expand All @@ -377,16 +375,16 @@ sub convert_vars {
$lsmod = "lsmod";
}

open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
open($linfile, '-|', $lsmod) || die "Can not call lsmod with $lsmod";
}

while (<LIN>) {
while (<$linfile>) {
next if (/^Module/); # Skip the first line.
if (/^(\S+)/) {
$modules{$1} = 1;
}
}
close (LIN);
close ($linfile);

# add to the configs hash all configs that are needed to enable
# a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o
Expand Down

0 comments on commit e0d2869

Please sign in to comment.