|
@@ -74,36 +74,22 @@ shellmatta_retCode_t shellmatta_doInit(
|
|
|
&& (NULL != writeFct)
|
|
|
&& ((NULL != historyBuffer) || (0u == historyBufferSize)))
|
|
|
{
|
|
|
+ /** -# clear the shellmatta instance */
|
|
|
+ memset((void *)inst, 0, sizeof(shellmatta_instance_t));
|
|
|
+
|
|
|
/** -# copy all provided buffers into the shellmatta instance */
|
|
|
inst->buffer = buffer;
|
|
|
inst->bufferSize = bufferSize;
|
|
|
- inst->inputCount = 0u;
|
|
|
- inst->byteCounter = 0u;
|
|
|
- inst->lastNewlineIdx = 0u;
|
|
|
- inst->cursor = 0u;
|
|
|
- inst->stdinIdx = 0u;
|
|
|
- inst->stdinLength = 0u;
|
|
|
inst->historyBuffer = historyBuffer;
|
|
|
inst->historyBufferSize = historyBufferSize;
|
|
|
- inst->historyStart = 0u;
|
|
|
- inst->historyEnd = 0u;
|
|
|
- inst->historyRead = 0u;
|
|
|
inst->historyReadUp = true;
|
|
|
inst->write = writeFct;
|
|
|
inst->prompt = prompt;
|
|
|
inst->echoEnabled = true;
|
|
|
inst->dirty = false;
|
|
|
- inst->tabCounter = 0u;
|
|
|
- inst->escapeCounter = 0u;
|
|
|
- inst->hereStartIdx = 0u;
|
|
|
- inst->hereDelimiterIdx = 0u;
|
|
|
- inst->hereLength = 0u;
|
|
|
inst->delimiter = '\r';
|
|
|
inst->mode = SHELLMATTA_MODE_INSERT;
|
|
|
inst->cmdList = &(inst->helpCmd);
|
|
|
- inst->continuousCmd = NULL;
|
|
|
- inst->busyCmd = NULL;
|
|
|
- inst->cmdListIsConst = false;
|
|
|
shellmatta_opt_init(inst, 0u);
|
|
|
|
|
|
/** -# copy the help command structure to this instance */
|