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

@@ -1578,12 +1578,7 @@ int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
else if (optind >= argc)
{
#ifndef CONFIG_DISABLE_ENVIRON
relpath = nsh_getcwd();
#else
nsh_error(vtbl, g_fmtargrequired, argv[0]);
return ERROR;
#endif
relpath = nsh_getcwd(vtbl);
}
else
{