From 640a6f08d73c1cdecbbe6da76114dd719324b481 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 15 Mar 2024 13:49:51 -0700 Subject: [PATCH 1/7] Fix indentation in `--help` output --- ddclient.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ddclient.in b/ddclient.in index ba95851..955adcf 100755 --- a/ddclient.in +++ b/ddclient.in @@ -1026,9 +1026,9 @@ my @opt = ( "", ["use", "=s", "-use : deprecated, see 'usev4' and 'usev6'"], &ip_strategies_usage(), - [ "usev4", "=s", "-usev4 : how the should IPv4 address be obtained."], + ["usev4", "=s", "-usev4 : how the should IPv4 address be obtained."], &ipv4_strategies_usage(), - [ "usev6", "=s", "-usev6 : how the should IPv6 address be obtained."], + ["usev6", "=s", "-usev6 : how the should IPv6 address be obtained."], &ipv6_strategies_usage(), "", " Options that apply to 'use=ip':", @@ -1076,8 +1076,8 @@ my @opt = ( ["ssl", "!", "-{no}ssl : do updates over encrypted SSL connection"], ["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)"], - ["fw-ssl-validate", "!", "-{no}fw-ssl-validate : Validate SSL certificate when retrieving IP address from firewall"], - ["web-ssl-validate", "!","-{no}web-ssl-validate : Validate SSL certificate when retrieving IP address from web"], + ["fw-ssl-validate", "!", "-{no}fw-ssl-validate : Validate SSL certificate when retrieving IP address from firewall"], + ["web-ssl-validate", "!", "-{no}web-ssl-validate : Validate SSL certificate when retrieving IP address from web"], ["retry", "!", "-{no}retry : retry failed updates"], ["force", "!", "-{no}force : force an update even if the update may be unnecessary"], ["timeout", "=i", "-timeout : when fetching a URL, wait at most seconds for a response"], From dac72a344c78ab0a5de0a45ea94b3e5ac5c6f85a Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 15 Mar 2024 13:18:58 -0700 Subject: [PATCH 2/7] Remove unimplemented `--usev*` strategies from `--help` usage The `ciscov4`, `ciscov6`, `cisco-asav4`, and `cisco-asav6` strategies were never implemented, and it doesn't make sense to implement them because the `v4` and `v6` variants don't follow the pattern established by the `%builtinfw` strategies. The `%builtinfw` strategies were never implemented for `--usev6`. --- ddclient.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ddclient.in b/ddclient.in index 955adcf..de6856b 100755 --- a/ddclient.in +++ b/ddclient.in @@ -375,8 +375,6 @@ my %ipv4_strategies = ( 'ifv4' => ": obtain IPv4 from the -ifv4 {interface}", 'cmdv4' => ": obtain IPv4 from the -cmdv4 {external-command}", 'fwv4' => ": obtain IPv4 from the firewall specified by -fwv4 {type|address}", - 'ciscov4' => ": obtain IPv4 from Cisco FW at the -fwv4 {address}", - 'cisco-asav4' => ": obtain IPv4 from Cisco ASA at the -fwv4 {address}", map { $_ => sprintf ": obtain IPv4 from %s at the -fwv4 {address}", $builtinfw{$_}->{'name'} } keys %builtinfw, ); sub ipv4_strategies_usage { @@ -395,9 +393,6 @@ my %ipv6_strategies = ( 'cmd' => ": deprecated, use 'cmdv6'", 'cmdv6' => ": obtain IPv6 from the -cmdv6 {external-command}", 'fwv6' => ": obtain IPv6 from the firewall specified by -fwv6 {type|address}", - 'ciscov6' => ": obtain IPv6 from Cisco FW at the -fwv6 {address}", - 'cisco-asav6' => ": obtain IPv6 from Cisco ASA at the -fwv6 {address}", - map { $_ => sprintf ": obtain IPv6 from %s at the -fwv6 {address}", $builtinfw{$_}->{'name'} } keys %builtinfw, ); sub ipv6_strategies_usage { return map { sprintf(" -usev6=%-22s %s.", $_, $ipv6_strategies{$_}) } sort keys %ipv6_strategies; From 77c9cb55127e7675f8d38a65911ee65010a61db6 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 16 Mar 2024 18:34:46 -0700 Subject: [PATCH 3/7] Consistently use `<` and `>` for placeholders in `--help` usage --- ddclient.in | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ddclient.in b/ddclient.in index de6856b..eca54bb 100755 --- a/ddclient.in +++ b/ddclient.in @@ -370,12 +370,12 @@ sub ip_strategies_usage { my %ipv4_strategies = ( 'disabled' => ": do not obtain an IPv4 address for this host", - 'ipv4' => ": obtain IPv4 from -ipv4 {address}", + 'ipv4' => ": obtain IPv4 from -ipv4
", 'webv4' => ": obtain IPv4 from an IP discovery page on the web", - 'ifv4' => ": obtain IPv4 from the -ifv4 {interface}", - 'cmdv4' => ": obtain IPv4 from the -cmdv4 {external-command}", - 'fwv4' => ": obtain IPv4 from the firewall specified by -fwv4 {type|address}", - map { $_ => sprintf ": obtain IPv4 from %s at the -fwv4 {address}", $builtinfw{$_}->{'name'} } keys %builtinfw, + 'ifv4' => ": obtain IPv4 from the -ifv4 ", + 'cmdv4' => ": obtain IPv4 from the -cmdv4 ", + 'fwv4' => ": obtain IPv4 from the firewall specified by -fwv4 ", + map { $_ => sprintf ": obtain IPv4 from %s at the -fwv4
", $builtinfw{$_}->{'name'} } keys %builtinfw, ); sub ipv4_strategies_usage { return map { sprintf(" -usev4=%-22s %s.", $_, $ipv4_strategies{$_}) } sort keys %ipv4_strategies; @@ -385,14 +385,14 @@ my %ipv6_strategies = ( 'no' => ": deprecated, use 'disabled'", 'disabled' => ": do not obtain an IPv6 address for this host", 'ip' => ": deprecated, use 'ipv6'", - 'ipv6' => ": obtain IPv6 from -ipv6 {address}", + 'ipv6' => ": obtain IPv6 from -ipv6
", 'web' => ": deprecated, use 'webv6'", 'webv6' => ": obtain IPv6 from an IP discovery page on the web", 'if' => ": deprecated, use 'ifv6'", - 'ifv6' => ": obtain IPv6 from the -if {interface}", + 'ifv6' => ": obtain IPv6 from the -if ", 'cmd' => ": deprecated, use 'cmdv6'", - 'cmdv6' => ": obtain IPv6 from the -cmdv6 {external-command}", - 'fwv6' => ": obtain IPv6 from the firewall specified by -fwv6 {type|address}", + 'cmdv6' => ": obtain IPv6 from the -cmdv6 ", + 'fwv6' => ": obtain IPv6 from the firewall specified by -fwv6 ", ); sub ipv6_strategies_usage { return map { sprintf(" -usev6=%-22s %s.", $_, $ipv6_strategies{$_}) } sort keys %ipv6_strategies; @@ -3788,7 +3788,7 @@ Configuration variables applicable to the 'dyndns1' protocol are: server=fqdn.of.service ## defaults to members.dyndns.org backupmx=no|yes ## indicates that this host is the primary MX for the domain. mx=any.host.domain ## a host MX'ing for this host definition. - wildcard=no|yes ## add a DNS wildcard CNAME record that points to {host} + wildcard=no|yes ## add a DNS wildcard CNAME record that points to login=service-login ## login name and password registered with the service password=service-password ## fully.qualified.host ## the host registered with the service. @@ -3909,7 +3909,7 @@ Configuration variables applicable to the 'dyndns2' protocol are: static=no|yes ## indicates that this host has a static IP address. custom=no|yes ## indicates that this host is a 'custom' top-level domain name. mx=any.host.domain ## a host MX'ing for this host definition. - wildcard=no|yes ## add a DNS wildcard CNAME record that points to {host} + wildcard=no|yes ## add a DNS wildcard CNAME record that points to login=service-login ## login name and password registered with the service password=service-password ## fully.qualified.host ## the host registered with the service. @@ -4739,7 +4739,7 @@ Configuration variables applicable to the 'easydns' protocol are: backupmx=no|yes ## indicates that EasyDNS should be the secondary MX ## for this domain or host. mx=any.host.domain ## a host MX'ing for this host or domain. - wildcard=no|yes ## add a DNS wildcard CNAME record that points to {host} + wildcard=no|yes ## add a DNS wildcard CNAME record that points to login=service-login ## login name and password registered with the service password=service-password ## fully.qualified.host ## the host registered with the service. @@ -6714,7 +6714,7 @@ Configuration variables applicable to the 'woima' protocol are: static=no|yes ## indicates that this host has a static IP address. custom=no|yes ## indicates that this host is a 'custom' top-level domain name. mx=any.host.domain ## a host MX'ing for this host definition. - wildcard=no|yes ## add a DNS wildcard CNAME record that points to {host} + wildcard=no|yes ## add a DNS wildcard CNAME record that points to login=service-login ## login name and password registered with the service password=service-password ## fully.qualified.host ## the host registered with the service. From fc4daae0cd7b181365afd3c086d554806c1475f7 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 17 Mar 2024 13:21:03 -0700 Subject: [PATCH 4/7] Consistently use `|` in placeholders for `--help` usage --- ddclient.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ddclient.in b/ddclient.in index eca54bb..ef2ddb0 100755 --- a/ddclient.in +++ b/ddclient.in @@ -1037,20 +1037,20 @@ my @opt = ( ["ifv6", "=s", "-ifv6 : obtain IPv6 address from "], "", " Options that apply to 'use=web':", - ["web", "=s", "-web | : deprecated, use 'webv4' or 'webv6'"], + ["web", "=s", "-web : deprecated, use 'webv4' or 'webv6'"], ["web-skip", "=s", "-web-skip : deprecated, use 'webv4-skip' or 'webv6-skip'"], - ["webv4", "=s", "-webv4 |: obtain IPv4 address from a web-based IP discovery service, either a known or a custom "], + ["webv4", "=s", "-webv4 : obtain IPv4 address from a web-based IP discovery service, either a known or a custom "], ["webv4-skip", "=s", "-webv4-skip : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], - ["webv6", "=s", "-webv6 |: obtain IPv6 address from a web-based IP discovery service, either a known or a custom "], + ["webv6", "=s", "-webv6 : obtain IPv6 address from a web-based IP discovery service, either a known or a custom "], ["webv6-skip", "=s", "-webv6-skip : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], ["list-web-services", "", "-list-web-services : print a machine-readable list of web-based IP discovery services for use with 'web=' and exit. Format: one service per line, each line has the form ' '"], "", " Options that apply to 'use=fw' and 'use=':", - ["fw", "=s", "-fw
| : deprecated, use 'fwv4' or 'fwv6'"], + ["fw", "=s", "-fw : deprecated, use 'fwv4' or 'fwv6'"], ["fw-skip", "=s", "-fw-skip : deprecated, use 'fwv4-skip' or 'fwv6-skip'"], - ["fwv4", "=s", "-fwv4
| : obtain IPv4 address from device with IP address
or URL "], + ["fwv4", "=s", "-fwv4 : obtain IPv4 address from device with IP address
or URL "], ["fwv4-skip", "=s", "-fwv4-skip : skip any IP addresses before in the text returned from the device"], - ["fwv6", "=s", "-fwv6
| : obtain IPv6 address from device with IP address
or URL "], + ["fwv6", "=s", "-fwv6 : obtain IPv6 address from device with IP address
or URL "], ["fwv6-skip", "=s", "-fwv6-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"], From 6ac1ee45b0a4922fe2aadddc245e3bb7713daea2 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 17 Mar 2024 13:31:51 -0700 Subject: [PATCH 5/7] Consistently use `-arg=val` in `--help` usage --- ddclient.in | 116 ++++++++++++++++++++++++++-------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/ddclient.in b/ddclient.in index ef2ddb0..ef0c52d 100755 --- a/ddclient.in +++ b/ddclient.in @@ -370,12 +370,12 @@ sub ip_strategies_usage { my %ipv4_strategies = ( 'disabled' => ": do not obtain an IPv4 address for this host", - 'ipv4' => ": obtain IPv4 from -ipv4
", + 'ipv4' => ": obtain IPv4 from -ipv4=
", 'webv4' => ": obtain IPv4 from an IP discovery page on the web", - 'ifv4' => ": obtain IPv4 from the -ifv4 ", - 'cmdv4' => ": obtain IPv4 from the -cmdv4 ", - 'fwv4' => ": obtain IPv4 from the firewall specified by -fwv4 ", - map { $_ => sprintf ": obtain IPv4 from %s at the -fwv4
", $builtinfw{$_}->{'name'} } keys %builtinfw, + 'ifv4' => ": obtain IPv4 from the -ifv4=", + 'cmdv4' => ": obtain IPv4 from the -cmdv4=", + 'fwv4' => ": obtain IPv4 from the firewall specified by -fwv4=", + map { $_ => sprintf ": obtain IPv4 from %s at the -fwv4=
", $builtinfw{$_}->{'name'} } keys %builtinfw, ); sub ipv4_strategies_usage { return map { sprintf(" -usev4=%-22s %s.", $_, $ipv4_strategies{$_}) } sort keys %ipv4_strategies; @@ -385,14 +385,14 @@ my %ipv6_strategies = ( 'no' => ": deprecated, use 'disabled'", 'disabled' => ": do not obtain an IPv6 address for this host", 'ip' => ": deprecated, use 'ipv6'", - 'ipv6' => ": obtain IPv6 from -ipv6
", + 'ipv6' => ": obtain IPv6 from -ipv6=
", 'web' => ": deprecated, use 'webv6'", 'webv6' => ": obtain IPv6 from an IP discovery page on the web", 'if' => ": deprecated, use 'ifv6'", - 'ifv6' => ": obtain IPv6 from the -if ", + 'ifv6' => ": obtain IPv6 from the -if=", 'cmd' => ": deprecated, use 'cmdv6'", - 'cmdv6' => ": obtain IPv6 from the -cmdv6 ", - 'fwv6' => ": obtain IPv6 from the firewall specified by -fwv6 ", + 'cmdv6' => ": obtain IPv6 from the -cmdv6=", + 'fwv6' => ": obtain IPv6 from the firewall specified by -fwv6=", ); sub ipv6_strategies_usage { return map { sprintf(" -usev6=%-22s %s.", $_, $ipv6_strategies{$_}) } sort keys %ipv6_strategies; @@ -1009,79 +1009,79 @@ $opt{'list-web-services'} = sub { my @opt = ( "usage: ${program} [options]", "options are:", - ["daemon", "=s", "-daemon : run as a daemon, specify as an interval"], + ["daemon", "=s", "-daemon= : run as a daemon, specify as an interval"], ["foreground", "!", "-foreground : do not fork"], - ["proxy", "=s", "-proxy : use as the HTTP proxy"], - ["server", "=s", "-server : update DNS information on "], - ["protocol", "=s", "-protocol : update protocol used"], + ["proxy", "=s", "-proxy= : use as the HTTP proxy"], + ["server", "=s", "-server= : update DNS information on "], + ["protocol", "=s", "-protocol= : update protocol used"], ["list-protocols", "", "-list-protocols : print a machine-readable list of supported update protocols and exit. Format: one per line"], - ["file", "=s", "-file : load configuration information from "], - ["cache", "=s", "-cache : record address used in "], - ["pid", "=s", "-pid : record process id in if daemonized"], + ["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 : deprecated, see 'usev4' and 'usev6'"], + ["use", "=s", "-use= : deprecated, see 'usev4' and 'usev6'"], &ip_strategies_usage(), - ["usev4", "=s", "-usev4 : how the should IPv4 address be obtained."], + ["usev4", "=s", "-usev4= : how the should IPv4 address be obtained."], &ipv4_strategies_usage(), - ["usev6", "=s", "-usev6 : how the should IPv6 address be obtained."], + ["usev6", "=s", "-usev6= : how the should IPv6 address be obtained."], &ipv6_strategies_usage(), "", " Options that apply to 'use=ip':", - ["ip", "=s", "-ip
: deprecated, use 'ipv4' or 'ipv6'"], - ["ipv4", "=s", "-ipv4
: set the IPv4 address to
"], - ["ipv6", "=s", "-ipv6
: set the IPv6 address to
"], + ["ip", "=s", "-ip=
: deprecated, use 'ipv4' or 'ipv6'"], + ["ipv4", "=s", "-ipv4=
: set the IPv4 address to
"], + ["ipv6", "=s", "-ipv6=
: set the IPv6 address to
"], "", " Options that apply to 'use=if':", - ["if", "=s", "-if : deprecated, use 'ifv4' or 'ifv6'"], - ["ifv4", "=s", "-ifv4 : obtain IPv4 address from "], - ["ifv6", "=s", "-ifv6 : obtain IPv6 address from "], + ["if", "=s", "-if= : deprecated, use 'ifv4' or 'ifv6'"], + ["ifv4", "=s", "-ifv4= : obtain IPv4 address from "], + ["ifv6", "=s", "-ifv6= : obtain IPv6 address from "], "", " Options that apply to 'use=web':", - ["web", "=s", "-web : deprecated, use 'webv4' or 'webv6'"], - ["web-skip", "=s", "-web-skip : deprecated, use 'webv4-skip' or 'webv6-skip'"], - ["webv4", "=s", "-webv4 : obtain IPv4 address from a web-based IP discovery service, either a known or a custom "], - ["webv4-skip", "=s", "-webv4-skip : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], - ["webv6", "=s", "-webv6 : obtain IPv6 address from a web-based IP discovery service, either a known or a custom "], - ["webv6-skip", "=s", "-webv6-skip : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], + ["web", "=s", "-web= : deprecated, use 'webv4' or 'webv6'"], + ["web-skip", "=s", "-web-skip= : deprecated, use 'webv4-skip' or 'webv6-skip'"], + ["webv4", "=s", "-webv4= : obtain IPv4 address from a web-based IP discovery service, either a known or a custom "], + ["webv4-skip", "=s", "-webv4-skip= : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], + ["webv6", "=s", "-webv6= : obtain IPv6 address from a web-based IP discovery service, either a known or a custom "], + ["webv6-skip", "=s", "-webv6-skip= : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], ["list-web-services", "", "-list-web-services : print a machine-readable list of web-based IP discovery services for use with 'web=' and exit. Format: one service per line, each line has the form ' '"], "", " Options that apply to 'use=fw' and 'use=':", - ["fw", "=s", "-fw : deprecated, use 'fwv4' or 'fwv6'"], - ["fw-skip", "=s", "-fw-skip : deprecated, use 'fwv4-skip' or 'fwv6-skip'"], - ["fwv4", "=s", "-fwv4 : obtain IPv4 address from device with IP address
or URL "], - ["fwv4-skip", "=s", "-fwv4-skip : skip any IP addresses before in the text returned from the device"], - ["fwv6", "=s", "-fwv6 : obtain IPv6 address from device with IP address
or URL "], - ["fwv6-skip", "=s", "-fwv6-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"], + ["fw", "=s", "-fw= : deprecated, use 'fwv4' or 'fwv6'"], + ["fw-skip", "=s", "-fw-skip= : deprecated, use 'fwv4-skip' or 'fwv6-skip'"], + ["fwv4", "=s", "-fwv4= : obtain IPv4 address from device with IP address
or URL "], + ["fwv4-skip", "=s", "-fwv4-skip= : skip any IP addresses before in the text returned from the device"], + ["fwv6", "=s", "-fwv6= : obtain IPv6 address from device with IP address
or URL "], + ["fwv6-skip", "=s", "-fwv6-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"], ["list-devices", "", "-list-devices : print a machine-readable list of supported firewall/router devices and exit. Format: one device per line, each line has the form ' '"], "", " Options that apply to 'use=cmd':", - ["cmd", "=s", "-cmd : deprecated, use 'cmdv4' or 'cmdv6'"], - ["cmd-skip", "=s", "-cmd-skip : deprecated, filter in program wrapper script"], - ["cmdv4", "=s", "-cmdv4 : obtain IPv4 address from the output of "], - ["cmdv6", "=s", "-cmdv6 : obtain IPv6 address from the output of "], + ["cmd", "=s", "-cmd= : deprecated, use 'cmdv4' or 'cmdv6'"], + ["cmd-skip", "=s", "-cmd-skip= : deprecated, filter in program wrapper script"], + ["cmdv4", "=s", "-cmdv4= : obtain IPv4 address from the output of "], + ["cmdv6", "=s", "-cmdv6= : obtain IPv6 address from the output of "], "", - ["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 "], + ["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 =[,=,...]\n : 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 : 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)"], + ["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)"], ["fw-ssl-validate", "!", "-{no}fw-ssl-validate : Validate SSL certificate when retrieving IP address from firewall"], ["web-ssl-validate", "!", "-{no}web-ssl-validate : Validate SSL certificate when retrieving IP address from web"], ["retry", "!", "-{no}retry : retry failed updates"], ["force", "!", "-{no}force : force an update even if the update may be unnecessary"], - ["timeout", "=i", "-timeout : when fetching a URL, wait at most seconds for a response"], + ["timeout", "=i", "-timeout= : when fetching a URL, wait at most seconds for a response"], ["syslog", "!", "-{no}syslog : log messages to syslog"], - ["facility", "=s", "-facility : log messages to syslog to facility "], - ["priority", "=s", "-priority : log messages to syslog with priority "], - ["max-warn", "=i", "-max-warn : log at most warning messages for undefined IP address"], - ["mail", "=s", "-mail
: e-mail messages to
"], - ["mail-failure", "=s", "-mail-failure : e-mail messages for failed updates to "], + ["facility", "=s", "-facility= : log messages to syslog to facility "], + ["priority", "=s", "-priority= : log messages to syslog with priority "], + ["max-warn", "=i", "-max-warn= : log at most warning messages for undefined IP address"], + ["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"], @@ -1094,7 +1094,7 @@ my @opt = ( ["if-skip", "=s", ""], ## deprecated ["test", "!", ""], ## hidden ["geturl", "=s", ""], ## hidden - ["redirect", "=i", "-redirect : enable and follow at most HTTP 30x redirections"], + ["redirect", "=i", "-redirect= : enable and follow at most HTTP 30x redirections"], "", nic_examples(), # Note: These lines are copied below to the -version argument implementation @@ -1170,10 +1170,10 @@ sub main { read_cache(opt('cache'), \%cache); print_info() if opt('debug') && opt('verbose'); - fatal("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')}; if (defined($opt{'usev6'})) { - usage("invalid argument '-usev6 %s'; possible values are:\n%s", $opt{'usev6'}, join("\n",ipv6_strategies_usage())) + usage("invalid argument '-usev6=%s'; possible values are:\n%s", $opt{'usev6'}, join("\n",ipv6_strategies_usage())) unless exists $ipv6_strategies{lc opt('usev6')}; } From 09b42a78bdb07e6c204b9e003718391d231e20dc Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 17 Mar 2024 14:09:24 -0700 Subject: [PATCH 6/7] Use `--arg` instead of `-arg` or `arg` in `--help` usage `--arg` is preferred over `-arg` because the broader convention is to use double hyphens for long option names. Perl accepts either. `--arg` is preferred over `arg` to avoid confusion between `--use=ip` and `--ip` and similar option pairs. --- ddclient.in | 244 ++++++++++++++++++++++++++-------------------------- 1 file changed, 122 insertions(+), 122 deletions(-) diff --git a/ddclient.in b/ddclient.in index ef0c52d..0896fed 100755 --- a/ddclient.in +++ b/ddclient.in @@ -350,52 +350,52 @@ my %builtinfw = ( ); my %ip_strategies = ( - 'no' => ": deprecated, see 'usev4' and 'usev6'", - 'ip' => ": deprecated, see 'usev4' and 'usev6'", - 'web' => ": deprecated, see 'usev4' and 'usev6'", - 'fw' => ": deprecated, see 'usev4' and 'usev6'", - 'if' => ": deprecated, see 'usev4' and 'usev6'", - 'cmd' => ": deprecated, see 'usev4' and 'usev6'", - 'cisco' => ": deprecated, see 'usev4' and 'usev6'", - 'cisco-asa' => ": deprecated, see 'usev4' and 'usev6'", - map({ $_ => sprintf(": Built-in firewall %s deprecated, see 'usev4' and 'usev6'", + 'no' => ": deprecated, see '--usev4' and '--usev6'", + 'ip' => ": deprecated, see '--usev4' and '--usev6'", + 'web' => ": deprecated, see '--usev4' and '--usev6'", + 'fw' => ": deprecated, see '--usev4' and '--usev6'", + 'if' => ": deprecated, see '--usev4' and '--usev6'", + 'cmd' => ": deprecated, see '--usev4' and '--usev6'", + 'cisco' => ": deprecated, see '--usev4' and '--usev6'", + 'cisco-asa' => ": deprecated, see '--usev4' and '--usev6'", + map({ $_ => sprintf(": Built-in firewall %s deprecated, see '--usev4' and '--usev6'", $builtinfw{$_}->{'name'}) } keys(%builtinfw)), ); sub ip_strategies_usage { - return map({ sprintf(" -use=%-22s %s.", $_, $ip_strategies{$_}) } + return map({ sprintf(" --use=%-22s %s.", $_, $ip_strategies{$_}) } ('ip', 'web', 'if', 'cmd', 'fw', sort('cisco', 'cisco-asa', keys(%builtinfw)))); } my %ipv4_strategies = ( 'disabled' => ": do not obtain an IPv4 address for this host", - 'ipv4' => ": obtain IPv4 from -ipv4=
", + 'ipv4' => ": obtain IPv4 from --ipv4=
", 'webv4' => ": obtain IPv4 from an IP discovery page on the web", - 'ifv4' => ": obtain IPv4 from the -ifv4=", - 'cmdv4' => ": obtain IPv4 from the -cmdv4=", - 'fwv4' => ": obtain IPv4 from the firewall specified by -fwv4=", - map { $_ => sprintf ": obtain IPv4 from %s at the -fwv4=
", $builtinfw{$_}->{'name'} } keys %builtinfw, + 'ifv4' => ": obtain IPv4 from the --ifv4=", + 'cmdv4' => ": obtain IPv4 from the --cmdv4=", + 'fwv4' => ": obtain IPv4 from the firewall specified by --fwv4=", + map { $_ => sprintf ": obtain IPv4 from %s at the --fwv4=
", $builtinfw{$_}->{'name'} } keys %builtinfw, ); sub ipv4_strategies_usage { - return map { sprintf(" -usev4=%-22s %s.", $_, $ipv4_strategies{$_}) } sort keys %ipv4_strategies; + return map { sprintf(" --usev4=%-22s %s.", $_, $ipv4_strategies{$_}) } sort keys %ipv4_strategies; } my %ipv6_strategies = ( - 'no' => ": deprecated, use 'disabled'", + 'no' => ": deprecated, use '--usev6=disabled'", 'disabled' => ": do not obtain an IPv6 address for this host", - 'ip' => ": deprecated, use 'ipv6'", - 'ipv6' => ": obtain IPv6 from -ipv6=
", - 'web' => ": deprecated, use 'webv6'", + 'ip' => ": deprecated, use '--usev6=ipv6'", + 'ipv6' => ": obtain IPv6 from --ipv6=
", + 'web' => ": deprecated, use '--usev6=webv6'", 'webv6' => ": obtain IPv6 from an IP discovery page on the web", - 'if' => ": deprecated, use 'ifv6'", - 'ifv6' => ": obtain IPv6 from the -if=", - 'cmd' => ": deprecated, use 'cmdv6'", - 'cmdv6' => ": obtain IPv6 from the -cmdv6=", - 'fwv6' => ": obtain IPv6 from the firewall specified by -fwv6=", + 'if' => ": deprecated, use '--usev6=ifv6'", + 'ifv6' => ": obtain IPv6 from the --if=", + 'cmd' => ": deprecated, use '--usev6=cmdv6'", + 'cmdv6' => ": obtain IPv6 from the --cmdv6=", + 'fwv6' => ": obtain IPv6 from the firewall specified by --fwv6=", ); sub ipv6_strategies_usage { - return map { sprintf(" -usev6=%-22s %s.", $_, $ipv6_strategies{$_}) } sort keys %ipv6_strategies; + return map { sprintf(" --usev6=%-22s %s.", $_, $ipv6_strategies{$_}) } sort keys %ipv6_strategies; } sub setv { @@ -1009,92 +1009,92 @@ $opt{'list-web-services'} = sub { my @opt = ( "usage: ${program} [options]", "options are:", - ["daemon", "=s", "-daemon= : run as a daemon, specify as an interval"], - ["foreground", "!", "-foreground : do not fork"], - ["proxy", "=s", "-proxy= : use as the HTTP proxy"], - ["server", "=s", "-server= : update DNS information on "], - ["protocol", "=s", "-protocol= : update protocol used"], - ["list-protocols", "", "-list-protocols : print a machine-readable list of supported update protocols and exit. Format: one per line"], - ["file", "=s", "-file= : load configuration information from "], - ["cache", "=s", "-cache= : record address used in "], - ["pid", "=s", "-pid= : record process id in if daemonized"], + ["daemon", "=s", "--daemon= : run as a daemon, specify as an interval"], + ["foreground", "!", "--foreground : do not fork"], + ["proxy", "=s", "--proxy= : use as the HTTP proxy"], + ["server", "=s", "--server= : update DNS information on "], + ["protocol", "=s", "--protocol= : update protocol used"], + ["list-protocols", "", "--list-protocols : print a machine-readable list of supported update protocols and exit. Format: one per line"], + ["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= : deprecated, see 'usev4' and 'usev6'"], + ["use", "=s", "--use= : deprecated, see '--usev4' and '--usev6'"], &ip_strategies_usage(), - ["usev4", "=s", "-usev4= : how the should IPv4 address be obtained."], + ["usev4", "=s", "--usev4= : how the should IPv4 address be obtained."], &ipv4_strategies_usage(), - ["usev6", "=s", "-usev6= : how the should IPv6 address be obtained."], + ["usev6", "=s", "--usev6= : how the should IPv6 address be obtained."], &ipv6_strategies_usage(), "", - " Options that apply to 'use=ip':", - ["ip", "=s", "-ip=
: deprecated, use 'ipv4' or 'ipv6'"], - ["ipv4", "=s", "-ipv4=
: set the IPv4 address to
"], - ["ipv6", "=s", "-ipv6=
: set the IPv6 address to
"], + " Options that apply to '--use=ip':", + ["ip", "=s", "--ip=
: deprecated, use '--ipv4' or '--ipv6'"], + ["ipv4", "=s", "--ipv4=
: set the IPv4 address to
"], + ["ipv6", "=s", "--ipv6=
: set the IPv6 address to
"], "", - " Options that apply to 'use=if':", - ["if", "=s", "-if= : deprecated, use 'ifv4' or 'ifv6'"], - ["ifv4", "=s", "-ifv4= : obtain IPv4 address from "], - ["ifv6", "=s", "-ifv6= : obtain IPv6 address from "], + " Options that apply to '--use=if':", + ["if", "=s", "--if= : deprecated, use '--ifv4' or '--ifv6'"], + ["ifv4", "=s", "--ifv4= : obtain IPv4 address from "], + ["ifv6", "=s", "--ifv6= : obtain IPv6 address from "], "", - " Options that apply to 'use=web':", - ["web", "=s", "-web= : deprecated, use 'webv4' or 'webv6'"], - ["web-skip", "=s", "-web-skip= : deprecated, use 'webv4-skip' or 'webv6-skip'"], - ["webv4", "=s", "-webv4= : obtain IPv4 address from a web-based IP discovery service, either a known or a custom "], - ["webv4-skip", "=s", "-webv4-skip= : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], - ["webv6", "=s", "-webv6= : obtain IPv6 address from a web-based IP discovery service, either a known or a custom "], - ["webv6-skip", "=s", "-webv6-skip= : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], - ["list-web-services", "", "-list-web-services : print a machine-readable list of web-based IP discovery services for use with 'web=' and exit. Format: one service per line, each line has the form ' '"], + " Options that apply to '--use=web':", + ["web", "=s", "--web= : deprecated, use '--webv4' or '--webv6'"], + ["web-skip", "=s", "--web-skip= : deprecated, use '--webv4-skip' or '--webv6-skip'"], + ["webv4", "=s", "--webv4= : obtain IPv4 address from a web-based IP discovery service, either a known or a custom "], + ["webv4-skip", "=s", "--webv4-skip= : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], + ["webv6", "=s", "--webv6= : obtain IPv6 address from a web-based IP discovery service, either a known or a custom "], + ["webv6-skip", "=s", "--webv6-skip= : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], + ["list-web-services", "", "--list-web-services : print a machine-readable list of web-based IP discovery services for use with 'web=' and exit. Format: one service per line, each line has the form ' '"], "", - " Options that apply to 'use=fw' and 'use=':", - ["fw", "=s", "-fw= : deprecated, use 'fwv4' or 'fwv6'"], - ["fw-skip", "=s", "-fw-skip= : deprecated, use 'fwv4-skip' or 'fwv6-skip'"], - ["fwv4", "=s", "-fwv4= : obtain IPv4 address from device with IP address
or URL "], - ["fwv4-skip", "=s", "-fwv4-skip= : skip any IP addresses before in the text returned from the device"], - ["fwv6", "=s", "-fwv6= : obtain IPv6 address from device with IP address
or URL "], - ["fwv6-skip", "=s", "-fwv6-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"], - ["list-devices", "", "-list-devices : print a machine-readable list of supported firewall/router devices and exit. Format: one device per line, each line has the form ' '"], + " Options that apply to '--use=fw' and '--use=':", + ["fw", "=s", "--fw= : deprecated, use '--fwv4' or '--fwv6'"], + ["fw-skip", "=s", "--fw-skip= : deprecated, use '--fwv4-skip' or '--fwv6-skip'"], + ["fwv4", "=s", "--fwv4= : obtain IPv4 address from device with IP address
or URL "], + ["fwv4-skip", "=s", "--fwv4-skip= : skip any IP addresses before in the text returned from the device"], + ["fwv6", "=s", "--fwv6= : obtain IPv6 address from device with IP address
or URL "], + ["fwv6-skip", "=s", "--fwv6-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"], + ["list-devices", "", "--list-devices : print a machine-readable list of supported firewall/router devices and exit. Format: one device per line, each line has the form ' '"], "", - " Options that apply to 'use=cmd':", - ["cmd", "=s", "-cmd= : deprecated, use 'cmdv4' or 'cmdv6'"], - ["cmd-skip", "=s", "-cmd-skip= : deprecated, filter in program wrapper script"], - ["cmdv4", "=s", "-cmdv4= : obtain IPv4 address from the output of "], - ["cmdv6", "=s", "-cmdv6= : obtain IPv6 address from the output of "], + " Options that apply to '--use=cmd':", + ["cmd", "=s", "--cmd= : deprecated, use '--cmdv4' or '--cmdv6'"], + ["cmd-skip", "=s", "--cmd-skip= : deprecated, filter in program wrapper script"], + ["cmdv4", "=s", "--cmdv4= : obtain IPv4 address from the output of "], + ["cmdv6", "=s", "--cmdv6= : obtain IPv6 address from the output of "], "", - ["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 "], + ["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==[,=,...]\n : 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= : 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)"], - ["fw-ssl-validate", "!", "-{no}fw-ssl-validate : Validate SSL certificate when retrieving IP address from firewall"], - ["web-ssl-validate", "!", "-{no}web-ssl-validate : Validate SSL certificate when retrieving IP address from web"], - ["retry", "!", "-{no}retry : retry failed updates"], - ["force", "!", "-{no}force : force an update even if the update may be unnecessary"], - ["timeout", "=i", "-timeout= : when fetching a URL, wait at most seconds for a response"], - ["syslog", "!", "-{no}syslog : log messages to syslog"], - ["facility", "=s", "-facility= : log messages to syslog to facility "], - ["priority", "=s", "-priority= : log messages to syslog with priority "], - ["max-warn", "=i", "-max-warn= : log at most warning messages for undefined IP address"], - ["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"], - ["help", "", "-help : display this message and exit"], - ["version", "", "-version : display version information and exit"], - ["postscript", "", "-postscript : script to run after updating ddclient, has new IP as param"], - ["query", "!", "-{no}query : print {no} ip addresses and exit"], + ["ssl", "!", "--{no}ssl : do updates over encrypted SSL connection"], + ["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)"], + ["fw-ssl-validate", "!", "--{no}fw-ssl-validate : Validate SSL certificate when retrieving IP address from firewall"], + ["web-ssl-validate", "!", "--{no}web-ssl-validate : Validate SSL certificate when retrieving IP address from web"], + ["retry", "!", "--{no}retry : retry failed updates"], + ["force", "!", "--{no}force : force an update even if the update may be unnecessary"], + ["timeout", "=i", "--timeout= : when fetching a URL, wait at most seconds for a response"], + ["syslog", "!", "--{no}syslog : log messages to syslog"], + ["facility", "=s", "--facility= : log messages to syslog to facility "], + ["priority", "=s", "--priority= : log messages to syslog with priority "], + ["max-warn", "=i", "--max-warn= : log at most warning messages for undefined IP address"], + ["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"], + ["help", "", "--help : display this message and exit"], + ["version", "", "--version : display version information 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 ["if-skip", "=s", ""], ## deprecated ["test", "!", ""], ## hidden ["geturl", "=s", ""], ## hidden - ["redirect", "=i", "-redirect= : enable and follow at most HTTP 30x redirections"], + ["redirect", "=i", "--redirect= : enable and follow at most HTTP 30x redirections"], "", nic_examples(), # Note: These lines are copied below to the -version argument implementation @@ -1170,10 +1170,10 @@ sub main { read_cache(opt('cache'), \%cache); print_info() if opt('debug') && opt('verbose'); - fatal("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')}; if (defined($opt{'usev6'})) { - usage("invalid argument '-usev6=%s'; possible values are:\n%s", $opt{'usev6'}, join("\n",ipv6_strategies_usage())) + usage("invalid argument '--usev6=%s'; possible values are:\n%s", $opt{'usev6'}, join("\n",ipv6_strategies_usage())) unless exists $ipv6_strategies{lc opt('usev6')}; } @@ -1305,7 +1305,7 @@ sub update_nics { # And if it is valid, remember it... $ipv4list{$usev4}{$arg_ipv4}{$arg_fwv4}{$arg_ifv4}{$arg_webv4}{$arg_cmdv4} = $ipv4; } else { - warning("%s: unable to determine IPv4 address with strategy usev4=%s", $h, $usev4) + warning("$h: unable to determine IPv4 address with strategy '--usev4=$usev4'") if !$daemon || opt('verbose'); } } @@ -1324,7 +1324,7 @@ sub update_nics { # And if it is valid, remember it... $ipv6list{$usev6}{$arg_ipv6}{$arg_fwv6}{$arg_ifv6}{$arg_webv6}{$arg_cmdv6} = $ipv6; } else { - warning("%s: unable to determine IPv6 address with strategy usev6=%s", $h, $usev6) + warning("$h: unable to determine IPv6 address with strategy '--usev6=$usev6'") if !$daemon || opt('verbose'); } } @@ -1357,9 +1357,9 @@ sub update_nics { &$update(@hosts); # Backwards compatibility: - # The legacy 'use' parameter sets 'wantip' and the legacy providers process this and + # The legacy '--use' parameter sets 'wantip' and the legacy providers process this and # set 'ip', 'status' accordingly. - # The new 'usev*' parameters set 'wantipv*' and the new providers set 'ipv*' and 'status-ipv*'. + # The new '--usev*' parameters set 'wantipv*' and the new providers set 'ipv*' and 'status-ipv*'. # To allow gradual transition, we make sure both the old 'status' and 'ip' are being set # accordingly to what new providers returned in the new 'status-ipv*' and 'ipv*' fields respectively. foreach my $h (@hosts) { @@ -3162,12 +3162,12 @@ sub get_ipv4 { } elsif ($usev4 eq 'ifv4') { ## Obtain IPv4 address from interface mamed in "ifv4=" - warning("'if-skip' is deprecated and does nothing for IPv4") if (opt('verbose') && opt('if-skip', $h)); + warning("'--if-skip' is deprecated and does nothing for IPv4") if (opt('verbose') && opt('if-skip', $h)); $ipv4 = get_ip_from_interface($arg,4); } elsif ($usev4 eq 'cmdv4') { ## Obtain IPv4 address by executing the command in "cmdv4=" - warning("'cmd-skip' is deprecated and does nothing for IPv4") if (opt('verbose') && opt('cmd-skip', $h)); + warning("'--cmd-skip' is deprecated and does nothing for IPv4") if (opt('verbose') && opt('cmd-skip', $h)); if ($arg) { my $sys_cmd = quotemeta($arg); $reply = qx{$sys_cmd}; @@ -3197,9 +3197,9 @@ sub get_ipv4 { # Stuff added to support Cisco router ip http or ASA https daemon # User fw-login should only have level 1 access to prevent # password theft. This is pretty harmless. - warning("'if' does nothing for IPv4. Use 'ifv4'") if (opt('if', $h)); - warning("'fw' does nothing for IPv4. Use 'fwv4'") if (opt('fw', $h)); - warning("'fw-skip' does nothing for IPv4. Use 'fwv4-skip'") if (opt('fw-skip', $h)); + warning("'--if' does nothing for IPv4. Use '--ifv4'") if (opt('if', $h)); + warning("'--fw' does nothing for IPv4. Use '--fwv4'") if (opt('fw', $h)); + warning("'--fw-skip' does nothing for IPv4. Use '--fwv4-skip'") if (opt('fw-skip', $h)); my $queryif = opt('ifv4', $h) // opt('if', $h); $skip = opt('fwv4-skip', $h) // opt('fw-skip', $h) // ''; # Convert slashes to protected value "\/" @@ -3226,8 +3226,8 @@ sub get_ipv4 { $reply = ''; } else { - warning("'fw' does nothing for IPv4. Use 'fwv4'") if (opt('fw', $h)); - warning("'fw-skip' does nothing for IPv4. Use 'fwv4-skip'") if (opt('fw-skip', $h)); + warning("'--fw' does nothing for IPv4. Use '--fwv4'") if (opt('fw', $h)); + warning("'--fw-skip' does nothing for IPv4. Use '--fwv4-skip'") if (opt('fw-skip', $h)); $url = opt('fwv4', $h) // opt('fw', $h) // ''; $skip = opt('fwv4-skip', $h) // opt('fw-skip', $h) // ''; @@ -3279,7 +3279,7 @@ sub get_ipv6 { if ($usev6 eq 'ipv6' || $usev6 eq 'ip') { ## Static IPv6 address is provided in "ipv6=
" if ($usev6 eq 'ip') { - warning("'usev6=ip' is deprecated. Use 'usev6=ipv6'"); + warning("'--usev6=ip' is deprecated. Use '--usev6=ipv6'"); $usev6 = 'ipv6'; ## If there is a value for ipv6= use that, else use value for ip= $arg = opt($usev6, $h) // $arg; @@ -3294,23 +3294,23 @@ sub get_ipv6 { } elsif ($usev6 eq 'ifv6' || $usev6 eq 'if' ) { ## Obtain IPv6 address from interface mamed in "ifv6=" if ($usev6 eq 'if') { - warning("'usev6=if' is deprecated. Use 'usev6=ifv6'"); + warning("'--usev6=if' is deprecated. Use '--usev6=ifv6'"); $usev6 = 'ifv6'; ## If there is a value for ifv6= use that, else use value for if= $arg = opt($usev6, $h) // $arg; } - warning("'if-skip' is deprecated and does nothing for IPv6") if (opt('verbose') && opt('if-skip', $h)); + warning("'--if-skip' is deprecated and does nothing for IPv6") if (opt('verbose') && opt('if-skip', $h)); $ipv6 = get_ip_from_interface($arg,6); } elsif ($usev6 eq 'cmdv6' || $usev6 eq 'cmd') { ## Obtain IPv6 address by executing the command in "cmdv6=" if ($usev6 eq 'cmd') { - warning("'usev6=cmd' is deprecated. Use 'usev6=cmdv6'"); + warning("'--usev6=cmd' is deprecated. Use '--usev6=cmdv6'"); $usev6 = 'cmdv6'; ## If there is a value for cmdv6= use that, else use value for cmd= $arg = opt($usev6, $h) // $arg; } - warning("'cmd-skip' is deprecated and does nothing for IPv6") if (opt('verbose') && opt('cmd-skip', $h)); + warning("'--cmd-skip' is deprecated and does nothing for IPv6") if (opt('verbose') && opt('cmd-skip', $h)); if ($arg) { my $sys_cmd = quotemeta($arg); $reply = qx{$sys_cmd}; @@ -3320,12 +3320,12 @@ sub get_ipv6 { } elsif ($usev6 eq 'webv6' || $usev6 eq 'web') { ## Obtain IPv6 address by accessing website at url in "webv6=" if ($usev6 eq 'web') { - warning("'usev6=web' is deprecated. Use 'usev6=webv6'"); + warning("'--usev6=web' is deprecated. Use '--usev6=webv6'"); $usev6 = 'webv6'; ## If there is a value for webv6= use that, else use value for web= $arg = opt($usev6, $h) // $arg; } - warning("'web-skip' does nothing for IPv6. Use 'webv6-skip'") if (opt('web-skip', $h)); + warning("'--web-skip' does nothing for IPv6. Use '--webv6-skip'") if (opt('web-skip', $h)); $url = $arg; $skip = opt('webv6-skip', $h) // ''; if (exists $builtinweb{$url}) { @@ -3345,16 +3345,16 @@ sub get_ipv6 { } } elsif ($usev6 eq 'cisco' || $usev6 eq 'cisco-asa') { - warning("'usev6=cisco' and 'usev6=cisco-asa' are not implemented and do nothing"); + warning("'--usev6=cisco' and '--usev6=cisco-asa' are not implemented and do nothing"); $reply = ''; } elsif ($usev6 eq 'disabled') { ## This is a no-op... Do not get an IPv6 address for this host/service - warning("'usev6=no' is deprecated. Use 'usev6=disabled'") if ($usev6 eq 'no'); + warning("'--usev6=no' is deprecated. Use '--usev6=disabled'") if ($usev6 eq 'no'); $reply = ''; } else { - warning("'usev6=%s' is not implemented and does nothing", $usev6); + warning("'--usev6=%s' is not implemented and does nothing", $usev6); $reply = ''; } @@ -3548,7 +3548,7 @@ sub nic_updateable { } elsif ( ($use ne 'disabled') && ((!exists($cache{$host}{'ip'})) || ("$cache{$host}{'ip'}" ne "$ip"))) { - ## Check whether to update IP address for the "use" method" + ## Check whether to update IP address for the "--use" method" if (($cache{$host}{'status'} eq 'good') && !interval_expired($host, 'mtime', 'min-interval')) { @@ -3593,7 +3593,7 @@ sub nic_updateable { } elsif ( ($usev4 ne 'disabled') && ((!exists($cache{$host}{'ipv4'})) || ("$cache{$host}{'ipv4'}" ne "$ipv4"))) { - ## Check whether to update IPv4 address for the "usev4" method" + ## Check whether to update IPv4 address for the "--usev4" method" if (($cache{$host}{'status-ipv4'} eq 'good') && !interval_expired($host, 'mtime', 'min-interval')) { @@ -3638,7 +3638,7 @@ sub nic_updateable { } elsif ( ($usev6 ne 'disabled') && ((!exists($cache{$host}{'ipv6'})) || ("$cache{$host}{'ipv6'}" ne "$ipv6"))) { - ## Check whether to update IPv6 address for the "usev6" method" + ## Check whether to update IPv6 address for the "--usev6" method" if (($cache{$host}{'status-ipv6'} eq 'good') && !interval_expired($host, 'mtime', 'min-interval')) { From 908b7285032fc7b969430de9b766eaf1e9719d56 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 17 Mar 2024 01:00:36 -0700 Subject: [PATCH 7/7] Refine `--help` usage for `--use*` strategies --- ddclient.in | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/ddclient.in b/ddclient.in index 0896fed..55bef67 100755 --- a/ddclient.in +++ b/ddclient.in @@ -358,9 +358,7 @@ my %ip_strategies = ( 'cmd' => ": deprecated, see '--usev4' and '--usev6'", 'cisco' => ": deprecated, see '--usev4' and '--usev6'", 'cisco-asa' => ": deprecated, see '--usev4' and '--usev6'", - map({ $_ => sprintf(": Built-in firewall %s deprecated, see '--usev4' and '--usev6'", - $builtinfw{$_}->{'name'}) } - keys(%builtinfw)), + map({ $_ => ": deprecated, see '--usev4' and '--usev6'"; } keys(%builtinfw)), ); sub ip_strategies_usage { @@ -370,12 +368,15 @@ sub ip_strategies_usage { my %ipv4_strategies = ( 'disabled' => ": do not obtain an IPv4 address for this host", - 'ipv4' => ": obtain IPv4 from --ipv4=
", + 'ipv4' => ": obtain IPv4 from the address given by --ipv4=
", 'webv4' => ": obtain IPv4 from an IP discovery page on the web", - 'ifv4' => ": obtain IPv4 from the --ifv4=", - 'cmdv4' => ": obtain IPv4 from the --cmdv4=", - 'fwv4' => ": obtain IPv4 from the firewall specified by --fwv4=", - map { $_ => sprintf ": obtain IPv4 from %s at the --fwv4=
", $builtinfw{$_}->{'name'} } keys %builtinfw, + 'ifv4' => ": obtain IPv4 from the interface given by --ifv4=", + 'cmdv4' => ": obtain IPv4 from the command given by --cmdv4=", + 'fwv4' => ": obtain IPv4 from the URL given by --fwv4=", + map({ + my $fw = $builtinfw{$_}; + $_ => ": obtain IPv4 from $fw->{'name'} at the host or URL given by --fwv4="; + } keys(%builtinfw)), ); sub ipv4_strategies_usage { return map { sprintf(" --usev4=%-22s %s.", $_, $ipv4_strategies{$_}) } sort keys %ipv4_strategies; @@ -385,14 +386,14 @@ my %ipv6_strategies = ( 'no' => ": deprecated, use '--usev6=disabled'", 'disabled' => ": do not obtain an IPv6 address for this host", 'ip' => ": deprecated, use '--usev6=ipv6'", - 'ipv6' => ": obtain IPv6 from --ipv6=
", + 'ipv6' => ": obtain IPv6 from the address given by --ipv6=
", 'web' => ": deprecated, use '--usev6=webv6'", 'webv6' => ": obtain IPv6 from an IP discovery page on the web", 'if' => ": deprecated, use '--usev6=ifv6'", - 'ifv6' => ": obtain IPv6 from the --if=", + 'ifv6' => ": obtain IPv6 from the interface given by --ifv6=", 'cmd' => ": deprecated, use '--usev6=cmdv6'", - 'cmdv6' => ": obtain IPv6 from the --cmdv6=", - 'fwv6' => ": obtain IPv6 from the firewall specified by --fwv6=", + 'cmdv6' => ": obtain IPv6 from the command given by --cmdv6=", + 'fwv6' => ": obtain IPv6 from the URL given by --fwv6=", ); sub ipv6_strategies_usage { return map { sprintf(" --usev6=%-22s %s.", $_, $ipv6_strategies{$_}) } sort keys %ipv6_strategies; @@ -1021,22 +1022,22 @@ my @opt = ( "", ["use", "=s", "--use= : deprecated, see '--usev4' and '--usev6'"], &ip_strategies_usage(), - ["usev4", "=s", "--usev4= : how the should IPv4 address be obtained."], + ["usev4", "=s", "--usev4= : how the IPv4 address should be obtained"], &ipv4_strategies_usage(), - ["usev6", "=s", "--usev6= : how the should IPv6 address be obtained."], + ["usev6", "=s", "--usev6= : how the IPv6 address should be obtained"], &ipv6_strategies_usage(), "", - " Options that apply to '--use=ip':", + " Options related to '--use=ip', '--usev4=ipv4', '--usev6=ipv6', and '--usev6=ip':", ["ip", "=s", "--ip=
: deprecated, use '--ipv4' or '--ipv6'"], ["ipv4", "=s", "--ipv4=
: set the IPv4 address to
"], ["ipv6", "=s", "--ipv6=
: set the IPv6 address to
"], "", - " Options that apply to '--use=if':", + " Options related to '--use=if', '--usev4=ifv4', '--usev6=ifv6', and '--usev6=if':", ["if", "=s", "--if= : deprecated, use '--ifv4' or '--ifv6'"], ["ifv4", "=s", "--ifv4= : obtain IPv4 address from "], ["ifv6", "=s", "--ifv6= : obtain IPv6 address from "], "", - " Options that apply to '--use=web':", + " Options related to '--use=web', '--usev4=webv4', '--usev6=webv6', and '--usev6=web':", ["web", "=s", "--web= : deprecated, use '--webv4' or '--webv6'"], ["web-skip", "=s", "--web-skip= : deprecated, use '--webv4-skip' or '--webv6-skip'"], ["webv4", "=s", "--webv4= : obtain IPv4 address from a web-based IP discovery service, either a known or a custom "], @@ -1045,8 +1046,8 @@ my @opt = ( ["webv6-skip", "=s", "--webv6-skip= : skip any IP addresses before in the output of 'ip address show dev ' (or 'ifconfig ')"], ["list-web-services", "", "--list-web-services : print a machine-readable list of web-based IP discovery services for use with 'web=' and exit. Format: one service per line, each line has the form ' '"], "", - " Options that apply to '--use=fw' and '--use=':", - ["fw", "=s", "--fw= : deprecated, use '--fwv4' or '--fwv6'"], + " Options related to '--use=fw', '--usev4=fwv4', '--usev6=fwv6', and '--usev6=fw'", + " as well as '--use=', '--usev4=', and '--usev6=':", ["fw-skip", "=s", "--fw-skip= : deprecated, use '--fwv4-skip' or '--fwv6-skip'"], ["fwv4", "=s", "--fwv4= : obtain IPv4 address from device with IP address
or URL "], ["fwv4-skip", "=s", "--fwv4-skip= : skip any IP addresses before in the text returned from the device"], @@ -1056,7 +1057,7 @@ my @opt = ( ["fw-password", "=s", "--fw-password= : use password when getting the IP from the device"], ["list-devices", "", "--list-devices : print a machine-readable list of supported firewall/router devices and exit. Format: one device per line, each line has the form ' '"], "", - " Options that apply to '--use=cmd':", + " Options related to '--use=cmd', '--usev4=cmdv4', '--usev6=cmdv6', and '--usev6=cmd':", ["cmd", "=s", "--cmd= : deprecated, use '--cmdv4' or '--cmdv6'"], ["cmd-skip", "=s", "--cmd-skip= : deprecated, filter in program wrapper script"], ["cmdv4", "=s", "--cmdv4= : obtain IPv4 address from the output of "],