diff options
Diffstat (limited to 'libtests/qtest')
-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"; +} |