]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Handle vararg in graph pretty-print
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 9 Aug 2016 22:23:17 +0000 (22:23 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 9 Aug 2016 22:23:17 +0000 (22:23 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/grammar_sandbox.c

index cf9ce2bb58fd92f10aaedaa439d52c58bae4a9d0..6473fc12e32b8b52bf71e2d01f951acc502a406c 100644 (file)
@@ -251,7 +251,13 @@ pretty_print_graph (struct graph_node *start, int level)
   if (vector_active (start->children))
     {
       if (vector_active (start->children) == 1)
-        pretty_print_graph (vector_slot (start->children, 0), level);
+        {
+          struct graph_node *child = vector_slot (start->children, 0);
+          if (child == start)
+            fprintf (stdout, "*");
+          else
+            pretty_print_graph (vector_slot (start->children, 0), level);
+        }
       else
         {
           fprintf(stdout, "\n");
@@ -260,7 +266,10 @@ pretty_print_graph (struct graph_node *start, int level)
               struct graph_node *r = vector_slot (start->children, i);
               for (int j = 0; j < level+1; j++)
                 fprintf (stdout, "    ");
-              pretty_print_graph (r, level+1);
+              if (r == start)
+                fprintf (stdout, "*");
+              else
+                pretty_print_graph (r, level+1);
             }
         }
     }