diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-08-09 22:23:17 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-08-09 22:23:17 +0000 |
| commit | b84f1d850aed50dea347ab5b99888bc85448604f (patch) | |
| tree | 3925b198a409db7a8fccc5619bd30516ee80953d /lib/grammar_sandbox.c | |
| parent | 78602b80294194b31fd402843c95af3bbb5c9999 (diff) | |
lib: Handle vararg in graph pretty-print
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/grammar_sandbox.c')
| -rw-r--r-- | lib/grammar_sandbox.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index cf9ce2bb58..6473fc12e3 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -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); } } } |
