1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #3308 from kaspar030/shell_improvements

sys: shell: some prompt improvements
This commit is contained in:
Peter Kietzmann 2015-07-06 13:31:24 +02:00
commit 83b8723938

View File

@ -223,15 +223,12 @@ static int readline(shell_t *shell, char *buf, size_t size)
/* QEMU transmits only a single '\r' == 13 on hitting enter ("-serial stdio"). */
/* DOS newlines are handled like hitting enter twice, but empty lines are ignored. */
if (c == '\r' || c == '\n') {
if (line_buf_ptr == buf) {
/* The line is empty. */
continue;
}
*line_buf_ptr = '\0';
shell->put_char('\r');
shell->put_char('\n');
return 0;
/* return 1 if line is empty, 0 otherwise */
return line_buf_ptr == buf;
}
/* QEMU uses 0x7f (DEL) as backspace, while 0x08 (BS) is for most terminals */
else if (c == 0x08 || c == 0x7f) {
@ -257,6 +254,11 @@ static inline void print_prompt(shell_t *shell)
{
shell->put_char('>');
shell->put_char(' ');
#ifdef MODULE_NEWLIB
fflush(stdout);
#endif
return;
}