From e10dcbe7e2387ab92fc5c8e825cd3af02a2e7112 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Wed, 7 May 2008 23:02:07 +0000 Subject: [PATCH] If using recursive cparse, a %c character in the format string inserting a % or $ should quote it (like %s does). git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@42 13b04d17-f746-0410-82c6-800466cd88b0 --- source/misc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/misc.c b/source/misc.c index b125053..df16bc4 100644 --- a/source/misc.c +++ b/source/misc.c @@ -4380,7 +4380,7 @@ static int cparse_recurse = -1; #endif #define RECURSE_CPARSE -/* One buffer for each recursive implementation. We also keep track of the +/* One buffer for each recursive invocation. We also keep track of the * buffer size, so that it can be resized when necessary. */ static char *cof_buffer[MAX_RECURSE + 1] = { NULL }; @@ -4465,6 +4465,12 @@ char *timestamp_str = get_string_var(TIMESTAMP_STRING_VAR); case 'c': { char c = (char )va_arg(args, int); +#ifdef RECURSE_CPARSE + if (c == '%') + buffer2[strlen(buffer2)] = '%'; + else if (c == '$') + buffer2[strlen(buffer2)] = '$'; +#endif buffer2[strlen(buffer2)] = c; break; }