Merge remote-tracking branch 'rhansen/process_args' (#121)

This commit is contained in:
Sandro Jäckel 2020-05-26 20:52:29 +02:00
commit 3d1ed60812
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5

View file

@ -743,6 +743,9 @@ $variables{'merged'} = merge($variables{'global-defaults'},
map { $services{$_}{'variables'} } keys %services,
);
# This will hold the processed args.
my %opt = ();
my @opt = (
"usage: ${program} [options]",
"options are:",
@ -810,7 +813,7 @@ my @opt = (
);
## process args
my ($opt_usage, %opt) = process_args(@opt);
my $opt_usage = process_args(@opt);
my ($result, %config, %globals, %cache);
my $saved_cache = '';
my %saved_opt = %opt;
@ -1449,7 +1452,6 @@ sub usage {
sub process_args {
my @spec = ();
my $usage = "";
my %opts = ();
foreach (@_) {
if (ref $_) {
@ -1486,7 +1488,7 @@ sub process_args {
if (! GetOptions(\%opt, @spec)) {
$opt{"help"} = 1;
}
return ($usage, %opt);
return $usage;
}
######################################################################
## test_possible_ip - print possible IPs