-/* Used to point to the last command in the list of registered command, just to\r
-make registering commands faster. */\r
-static xCommandLineInput *pxLastCommandInList = &xHelpCommand;\r
+static xCommandLineInputListItem *pxLastCommandInList = &xRegisteredCommands;\r
+xCommandLineInputListItem *pxNewListItem;\r
+portBASE_TYPE xReturn = pdFAIL;\r
+\r
+ /* Check the parameter is not NULL. */\r
+ configASSERT( pxCommandToRegister );\r
+\r
+ /* Create a new list item that will reference the command being registered. */\r
+ pxNewListItem = ( xCommandLineInputListItem * ) pvPortMalloc( sizeof( xCommandLineInputListItem ) );\r
+ configASSERT( pxNewListItem );\r
+\r
+ if( pxNewListItem != NULL )\r
+ {\r
+ taskENTER_CRITICAL();\r
+ {\r
+ /* Reference the command being registered from the newly created \r
+ list item. */\r
+ pxNewListItem->pxCommandLineDefinition = pxCommandToRegister;\r