- switch (method) {
- case CONF_METHOD_LOCAL_FILE:
- for (i = 0; i < n_parsers; i++) {
- if (parsers[i]->method != CONF_METHOD_LOCAL_FILE)
- continue;
-
- pb_log("\ttrying parser '%s'\n", parsers[i]->name);
- ctx->parser = parsers[i];
- iterate_parser_files(ctx, ctx->parser);
- }
- ctx->parser = NULL;
- break;
-
- case CONF_METHOD_DHCP:
- rc = download_config(ctx, &buf, &len);
- if (rc) {
- pb_log("\tdownload failed, aborting\n");
- return;
- }
-
- for (i = 0; i < n_parsers; i++) {
- if (parsers[i]->method != method)
- continue;
+ list_for_each_entry(&parsers, i, list) {
+ pb_debug("\ttrying parser '%s'\n", i->parser->name);
+ ctx->parser = i->parser;
+ i->parser->parse(ctx);
+ }
+ ctx->parser = NULL;
+}