From: Guus Sliepen Date: Fri, 30 Nov 2018 13:41:55 +0000 (+0100) Subject: Double-quote node names in dump graph output. X-Git-Tag: release-1.1pre18~32 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=6048e276153ae3cb181fe9996b7ab43afdbae38c;p=tinc Double-quote node names in dump graph output. 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. --- diff --git a/src/tincctl.c b/src/tincctl.c index a09ac985..08f30189 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);