|
@@ -51,7 +51,7 @@ uint32_t utils_shellItoa(int32_t value, char *buffer, uint32_t base)
|
|
|
char tempBuffer[34u];
|
|
|
uint32_t i;
|
|
|
uint32_t bufferIdx = 0u;
|
|
|
- char digitValue;
|
|
|
+ int8_t digitValue;
|
|
|
|
|
|
/** -# check the base for plausibility */
|
|
|
if((2 <= base) && (16 >= base))
|
|
@@ -68,8 +68,8 @@ uint32_t utils_shellItoa(int32_t value, char *buffer, uint32_t base)
|
|
|
i = 0u;
|
|
|
do
|
|
|
{
|
|
|
- digitValue = (char) (value % base);
|
|
|
- tempBuffer[i] = (digitValue < 10) ? ('0' + digitValue) : (('A' - 10) + digitValue);
|
|
|
+ digitValue = (int8_t) (value % base);
|
|
|
+ tempBuffer[i] = (digitValue < 10) ? ('0' + digitValue) : ('A' + (digitValue - 10));
|
|
|
value /= base;
|
|
|
i ++;
|
|
|
}while(value > 0);
|
|
@@ -91,7 +91,7 @@ uint32_t utils_shellItoa(int32_t value, char *buffer, uint32_t base)
|
|
|
*/
|
|
|
void utils_saveCursorPos(shellmatta_instance_t *inst)
|
|
|
{
|
|
|
- utils_writeEcho(inst, "\x1b[s", 3u);
|
|
|
+ utils_writeEcho(inst, "\x1b" "[s", 3u);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -100,7 +100,7 @@ void utils_saveCursorPos(shellmatta_instance_t *inst)
|
|
|
*/
|
|
|
void utils_restoreCursorPos(shellmatta_instance_t *inst)
|
|
|
{
|
|
|
- utils_writeEcho(inst, "\x1b[u", 3u);
|
|
|
+ utils_writeEcho(inst, "\x1b" "[u", 3u);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -110,7 +110,7 @@ void utils_restoreCursorPos(shellmatta_instance_t *inst)
|
|
|
*/
|
|
|
void utils_eraseLine(shellmatta_instance_t *inst)
|
|
|
{
|
|
|
- utils_writeEcho(inst, "\x1b[K", 3u);
|
|
|
+ utils_writeEcho(inst, "\x1b" "[K", 3u);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -275,22 +275,22 @@ void utils_clearInput(shellmatta_instance_t *inst)
|
|
|
* @return #SHELLMATTA_OK
|
|
|
* #SHELLMATTA_ERROR (buffer overflow)
|
|
|
*/
|
|
|
-static shellmatta_retCode_t helpCmdFct(shellmatta_handle_t handle, const char *arguments, uint32_t length)
|
|
|
+static shellmatta_retCode_t helpCmdFct(const shellmatta_handle_t handle, const char *arguments, uint32_t length)
|
|
|
{
|
|
|
- shellmatta_retCode_t ret = SHELLMATTA_OK;
|
|
|
- shellmatta_instance_t *inst = (shellmatta_instance_t*) handle;
|
|
|
- shellmatta_cmd_t *cmd = inst->cmdList;
|
|
|
- size_t maxCmdLen = 0u;
|
|
|
- size_t maxCmdAliasLen = 0u;
|
|
|
- size_t maxCmdHelpLen = 0u;
|
|
|
- size_t cmdLen = 0u;
|
|
|
- size_t cmdAliasLen = 0u;
|
|
|
- size_t cmdHelpLen = 0u;
|
|
|
- uint32_t tabCnt = 0u;
|
|
|
- static const char tabBuffer[] = { ' ', ' ', ' ', ' ',
|
|
|
- ' ', ' ', ' ', ' ',
|
|
|
- ' ', ' ', ' ', ' ',
|
|
|
- ' ', ' ', ' ', ' '};
|
|
|
+ shellmatta_retCode_t ret = SHELLMATTA_OK;
|
|
|
+ const shellmatta_instance_t *inst = (const shellmatta_instance_t*) handle;
|
|
|
+ shellmatta_cmd_t *cmd = inst->cmdList;
|
|
|
+ size_t maxCmdLen = 0u;
|
|
|
+ size_t maxCmdAliasLen = 0u;
|
|
|
+ size_t maxCmdHelpLen = 0u;
|
|
|
+ size_t cmdLen = 0u;
|
|
|
+ size_t cmdAliasLen = 0u;
|
|
|
+ size_t cmdHelpLen = 0u;
|
|
|
+ uint32_t tabCnt = 0u;
|
|
|
+ static const char tabBuffer[] = { ' ', ' ', ' ', ' ',
|
|
|
+ ' ', ' ', ' ', ' ',
|
|
|
+ ' ', ' ', ' ', ' ',
|
|
|
+ ' ', ' ', ' ', ' '};
|
|
|
|
|
|
/** -# loop through all commands to determine the lengths of each cmd */
|
|
|
while(NULL != cmd)
|