From 931cdb1f6f844810c4bc58f8e3f0f19e031b8e20 Mon Sep 17 00:00:00 2001 From: "chenchaoqun@rt-thread.com" Date: Wed, 7 Nov 2018 14:31:32 +0800 Subject: [PATCH] [finsh/shell] compatible definition for cube package --- components/finsh/cmd.c | 6 ++++++ components/finsh/msh.c | 4 ++++ components/finsh/msh_cmd.c | 10 +++++----- components/finsh/msh_file.c | 9 +++++---- components/finsh/shell.c | 5 +++++ components/finsh/symbol.c | 8 ++++++++ 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 0e04b794e9..a97ef3caab 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -28,6 +28,9 @@ */ #include + +#ifdef RT_USING_FINSH + #include "finsh.h" long hello(void) @@ -831,3 +834,6 @@ void list_prefix(char *prefix) static int dummy = 0; FINSH_VAR_EXPORT(dummy, finsh_type_int, dummy variable for finsh) #endif + +#endif /* RT_USING_FINSH */ + diff --git a/components/finsh/msh.c b/components/finsh/msh.c index ae5214cc2c..fd1ee1198d 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -9,6 +9,9 @@ * 2014-01-03 Bernard msh can execute module. * 2017-07-19 Aubr.Cool limit argc to RT_FINSH_ARG_MAX */ +#include + +#ifdef FINSH_USING_MSH #include "msh.h" #include @@ -610,3 +613,4 @@ void msh_auto_complete(char *prefix) } #endif +#endif /* FINSH_USING_MSH */ diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c index 8f5de3cc16..3c90542456 100644 --- a/components/finsh/msh_cmd.c +++ b/components/finsh/msh_cmd.c @@ -10,11 +10,12 @@ */ #include -#include - -#include "msh.h" #ifdef FINSH_USING_MSH + +#include +#include "msh.h" + #ifdef RT_USING_DFS #include @@ -418,5 +419,4 @@ int cmd_free(int argc, char **argv) FINSH_FUNCTION_EXPORT_ALIAS(cmd_free, __cmd_free, Show the memory usage in the system.); #endif -#endif - +#endif /* FINSH_USING_MSH */ diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c index ecab250859..d8eec0a71a 100644 --- a/components/finsh/msh_file.c +++ b/components/finsh/msh_file.c @@ -9,11 +9,11 @@ */ #include -#include - -#include "msh.h" #if defined(FINSH_USING_MSH) && defined(RT_USING_DFS) + +#include +#include "msh.h" #include static int msh_readline(int fd, char *line_buf, int size) @@ -137,4 +137,5 @@ int msh_exec_script(const char *cmd_line, int size) return ret; } -#endif +#endif /* defined(FINSH_USING_MSH) && defined(RT_USING_DFS) */ + diff --git a/components/finsh/shell.c b/components/finsh/shell.c index e4b27004d5..f96e1f8928 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -20,6 +20,8 @@ #include +#ifdef RT_USING_FINSH + #include "finsh.h" #include "shell.h" @@ -847,3 +849,6 @@ int finsh_system_init(void) return 0; } INIT_APP_EXPORT(finsh_system_init); + +#endif /* RT_USING_FINSH */ + diff --git a/components/finsh/symbol.c b/components/finsh/symbol.c index a8c64dfdd5..e500637bdd 100644 --- a/components/finsh/symbol.c +++ b/components/finsh/symbol.c @@ -7,6 +7,11 @@ * Date Author Notes * 2010-03-22 Bernard first version */ + +#include + +#ifdef RT_USING_FINSH + #include "finsh.h" long hello(void); @@ -63,3 +68,6 @@ struct finsh_syscall *_syscall_table_end = &_syscall_table[sizeof(_syscall_tab struct finsh_sysvar *_sysvar_table_begin = NULL; struct finsh_sysvar *_sysvar_table_end = NULL; #endif + +#endif /* RT_USING_FINSH */ +