]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: added strmatch()
authorDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 23 Sep 2016 22:12:11 +0000 (22:12 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 23 Sep 2016 22:12:11 +0000 (22:12 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
lib/str.c
lib/str.h
zebra/zebra_vty.c

index 16f759c074b1eefe252f36ca346b05ea5b2f8cb6..cfdb6e024e3d04dd54adc5d401c7938153c8a663 100644 (file)
--- a/lib/str.c
+++ b/lib/str.c
@@ -133,3 +133,11 @@ strndup (const char *s, size_t maxlen)
     return (char *) memcpy (new, s, len);
 }
 #endif
+
+extern int
+strmatch (const char *str1, const char *str2)
+{
+  if (!strcmp(str1, str2))
+    return 1;
+  return 0;
+}
index 7b83fe1cb14bfd284173cfd10f031f65a3eedeaa..dc8e7e5d67b10e3d6b60d093c6eb0a30138522b0 100644 (file)
--- a/lib/str.h
+++ b/lib/str.h
@@ -29,5 +29,7 @@ extern size_t strnlen(const char *s, size_t maxlen);
 extern char * strndup (const char *, size_t);
 #endif
 
+extern int strmatch (const char *, const char *);
+
 #endif /* _ZEBRA_STR_H */
 
index 17e9538ba04eb7f625c70bc0489cdbfa0dd01c80..ebe0ca4054abda078b991e331c4378e8a828d12c 100644 (file)
@@ -3014,7 +3014,7 @@ DEFUN (show_ip_route_tag,
   u_short tag = 0;
   vrf_id_t vrf_id = VRF_DEFAULT;
  
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       VRF_GET_ID (vrf_id, argv[4]->arg);
       tag = atoi(argv[6]->arg);
@@ -3063,7 +3063,7 @@ DEFUN (show_ip_route_prefix_longer,
   int first = 1;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       VRF_GET_ID (vrf_id, argv[4]->arg);
       ret = str2prefix (argv[5]->arg, &p);
@@ -3114,7 +3114,7 @@ DEFUN (show_ip_route_supernets,
   int first = 1;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     VRF_GET_ID (vrf_id, argv[4]->arg);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
@@ -3158,7 +3158,7 @@ DEFUN (show_ip_route_protocol,
   int first = 1;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       type = proto_redistnum (AFI_IP, argv[5]->arg);
       VRF_GET_ID (vrf_id, argv[4]->arg);
@@ -3246,7 +3246,7 @@ DEFUN (show_ip_route_addr,
   struct route_node *rn;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       VRF_GET_ID (vrf_id, argv[4]->arg);
       ret = str2prefix_ipv4 (argv[5]->arg, &p);
@@ -3295,7 +3295,7 @@ DEFUN (show_ip_route_prefix,
   struct route_node *rn;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       VRF_GET_ID (vrf_id, argv[4]->arg);
       ret = str2prefix_ipv4 (argv[5]->arg, &p);
@@ -3492,7 +3492,7 @@ DEFUN (show_ip_route_summary,
   struct route_table *table;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     VRF_GET_ID (vrf_id, argv[4]->arg);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
@@ -3519,7 +3519,7 @@ DEFUN (show_ip_route_summary_prefix,
   struct route_table *table;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     VRF_GET_ID (vrf_id, argv[4]->arg);
 
   table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
@@ -5510,7 +5510,7 @@ DEFUN (show_ipv6_route_tag,
   u_short tag = 0;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       VRF_GET_ID (vrf_id, argv[4]->arg);
       tag = atoi(argv[6]->arg);
@@ -5559,7 +5559,7 @@ DEFUN (show_ipv6_route_prefix_longer,
   int first = 1;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       VRF_GET_ID (vrf_id, argv[4]->arg);
       ret = str2prefix (argv[5]->arg, &p);
@@ -5669,7 +5669,7 @@ DEFUN (show_ipv6_route_addr,
   struct route_node *rn;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       VRF_GET_ID (vrf_id, argv[4]->arg);
       ret = str2prefix_ipv6 (argv[5]->arg, &p);
@@ -5718,7 +5718,7 @@ DEFUN (show_ipv6_route_prefix,
   struct route_node *rn;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     {
       VRF_GET_ID (vrf_id, argv[4]->arg);
       ret = str2prefix_ipv6 (argv[5]->arg, &p);
@@ -5764,7 +5764,7 @@ DEFUN (show_ipv6_route_summary,
   struct route_table *table;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     VRF_GET_ID (vrf_id, argv[4]->arg);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
@@ -5791,7 +5791,7 @@ DEFUN (show_ipv6_route_summary_prefix,
   struct route_table *table;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     VRF_GET_ID (vrf_id, argv[4]->arg);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
@@ -5822,7 +5822,7 @@ DEFUN (show_ipv6_mroute,
   int first = 1;
   vrf_id_t vrf_id = VRF_DEFAULT;
 
-  if (strcmp(argv[3]->text, "vrf"))
+  if (strmatch(argv[3]->text, "vrf"))
     VRF_GET_ID (vrf_id, argv[4]->arg);
 
   table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id);