Print expanded variables if -x
This commit is contained in:
parent
d03aa9112e
commit
35cf98d4df
@ -692,7 +692,7 @@
|
|||||||
|
|
||||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||||
# define NSH_NP_SET_OPTIONS "ex" /* Maintain order see nsh_npflags_e */
|
# define NSH_NP_SET_OPTIONS "ex" /* Maintain order see nsh_npflags_e */
|
||||||
# define NSH_NP_SET_OPTIONS_INIT (NSH_PFALG_SILENT)
|
# define NSH_NP_SET_OPTIONS_INIT (NSH_PFLAG_SILENT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DISABLE_ENVIRON) && defined(CONFIG_NSH_DISABLESCRIPT)
|
#if defined(CONFIG_DISABLE_ENVIRON) && defined(CONFIG_NSH_DISABLESCRIPT)
|
||||||
@ -758,9 +758,9 @@ struct nsh_loop_s
|
|||||||
|
|
||||||
enum nsh_npflags_e
|
enum nsh_npflags_e
|
||||||
{
|
{
|
||||||
NSH_PFALG_IGNORE = 1, /* set for +e no exit on errors,
|
NSH_PFLAG_IGNORE = 1, /* set for +e no exit on errors,
|
||||||
* cleared -e exit on error */
|
* cleared -e exit on error */
|
||||||
NSH_PFALG_SILENT = 2, /* cleared -x print a trace of commands
|
NSH_PFLAG_SILENT = 2, /* cleared -x print a trace of commands
|
||||||
* when parsing.
|
* when parsing.
|
||||||
* set +x no print a trace of commands */
|
* set +x no print a trace of commands */
|
||||||
};
|
};
|
||||||
|
@ -1169,6 +1169,11 @@ static FAR char *nsh_argexpand(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline,
|
|||||||
|
|
||||||
envstr = nsh_envexpand(vtbl, ptr);
|
envstr = nsh_envexpand(vtbl, ptr);
|
||||||
|
|
||||||
|
if ((vtbl->np.np_flags & NSH_PFLAG_SILENT) == 0)
|
||||||
|
{
|
||||||
|
nsh_output(vtbl," %s=%s\n", ptr, envstr ? envstr :"(null)");
|
||||||
|
}
|
||||||
|
|
||||||
/* Concatenate the result of the operation with the accumulated
|
/* Concatenate the result of the operation with the accumulated
|
||||||
* string. On failures to allocation memory, nsh_strcat will
|
* string. On failures to allocation memory, nsh_strcat will
|
||||||
* just return value value of argument
|
* just return value value of argument
|
||||||
|
@ -136,7 +136,7 @@ int nsh_script(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||||||
* considerable amount of stack may be used.
|
* considerable amount of stack may be used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((vtbl->np.np_flags & NSH_PFALG_SILENT) == 0)
|
if ((vtbl->np.np_flags & NSH_PFLAG_SILENT) == 0)
|
||||||
{
|
{
|
||||||
nsh_output(vtbl,"%s", buffer);
|
nsh_output(vtbl,"%s", buffer);
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ int nsh_script(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||||||
ret = nsh_parse(vtbl, buffer);
|
ret = nsh_parse(vtbl, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (pret && (ret == OK || (vtbl->np.np_flags & NSH_PFALG_IGNORE)));
|
while (pret && (ret == OK || (vtbl->np.np_flags & NSH_PFLAG_IGNORE)));
|
||||||
|
|
||||||
/* Close the script file */
|
/* Close the script file */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user