summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-08-30 21:44:58 +0000
committerStef Walter <stef@memberwebs.com>2006-08-30 21:44:58 +0000
commitddd22b0e7f227ee61ca030b0050ecbcb339403b7 (patch)
tree5a38eee7fbb0358d6c3f0f9091f673fab8842b20 /tools
parent327324d952b6be55c815172607d8c80fd28ba367 (diff)
Fix up escaping of commands passed to rrdgraph
Diffstat (limited to 'tools')
-rw-r--r--tools/rrdui-cgi.c18
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);
}