summaryrefslogtreecommitdiff
path: root/components/finsh/shell.c
diff options
context:
space:
mode:
authorWayne Lin <[email protected]>2022-01-10 12:36:11 +0800
committerWayne Lin <[email protected]>2022-01-10 12:36:11 +0800
commit715eecd3eb6cfbbc95aba4fdf932db2e1a7698fb (patch)
tree111003eb53eaa4a789729792a622d2abfd602031 /components/finsh/shell.c
parent6d2a7d00db2808f26b96efaebfa3aa18b6fd47b8 (diff)
parent5206f6504018d1e1978e1c547f6a5b782d505be5 (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into nuvoton
# Conflicts: # bsp/nuvoton/nk-980iot/.config # bsp/nuvoton/nk-n9h30/.config # bsp/nuvoton/nk-rtu980/.config # bsp/nuvoton/numaker-iot-m487/.config # bsp/nuvoton/numaker-m2354/.config # bsp/nuvoton/numaker-pfm-m487/.config
Diffstat (limited to 'components/finsh/shell.c')
-rw-r--r--components/finsh/shell.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index c5242d9527..5398db5370 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -146,7 +146,7 @@ int finsh_getchar(void)
{
#ifdef RT_USING_DEVICE
char ch = 0;
-#ifdef RT_USING_POSIX_DEVIO
+#ifdef RT_USING_POSIX_STDIO
if(read(STDIN_FILENO, &ch, 1) > 0)
{
return ch;
@@ -170,14 +170,14 @@ int finsh_getchar(void)
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
return ch;
-#endif /* RT_USING_POSIX_DEVIO */
+#endif /* RT_USING_POSIX_STDIO */
#else
extern char rt_hw_console_getchar(void);
return rt_hw_console_getchar();
#endif /* RT_USING_DEVICE */
}
-#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
+#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size)
{
RT_ASSERT(shell != RT_NULL);
@@ -221,7 +221,7 @@ void finsh_set_device(const char *device_name)
}
/* clear line buffer before switch to new device */
- memset(shell->line, 0, sizeof(shell->line));
+ rt_memset(shell->line, 0, sizeof(shell->line));
shell->line_curpos = shell->line_position = 0;
shell->device = dev;
@@ -241,7 +241,7 @@ const char *finsh_get_device()
RT_ASSERT(shell != RT_NULL);
return shell->device->parent.name;
}
-#endif /* !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE) */
+#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */
/**
* @ingroup finsh
@@ -404,11 +404,11 @@ static void shell_push_history(struct finsh_shell *shell)
int index;
for (index = 0; index < FINSH_HISTORY_LINES - 1; index ++)
{
- memcpy(&shell->cmd_history[index][0],
+ rt_memcpy(&shell->cmd_history[index][0],
&shell->cmd_history[index + 1][0], FINSH_CMD_SIZE);
}
- memset(&shell->cmd_history[index][0], 0, FINSH_CMD_SIZE);
- memcpy(&shell->cmd_history[index][0], shell->line, shell->line_position);
+ rt_memset(&shell->cmd_history[index][0], 0, FINSH_CMD_SIZE);
+ rt_memcpy(&shell->cmd_history[index][0], shell->line, shell->line_position);
/* it's the maximum history */
shell->history_count = FINSH_HISTORY_LINES;
@@ -420,8 +420,8 @@ static void shell_push_history(struct finsh_shell *shell)
if (shell->history_count == 0 || memcmp(&shell->cmd_history[shell->history_count - 1], shell->line, FINSH_CMD_SIZE))
{
shell->current_history = shell->history_count;
- memset(&shell->cmd_history[shell->history_count][0], 0, FINSH_CMD_SIZE);
- memcpy(&shell->cmd_history[shell->history_count][0], shell->line, shell->line_position);
+ rt_memset(&shell->cmd_history[shell->history_count][0], 0, FINSH_CMD_SIZE);
+ rt_memcpy(&shell->cmd_history[shell->history_count][0], shell->line, shell->line_position);
/* increase count and set current history position */
shell->history_count ++;
@@ -443,7 +443,7 @@ void finsh_thread_entry(void *parameter)
shell->echo_mode = 0;
#endif
-#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
+#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
/* set console device as shell device */
if (shell->device == RT_NULL)
{
@@ -453,7 +453,7 @@ void finsh_thread_entry(void *parameter)
finsh_set_device(console->parent.name);
}
}
-#endif /* !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE) */
+#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */
#ifdef FINSH_USING_AUTH
/* set the default password when the password isn't setting */
@@ -517,7 +517,7 @@ void finsh_thread_entry(void *parameter)
}
/* copy the history command */
- memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
+ rt_memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
FINSH_CMD_SIZE);
shell->line_curpos = shell->line_position = strlen(shell->line);
shell_handle_history(shell);
@@ -539,7 +539,7 @@ void finsh_thread_entry(void *parameter)
continue;
}
- memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
+ rt_memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
FINSH_CMD_SIZE);
shell->line_curpos = shell->line_position = strlen(shell->line);
shell_handle_history(shell);
@@ -630,7 +630,7 @@ void finsh_thread_entry(void *parameter)
msh_exec(shell->line, shell->line_position);
rt_kprintf(FINSH_PROMPT);
- memset(shell->line, 0, sizeof(shell->line));
+ rt_memset(shell->line, 0, sizeof(shell->line));
shell->line_curpos = shell->line_position = 0;
continue;
}