nshlib/[cd|ls|pwd]: add support for local CWD(Current working directory)

This PR will still allow basic shell operations such as cd/ls/pwd to be used even when the environment is disabled.

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an
2024-12-10 21:06:08 +08:00
committed by Xiang Xiao
parent d7ed69200f
commit e861ea8b53
6 changed files with 43 additions and 34 deletions

View File

@@ -162,10 +162,8 @@ static const struct cmdmap_s g_cmdmap[] =
"[<path> [<path> [<path> ...]]]"),
#endif
#ifndef CONFIG_DISABLE_ENVIRON
# ifndef CONFIG_NSH_DISABLE_CD
#ifndef CONFIG_NSH_DISABLE_CD
CMD_MAP("cd", cmd_cd, 1, 2, "[<dir-path>|-|~|..]"),
# endif
#endif
#ifndef CONFIG_NSH_DISABLE_CP
@@ -485,10 +483,8 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#ifndef CONFIG_DISABLE_ENVIRON
# ifndef CONFIG_NSH_DISABLE_PWD
#ifndef CONFIG_NSH_DISABLE_PWD
CMD_MAP("pwd", cmd_pwd, 1, 1, NULL),
# endif
#endif
#if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)