Convert invocations of usage() to fatal()
The usage text is extremely long which causes the error message to scroll off the top of the screen. Switch to fatal() to avoid this problem.
This commit is contained in:
parent
ca7f0927fc
commit
7be4d58b90
1 changed files with 6 additions and 13 deletions
19
ddclient
19
ddclient
|
@ -807,7 +807,10 @@ $result = 'OK';
|
||||||
|
|
||||||
test_geturl(opt('geturl')) if opt('geturl');
|
test_geturl(opt('geturl')) if opt('geturl');
|
||||||
|
|
||||||
usage() if opt('help');
|
if (opt('help')) {
|
||||||
|
printf "%s\n", $opt_usage;
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
## read config file because 'daemon' mode may be defined there.
|
## read config file because 'daemon' mode may be defined there.
|
||||||
read_config(define($opt{'file'}, default('file')), \%config, \%globals);
|
read_config(define($opt{'file'}, default('file')), \%config, \%globals);
|
||||||
|
@ -860,7 +863,7 @@ do {
|
||||||
read_cache(opt('cache'), \%cache);
|
read_cache(opt('cache'), \%cache);
|
||||||
print_info() if opt('debug') && opt('verbose');
|
print_info() if opt('debug') && opt('verbose');
|
||||||
|
|
||||||
usage("invalid argument '-use %s'; possible values are:\n%s", $opt{'use'}, join("\n", ip_strategies_usage()))
|
fatal("invalid argument '-use %s'; possible values are:\n%s", $opt{'use'}, join("\n", ip_strategies_usage()))
|
||||||
unless exists $ip_strategies{lc opt('use')};
|
unless exists $ip_strategies{lc opt('use')};
|
||||||
|
|
||||||
$daemon = $opt{'daemon'};
|
$daemon = $opt{'daemon'};
|
||||||
|
@ -1327,7 +1330,7 @@ sub init_config {
|
||||||
|
|
||||||
## sanity check
|
## sanity check
|
||||||
if (defined $opt{'host'} && defined $opt{'retry'}) {
|
if (defined $opt{'host'} && defined $opt{'retry'}) {
|
||||||
usage("options -retry and -host (or -option host=..) are mutually exclusive");
|
fatal("options -retry and -host (or -option host=..) are mutually exclusive");
|
||||||
}
|
}
|
||||||
|
|
||||||
## determine hosts to update (those on the cmd-line, config-file, or failed cached)
|
## determine hosts to update (those on the cmd-line, config-file, or failed cached)
|
||||||
|
@ -1403,16 +1406,6 @@ sub init_config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
|
||||||
## usage
|
|
||||||
######################################################################
|
|
||||||
sub usage {
|
|
||||||
_msg(1, 1, 'FATAL:', @_) if @_;
|
|
||||||
printf { @_ ? *STDERR : *STDOUT } "%s\n", $opt_usage;
|
|
||||||
sendmail() if @_;
|
|
||||||
exit (@_ ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
## process_args -
|
## process_args -
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
Loading…
Reference in a new issue