From 7d1d942f92a6ee4114c78b58516649bae9c2ae92 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Tue, 11 May 2021 11:35:50 +0200 Subject: [PATCH 1/3] ALign comments --- lwshell/src/lwshell/lwshell.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lwshell/src/lwshell/lwshell.c b/lwshell/src/lwshell/lwshell.c index 2f76dd9..c4819b7 100644 --- a/lwshell/src/lwshell/lwshell.c +++ b/lwshell/src/lwshell/lwshell.c @@ -35,12 +35,12 @@ #include "lwshell/lwshell.h" /* Default characters */ -#define LWSHELL_ASCII_NULL 0x00 /*!< Null character */ -#define LWSHELL_ASCII_BACKSPACE 0x08 /*!< Backspace */ -#define LWSHELL_ASCII_LF 0x0A /*!< Line feed */ -#define LWSHELL_ASCII_CR 0x0D /*!< Carriage return */ -#define LWSHELL_ASCII_DEL 0x7F /*!< Delete character */ -#define LWSHELL_ASCII_SPACE 0x20 /*!< Space character */ +#define LWSHELL_ASCII_NULL 0x00/*!< Null character */ +#define LWSHELL_ASCII_BACKSPACE 0x08/*!< Backspace */ +#define LWSHELL_ASCII_LF 0x0A/*!< Line feed */ +#define LWSHELL_ASCII_CR 0x0D/*!< Carriage return */ +#define LWSHELL_ASCII_DEL 0x7F/*!< Delete character */ +#define LWSHELL_ASCII_SPACE 0x20/*!< Space character */ #if LWSHELL_CFG_USE_OUTPUT #define LW_OUTPUT(lw, str) do { if ((lw)->out_fn != NULL && (str) != NULL) { (lw)->out_fn((str), (lw)); }} while (0) @@ -121,7 +121,7 @@ prv_parse_input(lwshell_t* lw) { /* Check if it starts with quote to handle escapes */ if (*str == '"') { ++str; - lw->argv[lw->argc++] = str; /* Set start of argument after quotes */ + lw->argv[lw->argc++] = str; /* Set start of argument after quotes */ /* Process until end of quote */ while (*str != '\0') { @@ -139,10 +139,10 @@ prv_parse_input(lwshell_t* lw) { } } } else { - lw->argv[lw->argc++] = str; /* Set start of argument directly on character */ + lw->argv[lw->argc++] = str; /* Set start of argument directly on character */ while ((*str != ' ' && *str != '\0')) { - if (*str == '"') { /* Quote should not be here... */ - *str = '\0'; /* ...add NULL termination to end token */ + if (*str == '"') { /* Quote should not be here... */ + *str = '\0'; /* ...add NULL termination to end token */ } ++str; } From 22b43eb3e2dc1c84f93df08a40cafbb753d169e5 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Wed, 27 Oct 2021 08:42:34 +0200 Subject: [PATCH 2/3] Fix bug for cmd selection --- lwshell/src/lwshell/lwshell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lwshell/src/lwshell/lwshell.c b/lwshell/src/lwshell/lwshell.c index c4819b7..7e8d923 100644 --- a/lwshell/src/lwshell/lwshell.c +++ b/lwshell/src/lwshell/lwshell.c @@ -161,7 +161,8 @@ prv_parse_input(lwshell_t* lw) { lwshell_cmd_t* c = NULL; /* Process all commands */ for (size_t i = 0; i < cmds_cnt; ++i) { - if (strncmp(cmds[i].name, lw->argv[0], strlen(lw->argv[0])) == 0) { + if (strlen(lw->argv[0]) == strlen(cmds[i].name) + && strncmp(cmds[i].name, lw->argv[0], strlen(lw->argv[0])) == 0) { c = &cmds[i]; break; } From aea252dda39536ab131bc6334eb5d91b137090b9 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Wed, 27 Oct 2021 21:33:01 +0200 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 633af73..fb93478 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Develop + +- Fix wrong parsing of command names + ## v1.0.0 - +- Initial release