summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-11-25 14:13:15 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2016-11-28 18:12:18 +0100
commit64bf316f344f0a905853c08fc1a0b7888a7aed78 (patch)
treee97a25b46f120e982b37dcdcbb5fd2bdf173654c /tools
parentMerge commit '34d5ef459140ee7e' (diff)
downloadfrr-64bf316f344f0a905853c08fc1a0b7888a7aed78.tar.xz
frr-64bf316f344f0a905853c08fc1a0b7888a7aed78.zip
xml2cli/ldpd: sync with the latest changes in CLI code
* use argv[N]->arg instead of argv[N]; * don't skip over non-variable args anymore; * convert <>s to ()s and ()s to <>s; Signed-off-by: Renato Westphal <renato@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/xml2cli.pl21
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/xml2cli.pl b/tools/xml2cli.pl
index 43789131c..1b45e7f72 100755
--- a/tools/xml2cli.pl
+++ b/tools/xml2cli.pl
@@ -41,17 +41,17 @@ use XML::LibXML;
"ipv4m" => "A.B.C.D/M",
"ipv6" => "X:X::X:X",
"ipv6m" => "X:X::X:X/M",
- "mtu" => "<1500-9180>",
+ "mtu" => "(1500-9180)",
# BGP specific
"rd" => "ASN:nn_or_IP-address:nn",
- "asn" => "<1-4294967295>",
+ "asn" => "(1-4294967295)",
"community" => "AA:NN",
- "clist" => "<1-500>",
+ "clist" => "(1-500)",
# LDP specific
- "disc_time" => "<1-65535>",
- "session_time" => "<15-65535>",
- "pwid" => "<1-4294967295>",
- "hops" => "<1-254>"
+ "disc_time" => "(1-65535)",
+ "session_time" => "(15-65535)",
+ "pwid" => "(1-4294967295)",
+ "hops" => "(1-254)"
);
# parse options node and store the corresponding information
@@ -91,7 +91,7 @@ sub parse_options {
push (@cmdstr, $name);
$::options{$options_name}{'help'} .= "\n \"" . $help . "\\n\"";
}
- $::options{$options_name}{'cmdstr'} = "(" . join('|', @cmdstr) . ")";
+ $::options{$options_name}{'cmdstr'} = "<" . join('|', @cmdstr) . ">";
}
# given a subtree, replace all the corresponding include nodes by
@@ -122,7 +122,7 @@ sub generate_arguments {
my @nodes = @_;
my $arguments;
my $no_args = 1;
- my $argc = 0;
+ my $argc = -1;
$arguments .= " struct vty_arg *args[] =\n";
$arguments .= " {\n";
@@ -130,6 +130,7 @@ sub generate_arguments {
my %node = %{$nodes[$i]};
my $arg_value;
+ $argc++;
if (not $node{'arg'}) {
next;
}
@@ -139,7 +140,7 @@ sub generate_arguments {
# argv[] element. for the other types of nodes, the value of the
# argument is the name of the node
if ($node{'input'} or $node{'type'} eq "select") {
- $arg_value = "argv[" . $argc++ . "]";
+ $arg_value = "argv[" . $argc . "]->arg";
} else {
$arg_value = '"' . $node{'name'} . '"';
}