}
-int cmdline_poll(void)
+void cmdline_poll(void)
{
const char *history, *buffer;
int8_t ret, same = 0;
int16_t c;
- c = cmdline_dev_recv(NULL);
- if (c < 0)
- return -1;
-
- ret = rdline_char_in(&imuboard.rdl, c);
- if (ret == 1) {
- buffer = rdline_get_buffer(&imuboard.rdl);
- history = rdline_get_history_item(&imuboard.rdl, 0);
- if (history) {
- same = !memcmp(buffer, history, strlen(history)) &&
- buffer[strlen(history)] == '\n';
+ while (1) {
+ c = cmdline_dev_recv(NULL);
+ if (c < 0)
+ break;
+
+ ret = rdline_char_in(&imuboard.rdl, c);
+ if (ret == 1) {
+ buffer = rdline_get_buffer(&imuboard.rdl);
+ history = rdline_get_history_item(&imuboard.rdl, 0);
+ if (history) {
+ same = !memcmp(buffer, history, strlen(history)) &&
+ buffer[strlen(history)] == '\n';
+ }
+ else
+ same = 0;
+ if (strlen(buffer) > 1 && !same)
+ rdline_add_history(&imuboard.rdl, buffer);
+
+ if (imuboard.rdl.status != RDLINE_STOPPED)
+ rdline_newline(&imuboard.rdl, imuboard.prompt);
}
- else
- same = 0;
- if (strlen(buffer) > 1 && !same)
- rdline_add_history(&imuboard.rdl, buffer);
-
- if (imuboard.rdl.status != RDLINE_STOPPED)
- rdline_newline(&imuboard.rdl, imuboard.prompt);
}
-
- return 0;
}
void cmdline_init(void)
void mylog(struct error * e, ...);
/* poll cmdline */
-int cmdline_poll(void);
+void cmdline_poll(void);
int cmdline_dev_send(char c, FILE* f);
int cmdline_dev_recv(FILE* f);