#include "command.h"
#include "linklist.h"
-#include "vtysh.h"
+#include "vtysh/vtysh.h"
EOF
my $cli_stomp = 0;
-foreach (@ARGV) {
- $file = $_;
+sub scan_file {
+ my ( $file, $fabricd) = @_;
+
+ $cppadd = $fabricd ? "-DFABRICD=1" : "";
- open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_builddir@/lib -I@top_srcdir@/bgpd -I@top_srcdir@/@LIBRFP@ -I@top_srcdir@/bgpd/rfapi @CPPFLAGS@ $file |");
+ open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -Ivtysh/@top_builddir@ -Ivtysh/@top_srcdir@ -Ivtysh/@top_srcdir@/lib -Ivtysh/@top_builddir@/lib -Ivtysh/@top_srcdir@/bgpd -Ivtysh/@top_srcdir@/bgpd/rfapi @CPPFLAGS@ $cppadd $file |");
local $/; undef $/;
$line = <FH>;
close (FH);
$cmd =~ s/^\s+//g;
$cmd =~ s/\s+$//g;
+ if ($fabricd) {
+ $cmd = "fabricd_" . $cmd;
+ }
+
# $protocol is VTYSH_PROTO format for redirection of user input
if ($file =~ /lib\/keychain\.c$/) {
- $protocol = "VTYSH_RIPD";
+ $protocol = "VTYSH_RIPD|VTYSH_EIGRPD";
}
elsif ($file =~ /lib\/routemap\.c$/) {
$protocol = "VTYSH_RMAP";
}
elsif ($file =~ /lib\/plist\.c$/) {
if ($defun_array[1] =~ m/ipv6/) {
- $protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_BABELD|VTYSH_ISISD";
+ $protocol = "VTYSH_RIPNGD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_BABELD|VTYSH_ISISD|VTYSH_FABRICD";
} else {
- $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_ISISD";
+ $protocol = "VTYSH_RIPD|VTYSH_OSPFD|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_ISISD|VTYSH_FABRICD";
}
}
elsif ($file =~ /lib\/distribute\.c$/) {
elsif ($file =~ /librfp\/.*\.c$/ || $file =~ /rfapi\/.*\.c$/) {
$protocol = "VTYSH_BGPD";
}
+ elsif ($fabricd) {
+ $protocol = "VTYSH_FABRICD";
+ }
else {
($protocol) = ($file =~ /^.*\/([a-z0-9]+)\/[a-zA-Z0-9_\-]+\.c$/);
$protocol = "VTYSH_" . uc $protocol;
$ecmd =~ s/^\s+//g;
$ecmd =~ s/\s+$//g;
+ if ($fabricd) {
+ $ecmd = "fabricd_" . $ecmd;
+ }
+
# Register $ecmd
if (defined ($cmd2str{$ecmd})) {
my ($key);
}
}
+foreach (@ARGV) {
+ if (/\/isisd\//) {
+ # We scan all the IS-IS files twice, once for isisd,
+ # once for fabricd. Exceptions are made for the files
+ # that are not shared between the two.
+ if (/isis_vty_isisd.c/) {
+ scan_file($_, 0);
+ } elsif (/isis_vty_fabricd.c/) {
+ scan_file($_, 1);
+ } else {
+ scan_file($_, 0);
+ scan_file($_, 1);
+ }
+ } else {
+ scan_file($_, 0);
+ }
+}
+
# When we have cli commands that map to the same function name, we
# can introduce subtle bugs due to code not being called when
# we think it is.