diff options
author | Stef Walter <stef@memberwebs.com> | 2006-08-30 21:44:58 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2006-08-30 21:44:58 +0000 |
commit | ddd22b0e7f227ee61ca030b0050ecbcb339403b7 (patch) | |
tree | 5a38eee7fbb0358d6c3f0f9091f673fab8842b20 | |
parent | 327324d952b6be55c815172607d8c80fd28ba367 (diff) |
Fix up escaping of commands passed to rrdgraph
-rw-r--r-- | tools/rrdui-cgi.c | 18 |
1 files changed, 9 insertions, 9 deletions
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); } |