ddclient/patches/debianpatches/help_nonroot.diff
wimpunk b507eec71a Added debian and ubuntu patches
git-svn-id: svn+ssh://svn.code.sf.net/p/ddclient/code/trunk/svn@69 3873ddee-7413-0410-b6c4-c2c57c1ab35a
2007-07-30 07:11:22 +00:00

46 lines
1.2 KiB
Diff

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;
}
######################################################################