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

@@ -867,10 +867,10 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
FAR char **argv, FAR const struct nsh_param_s *param);
#endif
#ifndef CONFIG_DISABLE_ENVIRON
/* Working directory support */
FAR const char *nsh_getcwd(void);
FAR const char *nsh_getcwd(FAR struct nsh_vtbl_s *vtbl);
#ifndef CONFIG_DISABLE_ENVIRON
FAR char *nsh_getfullpath(FAR struct nsh_vtbl_s *vtbl,
FAR const char *relpath);
void nsh_freefullpath(FAR char *fullpath);
@@ -1071,14 +1071,12 @@ int cmd_irqinfo(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv);
# endif
#endif /* !CONFIG_DISABLE_MOUNTPOINT */
#if !defined(CONFIG_DISABLE_ENVIRON)
# ifndef CONFIG_NSH_DISABLE_CD
#ifndef CONFIG_NSH_DISABLE_CD
int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_PWD
#endif
#ifndef CONFIG_NSH_DISABLE_PWD
int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv);
# endif
#endif /* !CONFIG_DISABLE_MOUNTPOINT */
#endif
#ifndef CONFIG_NSH_DISABLE_ENV
int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv);