close #30 added overwritable help command parameter and fixed some compiler issues (some of them only appeared when compiling with optimization)
This commit is contained in:
@@ -52,6 +52,9 @@ static shellmatta_retCode_t doSome(shellmatta_handle_t handle, const char *argum
|
||||
|
||||
shellmatta_write(handle, "blubb\r\n", 7u);
|
||||
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
shellmatta_cmd_t doSomeCmd = {"adoSome2", "adof2", "Function does something", "use me, please", doSome, NULL};
|
||||
@@ -62,6 +65,9 @@ static shellmatta_retCode_t removeCmdFct(shellmatta_handle_t handle, const char
|
||||
|
||||
shellmatta_removeCmd(handle, &doSomeCmd);
|
||||
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
shellmatta_cmd_t removeCommand = {"remove", "r", "Function removes a command", "", removeCmdFct, NULL};
|
||||
@@ -71,6 +77,10 @@ static shellmatta_retCode_t quit(shellmatta_handle_t handle, const char *argumen
|
||||
{
|
||||
exitRequest = true;
|
||||
|
||||
(void)handle;
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
shellmatta_cmd_t quitCommand = {"quit", "q", "Function quits the shell", "", quit, NULL};
|
||||
@@ -83,17 +93,23 @@ shellmatta_retCode_t writeFct(const char* data, uint32_t length)
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
static char buffer[1024];
|
||||
static char historyBuffer[4096];
|
||||
static shellmatta_instance_t instance;
|
||||
|
||||
f = open("/dev/pts/3", O_RDWR | O_SYNC);
|
||||
if(2 != argc)
|
||||
{
|
||||
printf("%s <serial device>\n", argv[0u]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
f = open(argv[1u], O_RDWR | O_SYNC);
|
||||
|
||||
if (f < 0)
|
||||
{
|
||||
printf("failure %d\n", errno);
|
||||
printf("failure opening device %s %d\n", argv[1u], errno);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user