Index: ddclient-3.7.0/ddclient =================================================================== --- ddclient-3.7.0.orig/ddclient 2006-12-01 23:22:37.083904332 +0100 +++ ddclient-3.7.0/ddclient 2006-12-01 23:24:46.118219338 +0100 @@ -553,6 +553,12 @@ test_geturl(opt('geturl')) if opt('geturl'); +## process help option +if (opt('help')) { + *STDERR = *STDOUT; + usage(0); +} + ## read config file because 'daemon' mode may be defined there. read_config(define($opt{'file'}, default('file')), \%config, \%globals); init_config(); @@ -1109,16 +1115,14 @@ $config{$h}{'cacheable'} = [ @{$services{$proto}{'cacheable'}} ]; } } - if (opt('help')) { - *STDERR = *STDOUT; - usage(); - } } ###################################################################### ## usage ###################################################################### sub usage { + my $exitcode = 1; + $exitcode = shift if @_ != 0; # use first arg if given my $msg = ''; if (@_) { my $format = shift; @@ -1128,7 +1132,7 @@ } printf STDERR "%s%s\n", $msg, $opt_usage; sendmail(); - exit 1; + exit $exitcode; } ######################################################################