close #14 - added a resetShell api function + fixed some problems

This commit is contained in:
prozessorkern
2020-03-01 21:07:08 +01:00
parent 48fcf05b7d
commit bf1d91eca7
7 changed files with 269 additions and 18 deletions

View File

@@ -96,6 +96,24 @@ static shellmatta_retCode_t empty(shellmatta_handle_t handle, const char *argume
}
shellmatta_cmd_t emptyCommand = {"empty", NULL, NULL, NULL, empty, NULL};
static shellmatta_retCode_t reset(shellmatta_handle_t handle, const char *arguments, uint32_t length)
{
(void)arguments;
(void)length;
if(0 == strncmp(arguments, "prompt", length))
{
shellmatta_resetShell(handle, true);
}
else
{
shellmatta_resetShell(handle, false);
}
return SHELLMATTA_OK;
}
shellmatta_cmd_t resetCommand = {"reset", NULL, "resets the shellmatta instance", "reset [prompt]", reset, NULL};
shellmatta_retCode_t writeFct(const char* data, uint32_t length)
{
@@ -140,6 +158,7 @@ int main(int argc, char **argv)
shellmatta_addCmd(handle, &quitCommand);
shellmatta_addCmd(handle, &removeCommand);
shellmatta_addCmd(handle, &emptyCommand);
shellmatta_addCmd(handle, &resetCommand);
while(exitRequest == false)
{