-while (@ARGV > 0 && $ARGV[0] =~ /^-/)
- {
- my($arg) = shift @ARGV;
- if ($optargs eq '')
- {
- if ($arg eq "-DEBUG") { $debug = 1; $cr = "\n"; next; }
- if ($arg eq "-DIFF") { $cf = "diff -u"; next; }
- if ($arg eq "-CONTINUE"){$force_continue = 1;
- $more = "cat";
- next; }
- if ($arg eq "-UPDATE") { $force_update = 1; next; }
- if ($arg eq "-NOIPV4") { $have_ipv4 = 0; next; }
- if ($arg eq "-NOIPV6") { $have_ipv6 = 0; next; }
- if ($arg eq "-KEEP") { $save_output = 1; next; }
- if ($arg eq "-VALGRIND") { $valgrind = 1; next; }
- if ($arg =~ /^-FLAVOU?R$/) { $flavour = shift; next; }
- }
- $optargs .= " $arg";
- }
+Getopt::Long::Configure qw(no_getopt_compat);
+GetOptions(
+ 'debug' => sub { $debug = 1; $cr = "\n" },
+ 'diff' => sub { $cf = 'diff -u' },
+ 'continue' => sub { $force_continue = 1; $more = 'cat' },
+ 'update' => \$force_update,
+ 'ipv4!' => \$have_ipv4,
+ 'ipv6!' => \$have_ipv6,
+ 'keep' => \$save_output,
+ 'slow' => \$slow,
+ 'valgrind' => \$valgrind,
+ 'range=i{2}' => \my @range_wanted,
+ 'test=i@' => \my @tests_wanted,
+ 'flavor|flavour=s' => $flavour,
+ 'help' => sub { pod2usage(-exit => 0) },
+ 'man' => sub {
+ pod2usage(
+ -exit => 0,
+ -verbose => 2,
+ -noperldoc => system('perldoc -V 2>/dev/null 1>&2')
+ );
+ },
+) or pod2usage;
+
+($parm_exim, @ARGV) = Exim::Runtest::exim_binary(@ARGV);
+print "Exim binary is `$parm_exim'\n" if defined $parm_exim;
+