summaryrefslogtreecommitdiffstatsabout
path: root/utility/logparse.c
diff options
context:
space:
mode:
authorEdward Rudd <urkle@outoforder.cc>2008-10-30 03:16:51 (GMT)
committer Edward Rudd <urkle@outoforder.cc>2008-10-30 03:16:51 (GMT)
commit4c46bfeaa5ec5c6a87c29ece56891e070d3faee1 (patch)
tree15d788623ea5a2ff7f4dacbf42f454bc8510c675 /utility/logparse.c
parentd3a4a623fa6e429bfa5938e01c97cb7dbd3ece97 (diff)
fix tokenize_logfile (derived off of now known buggy apr_tokenize_to_argv function)
switch all calls to apr_tokenize_to_argv to renamed tokenize_logfile (parser_tokenize_line)
Diffstat (limited to 'utility/logparse.c')
-rw-r--r--utility/logparse.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/utility/logparse.c b/utility/logparse.c
index a1dce69..097e66d 100644
--- a/utility/logparse.c
+++ b/utility/logparse.c
@@ -222,10 +222,9 @@ void parser_find_logs(config_t *cfg)
222 * This value will be allocated from the contexts 222 * This value will be allocated from the contexts
223 * pool and filled in with copies of the tokens 223 * pool and filled in with copies of the tokens
224 * found during parsing of the arg_str. 224 * found during parsing of the arg_str.
225 * keepquotes: Keep the quotes instead of stripping them
226 */ 225 */
227static apr_status_t tokenize_logline(const char *arg_str, char ***argv_out, 226apr_status_t parser_tokenize_line(const char *arg_str, char ***argv_out,
228 apr_pool_t *token_context, int keepquotes) 227 apr_pool_t *token_context)
229{ 228{
230 const char *cp; 229 const char *cp;
231 const char *ct; 230 const char *ct;
@@ -259,8 +258,7 @@ static apr_status_t tokenize_logline(const char *arg_str, char ***argv_out,
259 */ 258 */
260#define DETERMINE_NEXTSTRING(cp,isquoted) \ 259#define DETERMINE_NEXTSTRING(cp,isquoted) \
261 for ( ; *cp != '\0'; cp++) { \ 260 for ( ; *cp != '\0'; cp++) { \
262 if ( (isquoted && (*cp == ' ' || *cp == '\t')) \ 261 if ( (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
263 || (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
264 *(cp+1) == '"' || *(cp+1) == '\'' || \ 262 *(cp+1) == '"' || *(cp+1) == '\'' || \
265 *(cp+1) == '[' || *(cp+1) == ']'))) { \ 263 *(cp+1) == '[' || *(cp+1) == ']'))) { \
266 cp++; \ 264 cp++; \
@@ -324,7 +322,7 @@ static apr_status_t tokenize_logline(const char *arg_str, char ***argv_out,
324 ct = cp; 322 ct = cp;
325 DETERMINE_NEXTSTRING(cp, isquoted); 323 DETERMINE_NEXTSTRING(cp, isquoted);
326 cp++; 324 cp++;
327 if (isquoted && keepquotes) { 325 if (isquoted) {
328 (*argv_out)[argnum] = apr_palloc(token_context, cp - ct + 2); 326 (*argv_out)[argnum] = apr_palloc(token_context, cp - ct + 2);
329 apr_cpystrn((*argv_out)[argnum], ct -1, cp - ct + 2); 327 apr_cpystrn((*argv_out)[argnum], ct -1, cp - ct + 2);
330 } else { 328 } else {
@@ -401,7 +399,7 @@ apr_status_t parser_parsefile(config_t *cfg, config_filestat_t *fstat)
401 if (cont) continue; 399 if (cont) continue;
402 400
403 apr_pool_clear(targp); 401 apr_pool_clear(targp);
404 tokenize_logline(buff, &targv, targp, 0); 402 parser_tokenize_line(buff, &targv, targp);
405 targc = 0; 403 targc = 0;
406 while (targv[targc]) 404 while (targv[targc])
407 targc++; 405 targc++;