diff options
Diffstat (limited to 'vtysh/extract.pl')
-rwxr-xr-x | vtysh/extract.pl | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/vtysh/extract.pl b/vtysh/extract.pl index 4eb88fa6..5d29f8ab 100755 --- a/vtysh/extract.pl +++ b/vtysh/extract.pl @@ -61,25 +61,6 @@ foreach (@ARGV) { @defun = ($line =~ /(?:DEFUN|ALIAS)\s*\((.+?)\);?\s?\s?\n/sg); @install = ($line =~ /install_element \(\s*[0-9A-Z_]+,\s*&[^;]*;\s*\n/sg); - # $protocol is VTYSH_PROTO format for redirection of user input - if ($file =~ /lib/) { - if ($file =~ /keychain.c/) { - $protocol = "VTYSH_RIPD"; - } - if ($file =~ /routemap.c/) { - $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD"; - } - if ($file =~ /filter.c/) { - $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD"; - } - if ($file =~ /plist.c/) { - $protocol = "VTYSH_RIPD|VTYSH_BGPD"; - } - } else { - ($protocol) = ($file =~ /\/([a-z0-9]+)/); - $protocol = "VTYSH_" . uc $protocol; - } - # DEFUN process foreach (@defun) { my (@defun_array); @@ -98,6 +79,33 @@ foreach (@ARGV) { $cmd =~ s/^\s+//g; $cmd =~ s/\s+$//g; + # $protocol is VTYSH_PROTO format for redirection of user input + if ($file =~ /lib/) { + if ($file =~ /keychain.c/) { + $protocol = "VTYSH_RIPD"; + } + if ($file =~ /routemap.c/) { + $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD"; + } + if ($file =~ /filter.c/) { + if ($defun_array[1] =~ m/ipv6/) { + $protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD"; + } else { + $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD"; + } + } + if ($file =~ /plist.c/) { + if ($defun_array[1] =~ m/ipv6/) { + $protocol = "VTYSH_RIPNGD|VTYSH_BGPD"; + } else { + $protocol = "VTYSH_RIPD|VTYSH_BGPD"; + } + } + } else { + ($protocol) = ($file =~ /\/([a-z0-9]+)/); + $protocol = "VTYSH_" . uc $protocol; + } + # Append _vtysh to structure then build DEFUN again $defun_array[1] = $cmd . "_vtysh"; $defun_body = join (", ", @defun_array); |