diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-10-28 16:08:18 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-10-28 16:08:18 +0100 |
commit | 7cad0a47a07c5b32e1b547e6b293a1f96daf39ba (patch) | |
tree | 5e01a14a22ff7dc12ad44306d17414da2b261add | |
parent | 395531b6522e0fea00ce30ad8c384302f07db6e0 (diff) | |
download | vyatta-cfg-7cad0a47a07c5b32e1b547e6b293a1f96daf39ba.tar.gz vyatta-cfg-7cad0a47a07c5b32e1b547e6b293a1f96daf39ba.zip |
T253: quote tag node names if they contain special characters.
-rw-r--r-- | src/cnode/cnode-algorithm.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cnode/cnode-algorithm.cpp b/src/cnode/cnode-algorithm.cpp index 6638936..379fb6a 100644 --- a/src/cnode/cnode-algorithm.cpp +++ b/src/cnode/cnode-algorithm.cpp @@ -513,7 +513,12 @@ _diff_show_other(const CfgNode *cfg1, const CfgNode *cfg2, int level, _diff_print_indent(cfg1, cfg2, level, pfx_diff); if (is_value) { // at tag value - printf("%s %s", name.c_str(), value.c_str()); + const char *quote = ""; + size_t vlen = value.length(); + if (strcspn(value.c_str(), "*}{;\011\012\013\014\015 ") < vlen) { + quote = "\""; + } + printf("%s %s%s%s", name.c_str(), quote, value.c_str(), quote); } else { // at intermediate node printf("%s", name.c_str()); |