diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-12-30 18:56:27 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-01-06 00:13:25 +0100 |
commit | 4782b5904f2cddc7ecda86abc0590a2ff8715b33 (patch) | |
tree | 845e42d34511ed8340c6af87188057cbfa0c7035 /libtests | |
parent | 32f7d9989a3c6d45083ff9e686d5eebb87615e42 (diff) | |
download | qpdf-4782b5904f2cddc7ecda86abc0590a2ff8715b33.tar.zst |
Move filter-completion.pl to libtests/arg_parser
Diffstat (limited to 'libtests')
-rw-r--r-- | libtests/qtest/arg_parser/filter-completion.pl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libtests/qtest/arg_parser/filter-completion.pl b/libtests/qtest/arg_parser/filter-completion.pl new file mode 100644 index 00000000..2d176309 --- /dev/null +++ b/libtests/qtest/arg_parser/filter-completion.pl @@ -0,0 +1,41 @@ +use warnings; +use strict; + +# THIS SCRIPT IS ALSO USED IN qpdf.test + +# Output every line from STDIN that appears in the file. +my %wanted = (); +my %notwanted = (); +my $f = $ARGV[0]; +if (open(F, "<$f")) +{ + while (<F>) + { + chomp; + if (s/^!//) + { + $notwanted{$_} = 1; + } + else + { + $wanted{$_} = 1; + } + } + close(F); +} +while (<STDIN>) +{ + chomp; + if (exists $wanted{$_}) + { + print $_, "\n"; + } + elsif (exists $notwanted{$_}) + { + delete $notwanted{$_}; + } +} +foreach my $k (sort keys %notwanted) +{ + print "!$k\n"; +} |