apps/nshlib: Fix an incorrect usage of a configuration variable in a previous commit.

This commit is contained in:
Gregory Nutt 2018-10-01 15:44:41 -06:00
parent 23b32baf98
commit ee01445aa2
3 changed files with 19 additions and 9 deletions

View File

@ -1459,14 +1459,15 @@ FAR char *nsh_trimspaces(FAR char *str);
#endif
/****************************************************************************
* Name: nsh_getvar and nsh_setvar
* Name: nsh_getvar, nsh_setvar, and nsh_setvar
*
* Description:
* Get or set an NSH variable.
* Get, set, or unset an NSH variable.
*
* Input Parmeters:
* vtbl - NSH session data
* name - The name of the variable to get or set
* vtbl - NSH session data
* name - The name of the variable to get or set
* value - The value to use with nsh_setvar()
*
* Returned value:
* nsh_getvar() returns a read-only reference to the variable value on
@ -1479,9 +1480,13 @@ FAR char *nsh_trimspaces(FAR char *str);
#ifdef CONFIG_NSH_VARS
FAR const char *nsh_getvar(FAR struct nsh_vtbl_s *vtbl,
FAR const char *name);
#ifndef CONFIG_NSH_DISABLE_SET
int nsh_setvar(FAR struct nsh_vtbl_s *vtbl, FAR const char *name,
FAR const char *value);
#endif
#if !defined(CONFIG_NSH_DISABLE_UNSET) || !defined(CONFIG_NSH_DISABLE_EXPORT)
int nsh_unsetvar(FAR struct nsh_vtbl_s *vtbl, FAR const char *name);
#endif
#endif
#endif /* __APPS_NSHLIB_NSH_H */

View File

@ -470,7 +470,7 @@ int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_export
****************************************************************************/
#ifndef CONFIG_NSH_DISABLE_UNSET
#ifndef CONFIG_NSH_DISABLE_EXPORT
int cmd_export(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
FAR const char *value = "";

View File

@ -182,14 +182,15 @@ int nsh_removevar(FAR struct console_stdio_s *pstate, FAR char *pair)
****************************************************************************/
/****************************************************************************
* Name: nsh_getvar and nsh_setvar
* Name: nsh_getvar, nsh_setvar, and nsh_setvar
*
* Description:
* Get or set an NSH variable.
* Get, set, or unset an NSH variable.
*
* Input Parmeters:
* vtbl - NSH session data
* name - The name of the variable to get or set
* vtbl - NSH session data
* name - The name of the variable to get or set
* value - The value to use with nsh_setvar()
*
* Returned value:
* nsh_getvar() returns a read-only reference to the variable value on
@ -234,6 +235,7 @@ FAR const char *nsh_getvar(FAR struct nsh_vtbl_s *vtbl,
* Name: nsh_setvar
****************************************************************************/
#ifndef CONFIG_NSH_DISABLE_SET
int nsh_setvar(FAR struct nsh_vtbl_s *vtbl, FAR const char *name,
FAR const char *value)
{
@ -298,11 +300,13 @@ int nsh_setvar(FAR struct nsh_vtbl_s *vtbl, FAR const char *name,
sprintf(pair, "%s=%s", name, value);
return OK;
}
#endif
/****************************************************************************
* Name: nsh_unsetvar
****************************************************************************/
#if !defined(CONFIG_NSH_DISABLE_UNSET) || !defined(CONFIG_NSH_DISABLE_EXPORT)
int nsh_unsetvar(FAR struct nsh_vtbl_s *vtbl, FAR const char *name)
{
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
@ -359,5 +363,6 @@ int nsh_unsetvar(FAR struct nsh_vtbl_s *vtbl, FAR const char *name)
sched_unlock();
return ret;
}
#endif
#endif /* CONFIG_NSH_VARS */