|
@@ -193,8 +193,8 @@ shellmatta_retCode_t shellmatta_addCmd(shellmatta_handle_t handle, shellmatta_cm
|
|
|
shellmatta_cmd_t **prevCmd;
|
|
|
bool cmdPlaced = false;
|
|
|
shellmatta_retCode_t ret = SHELLMATTA_OK;
|
|
|
- int cmdDiff = 0;
|
|
|
- int aliasDiff = 0;
|
|
|
+ int cmdDiff;
|
|
|
+ int aliasDiff;
|
|
|
|
|
|
/** -# check parameters for plausibility */
|
|
|
if( (NULL != inst)
|
|
@@ -203,8 +203,8 @@ shellmatta_retCode_t shellmatta_addCmd(shellmatta_handle_t handle, shellmatta_cm
|
|
|
&& (NULL != cmd)
|
|
|
&& (NULL != cmd->cmd))
|
|
|
{
|
|
|
- tempCmd = inst->cmdList;
|
|
|
- prevCmd = &inst->cmdList;
|
|
|
+ tempCmd = inst->cmdList;
|
|
|
+ prevCmd = &inst->cmdList;
|
|
|
/** -# register first command as list entry */
|
|
|
if (NULL == tempCmd)
|
|
|
{
|
|
@@ -216,7 +216,7 @@ shellmatta_retCode_t shellmatta_addCmd(shellmatta_handle_t handle, shellmatta_cm
|
|
|
{
|
|
|
while ((false == cmdPlaced) && (SHELLMATTA_OK == ret))
|
|
|
{
|
|
|
- cmdDiff = strcmp(tempCmd->cmd, cmd->cmd);
|
|
|
+ cmdDiff = strcmp(tempCmd->cmd, cmd->cmd);
|
|
|
if( (NULL != cmd->cmdAlias)
|
|
|
&& (NULL != tempCmd->cmdAlias))
|
|
|
{
|
|
@@ -232,7 +232,7 @@ shellmatta_retCode_t shellmatta_addCmd(shellmatta_handle_t handle, shellmatta_cm
|
|
|
{
|
|
|
ret = SHELLMATTA_DUPLICATE;
|
|
|
}
|
|
|
- else if(0 < cmdDiff)
|
|
|
+ else if(cmdDiff > 0)
|
|
|
{
|
|
|
cmd->next = tempCmd;
|
|
|
*prevCmd = cmd;
|
|
@@ -289,9 +289,8 @@ shellmatta_retCode_t shellmatta_removeCmd(shellmatta_handle_t handle, shellmatta
|
|
|
while(NULL != tempCmd)
|
|
|
{
|
|
|
/** -# compare command strings to find the command to delete */
|
|
|
- if (0 == strcmp( tempCmd->cmd,
|
|
|
- cmd->cmd)
|
|
|
- && (strlen(tempCmd->cmd) == strlen(cmd->cmd)))
|
|
|
+ if (0 == strcmp(tempCmd->cmd, cmd->cmd)
|
|
|
+ && (strlen(tempCmd->cmd) == strlen(cmd->cmd)))
|
|
|
{
|
|
|
/** -# first command removed */
|
|
|
if(NULL == prevCmd)
|
|
@@ -344,7 +343,7 @@ shellmatta_retCode_t shellmatta_configure( shellmatta_handle_t handle,
|
|
|
/** -# check parameters for plausibility */
|
|
|
if( (NULL != inst)
|
|
|
&& (SHELLMATTA_MAGIC == inst->magic)
|
|
|
- && ((mode == SHELLMATTA_MODE_INSERT) || (mode == SHELLMATTA_MODE_OVERWRITE)))
|
|
|
+ && ((SHELLMATTA_MODE_INSERT == mode) || (SHELLMATTA_MODE_OVERWRITE == mode)))
|
|
|
{
|
|
|
inst->mode = mode;
|
|
|
inst->echoEnabled = echoEnabled;
|
|
@@ -601,15 +600,11 @@ shellmatta_retCode_t shellmatta_processData(shellmatta_handle_t handle,
|
|
|
while (NULL != cmd)
|
|
|
{
|
|
|
/** -# compare command and alias string and length */
|
|
|
- if ( ((cmdLen == strlen(cmd->cmd))
|
|
|
- && (0 == strncmp( inst->buffer,
|
|
|
- cmd->cmd,
|
|
|
- cmdLen)))
|
|
|
+ if ( ((cmdLen == strlen(cmd->cmd))
|
|
|
+ && (0 == strncmp(inst->buffer, cmd->cmd, cmdLen)))
|
|
|
|| ((NULL != cmd->cmdAlias)
|
|
|
- && (cmdLen == strlen(cmd->cmdAlias))
|
|
|
- && (0 == strncmp( inst->buffer,
|
|
|
- cmd->cmdAlias,
|
|
|
- cmdLen))))
|
|
|
+ && (cmdLen == strlen(cmd->cmdAlias))
|
|
|
+ && (0 == strncmp(inst->buffer, cmd->cmdAlias, cmdLen))))
|
|
|
{
|
|
|
utils_writeEcho(inst, "\r\n", 2u);
|
|
|
shellmatta_opt_init(inst, cmdLen + 1u);
|
|
@@ -643,7 +638,7 @@ shellmatta_retCode_t shellmatta_processData(shellmatta_handle_t handle,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if ((cmdExecuted == 0u) && (inst->inputCount > 0))
|
|
|
+ if ((0u == cmdExecuted) && (inst->inputCount > 0))
|
|
|
{
|
|
|
inst->write("\r\nCommand: ", 11u);
|
|
|
inst->write(inst->buffer, inst->inputCount);
|