From 4c46bfeaa5ec5c6a87c29ece56891e070d3faee1 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Thu, 30 Oct 2008 03:16:51 +0000 Subject: 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) --- (limited to 'utility') 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, if (*ptr == '\0') continue; apr_pool_clear(targp); - apr_tokenize_to_argv(ptr, &targv, targp); + parser_tokenize_line(ptr, &targv, targp); targc = 0; while (targv[targc]) 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) * This value will be allocated from the contexts * pool and filled in with copies of the tokens * found during parsing of the arg_str. - * keepquotes: Keep the quotes instead of stripping them */ -static apr_status_t tokenize_logline(const char *arg_str, char ***argv_out, - apr_pool_t *token_context, int keepquotes) +apr_status_t parser_tokenize_line(const char *arg_str, char ***argv_out, + apr_pool_t *token_context) { const char *cp; const char *ct; @@ -259,8 +258,7 @@ static apr_status_t tokenize_logline(const char *arg_str, char ***argv_out, */ #define DETERMINE_NEXTSTRING(cp,isquoted) \ for ( ; *cp != '\0'; cp++) { \ - if ( (isquoted && (*cp == ' ' || *cp == '\t')) \ - || (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \ + if ( (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \ *(cp+1) == '"' || *(cp+1) == '\'' || \ *(cp+1) == '[' || *(cp+1) == ']'))) { \ cp++; \ @@ -324,7 +322,7 @@ static apr_status_t tokenize_logline(const char *arg_str, char ***argv_out, ct = cp; DETERMINE_NEXTSTRING(cp, isquoted); cp++; - if (isquoted && keepquotes) { + if (isquoted) { (*argv_out)[argnum] = apr_palloc(token_context, cp - ct + 2); apr_cpystrn((*argv_out)[argnum], ct -1, cp - ct + 2); } else { @@ -401,7 +399,7 @@ apr_status_t parser_parsefile(config_t *cfg, config_filestat_t *fstat) if (cont) continue; apr_pool_clear(targp); - tokenize_logline(buff, &targv, targp, 0); + parser_tokenize_line(buff, &targv, targp); targc = 0; while (targv[targc]) 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); void parser_find_logs(config_t *cfg); +apr_status_t parser_tokenize_line(const char *arg_str, char ***argv_out, + apr_pool_t *token_context); + apr_status_t parser_parsefile(config_t *cfg, config_filestat_t *fstat); apr_status_t parser_processline(apr_pool_t *ptemp, config_t *cfg, -- cgit v0.9.2