From 6048e276153ae3cb181fe9996b7ab43afdbae38c Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 30 Nov 2018 14:41:55 +0100 Subject: [PATCH] Double-quote node names in dump graph output. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is needed for all nodes with a name starting with a digit, otherwise the ID would be interpreted as a numeral. Based on the patch from Quentin Rameau for tinc 1.0. --- src/tincctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tincctl.c b/src/tincctl.c index a09ac98..08f3018 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -1352,7 +1352,7 @@ static int cmd_dump(int argc, char *argv[]) { color = "green"; } - printf(" %s [label = \"%s\", color = \"%s\"%s];\n", node, node, color, strcmp(host, "MYSELF") ? "" : ", style = \"filled\""); + printf(" \"%s\" [label = \"%s\", color = \"%s\"%s];\n", node, node, color, strcmp(host, "MYSELF") ? "" : ", style = \"filled\""); } else { if(only_reachable && !status.reachable) { continue; @@ -1382,9 +1382,9 @@ static int cmd_dump(int argc, char *argv[]) { float w = 1 + 65536.0 / weight; if(do_graph == 1 && strcmp(node1, node2) > 0) { - printf(" %s -- %s [w = %f, weight = %f];\n", node1, node2, w, w); + printf(" \"%s\" -- \"%s\" [w = %f, weight = %f];\n", node1, node2, w, w); } else if(do_graph == 2) { - printf(" %s -> %s [w = %f, weight = %f];\n", node1, node2, w, w); + printf(" \"%s\" -> \"%s\" [w = %f, weight = %f];\n", node1, node2, w, w); } } else { printf("%s to %s at %s port %s local %s port %s options %x weight %d\n", from, to, host, port, local_host, local_port, options, weight); -- 2.25.1