state: use lif_next_token() when parsing ifstate files

This commit is contained in:
Ariadne Conill 2020-09-08 14:46:07 -06:00
parent 3b10494b40
commit 923b96fab8

View file

@ -16,14 +16,17 @@
#include <string.h> #include <string.h>
#include "libifupdown/state.h" #include "libifupdown/state.h"
#include "libifupdown/fgetline.h" #include "libifupdown/fgetline.h"
#include "libifupdown/tokenize.h"
bool bool
lif_state_read(struct lif_dict *state, FILE *fd) lif_state_read(struct lif_dict *state, FILE *fd)
{ {
char linebuf[4096]; char linebuf[4096];
char *bufp = linebuf;
while (lif_fgetline(linebuf, sizeof linebuf, fd)) while (lif_fgetline(linebuf, sizeof linebuf, fd))
{ {
char *ifname = linebuf; char *ifname = lif_next_token(&bufp);
char *equals_p = strchr(linebuf, '='); char *equals_p = strchr(linebuf, '=');
if (equals_p == NULL) if (equals_p == NULL)