=================================================================== RCS file: /cvs/mandoc/regress/regress.pl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -p -r1.8 -r1.9 --- mandoc/regress/regress.pl 2017/07/18 18:47:06 1.8 +++ mandoc/regress/regress.pl 2018/12/16 00:17:04 1.9 @@ -1,6 +1,6 @@ #!/usr/bin/env perl # -# $Id: regress.pl,v 1.8 2017/07/18 18:47:06 schwarze Exp $ +# $Id: regress.pl,v 1.9 2018/12/16 00:17:04 schwarze Exp $ # # Copyright (c) 2017 Ingo Schwarze # @@ -79,23 +79,25 @@ sub syshtml ($@) { open my $outfd, '>', $outfile or die "$outfile: $!"; my $infd; my $pid = open3 undef, $infd, undef, @_; - my $state; + my $state = 0; while (<$infd>) { chomp; if (!$state && s/.*//) { - $state = 1; + $state = 'math'; next unless length; + } elsif (/^BEGINTEST/) { + $state = 'other'; } - $state = 1 if /^BEGINTEST/; - if ($state && s/<\/math>.*//) { + if ($state eq 'math') { s/^ *//; - print $outfd "$_\n" if length; - undef $state; - next; + if (s/<\/math>.*//) { + print $outfd "$_\n" if length; + $state = 0; + next; + } } - s/^ *//; print $outfd "$_\n" if $state; - undef $state if /^ENDTEST/; + $state = 0 if /^ENDTEST/; } close $outfd; close $infd;