3 #=======================================================================
5 # File ID: 1268bb2c-2988-11e5-9cd9-000df06acc56
10 # ©opyleft 2015– Øyvind A. Holm <sunny@sunbase.org>
11 # License: GNU General Public License version 2 or later, see end of
12 # file for legal stuff.
13 #=======================================================================
32 $progname =~ s/^.*\/(.*?)$/$1/;
33 our $VERSION = '0.1.0';
35 Getopt
::Long
::Configure
('bundling');
38 'help|h' => \
$Opt{'help'},
39 'number|n=i' => \
$Opt{'number'},
40 'quiet|q+' => \
$Opt{'quiet'},
41 'verbose|v+' => \
$Opt{'verbose'},
42 'version' => \
$Opt{'version'},
44 ) || die("$progname: Option error. Use -h for help.\n");
46 $Opt{'verbose'} -= $Opt{'quiet'};
47 $Opt{'help'} && usage
(0);
48 if ($Opt{'version'}) {
60 my $slurp = join('', <>);
61 !length($slurp) && return(0);
71 my ($header, $got, $exp) = ($1, $2, $3);
73 write_data
($count, $Opt{'number'}, $header, $got, $exp);
82 my ($count, $number, $header, $got, $exp) = @_;
83 if ($count == $Opt{'number'}) {
84 $exp =~ s/^(.*?\n)(not )?ok .*$/$1/s;
85 open(my $gotfh, ">got") or die("$progname: got: Cannot create file: $!\n");
86 open(my $expfh, ">exp") or die("$progname: exp: Cannot create file: $!\n");
87 print($gotfh $header . $got);
88 print($expfh $header . $exp);
97 # Print program version {{{
98 print("$progname $VERSION\n");
104 # Send the help message to stdout {{{
107 if ($Opt{'verbose'}) {
113 Usage: $progname [options] [file [files [...]]]
120 Skip to error number X.
122 Be more quiet. Can be repeated to increase silence.
124 Increase level of verbosity. Can be repeated.
126 Print version information.
134 # Print a status message to stderr based on verbosity level {{{
135 my ($verbose_level, $Txt) = @_;
137 if ($Opt{'verbose'} >= $verbose_level) {
138 print(STDERR
"$progname: $Txt\n");
146 # This program is free software; you can redistribute it and/or modify
147 # it under the terms of the GNU General Public License as published by
148 # the Free Software Foundation; either version 2 of the License, or (at
149 # your option) any later version.
151 # This program is distributed in the hope that it will be useful, but
152 # WITHOUT ANY WARRANTY; without even the implied warranty of
153 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
154 # See the GNU General Public License for more details.
156 # You should have received a copy of the GNU General Public License
157 # along with this program.
158 # If not, see L<http://www.gnu.org/licenses/>.
160 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :