From 4bf9d597224af9792f6c58ea05ff0021d60d6baa Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 2 Aug 2020 17:03:54 -0400 Subject: [PATCH 1/2] Whitespace fixes --- ddclient.in | 94 ++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/ddclient.in b/ddclient.in index 4303197..94dcd4e 100755 --- a/ddclient.in +++ b/ddclient.in @@ -758,64 +758,62 @@ $opt{'fw-banlocal'} = sub { warning("'-fw-banlocal' is deprecated and does nothi my @opt = ( "usage: ${program} [options]", "options are:", - [ "daemon", "=s", "-daemon delay : run as a daemon, specify delay as an interval." ], - [ "foreground", "!", "-foreground : do not fork" ], - [ "proxy", "=s", "-proxy host : use 'host' as the HTTP proxy" ], - [ "server", "=s", "-server host : update DNS information on 'host'" ], - [ "protocol", "=s", "-protocol type : update protocol used" ], - [ "file", "=s", "-file path : load configuration information from 'path'" ], - [ "cache", "=s", "-cache path : record address used in 'path'" ], - [ "pid", "=s", "-pid path : record process id in 'path' if daemonized" ], + ["daemon", "=s", "-daemon delay : run as a daemon, specify delay as an interval."], + ["foreground", "!", "-foreground : do not fork"], + ["proxy", "=s", "-proxy host : use 'host' as the HTTP proxy"], + ["server", "=s", "-server host : update DNS information on 'host'"], + ["protocol", "=s", "-protocol type : update protocol used"], + ["file", "=s", "-file path : load configuration information from 'path'"], + ["cache", "=s", "-cache path : record address used in 'path'"], + ["pid", "=s", "-pid path : record process id in 'path' if daemonized"], "", - [ "use", "=s", "-use which : how the should IP address be obtained." ], + ["use", "=s", "-use which : how the should IP address be obtained."], &ip_strategies_usage(), "", - [ "ip", "=s", "-ip address : set the IP address to 'address'" ], + ["ip", "=s", "-ip address : set the IP address to 'address'"], "", - [ "if", "=s", "-if interface : obtain IP address from 'interface'" ], - [ "if-skip", "=s", "-if-skip pattern : skip any IP addresses before 'pattern' in the output of 'ip address show dev {if}' (or 'ifconfig {if}')" ], + ["if", "=s", "-if interface : obtain IP address from 'interface'"], + ["if-skip", "=s", "-if-skip pattern : skip any IP addresses before 'pattern' in the output of 'ip address show dev {if}' (or 'ifconfig {if}')"], "", - [ "web", "=s", "-web provider|url : obtain IP address from provider's IP checking page" ], - [ "web-skip", "=s", "-web-skip pattern : skip any IP addresses before 'pattern' on the web provider|url" ], + ["web", "=s", "-web provider|url : obtain IP address from provider's IP checking page"], + ["web-skip", "=s", "-web-skip pattern : skip any IP addresses before 'pattern' on the web provider|url"], "", - [ "fw", "=s", "-fw address|url : obtain IP address from firewall at 'address'" ], - [ "fw-skip", "=s", "-fw-skip pattern : skip any IP addresses before 'pattern' on the firewall address|url" ], - [ "fw-login", "=s", "-fw-login login : use 'login' when getting IP from fw" ], - [ "fw-password", "=s", "-fw-password secret : use password 'secret' when getting IP from fw" ], + ["fw", "=s", "-fw address|url : obtain IP address from firewall at 'address'"], + ["fw-skip", "=s", "-fw-skip pattern : skip any IP addresses before 'pattern' on the firewall address|url"], + ["fw-login", "=s", "-fw-login login : use 'login' when getting IP from fw"], + ["fw-password", "=s", "-fw-password secret : use password 'secret' when getting IP from fw"], "", - [ "cmd", "=s", "-cmd program : obtain IP address from by calling {program}" ], - [ "cmd-skip", "=s", "-cmd-skip pattern : skip any IP addresses before 'pattern' in the output of {cmd}" ], + ["cmd", "=s", "-cmd program : obtain IP address from by calling {program}"], + ["cmd-skip", "=s", "-cmd-skip pattern : skip any IP addresses before 'pattern' in the output of {cmd}"], "", - [ "login", "=s", "-login user : login as 'user'" ], - [ "password", "=s", "-password secret : use password 'secret'" ], - [ "host", "=s", "-host host : update DNS information for 'host'" ], + ["login", "=s", "-login user : login as 'user'"], + ["password", "=s", "-password secret : use password 'secret'"], + ["host", "=s", "-host host : update DNS information for 'host'"], "", - [ "options", "=s", "-options opt,opt : optional per-service arguments (see below)" ], + ["options", "=s", "-options opt,opt : optional per-service arguments (see below)"], "", - [ "ssl", "!", "-{no}ssl : do updates over encrypted SSL connection" ], - [ "ssl_ca_dir", "=s", "-ssl_ca_dir : directory containing certificates of trusted certificate authorities (default: auto-detect)" ], - [ "ssl_ca_file", "=s", "-ssl_ca_file : file containing certificates of trusted certificate authorities (default: auto-detect)" ], - [ "retry", "!", "-{no}retry : retry failed updates." ], - [ "force", "!", "-{no}force : force an update even if the update may be unnecessary" ], - [ "timeout", "=i", "-timeout max : wait at most 'max' seconds for the host to respond" ], - - [ "syslog", "!", "-{no}syslog : log messages to syslog" ], - [ "facility", "=s", "-facility {type} : log messages to syslog to facility {type}" ], - [ "priority", "=s", "-priority {pri} : log messages to syslog with priority {pri}" ], - [ "mail", "=s", "-mail address : e-mail messages to {address}" ], - [ "mail-failure","=s", "-mail-failure address : e-mail messages for failed updates to {address}" ], - [ "exec", "!", "-{no}exec : do {not} execute; just show what would be done" ], - [ "debug", "!", "-{no}debug : print {no} debugging information" ], - [ "verbose", "!", "-{no}verbose : print {no} verbose information" ], - [ "quiet", "!", "-{no}quiet : print {no} messages for unnecessary updates" ], - [ "ipv6", "!", "-{no}ipv6 : use ipv6" ], - [ "help", "", "-help : this message" ], - [ "postscript", "", "-postscript : script to run after updating ddclient, has new IP as param" ], - - [ "query", "!", "-{no}query : print {no} ip addresses and exit" ], - [ "fw-banlocal", "!", "" ], ## deprecated - [ "test", "!", "" ], ## hidden - [ "geturl", "=s", "" ], ## hidden + ["ssl", "!", "-{no}ssl : do updates over encrypted SSL connection"], + ["ssl_ca_dir", "=s", "-ssl_ca_dir : directory containing certificates of trusted certificate authorities (default: auto-detect)"], + ["ssl_ca_file", "=s", "-ssl_ca_file : file containing certificates of trusted certificate authorities (default: auto-detect)"], + ["retry", "!", "-{no}retry : retry failed updates."], + ["force", "!", "-{no}force : force an update even if the update may be unnecessary"], + ["timeout", "=i", "-timeout max : wait at most 'max' seconds for the host to respond"], + ["syslog", "!", "-{no}syslog : log messages to syslog"], + ["facility", "=s", "-facility {type} : log messages to syslog to facility {type}"], + ["priority", "=s", "-priority {pri} : log messages to syslog with priority {pri}"], + ["mail", "=s", "-mail address : e-mail messages to {address}"], + ["mail-failure", "=s", "-mail-failure address : e-mail messages for failed updates to {address}"], + ["exec", "!", "-{no}exec : do {not} execute; just show what would be done"], + ["debug", "!", "-{no}debug : print {no} debugging information"], + ["verbose", "!", "-{no}verbose : print {no} verbose information"], + ["quiet", "!", "-{no}quiet : print {no} messages for unnecessary updates"], + ["ipv6", "!", "-{no}ipv6 : use ipv6"], + ["help", "", "-help : this message"], + ["postscript", "", "-postscript : script to run after updating ddclient, has new IP as param"], + ["query", "!", "-{no}query : print {no} ip addresses and exit"], + ["fw-banlocal", "!", ""], ## deprecated + ["test", "!", ""], ## hidden + ["geturl", "=s", ""], ## hidden "", nic_examples(), "$program version $version, ", From 686bf5a8c87e2577181456e543c7866441dfae37 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 2 Aug 2020 21:27:15 -0400 Subject: [PATCH 2/2] Improve `-help` text --- ddclient.in | 90 +++++++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 41 deletions(-) diff --git a/ddclient.in b/ddclient.in index 94dcd4e..be005a8 100755 --- a/ddclient.in +++ b/ddclient.in @@ -341,18 +341,21 @@ my %builtinfw = ( ); my %ip_strategies = ( - 'ip' => ": obtain IP from -ip {address}", - 'web' => ": obtain IP from an IP discovery page on the web", - 'fw' => ": obtain IP from the firewall specified by -fw {type|address}", - 'if' => ": obtain IP from the -if {interface}", - 'cmd' => ": obtain IP from the -cmd {external-command}", - 'cisco' => ": obtain IP from Cisco FW at the -fw {address}", - 'cisco-asa' => ": obtain IP from Cisco ASA at the -fw {address}", - map { $_ => sprintf ": obtain IP from %s at the -fw {address}", $builtinfw{$_}->{'name'} } keys %builtinfw, + 'ip' => ": use IP given by '-ip
'", + 'web' => ": obtain IP from the web-based IP discovery service given by '-web |'", + 'fw' => ": obtain IP from a firewall/router device by visiting the URL given by '-fw '", + 'if' => ": obtain IP from the interface given by '-if '", + 'cmd' => ": obtain IP by running the command given by '-cmd '", + 'cisco' => ": obtain IP from Cisco FW device at the address given by '-fw
'", + 'cisco-asa' => ": obtain IP from Cisco ASA device at the address given by '-fw
'", + map({ $_ => sprintf(": obtain IP from %s device at the address given by '-fw
'", + $builtinfw{$_}->{'name'}) } + keys(%builtinfw)), ); sub ip_strategies_usage { - return map { sprintf(" -use=%-22s %s.", $_, $ip_strategies{$_}) } sort keys %ip_strategies; + return map({ sprintf(" -use=%-22s %s.", $_, $ip_strategies{$_}) } + ('ip', 'web', 'if', 'cmd', 'fw', sort('cisco', 'cisco-asa', keys(%builtinfw)))); } sub setv { @@ -758,57 +761,62 @@ $opt{'fw-banlocal'} = sub { warning("'-fw-banlocal' is deprecated and does nothi my @opt = ( "usage: ${program} [options]", "options are:", - ["daemon", "=s", "-daemon delay : run as a daemon, specify delay as an interval."], + ["daemon", "=s", "-daemon : run as a daemon, specify as an interval"], ["foreground", "!", "-foreground : do not fork"], - ["proxy", "=s", "-proxy host : use 'host' as the HTTP proxy"], - ["server", "=s", "-server host : update DNS information on 'host'"], - ["protocol", "=s", "-protocol type : update protocol used"], - ["file", "=s", "-file path : load configuration information from 'path'"], - ["cache", "=s", "-cache path : record address used in 'path'"], - ["pid", "=s", "-pid path : record process id in 'path' if daemonized"], + ["proxy", "=s", "-proxy : use as the HTTP proxy"], + ["server", "=s", "-server : update DNS information on "], + ["protocol", "=s", "-protocol : update protocol used"], + ["file", "=s", "-file : load configuration information from "], + ["cache", "=s", "-cache : record address used in "], + ["pid", "=s", "-pid : record process id in if daemonized"], "", - ["use", "=s", "-use which : how the should IP address be obtained."], + ["use", "=s", "-use : how the IP address should be obtained"], &ip_strategies_usage(), "", - ["ip", "=s", "-ip address : set the IP address to 'address'"], + " Options that apply to 'use=ip':", + ["ip", "=s", "-ip
: set the IP address to
"], "", - ["if", "=s", "-if interface : obtain IP address from 'interface'"], - ["if-skip", "=s", "-if-skip pattern : skip any IP addresses before 'pattern' in the output of 'ip address show dev {if}' (or 'ifconfig {if}')"], + " Options that apply to 'use=if':", + ["if", "=s", "-if : obtain IP address from "], + ["if-skip", "=s", "-if-skip : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], "", - ["web", "=s", "-web provider|url : obtain IP address from provider's IP checking page"], - ["web-skip", "=s", "-web-skip pattern : skip any IP addresses before 'pattern' on the web provider|url"], + " Options that apply to 'use=web':", + ["web", "=s", "-web | : obtain IP address from a web-based IP discovery service, either a known or a custom "], + ["web-skip", "=s", "-web-skip : skip any IP addresses before in the text returned from the web-based IP discovery service"], "", - ["fw", "=s", "-fw address|url : obtain IP address from firewall at 'address'"], - ["fw-skip", "=s", "-fw-skip pattern : skip any IP addresses before 'pattern' on the firewall address|url"], - ["fw-login", "=s", "-fw-login login : use 'login' when getting IP from fw"], - ["fw-password", "=s", "-fw-password secret : use password 'secret' when getting IP from fw"], + " Options that apply to 'use=fw' and 'use=':", + ["fw", "=s", "-fw
| : obtain IP address from device with IP address
or URL "], + ["fw-skip", "=s", "-fw-skip : skip any IP addresses before in the text returned from the device"], + ["fw-login", "=s", "-fw-login : use when getting the IP from the device"], + ["fw-password", "=s", "-fw-password : use password when getting the IP from the device"], "", - ["cmd", "=s", "-cmd program : obtain IP address from by calling {program}"], - ["cmd-skip", "=s", "-cmd-skip pattern : skip any IP addresses before 'pattern' in the output of {cmd}"], + " Options that apply to 'use=cmd':", + ["cmd", "=s", "-cmd : obtain IP address from the output of "], + ["cmd-skip", "=s", "-cmd-skip : skip any IP addresses before in the command's output"], "", - ["login", "=s", "-login user : login as 'user'"], - ["password", "=s", "-password secret : use password 'secret'"], - ["host", "=s", "-host host : update DNS information for 'host'"], + ["login", "=s", "-login : log in to the dynamic DNS service as "], + ["password", "=s", "-password : log in to the dynamic DNS service with password "], + ["host", "=s", "-host : update DNS information for "], "", - ["options", "=s", "-options opt,opt : optional per-service arguments (see below)"], + ["options", "=s", "-options =[,=,...]\n : optional per-service arguments (see below)"], "", ["ssl", "!", "-{no}ssl : do updates over encrypted SSL connection"], - ["ssl_ca_dir", "=s", "-ssl_ca_dir : directory containing certificates of trusted certificate authorities (default: auto-detect)"], - ["ssl_ca_file", "=s", "-ssl_ca_file : file containing certificates of trusted certificate authorities (default: auto-detect)"], - ["retry", "!", "-{no}retry : retry failed updates."], + ["ssl_ca_dir", "=s", "-ssl_ca_dir : look in for certificates of trusted certificate authorities (default: auto-detect)"], + ["ssl_ca_file", "=s", "-ssl_ca_file : look at for certificates of trusted certificate authorities (default: auto-detect)"], + ["retry", "!", "-{no}retry : retry failed updates"], ["force", "!", "-{no}force : force an update even if the update may be unnecessary"], - ["timeout", "=i", "-timeout max : wait at most 'max' seconds for the host to respond"], + ["timeout", "=i", "-timeout : when fetching a URL, wait at most seconds for a response"], ["syslog", "!", "-{no}syslog : log messages to syslog"], - ["facility", "=s", "-facility {type} : log messages to syslog to facility {type}"], - ["priority", "=s", "-priority {pri} : log messages to syslog with priority {pri}"], - ["mail", "=s", "-mail address : e-mail messages to {address}"], - ["mail-failure", "=s", "-mail-failure address : e-mail messages for failed updates to {address}"], + ["facility", "=s", "-facility : log messages to syslog to facility "], + ["priority", "=s", "-priority : log messages to syslog with priority "], + ["mail", "=s", "-mail
: e-mail messages to
"], + ["mail-failure", "=s", "-mail-failure : e-mail messages for failed updates to "], ["exec", "!", "-{no}exec : do {not} execute; just show what would be done"], ["debug", "!", "-{no}debug : print {no} debugging information"], ["verbose", "!", "-{no}verbose : print {no} verbose information"], ["quiet", "!", "-{no}quiet : print {no} messages for unnecessary updates"], ["ipv6", "!", "-{no}ipv6 : use ipv6"], - ["help", "", "-help : this message"], + ["help", "", "-help : display this message and exit"], ["postscript", "", "-postscript : script to run after updating ddclient, has new IP as param"], ["query", "!", "-{no}query : print {no} ip addresses and exit"], ["fw-banlocal", "!", ""], ## deprecated