summaryrefslogtreecommitdiff
path: root/components/finsh
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
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')
-rw-r--r--components/finsh/finsh.h2
-rw-r--r--components/finsh/msh.c8
-rw-r--r--components/finsh/msh_file.c2
-rw-r--r--components/finsh/shell.c30
-rw-r--r--components/finsh/shell.h2
5 files changed, 22 insertions, 22 deletions
diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h
index 865627fd79..05399e1863 100644
--- a/components/finsh/finsh.h
+++ b/components/finsh/finsh.h
@@ -168,7 +168,7 @@ extern struct finsh_syscall *_syscall_table_begin, *_syscall_table_end;
/* find out system call, which should be implemented in user program */
struct finsh_syscall *finsh_syscall_lookup(const char *name);
-#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
+#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
void finsh_set_device(const char *device_name);
#endif
diff --git a/components/finsh/msh.c b/components/finsh/msh.c
index 47ee1efa59..acb5445ad1 100644
--- a/components/finsh/msh.c
+++ b/components/finsh/msh.c
@@ -71,7 +71,7 @@ MSH_CMD_EXPORT_ALIAS(cmd_ps, ps, List threads in the system.);
#ifdef RT_USING_HEAP
int cmd_free(int argc, char **argv)
{
- rt_uint32_t total = 0, used = 0, max_used = 0;
+ rt_size_t total = 0, used = 0, max_used = 0;
rt_memory_info(&total, &used, &max_used);
rt_kprintf("total : %d\n", total);
@@ -207,7 +207,7 @@ int msh_exec_module(const char *cmd_line, int size)
return -RT_ENOMEM;
/* copy command0 */
- memcpy(pg_name, cmd_line, cmd_length);
+ rt_memcpy(pg_name, cmd_line, cmd_length);
pg_name[cmd_length] = '\0';
if (strstr(pg_name, ".mo") != RT_NULL || strstr(pg_name, ".MO") != RT_NULL)
@@ -276,7 +276,7 @@ static int _msh_exec_cmd(char *cmd, rt_size_t length, int *retp)
return -RT_ERROR;
/* split arguments */
- memset(argv, 0x00, sizeof(argv));
+ rt_memset(argv, 0x00, sizeof(argv));
argc = msh_split(cmd, length, argv);
if (argc == 0)
return -RT_ERROR;
@@ -509,7 +509,7 @@ void msh_auto_complete_path(char *path)
}
length = index - path;
- memcpy(index, full_path, min_length);
+ rt_memcpy(index, full_path, min_length);
path[length + min_length] = '\0';
}
}
diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c
index 2b359fb4bc..8022b176fc 100644
--- a/components/finsh/msh_file.c
+++ b/components/finsh/msh_file.c
@@ -78,7 +78,7 @@ int msh_exec_script(const char *cmd_line, int size)
if (pg_name == RT_NULL) return -RT_ENOMEM;
/* copy command0 */
- memcpy(pg_name, cmd_line, cmd_length);
+ rt_memcpy(pg_name, cmd_line, cmd_length);
pg_name[cmd_length] = '\0';
if (strstr(pg_name, ".sh") != RT_NULL || strstr(pg_name, ".SH") != RT_NULL)
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;
}
diff --git a/components/finsh/shell.h b/components/finsh/shell.h
index 0c20ba60dd..a74f4dad05 100644
--- a/components/finsh/shell.h
+++ b/components/finsh/shell.h
@@ -78,7 +78,7 @@ struct finsh_shell
rt_uint16_t line_position;
rt_uint16_t line_curpos;
-#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
+#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
rt_device_t device;
#endif