diff options
author | Edward Rudd | 2008-10-30 03:16:51 +0000 |
---|---|---|
committer | Edward Rudd | 2008-10-30 03:16:51 +0000 |
commit | 4c46bfeaa5ec5c6a87c29ece56891e070d3faee1 (patch) | |
tree | 15d788623ea5a2ff7f4dacbf42f454bc8510c675 /utility | |
parent | d3a4a623fa6e429bfa5938e01c97cb7dbd3ece97 (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')
-rw-r--r-- | utility/config.c | 2 | ||||
-rw-r--r-- | utility/logparse.c | 12 | ||||
-rw-r--r-- | utility/logparse.h | 3 |
3 files changed, 9 insertions, 8 deletions
diff --git a/utility/config.c b/utility/config.c index 3b6e946..064a5e2 100644 --- a/utility/config.c +++ b/utility/config.c | |||
@@ -442,7 +442,7 @@ apr_status_t config_read(config_t *cfg, const char *filename, | |||
442 | if (*ptr == '\0') | 442 | if (*ptr == '\0') |
443 | continue; | 443 | continue; |
444 | apr_pool_clear(targp); | 444 | apr_pool_clear(targp); |
445 | apr_tokenize_to_argv(ptr, &targv, targp); | 445 | parser_tokenize_line(ptr, &targv, targp); |
446 | targc = 0; | 446 | targc = 0; |
447 | while (targv[targc]) | 447 | while (targv[targc]) |
448 | targc++; | 448 | targc++; |
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 | */ |
227 | static apr_status_t tokenize_logline(const char *arg_str, char ***argv_out, | 226 | apr_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++; |
diff --git a/utility/logparse.h b/utility/logparse.h index fe708a5..8f0fc42 100644 --- a/utility/logparse.h +++ b/utility/logparse.h | |||
@@ -23,6 +23,9 @@ void parser_init(apr_pool_t *p); | |||
23 | 23 | ||
24 | void parser_find_logs(config_t *cfg); | 24 | void parser_find_logs(config_t *cfg); |
25 | 25 | ||
26 | apr_status_t parser_tokenize_line(const char *arg_str, char ***argv_out, | ||
27 | apr_pool_t *token_context); | ||
28 | |||
26 | apr_status_t parser_parsefile(config_t *cfg, config_filestat_t *fstat); | 29 | apr_status_t parser_parsefile(config_t *cfg, config_filestat_t *fstat); |
27 | 30 | ||
28 | apr_status_t parser_processline(apr_pool_t *ptemp, config_t *cfg, | 31 | apr_status_t parser_processline(apr_pool_t *ptemp, config_t *cfg, |