Support %% in protocol just like in printf/scanf. (Suggested by Klemen Vodopivec)

This commit is contained in:
2019-02-26 16:30:20 +01:00
parent ece1e01d21
commit b84655e4de
2 changed files with 23 additions and 2 deletions

View File

@ -1124,6 +1124,13 @@ compileString(StreamBuffer& buffer, const char*& source,
continue;
}
if (c == '%') {
if (buffer[formatpos+1] == '%') {
// treat %% as literal % like printf/scanf do
// replace with escaped %
buffer[formatpos] = esc;
formatpos+=2;
continue;
}
debug("StreamProtocolParser::Protocol::compileString "
"format=\"%s\"\n", buffer.expand(formatpos)());
nformats++;