input: reset after parse

This commit is contained in:
Peter McGoron 2021-07-10 15:45:51 -04:00
parent bbb7bb181a
commit 2e2c8bff35
1 changed files with 5 additions and 2 deletions

View File

@ -10,6 +10,7 @@ void libscomm_reset(struct libscomm_input *in) {
static enum libscomm_input_r parse(struct libscomm_input *in,
struct libscomm_line *line) {
char *s = in->intbuf;
enum libscomm_input_r r = LIBSCOMM_ARG_OVERFLOW;
line->name = (*s == ':');
line->len = 0;
@ -19,14 +20,16 @@ static enum libscomm_input_r parse(struct libscomm_input *in,
for (; *s && *s != '\t'; s++);
if (!*s) {
return LIBSCOMM_COMPLETE;
r = LIBSCOMM_COMPLETE;
break;
} else {
*s = 0;
s++;
}
}
return LIBSCOMM_ARG_OVERFLOW;
libscomm_reset(in);
return r;
}
enum libscomm_input_r libscomm_read(struct libscomm_input *in,