From 47f1db868f0910a6206b0ce5d54d79f2771a6696 Mon Sep 17 00:00:00 2001 From: LokLiang Date: Thu, 27 Mar 2025 14:47:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=91=BD=E4=BB=A4=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E5=92=8C=E7=A9=BA=E6=A0=BC=E6=A3=80=E6=9F=A5=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=9C=80=E5=A4=A7=E5=91=BD=E4=BB=A4=E9=95=BF=E5=BA=A6=E7=9A=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/system/source/shell/sh.c | 30 ++++++++++++----------------- components/system/source/shell/sh.h | 4 ++-- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/components/system/source/shell/sh.c b/components/system/source/shell/sh.c index 230ead6..602fc86 100755 --- a/components/system/source/shell/sh.c +++ b/components/system/source/shell/sh.c @@ -317,29 +317,23 @@ static int _register_cmd_check_fn(sh_t *sh_hdl, const sh_cmd_reg_t *sh_reg, char if (strlen(cmd->cmd) >= CONFIG_SH_MAX_CMD_LEN) { - if (sh_hdl && sh_hdl->disable_echo == 0) - { - SYS_LOG_WRN("cmd: Command length exceeds the maximum limit!\r\n" - "Defined in file: %s:%d\r\n" - "Command: '%s'", - _FILENAME(sh_reg->file), - sh_reg->line, - cmd->cmd); - } + SYS_LOG_WRN("cmd: Command length exceeds the maximum limit!\r\n" + "Defined in file: %s:%d\r\n" + "Command: '%s'", + _FILENAME(sh_reg->file), + sh_reg->line, + cmd->cmd); return -1; } if (strchr(cmd->cmd, ' ')) { - if (sh_hdl && sh_hdl->disable_echo == 0) - { - SYS_LOG_WRN("cmd: Command cannot contain spaces!\r\n" - "Defined in file: %s:%d\r\n" - "Command: '%s'", - _FILENAME(sh_reg->file), - sh_reg->line, - cmd->cmd); - } + SYS_LOG_WRN("cmd: Command cannot contain spaces!\r\n" + "Defined in file: %s:%d\r\n" + "Command: '%s'", + _FILENAME(sh_reg->file), + sh_reg->line, + cmd->cmd); return -1; } diff --git a/components/system/source/shell/sh.h b/components/system/source/shell/sh.h index 69e9515..1857175 100755 --- a/components/system/source/shell/sh.h +++ b/components/system/source/shell/sh.h @@ -32,7 +32,7 @@ #endif #ifndef CONFIG_SH_MAX_CMD_LEN -#define CONFIG_SH_MAX_CMD_LEN ((CONFIG_SH_MAX_PARAM / 10) > 10 ? (CONFIG_SH_MAX_PARAM / 10) : 10) /* 最大单个命令长度(包含结束符 '\0' ) */ +#define CONFIG_SH_MAX_CMD_LEN ((CONFIG_SH_MAX_LINE_LEN / 10) > 10 ? (CONFIG_SH_MAX_LINE_LEN / 10) : 10) /* 最大单个命令长度(包含结束符 '\0' ) */ #endif typedef struct sh_obj_def sh_t; @@ -102,7 +102,7 @@ typedef struct sh_cmd typedef struct { - sys_psnode_t *reg_node; // 注意时设置的节点 + sys_psnode_t *reg_node; // 注册节点 const sh_cmd_t *cmd; // 命令数据 const char *file; // 文件 int line; // 行号