From 2682aa5fc9f2120e8e6e3e7e1d6095e27f8cbe54 Mon Sep 17 00:00:00 2001 From: Nelson Araujo Date: Mon, 19 Jan 2015 10:00:24 -0800 Subject: [PATCH] Cleanup of ddclient source. --- ddclient | 92 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/ddclient b/ddclient index 7435aaf..b831280 100755 --- a/ddclient +++ b/ddclient @@ -456,7 +456,10 @@ my %services = ( 'updateable' => \&nic_dyndns2_updateable, 'update' => \&nic_dyndns1_update, 'examples' => \&nic_dyndns1_examples, - 'variables' => merge( $variables{'dyndns-common-defaults'}, $variables{'service-common-defaults'}, ), + 'variables' => merge( + $variables{'dyndns-common-defaults'}, + $variables{'service-common-defaults'}, + ), }, 'dyndns2' => { 'updateable' => \&nic_dyndns2_updateable, @@ -476,7 +479,9 @@ my %services = ( 'update' => \&nic_noip_update, 'examples' => \&nic_noip_examples, 'variables' => merge( - { 'custom' => setv( T_BOOL, 0, 1, 1, 0, undef ), }, $variables{'noip-common-defaults'}, $variables{'noip-service-common-defaults'}, + { 'custom' => setv( T_BOOL, 0, 1, 1, 0, undef ), }, + $variables{'noip-common-defaults'}, + $variables{'noip-service-common-defaults'}, ), }, 'concont' => { @@ -493,7 +498,10 @@ my %services = ( 'updateable' => undef, 'update' => \&nic_dslreports1_update, 'examples' => \&nic_dslreports1_examples, - 'variables' => merge( { 'host' => setv( T_NUMBER, 1, 1, 1, 0, undef ) }, $variables{'service-common-defaults'}, ), + 'variables' => merge( + { 'host' => setv( T_NUMBER, 1, 1, 1, 0, undef ) }, + $variables{'service-common-defaults'}, + ), }, 'hammernode1' => { 'updateable' => undef, @@ -532,8 +540,10 @@ my %services = ( 'update' => \&nic_dnspark_update, 'examples' => \&nic_dnspark_examples, 'variables' => merge( - { 'server' => setv( T_FQDNP, 1, 0, 1, 'www.dnspark.com', undef ) }, { 'min-interval' => setv( T_DELAY, 0, 0, 1, interval('5m'), 0 ), }, - $variables{'dnspark-common-defaults'}, $variables{'service-common-defaults'}, + { 'server' => setv( T_FQDNP, 1, 0, 1, 'www.dnspark.com', undef ) }, + { 'min-interval' => setv( T_DELAY, 0, 0, 1, interval('5m'), 0 ), }, + $variables{'dnspark-common-defaults'}, + $variables{'service-common-defaults'}, ), }, 'namecheap' => { @@ -580,14 +590,18 @@ my %services = ( 'updateable' => undef, 'update' => \&nic_dtdns_update, 'examples' => \&nic_dtdns_examples, - 'variables' => merge( $variables{'dtdns-common-defaults'}, $variables{'service-common-defaults'}, ), + 'variables' => merge( + $variables{'dtdns-common-defaults'}, + $variables{'service-common-defaults'}, + ), }, 'nsupdate' => { 'updateable' => undef, 'update' => \&nic_nsupdate_update, 'examples' => \&nic_nsupdate_examples, 'variables' => merge( - { 'login' => setv( T_LOGIN, 1, 0, 1, '/usr/bin/nsupdate', undef ), }, $variables{'nsupdate-common-defaults'}, + { 'login' => setv( T_LOGIN, 1, 0, 1, '/usr/bin/nsupdate', undef ), }, + $variables{'nsupdate-common-defaults'}, $variables{'service-common-defaults'}, ), }, @@ -605,51 +619,53 @@ my %services = ( ); $variables{'merged'} = merge( - $variables{'global-defaults'}, $variables{'service-common-defaults'}, - $variables{'dyndns-common-defaults'}, map { $services{$_}{'variables'} } keys %services, + $variables{'global-defaults'}, + $variables{'service-common-defaults'}, + $variables{'dyndns-common-defaults'}, + map { $services{$_}{'variables'} } keys %services, ); 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'" ], + [ "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'" ], "", - [ "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 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 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" ], - [ "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" ], + [ "ssl", "!", "-{no}ssl : do updates over encrypted SSL connection" ], + [ "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}" ], @@ -663,7 +679,7 @@ my @opt = ( [ "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" ], + [ "query", "!", "-{no}query : print {no} ip addresses and exit" ], [ "test", "!", "" ], ## hidden [ "geturl", "=s", "" ], ## hidden "",