summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f544559)
int curarg_contains_rrd_directives;
/* local array of arguments while parsing */
int curarg_contains_rrd_directives;
/* local array of arguments while parsing */
char **argv;
#ifdef DEBUG_PARSER
char **argv;
#ifdef DEBUG_PARSER
if (!argv) {
return NULL;
}
if (!argv) {
return NULL;
}
/* skip leading blanks */
while (isspace((int) *line)) {
/* skip leading blanks */
while (isspace((int) *line)) {
argv[argc - 1] = rrd_expand_vars(stralloc(argv[argc - 1]));
}
#ifdef DEBUG_PARSER
argv[argc - 1] = rrd_expand_vars(stralloc(argv[argc - 1]));
}
#ifdef DEBUG_PARSER
int n;
printf("<-- arguments found [%d]\n", argc);
int n;
printf("<-- arguments found [%d]\n", argc);
#endif
/* update caller's notion of the argument array and it's size */
#endif
/* update caller's notion of the argument array and it's size */
- *arguments = argv;
- *argument_count = argc;
+
+ /* note this is a bit of a hack since the rrd_cgi code used to just put
+ its arguments into a normal array starting at 0 ... since the rrd_*
+ commands expect and argc/argv array we used to just shift everything
+ by -1 ... this in turn exploded when a rrd_* function tried to print
+ argv[0] ... hence we are now doing everything in argv style but hand
+ over seemingly the old array ... but doing argv-1 will actually end
+ up in a 'good' place now. */
+
+ *arguments = argv+1;
+ *argument_count = argc-1;
if (Quote) {
return NULL;
if (Quote) {
return NULL;
if (end) {
/* got arguments, call function for 'tag' with arguments */
val = func(argc, (const char **) args);
if (end) {
/* got arguments, call function for 'tag' with arguments */
val = func(argc, (const char **) args);
} else {
/* unable to parse arguments, undo 0-termination by scanargs */
for (; argc > 0; argc--) {
} else {
/* unable to parse arguments, undo 0-termination by scanargs */
for (; argc > 0; argc--) {