mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-17 15:32:21 +08:00
nshlib/prompt: extend NSH prompt string management
Currently NSH prompt is defined at build time, thus improper for AMP cases where the same NSH binary is used on different nodes as the same NSH prompt shows on all nodes. This patch attempts to support runtime prompt string population from ordered sources: - the environment variable defined by NSH_PROMPT_ENV plus suffix - the NSH_PROMPT_STRING - the HOSTNAME plus suffix The suffix is defined by NSH_PROMPT_SUFFIX so that to clearly separate the command inputs. Changes in `nshlib/` - Kconfig: add configs NSH_PROMPT_MAX/ENV/SUFFIX etc - nsh.h: adjust g_nshprompt defs, add nsh_update_prompt - nsh_parse.c relocate g_nshpromt to nsh_prompt.c - nsh_init.c revise to use nsh_update_prompt once - nsh_session.c revise to use methods in nsh_prompt.c - Makefile add nsh_prompt.c - CMakeLists.txt add nsh_prompt.c New additions in `nshlib/` - nsh_prompt.c prompt related data structures and methods. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
@@ -748,7 +748,6 @@ extern const char g_loginsuccess[];
|
||||
extern const char g_badcredentials[];
|
||||
extern const char g_loginfailure[];
|
||||
#endif
|
||||
extern const char g_nshprompt[];
|
||||
extern const char g_fmtsyntax[];
|
||||
extern const char g_fmtargrequired[];
|
||||
extern const char g_fmtnomatching[];
|
||||
@@ -825,6 +824,11 @@ int nsh_session(FAR struct console_stdio_s *pstate,
|
||||
int login, int argc, FAR char *argv[]);
|
||||
int nsh_parse(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline);
|
||||
|
||||
/* Prompt string handling */
|
||||
|
||||
FAR const char *nsh_prompt(void);
|
||||
void nsh_update_prompt(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_login
|
||||
*
|
||||
|
Reference in New Issue
Block a user