better even though we don't use long options.
use Fcntl qw(O_WRONLY O_EXCL O_CREAT);
use FileHandle;
use File::stat;
use Fcntl qw(O_WRONLY O_EXCL O_CREAT);
use FileHandle;
use File::stat;
-use Getopt::Std; $Getopt::Std::STANDARD_HELP_VERSION = 1;
+use Getopt::Long qw(:config gnu_getopt no_ignore_case);
use POSIX qw(strftime WEXITSTATUS WIFEXITED);
use POSIX qw(strftime WEXITSTATUS WIFEXITED);
+my $dumpfilters;
+my $help;
-our $run = 1;
-my $printfilenames = 0;
-
-my %opts;
-
-if (not getopts('dm:np', \%opts)) {
- exit(2);
-}
-
-if ($opts{'d'}) {
- $dumpfilters = 1;
-} elsif ($opts{'n'}) {
- $run = 0;
-}
-
-if (defined($opts{'m'})) {
- $maxmsgs = $opts{'m'};
-}
-
-if ($opts{'p'}) {
- $printfilenames = 1;
-}
+my $norun;
+my $printfilenames;
+
+GetOptions(
+ 'd' => \$dumpfilters,
+ 'h|help' => \$help,
+ 'm=i' => \$maxmsgs,
+ 'n' => \$norun,
+ 'p' => \$printfilenames,
+ ) or pod2usage();
+$help and pod2usage(-exitstatus=>0, -verbose=>1);
+scalar(@ARGV) == 0 or pod2usage();
+
+our $run = !$norun;