all: scrubbed some argc CHECK MEs

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Daniel Walton 2016-09-29 19:51:56 +00:00
parent 00d7d2d345
commit abddf07563
14 changed files with 14 additions and 65 deletions

View File

@ -618,7 +618,6 @@ DEFUN (no_isis_redistribute,
"Redistribute into level-1\n"
"Redistribute into level-2\n")
{
/* CHECK ME argc referenced below */
int idx_afi = 2;
int idx_protocol = 3;
int idx_level = 4;
@ -628,9 +627,6 @@ DEFUN (no_isis_redistribute,
int family;
int afi;
if (argc < 3)
return CMD_WARNING;
family = str2family(argv[idx_afi]->arg);
if (family < 0)
return CMD_WARNING;
@ -669,7 +665,6 @@ DEFUN (isis_default_originate,
"Route map reference\n"
"Pointer to route-map entries\n")
{
/* CHECK ME argc referenced below */
int idx_afi = 2;
int idx_level = 3;
int idx_metric_rmap = 4;
@ -680,9 +675,6 @@ DEFUN (isis_default_originate,
unsigned long metric;
const char *routemap;
if (argc < 5)
return CMD_WARNING;
family = str2family(argv[idx_afi]->arg);
if (family < 0)
return CMD_WARNING;
@ -741,7 +733,6 @@ DEFUN (no_isis_default_originate,
"Distribute default route into level-1\n"
"Distribute default route into level-2\n")
{
/* CHECK ME argc referenced below */
int idx_afi = 3;
int idx_level = 4;
struct isis_area *area = vty->index;
@ -749,9 +740,6 @@ DEFUN (no_isis_default_originate,
int family;
int level;
if (argc < 2)
return CMD_WARNING;
family = str2family(argv[idx_afi]->arg);
if (family < 0)
return CMD_WARNING;

View File

@ -370,7 +370,6 @@ DEFUN (no_match_ip_address,
"IP access-list number (expanded range)\n"
"IP Access-list name\n")
{
/* CHECK ME argc referenced below */
int idx_acl = 4;
if (argc <= idx_acl)
return isis_route_match_delete(vty, vty->index, "ip address", NULL);
@ -404,7 +403,6 @@ DEFUN (no_match_ip_address_prefix_list,
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
/* CHECK ME argc referenced below */
int idx_word = 5;
if (argc <= idx_word)
return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL);
@ -436,7 +434,6 @@ DEFUN (no_match_ipv6_address,
"Match IPv6 address of route\n"
"IPv6 access-list name\n")
{
/* CHECK ME argc referenced below */
int idx_word = 4;
if (argc <= idx_word)
return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL);
@ -469,7 +466,6 @@ DEFUN (no_match_ipv6_address_prefix_list,
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
/* CHECK ME argc referenced below */
int idx_word = 5;
if (argc <= idx_word)
return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL);
@ -501,7 +497,6 @@ DEFUN (no_set_metric,
"Metric value for destination routing protocol\n"
"Metric value\n")
{
/* CHECK ME argc referenced below */
int idx_number = 3;
if (argc <= idx_number)
return isis_route_set_delete(vty, vty->index, "metric", NULL);

View File

@ -1318,13 +1318,12 @@ DEFUN (show_isis_mpls_te_interface,
"Interface information\n"
"Interface name\n")
{
/* CHECK ME argc referenced below */
int idx_interface = 4;
struct interface *ifp;
struct listnode *node;
/* Show All Interfaces. */
if (argc == 0)
if (argc == 4)
{
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
show_mpls_te_sub (vty, ifp);

View File

@ -2067,7 +2067,6 @@ DEFUN (area_passwd_md5,
"Send but do not check PDUs on receiving\n"
"Send and check PDUs on receiving\n")
{
/* CHECK ME argc referenced below */
int idx_password = 0;
int idx_word = 2;
int idx_type = 5;
@ -2098,7 +2097,6 @@ DEFUN (area_passwd_clear,
"Send but do not check PDUs on receiving\n"
"Send and check PDUs on receiving\n")
{
/* CHECK ME argc referenced below */
int idx_password = 0;
int idx_word = 2;
int idx_type = 5;

View File

@ -308,7 +308,6 @@ DEFUN (distribute_list,
"Filter outgoing routing updates\n"
"Interface name\n")
{
/* CHECK ME argc referenced below */
int prefix = (argv[1]->type == WORD_TKN) ? 1 : 0;
/* Check of distribute list type. */
@ -340,7 +339,6 @@ DEFUN (no_distribute_list,
"Filter outgoing routing updates\n"
"Interface name\n")
{
/* CHECK ME argc referenced below */
int prefix = (argv[2]->type == WORD_TKN) ? 1 : 0;
/* Check of distribute list type. */

View File

@ -756,10 +756,10 @@ DEFUN (interface,
"Interface's name\n"
VRF_CMD_HELP_STR)
{
/* CHECK ME argc referenced below */
int idx_ifname = 1;
int idx_vrf = 3;
const char *ifname = argv[idx_ifname]->arg;
const char *vrfname = (argc > 2) ? argv[3]->arg : NULL;
const char *vrfname = (argc > 2) ? argv[idx_vrf]->arg : NULL;
struct interface *ifp;
size_t sl;
@ -901,8 +901,7 @@ DEFUN (show_address,
"address\n"
VRF_CMD_HELP_STR)
{
/* CHECK ME argc referenced below */
int idx_vrf_cmd_str = 2;
int idx_vrf = 3;
struct listnode *node;
struct listnode *node2;
struct interface *ifp;

View File

@ -1544,13 +1544,9 @@ DEFUN (rmap_onmatch_goto,
"Goto Clause number\n"
"Number\n")
{
/* CHECK ME argc referenced below */
int idx_number = 2;
char *num = NULL;
if (!strcmp (argv[0]->text, "continue"))
num = argv[1]->arg;
else
num = argv[idx_number]->arg;
num = argv[idx_number]->arg;
struct route_map_index *index = vty->index;
int d = 0;
@ -1565,7 +1561,7 @@ DEFUN (rmap_onmatch_goto,
return CMD_WARNING;
}
if (argc == 1 && num)
if (num)
VTY_GET_INTEGER_RANGE("route-map index", d, num, 1, 65535);
else
d = index->pref + 1;
@ -1634,10 +1630,9 @@ DEFUN (rmap_show_name,
"route-map information\n"
"route-map name\n")
{
/* CHECK ME argc referenced below */
int idx_word = 2;
const char *name = (argc == 3) ? argv[idx_word]->arg : NULL;
return vty_show_route_map (vty, name);
const char *name = (argc == 3) ? argv[idx_word]->arg : NULL;
return vty_show_route_map (vty, name);
}
DEFUN (rmap_call,

View File

@ -299,7 +299,6 @@ DEFUN (show_thread_cpu,
"Thread CPU usage\n"
"Display filter (rwtexb)\n")
{
/* CHECK ME argc referenced below */
int idx_filter = 3;
int i = 0;
thread_type filter = (thread_type) -1U;
@ -383,7 +382,6 @@ DEFUN (clear_thread_cpu,
"Thread CPU usage\n"
"Display filter (rwtexb)\n")
{
/* CHECK ME argc referenced below */
int idx_filter = 3;
int i = 0;
thread_type filter = (thread_type) -1U;

View File

@ -2797,10 +2797,9 @@ DEFUN (no_vty_access_class,
"Filter connections based on an IP access list\n"
"IP access list\n")
{
/* CHECK ME argc referenced below */
int idx_word = 2;
const char *accesslist = (argc == 3) ? argv[idx_word]->arg : NULL;
if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, accesslist)))
if (! vty_accesslist_name || (argc == 3 && strcmp(vty_accesslist_name, accesslist)))
{
vty_out (vty, "Access-class is not currently applied to vty%s",
VTY_NEWLINE);
@ -2841,12 +2840,11 @@ DEFUN (no_vty_ipv6_access_class,
"Filter connections based on an IP access list\n"
"IPv6 access list\n")
{
/* CHECK ME argc referenced below */
int idx_word = 3;
const char *accesslist = (argc == 4) ? argv[idx_word]->arg : NULL;
if (! vty_ipv6_accesslist_name ||
(argc && strcmp(vty_ipv6_accesslist_name, accesslist)))
(argc == 4 && strcmp(vty_ipv6_accesslist_name, accesslist)))
{
vty_out (vty, "IPv6 access-class is not currently applied to vty%s",
VTY_NEWLINE);

View File

@ -2534,11 +2534,10 @@ DEFUN (ip_ssmpingd,
CONF_SSMPINGD_STR
"Source address\n")
{
/* CHECK ME argc referenced below */
int idx_ipv4 = 2;
int result;
struct in_addr source_addr;
const char *source_str = (argc > 0) ? argv[idx_ipv4]->arg : "0.0.0.0";
const char *source_str = (argc > idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0";
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
@ -2565,11 +2564,10 @@ DEFUN (no_ip_ssmpingd,
CONF_SSMPINGD_STR
"Source address\n")
{
/* CHECK ME argc referenced below */
int idx_ipv4 = 3;
int result;
struct in_addr source_addr;
const char *source_str = (argc > 0) ? argv[idx_ipv4]->arg : "0.0.0.0";
const char *source_str = (argc > idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0";
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
@ -3562,7 +3560,6 @@ DEFUN (interface_ip_pim_hello,
IFACE_PIM_HELLO_TIME_STR
IFACE_PIM_HELLO_HOLD_STR)
{
/* CHECK ME argc referenced below */
int idx_time = 3;
int idx_hold = 4;
struct interface *ifp;

View File

@ -1528,7 +1528,6 @@ DEFUN (ip_rip_authentication_mode,
"RFC compatible\n"
"Old ripd compatible\n")
{
/* CHECK ME argc referenced below */
char *cryptmode = argv[4]->text;
char *authlen = (argc > 5) ? argv[6]->text : NULL;
struct interface *ifp;

View File

@ -754,7 +754,6 @@ DEFUN (no_match_metric,
"Match metric of route\n"
"Metric value\n")
{
/* CHECK ME argc referenced below */
char *mval = (argc == 4) ? argv[3]->arg : NULL;
return rip_route_match_delete (vty, vty->index, "metric", mval);
}
@ -779,7 +778,6 @@ DEFUN (no_match_interface,
"Match first hop interface of route\n"
"Interface name\n")
{
/* CHECK ME argc referenced below */
char *iface = (argc == 4) ? argv[3]->arg : NULL;
return rip_route_match_delete (vty, vty->index, "interface", iface);
}
@ -809,7 +807,6 @@ DEFUN (no_match_ip_next_hop,
"IP access-list number (expanded range)\n"
"IP Access-list name\n")
{
/* CHECK ME argc referenced below */
char *al = (argc == 5) ? argv[4]->arg : NULL;
return rip_route_match_delete (vty, vty->index, "ip next-hop", al);
}
@ -837,7 +834,6 @@ DEFUN (no_match_ip_next_hop_prefix_list,
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
/* CHECK ME argc referenced below */
char *plist = (argc == 6) ? argv[5]->arg : NULL;
return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", plist);
}
@ -869,7 +865,6 @@ DEFUN (no_match_ip_address,
"IP access-list number (expanded range)\n"
"IP Access-list name\n")
{
/* CHECK ME argc referenced below */
char *al = (argc == 5) ? argv[4]->arg : NULL;
return rip_route_match_delete (vty, vty->index, "ip address", al);
}
@ -898,7 +893,6 @@ DEFUN (no_match_ip_address_prefix_list,
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
/* CHECK ME argc referenced below */
char *plist = (argc == 6) ? argv[5]->arg : NULL;
return rip_route_match_delete (vty, vty->index, "ip address prefix-list", plist);
}
@ -923,7 +917,6 @@ DEFUN (no_match_tag,
"Match tag of route\n"
"Metric value\n")
{
/* CHECK ME argc referenced below */
char *mval = (argc == 4) ? argv[3]->arg : NULL;
return rip_route_match_delete (vty, vty->index, "tag", mval);
}
@ -996,7 +989,6 @@ DEFUN (no_set_ip_nexthop,
"Next hop address\n"
"IP address of next hop\n")
{
/* CHECK ME argc referenced below */
char *addr = (argc == 5) ? argv[4]->arg : NULL;
return rip_route_set_delete (vty, vty->index, "ip next-hop", addr);
}
@ -1021,7 +1013,6 @@ DEFUN (no_set_tag,
"Tag value for routing protocol\n"
"Tag value\n")
{
/* CHECK ME argc referenced below */
char *tag = (argc == 4) ? argv[3]->arg : NULL;
return rip_route_set_delete (vty, vty->index, "tag", tag);
}

View File

@ -519,7 +519,6 @@ DEFUN (no_match_metric,
"Match metric of route\n"
"Metric value\n")
{
/* CHECK ME argc referenced below */
char *mval = (argc == 4) ? argv[3]->arg : NULL;
return ripng_route_match_delete (vty, vty->index, "metric", mval);
}
@ -544,7 +543,6 @@ DEFUN (no_match_interface,
"Match first hop interface of route\n"
"Interface name\n")
{
/* CHECK ME argc referenced below */
char *iface = (argc == 4) ? argv[3]->arg : NULL;
return ripng_route_match_delete (vty, vty->index, "interface", iface);
}
@ -569,7 +567,6 @@ DEFUN (no_match_tag,
"Match tag of route\n"
"Metric value\n")
{
/* CHECK ME argc referenced below */
char *mval = (argc == 4) ? argv[3]->arg : NULL;
return ripng_route_match_delete (vty, vty->index, "tag", mval);
}
@ -596,7 +593,6 @@ DEFUN (no_set_metric,
"Metric value for destination routing protocol\n"
"Metric value\n")
{
/* CHECK ME argc referenced below */
char *mval = (argc == 4) ? argv[3]->arg : NULL;
return ripng_route_set_delete (vty, vty->index, "metric", mval);
}
@ -641,7 +637,6 @@ DEFUN (no_set_ipv6_nexthop_local,
"IPv6 local address\n"
"IPv6 address of next hop\n")
{
/* CHECK ME argc referenced below */
char *addr = (argc == 6) ? argv[5]->arg : NULL;
return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", addr);
}
@ -666,7 +661,6 @@ DEFUN (no_set_tag,
"Tag value for routing protocol\n"
"Tag value\n")
{
/* CHECK ME argc referenced below */
char *tag = (argc == 4) ? argv[3]->arg : NULL;
return ripng_route_set_delete (vty, vty->index, "tag", tag);
}

View File

@ -1732,12 +1732,12 @@ DEFUN (vtysh_show_thread,
"Thread CPU usage\n"
"Display filter (rwtexb)\n")
{
/* CHECK ME argc referenced below */
int idx_filter = 3;
unsigned int i;
int ret = CMD_SUCCESS;
char line[100];
sprintf(line, "show thread cpu %s\n", (argc == 1) ? argv[0] : "");
sprintf(line, "show thread cpu %s\n", (argc == 4) ? argv[idx_filter] : "");
for (i = 0; i < array_size(vtysh_client); i++)
if ( vtysh_client[i].fd >= 0 )
{