mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 01:58:32 -04:00
Change command interpreter semantics.
This commit is contained in:
parent
49f726cf25
commit
ff8a7626d0
3 changed files with 39 additions and 64 deletions
|
@ -65,8 +65,12 @@
|
|||
/* Utils includes. */
|
||||
#include "CommandInterpreter.h"
|
||||
|
||||
/* Dimensions the buffer into which input characters are placed. */
|
||||
#define cmdMAX_INPUT_SIZE 20
|
||||
|
||||
/* Dimensions the buffer into which string outputs can be placed. */
|
||||
#define cmdMAX_OUTPUT_SIZE 1024
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vBasicSocketsCommandInterpreterTask( void *pvParameters )
|
||||
|
@ -75,9 +79,9 @@ long lSocket, lClientFd, lBytes, lAddrLen = sizeof( struct sockaddr_in );
|
|||
struct sockaddr_in sLocalAddr;
|
||||
struct sockaddr_in client_addr;
|
||||
const signed char *pcWelcomeMessage = "FreeRTOS command server - connection accepted.\r\nType Help to view a list of registered commands.\r\n\r\n>";
|
||||
const signed char *pcString;
|
||||
signed char cInChar, cInputIndex;
|
||||
signed char cInputString[ cmdMAX_INPUT_SIZE ];
|
||||
static signed char cInputString[ cmdMAX_INPUT_SIZE ], cOutputString[ cmdMAX_OUTPUT_SIZE ];
|
||||
portBASE_TYPE xReturned;
|
||||
|
||||
( void ) pvParameters;
|
||||
|
||||
|
@ -134,12 +138,12 @@ signed char cInputString[ cmdMAX_INPUT_SIZE ];
|
|||
{
|
||||
/* The input string was not a quit command.
|
||||
Pass the string to the command interpreter. */
|
||||
while( ( pcString = pcCmdIntProcessCommand( cInputString ) ) != NULL )
|
||||
do
|
||||
{
|
||||
/* A string has been generated by the
|
||||
command interpreter. Send it. */
|
||||
lwip_send( lClientFd, pcString, strlen( ( const char * ) pcString ), 0 );
|
||||
}
|
||||
xReturned = xCmdIntProcessCommand( cInputString, cOutputString, cmdMAX_OUTPUT_SIZE );
|
||||
lwip_send( lClientFd, cOutputString, strlen( ( const char * ) cOutputString ), 0 );
|
||||
|
||||
} while( xReturned != pdFALSE );
|
||||
|
||||
/* All the strings generated by the input
|
||||
command have been sent. Clear the input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue