diff --git a/src/StreamCore.cc b/src/StreamCore.cc index 1943bf1..4154fa6 100644 --- a/src/StreamCore.cc +++ b/src/StreamCore.cc @@ -1364,13 +1364,15 @@ normal_format: { int i = 0; while (commandIndex[i] >= ' ') i++; - error("%s: Input \"%s%s\" mismatch after %ld byte%s\n", + error("%s: Input \"%s%s\" mismatch after %ld byte%s: %c != %c\n", name(), consumedInput > 10 ? "..." : "", inputLine.expand(consumedInput > 10 ? consumedInput-10 : 0,20)(), consumedInput, - consumedInput==1 ? "" : "s"); + consumedInput==1 ? "" : "s", + command, + inputLine[consumedInput]); #ifndef NO_TEMPORARY error("%s: got \"%s\" where \"%s\" was expected\n", diff --git a/src/StreamProtocol.cc b/src/StreamProtocol.cc index 6f97db8..f43f8c2 100644 --- a/src/StreamProtocol.cc +++ b/src/StreamProtocol.cc @@ -1058,6 +1058,14 @@ compileNumber(unsigned long& number, const char*& source, unsigned long max) bool StreamProtocolParser::Protocol:: compileString(StreamBuffer& buffer, const char*& source, FormatType formatType, Client* client, int quoted) +{ + return compileStringInternal(buffer, source, formatType, client, quoted, 0); +} + + +bool StreamProtocolParser::Protocol:: +compileStringInternal(StreamBuffer& buffer, const char*& source, + FormatType formatType, Client* client, int quoted, int recursionDepth) { bool escaped = false; int newline = 0; @@ -1085,7 +1093,7 @@ compileString(StreamBuffer& buffer, const char*& source, // compile all formats in this line // We do this here after all variables in this line // have been replaced and after string has been coded. - if (formatType != NoFormat) + if (recursionDepth == 0 && formatType != NoFormat) { int nformats=0; char c; @@ -1250,7 +1258,7 @@ compileString(StreamBuffer& buffer, const char*& source, source += strlen(source)+1+sizeof(int); p = value(); int saveline = line; - if (!compileString(buffer, p, formatType, client)) + if (!compileStringInternal(buffer, p, formatType, client, false, recursionDepth + 1)) return false; line = saveline; continue; diff --git a/src/StreamProtocol.h b/src/StreamProtocol.h index b3c1231..91f9183 100644 --- a/src/StreamProtocol.h +++ b/src/StreamProtocol.h @@ -59,6 +59,8 @@ public: bool compileCommands(StreamBuffer&, const char*& source, Client*); bool replaceVariable(StreamBuffer&, const char* varname); const Variable* getVariable(const char* name); + bool compileStringInternal(StreamBuffer& buffer, const char*& source, + FormatType formatType, Client*, int quoted, int recursionDepth); public: