Instead of stdin.
To simplify the command-line, and allow using a safe and portable
`system()` call from `badwords-all`.
Ref: https://perldoc.perl.org/functions/system
Closes #20970
my @w;
my @exact;
-while(<STDIN>) {
+my $file = shift @ARGV;
+open(CONFIG, "<$file") or die "Cannot open '$file': $!";
+while(<CONFIG>) {
chomp;
if($_ =~ /^#/) {
next;
}
}
}
+close(CONFIG);
# Build a single combined regex for case-insensitive words
my $re_ci;
use File::Basename;
-chdir dirname(__FILE__) . "/..";
+chdir dirname(__FILE__) . '/..';
-exit system("scripts/badwords '**.md' projects/OS400/README.OS400 src lib include docs/examples < scripts/badwords.txt") >> 8;
+exit system('scripts/badwords', ('scripts/badwords.txt',
+ '**.md', 'projects/OS400/README.OS400', 'src', 'lib', 'include', 'docs/examples')) >> 8;