interface file: simplify scanning iface directives for relevant keywords

This commit is contained in:
Ariadne Conill 2020-08-04 11:32:34 -06:00
parent 1964a99e5d
commit 0eb25f1d62

View file

@ -82,18 +82,16 @@ lif_interface_file_parse(struct lif_dict *collection, const char *filename)
* or "inet dhcp" or such to designate hints. lets pick up * or "inet dhcp" or such to designate hints. lets pick up
* those hints here. * those hints here.
*/ */
char *inet_type = lif_next_token(&bufp); char *token = lif_next_token(&bufp);
if (!*inet_type) while (*token)
continue;
char *hint = lif_next_token(&bufp);
if (!*hint)
continue;
if (!strcmp(hint, "dhcp"))
{ {
cur_iface->is_dhcp = true; if (!strcmp(token, "dhcp"))
lif_dict_add(&cur_iface->vars, "use", strdup("dhcp")); {
cur_iface->is_dhcp = true;
lif_dict_add(&cur_iface->vars, "use", strdup("dhcp"));
}
token = lif_next_token(&bufp);
} }
} }
else if (!strcmp(token, "use")) else if (!strcmp(token, "use"))