From 5e6a50559d74cc26e6b24672b7292ab19855b048 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 2 Aug 2020 16:57:25 -0400 Subject: [PATCH] New `-list-devices` option This will make it possible for the Debian package to fetch the list of supported firewall/router devices and prompt the user to choose one upon installation. --- ddclient.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ddclient.in b/ddclient.in index 2b73351..0a45a54 100755 --- a/ddclient.in +++ b/ddclient.in @@ -816,6 +816,10 @@ my %opt = (); my $deprecated_handler = sub { warning("'-$_[0]' is deprecated and does nothing"); }; $opt{'fw-banlocal'} = $deprecated_handler; $opt{'if-skip'} = $deprecated_handler; +$opt{'list-devices'} = sub { + printf("%s %s\n", $_, $builtinfw{$_}{name}) for sort(keys(%builtinfw)); + exit(0); +}; $opt{'list-protocols'} = sub { printf("%s\n", $_) for sort(keys(%services)); exit(0); @@ -857,6 +861,7 @@ my @opt = ( ["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"], + ["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 : obtain IP address from the output of "],