- struct filter_cmdline_parser_params params = {
- .override = 0,
- .initialize = 0,
- .check_required = 0,
- .check_ambiguity = 0,
- .print_errors = 1
- };
- filter_cmdline_parser_config_file(cf, &conf, ¶ms);
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
+ void *map;
+ size_t sz;
+ int cf_argc;
+ char **cf_argv, *errctx;
+ struct lls_parse_result *cf_lpr, *merged_lpr;
+
+ ret = mmap_full_file(cf, O_RDONLY, &map, &sz, NULL);
+ if (ret != -E_EMPTY) {
+ if (ret < 0)
+ return ret;
+ ret = lls(lls_convert_config(map, sz, NULL, &cf_argv,
+ &errctx));
+ para_munmap(map, sz);
+ if (ret < 0) {
+ PARA_ERROR_LOG("syntax error in %s\n", cf);
+ return ret;
+ }
+ cf_argc = ret;
+ ret = lls(lls_parse(cf_argc, cf_argv, CMD_PTR, &cf_lpr,
+ &errctx));
+ lls_free_argv(cf_argv);
+ if (ret < 0) {
+ PARA_ERROR_LOG("parse error in %s\n", cf);
+ return ret;
+ }
+ ret = lls(lls_merge(lpr, cf_lpr, CMD_PTR, &merged_lpr, &errctx));
+ lls_free_parse_result(cf_lpr, CMD_PTR);
+ if (ret < 0)
+ return ret;
+ lls_free_parse_result(lpr, CMD_PTR);
+ lpr = merged_lpr;
+ loglevel = OPT_UINT32_VAL(LOGLEVEL);
+ }
+ }
+ if (!OPT_GIVEN(FILTER)) {
+ print_filter_list();
+ exit(EXIT_SUCCESS);