3 #=======================================================================
5 # File ID: f8b42aae-f743-11dd-b0d8-000475e441b9
7 # Search for duplicates in MD5 and SHA1 files.
10 # ©opyleft 2008– Ø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 #=======================================================================
31 $progname =~ s/^.*\/(.*?)$/$1/;
32 our $VERSION = '0.1.0';
34 Getopt
::Long
::Configure
('bundling');
37 'help|h' => \
$Opt{'help'},
38 'quiet|q+' => \
$Opt{'quiet'},
39 'verbose|v+' => \
$Opt{'verbose'},
40 'version' => \
$Opt{'version'},
42 ) || die("$progname: Option error. Use -h for help.\n");
44 $Opt{'verbose'} -= $Opt{'quiet'};
45 $Opt{'help'} && usage
(0);
46 if ($Opt{'version'}) {
57 my ($Last, $Curr) = ("", "");
58 my ($Line, $last_line) = ("", "");
59 my $first_printed = 0;
63 /^([[:xdigit:]]+)/ && ($Curr = $1);
65 if (!$first_printed) {
66 print("\n$last_line\n");
82 # Print program version {{{
83 print("$progname $VERSION\n");
89 # Send the help message to stdout {{{
92 if ($Opt{'verbose'}) {
98 Find duplicates in MD5 and SHA1 files. Input has to be sorted.
100 Usage: $progname [options] [file [files [...]]]
107 Be more quiet. Can be repeated to increase silence.
109 Increase level of verbosity. Can be repeated.
111 Print version information.
119 # Print a status message to stderr based on verbosity level {{{
120 my ($verbose_level, $Txt) = @_;
122 if ($Opt{'verbose'} >= $verbose_level) {
123 print(STDERR
"$progname: $Txt\n");
131 # This program is free software; you can redistribute it and/or modify
132 # it under the terms of the GNU General Public License as published by
133 # the Free Software Foundation; either version 2 of the License, or (at
134 # your option) any later version.
136 # This program is distributed in the hope that it will be useful, but
137 # WITHOUT ANY WARRANTY; without even the implied warranty of
138 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
139 # See the GNU General Public License for more details.
141 # You should have received a copy of the GNU General Public License
142 # along with this program.
143 # If not, see L<http://www.gnu.org/licenses/>.
145 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :