From ddd22b0e7f227ee61ca030b0050ecbcb339403b7 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 30 Aug 2006 21:44:58 +0000 Subject: Fix up escaping of commands passed to rrdgraph --- tools/rrdui-cgi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/rrdui-cgi.c b/tools/rrdui-cgi.c index b593bf5..4b6b09c 100644 --- a/tools/rrdui-cgi.c +++ b/tools/rrdui-cgi.c @@ -130,9 +130,9 @@ parse_argv(const char* s, const char*** argvp) argv[argc] = buf; for (src = s; r == 0 && *src; src++) { - if (quote != '\0') { - if (quote == *src) - quote = '\0'; + if (quote == *src) { + quote = '\0'; + } else if (quote != '\0') { if (*src == '\\') { *buf++ = *src++; if (!*src) { @@ -159,16 +159,16 @@ parse_argv(const char* s, const char*** argvp) } } else { switch (*src) { + case '"': + case '\'': + quote = *src; + break; case '\\': *buf++ = *src++; if (!*src) { r = -1; errno = EINVAL; continue; } - case '"': - case '\'': - quote = *src; - /* Fall through */ default: *buf++ = *src; break; @@ -508,13 +508,13 @@ run_rrd(int argc, const char** argv) optind = 0; opterr = 0; -//#ifdef TEST +#ifdef TEST { int i; for(i = 0; i < argc; i++) fprintf(stderr, "%s\n", argv[i]); } -//#endif +#endif return rrd_graph(argc, (char**)argv, &text, &x, &y, stdout, &min, &max); } -- cgit v1.2.3