badwords: pass config as filename arg

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
This commit is contained in:
Viktor Szakats 2026-03-18 00:51:08 +01:00
parent 3f06e27502
commit 650b33a3db
No known key found for this signature in database
2 changed files with 7 additions and 3 deletions

View File

@ -174,7 +174,9 @@ my %wl;
my @w;
my @exact;
while(<STDIN>) {
my $file = shift @ARGV;
open(CONFIG, "<$file") or die "Cannot open '$file': $!";
while(<CONFIG>) {
chomp;
if($_ =~ /^#/) {
next;
@ -200,6 +202,7 @@ while(<STDIN>) {
}
}
}
close(CONFIG);
# Build a single combined regex for case-insensitive words
my $re_ci;

View File

@ -8,6 +8,7 @@ use warnings;
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;