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,19 +82,17 @@ lif_interface_file_parse(struct lif_dict *collection, const char *filename)
* or "inet dhcp" or such to designate hints. lets pick up
* those hints here.
*/
char *inet_type = lif_next_token(&bufp);
if (!*inet_type)
continue;
char *hint = lif_next_token(&bufp);
if (!*hint)
continue;
if (!strcmp(hint, "dhcp"))
char *token = lif_next_token(&bufp);
while (*token)
{
if (!strcmp(token, "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"))
{