diff --git a/input.c b/input.c index 0845a04..550292a 100644 --- a/input.c +++ b/input.c @@ -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,