From 354096a9730611e2af046273e5758c6504cac79e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 25 Mar 2018 15:10:41 +0000 Subject: Fixed bug #930. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11855 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/various/shell/shell.c | 6 +++--- os/various/shell/shell.h | 15 ++++++++------- os/various/shell/shell_cmd.c | 34 +++++++++++++++++----------------- 3 files changed, 28 insertions(+), 27 deletions(-) (limited to 'os/various') diff --git a/os/various/shell/shell.c b/os/various/shell/shell.c index 1b6662136..f699901ec 100644 --- a/os/various/shell/shell.c +++ b/os/various/shell/shell.c @@ -353,7 +353,7 @@ THD_FUNCTION(shellThread, p) { #endif chprintf(chp, SHELL_NEWLINE_STR); - chprintf(chp, "ChibiOS/RT Shell"SHELL_NEWLINE_STR); + chprintf(chp, "ChibiOS/RT Shell" SHELL_NEWLINE_STR); while (true) { chprintf(chp, SHELL_PROMPT_STR); if (shellGetLine(scfg, line, sizeof(line), shp)) { @@ -372,7 +372,7 @@ THD_FUNCTION(shellThread, p) { n = 0; while ((lp = parse_arguments(NULL, &tokp)) != NULL) { if (n >= SHELL_MAX_ARGUMENTS) { - chprintf(chp, "too many arguments"SHELL_NEWLINE_STR); + chprintf(chp, "too many arguments" SHELL_NEWLINE_STR); cmd = NULL; break; } @@ -394,7 +394,7 @@ THD_FUNCTION(shellThread, p) { else if (cmdexec(shell_local_commands, chp, cmd, n, args) && ((scp == NULL) || cmdexec(scp, chp, cmd, n, args))) { chprintf(chp, "%s", cmd); - chprintf(chp, " ?"SHELL_NEWLINE_STR); + chprintf(chp, " ?" SHELL_NEWLINE_STR); } } } diff --git a/os/various/shell/shell.h b/os/various/shell/shell.h index 97518b4e0..cecf5969b 100644 --- a/os/various/shell/shell.h +++ b/os/various/shell/shell.h @@ -174,10 +174,10 @@ typedef struct { * * @notapi */ -#define _shell_reset_cur(stream) chprintf(stream, "\033[%dD\033[%dC", \ - SHELL_MAX_LINE_LENGTH + \ - strlen(SHELL_PROMPT_STR) + 2, \ - strlen(SHELL_PROMPT_STR)) +#define _shell_reset_cur(stream) chprintf(stream, "\033[%dD\033[%dC", \ + SHELL_MAX_LINE_LENGTH + \ + strlen(SHELL_PROMPT_STR) + 2, \ + strlen(SHELL_PROMPT_STR)) /** * @brief Send escape codes to clear the rest of the line @@ -196,8 +196,8 @@ typedef struct { * * @api */ -#define shellUsage(stream, message) \ - chprintf(stream, "Usage: %s"SHELL_NEWLINE_STR, message) +#define shellUsage(stream, message) \ + chprintf(stream, "Usage: %s" SHELL_NEWLINE_STR, message) /*===========================================================================*/ /* External declarations. */ @@ -213,7 +213,8 @@ extern "C" { void shellInit(void); THD_FUNCTION(shellThread, p); void shellExit(msg_t msg); - bool shellGetLine(ShellConfig *scfg, char *line, unsigned size, ShellHistory *shp); + bool shellGetLine(ShellConfig *scfg, char *line, + unsigned size, ShellHistory *shp); #ifdef __cplusplus } #endif diff --git a/os/various/shell/shell_cmd.c b/os/various/shell/shell_cmd.c index 37f80020e..525f26980 100644 --- a/os/various/shell/shell_cmd.c +++ b/os/various/shell/shell_cmd.c @@ -78,26 +78,26 @@ static void cmd_info(BaseSequentialStream *chp, int argc, char *argv[]) { return; } - chprintf(chp, "Kernel: %s"SHELL_NEWLINE_STR, CH_KERNEL_VERSION); + chprintf(chp, "Kernel: %s" SHELL_NEWLINE_STR, CH_KERNEL_VERSION); #ifdef PORT_COMPILER_NAME - chprintf(chp, "Compiler: %s"SHELL_NEWLINE_STR, PORT_COMPILER_NAME); + chprintf(chp, "Compiler: %s" SHELL_NEWLINE_STR, PORT_COMPILER_NAME); #endif - chprintf(chp, "Architecture: %s"SHELL_NEWLINE_STR, PORT_ARCHITECTURE_NAME); + chprintf(chp, "Architecture: %s" SHELL_NEWLINE_STR, PORT_ARCHITECTURE_NAME); #ifdef PORT_CORE_VARIANT_NAME - chprintf(chp, "Core Variant: %s"SHELL_NEWLINE_STR, PORT_CORE_VARIANT_NAME); + chprintf(chp, "Core Variant: %s" SHELL_NEWLINE_STR, PORT_CORE_VARIANT_NAME); #endif #ifdef PORT_INFO - chprintf(chp, "Port Info: %s"SHELL_NEWLINE_STR, PORT_INFO); + chprintf(chp, "Port Info: %s" SHELL_NEWLINE_STR, PORT_INFO); #endif #ifdef PLATFORM_NAME - chprintf(chp, "Platform: %s"SHELL_NEWLINE_STR, PLATFORM_NAME); + chprintf(chp, "Platform: %s" SHELL_NEWLINE_STR, PLATFORM_NAME); #endif #ifdef BOARD_NAME - chprintf(chp, "Board: %s"SHELL_NEWLINE_STR, BOARD_NAME); + chprintf(chp, "Board: %s" SHELL_NEWLINE_STR, BOARD_NAME); #endif #ifdef __DATE__ #ifdef __TIME__ - chprintf(chp, "Build time: %s%s%s"SHELL_NEWLINE_STR, __DATE__, " - ", __TIME__); + chprintf(chp, "Build time: %s%s%s" SHELL_NEWLINE_STR, __DATE__, " - ", __TIME__); #endif #endif } @@ -111,7 +111,7 @@ static void cmd_echo(BaseSequentialStream *chp, int argc, char *argv[]) { shellUsage(chp, "echo \"message\""); return; } - chprintf(chp, "%s"SHELL_NEWLINE_STR, argv[0]); + chprintf(chp, "%s" SHELL_NEWLINE_STR, argv[0]); } #endif @@ -123,7 +123,7 @@ static void cmd_systime(BaseSequentialStream *chp, int argc, char *argv[]) { shellUsage(chp, "systime"); return; } - chprintf(chp, "%lu"SHELL_NEWLINE_STR, (unsigned long)chVTGetSystemTime()); + chprintf(chp, "%lu" SHELL_NEWLINE_STR, (unsigned long)chVTGetSystemTime()); } #endif @@ -137,10 +137,10 @@ static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { return; } n = chHeapStatus(NULL, &total, &largest); - chprintf(chp, "core free memory : %u bytes"SHELL_NEWLINE_STR, chCoreGetStatusX()); - chprintf(chp, "heap fragments : %u"SHELL_NEWLINE_STR, n); - chprintf(chp, "heap free total : %u bytes"SHELL_NEWLINE_STR, total); - chprintf(chp, "heap free largest: %u bytes"SHELL_NEWLINE_STR, largest); + chprintf(chp, "core free memory : %u bytes" SHELL_NEWLINE_STR, chCoreGetStatusX()); + chprintf(chp, "heap fragments : %u" SHELL_NEWLINE_STR, n); + chprintf(chp, "heap free total : %u bytes" SHELL_NEWLINE_STR, total); + chprintf(chp, "heap free largest: %u bytes" SHELL_NEWLINE_STR, largest); } #endif @@ -154,7 +154,7 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { shellUsage(chp, "threads"); return; } - chprintf(chp, "stklimit stack addr refs prio state name\r\n"SHELL_NEWLINE_STR); + chprintf(chp, "stklimit stack addr refs prio state name\r\n" SHELL_NEWLINE_STR); tp = chRegFirstThread(); do { #if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE) @@ -162,7 +162,7 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { #else uint32_t stklimit = 0U; #endif - chprintf(chp, "%08lx %08lx %08lx %4lu %4lu %9s %12s"SHELL_NEWLINE_STR, + chprintf(chp, "%08lx %08lx %08lx %4lu %4lu %9s %12s" SHELL_NEWLINE_STR, stklimit, (uint32_t)tp->ctx.sp, (uint32_t)tp, (uint32_t)tp->refs - 1, (uint32_t)tp->prio, states[tp->state], tp->name == NULL ? "" : tp->name); @@ -205,7 +205,7 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { "test", chThdGetPriorityX(), tfp, chp); if (tp == NULL) { - chprintf(chp, "out of memory"SHELL_NEWLINE_STR); + chprintf(chp, "out of memory" SHELL_NEWLINE_STR); return; } chThdWait(tp); -- cgit v1.2.3