mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 12:55:43 +08:00
apps/nshlib: Add support for NSH local variables if CONFIG_NSH_VARS are set. These are like environment variables but are local to NSH. The importance of this is that these variables are *not* inherited when NSH creates a new task. The new command 'export' was added. In this case, the NSH variable will be promoted to an environment variable and will then be inherited by any tasks executed by NSH.
This commit is contained in:
@@ -307,6 +307,15 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NSH_VARS
|
||||
/* Free any NSH variables */
|
||||
|
||||
if (pstate->varp != NULL)
|
||||
{
|
||||
free(pstate->varp);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then release the vtable container */
|
||||
|
||||
free(pstate);
|
||||
@@ -343,7 +352,8 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl)
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save)
|
||||
static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd,
|
||||
FAR uint8_t *save)
|
||||
{
|
||||
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
|
||||
FAR struct serialsave_s *ssave = (FAR struct serialsave_s *)save;
|
||||
|
Reference in New Issue
Block a user