From fdf12d01b39c4bc00a958ce58656c042d02d3214 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 8 Apr 2016 14:51:08 +0200 Subject: [PATCH] sys/shell: adding definition for deactiving prompt and/or echo in shell --- sys/shell/shell.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/shell/shell.c b/sys/shell/shell.c index fba645dea8..f8f62b3cf4 100644 --- a/sys/shell/shell.c +++ b/sys/shell/shell.c @@ -234,8 +234,10 @@ static int readline(char *buf, size_t size) /* DOS newlines are handled like hitting enter twice, but empty lines are ignored. */ if (c == '\r' || c == '\n') { *line_buf_ptr = '\0'; +#ifndef SHELL_NO_ECHO _putchar('\r'); _putchar('\n'); +#endif /* return 1 if line is empty, 0 otherwise */ return line_buf_ptr == buf; @@ -249,21 +251,27 @@ static int readline(char *buf, size_t size) *--line_buf_ptr = '\0'; /* white-tape the character */ +#ifndef SHELL_NO_ECHO _putchar('\b'); _putchar(' '); _putchar('\b'); +#endif } else { *line_buf_ptr++ = c; +#ifndef SHELL_NO_ECHO _putchar(c); +#endif } } } static inline void print_prompt(void) { +#ifndef SHELL_NO_PROMPT _putchar('>'); _putchar(' '); +#endif #ifdef MODULE_NEWLIB fflush(stdout);