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:
Gregory Nutt
2018-10-01 13:30:25 -06:00
parent d376723ad2
commit e9edfd064f
10 changed files with 318 additions and 77 deletions

View File

@@ -204,8 +204,12 @@ static const struct cmdmap_s g_cmdmap[] =
{ "exit", cmd_exit, 1, 1, NULL },
#endif
#ifndef CONFIG_NSH_DISABLE_EXPORT
{ "export", cmd_export, 2, 3, "[<name> [<value>]]" },
#endif
#ifndef CONFIG_NSH_DISABLESCRIPT
{ "false", cmd_false, 1, 1, NULL },
{ "false", cmd_false, 1, 1, NULL },
#endif
#ifndef CONFIG_NSH_DISABLE_FREE
@@ -517,10 +521,8 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#ifndef CONFIG_DISABLE_ENVIRON
# ifndef CONFIG_NSH_DISABLE_UNSET
#ifndef CONFIG_NSH_DISABLE_UNSET
{ "unset", cmd_unset, 2, 2, "<name>" },
# endif
#endif
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_URLCODE)