- int j;
-
- *conf = NULL;
-// PARA_DEBUG_LOG("arg: %s\n", fa);
- FOR_EACH_SUPPORTED_FILTER(j) {
- const char *name = filters[j].name;
- size_t len = strlen(name);
- char c;
- if (strlen(fa) < len)
- continue;
- if (strncmp(name, fa, len))
- continue;
- c = fa[len];
- if (c && c != ' ')
- continue;
- if (c && !filters[j].parse_config)
- return -E_BAD_FILTER_OPTIONS;
- return parse_filter_args(j, c? fa + len + 1 :
- fa + strlen(fa), conf);
+ int ret, filter_num, argc;
+ char *errctx = NULL, **argv;
+ const struct lls_command *cmd;
+ const struct filter *f;
+
+ ret = create_argv(fa, " \t\n", &argv);
+ if (ret < 0)
+ goto fail;
+ argc = ret;
+ ret = lls(lls_lookup_subcmd(argv[0], filter_cmd_suite, &errctx));
+ if (ret < 0)
+ goto free_argv;
+ filter_num = ret;
+ cmd = FILTER_CMD(filter_num);
+ if (!filter_supported(filter_num)) {
+ ret = -E_UNSUPPORTED_FILTER;
+ errctx = make_message("bad filter name: %s",
+ lls_command_name(cmd));
+ goto free_argv;