input: reset after parse
This commit is contained in:
parent
bbb7bb181a
commit
2e2c8bff35
7
input.c
7
input.c
|
@ -10,6 +10,7 @@ void libscomm_reset(struct libscomm_input *in) {
|
||||||
static enum libscomm_input_r parse(struct libscomm_input *in,
|
static enum libscomm_input_r parse(struct libscomm_input *in,
|
||||||
struct libscomm_line *line) {
|
struct libscomm_line *line) {
|
||||||
char *s = in->intbuf;
|
char *s = in->intbuf;
|
||||||
|
enum libscomm_input_r r = LIBSCOMM_ARG_OVERFLOW;
|
||||||
|
|
||||||
line->name = (*s == ':');
|
line->name = (*s == ':');
|
||||||
line->len = 0;
|
line->len = 0;
|
||||||
|
@ -19,14 +20,16 @@ static enum libscomm_input_r parse(struct libscomm_input *in,
|
||||||
for (; *s && *s != '\t'; s++);
|
for (; *s && *s != '\t'; s++);
|
||||||
|
|
||||||
if (!*s) {
|
if (!*s) {
|
||||||
return LIBSCOMM_COMPLETE;
|
r = LIBSCOMM_COMPLETE;
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
*s = 0;
|
*s = 0;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LIBSCOMM_ARG_OVERFLOW;
|
libscomm_reset(in);
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum libscomm_input_r libscomm_read(struct libscomm_input *in,
|
enum libscomm_input_r libscomm_read(struct libscomm_input *in,
|
||||||
|
|
Loading…
Reference in New Issue