X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=filter_chain.c;h=4c1f94bcb890526548e1702209625add432232e1;hp=6265f19c931dc26b53a76eecfd887164961c928d;hb=ccf42979a31a56e991b5c6d7d4043381f7487d6e;hpb=7533926d69875da66c5dc45940f67cb5d659738e diff --git a/filter_chain.c b/filter_chain.c index 6265f19c..4c1f94bc 100644 --- a/filter_chain.c +++ b/filter_chain.c @@ -186,32 +186,27 @@ static int parse_filter_args(int filter_num, char *options, void **conf) { struct filter *f = &filters[filter_num]; int i, argc = 2; - char *dummy_args[] = {"", "", NULL}; char **argv; // PARA_DEBUG_LOG("%s, options: %s, parser: %p\n", f->name, // options? options : "(none)", f->parse_config); if (!f->parse_config) - return options? -E_BAD_FILTER_OPTIONS : filter_num; - if (options) { -// PARA_DEBUG_LOG("options: %s\n", options); - argc = split_args(options, &argv, ' '); + return strlen(options)? -E_BAD_FILTER_OPTIONS : filter_num; +// PARA_DEBUG_LOG("options: %s\n", options); + argc = split_args(options, &argv, " \t"); // PARA_DEBUG_LOG("argc = %d, argv[0]: %s\n", argc, argv[0]); - for (i = argc; i >= 0; i--) - argv[i + 1] = argv[i]; - argc += 2; - *conf = f->parse_config(argc, argv); - } else { - /* is it OK to have no options? */ - *conf = f->parse_config(2, dummy_args); - } + for (i = argc - 1; i >= 0; i--) + argv[i + 1] = argv[i]; + argv[0] = para_strdup(f->name); + argc += 1; + *conf = f->parse_config(argc, argv); return *conf? filter_num : -E_BAD_FILTER_OPTIONS; } /** * check the filter command line options * - * \param fa the command line options (values separated by colons) + * \param fa the command line options * \param conf points to the filter configuration upon successful return * * Check if \a fa starts with a the name of a supported filter, followed by @@ -245,7 +240,8 @@ int check_filter_arg(char *fa, void **conf) continue; if (c && !filters[j].parse_config) return -E_BAD_FILTER_OPTIONS; - return parse_filter_args(j, c? fa + len + 1 : NULL, conf); + return parse_filter_args(j, c? fa + len + 1 : + fa + strlen(fa), conf); } return -E_UNSUPPORTED_FILTER; }