subsys: shell: fix accept either CR or LF as as line delimiter

1. Shell will accept CR or LF as line delimiter.
2. Macro SHELL_DEFINE simplified - it no longer requires
   new line character.
3. Fixes: #10207.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
Jakub Rzeszutko 2018-10-02 11:48:40 +02:00 committed by Anas Nashif
commit c471614cb6
4 changed files with 4 additions and 13 deletions

View file

@ -365,9 +365,6 @@ struct shell {
LOG_INSTANCE_PTR_DECLARE(log);
/*!< New line character, only allowed values: \\n and \\r.*/
const char newline_char;
struct k_thread *thread;
k_thread_stack_t *stack;
};
@ -378,12 +375,10 @@ struct shell {
* @param[in] _name Instance name.
* @param[in] _prompt Shell prompt string.
* @param[in] transport_iface Pointer to the transport interface.
* @param[in] newline_ch New line character - only allowed values are
* '\\n' or '\\r'.
* @param[in] log_queue_size Logger processing queue size.
*/
#define SHELL_DEFINE(_name, _prompt, transport_iface, \
newline_ch, log_queue_size) \
log_queue_size) \
static const struct shell _name; \
static struct shell_ctx UTIL_CAT(_name, _ctx); \
static char _name##prompt[CONFIG_SHELL_PROMPT_LENGTH + 1] = _prompt; \
@ -407,7 +402,6 @@ struct shell {
.stats = SHELL_STATS_PTR(_name), \
.log_backend = SHELL_LOG_BACKEND_PTR(_name), \
LOG_INSTANCE_PTR_INIT(log, shell, _name) \
.newline_char = newline_ch, \
.thread = &_name##_thread, \
.stack = _name##_stack \
}