summaryrefslogtreecommitdiff
path: root/nuttx/examples/nsh/nsh.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-08-23 15:16:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-08-23 15:16:10 +0000
commit872cf9f99f8b6e2a64781c0c6bc8aee6e35f5cb7 (patch)
tree27c66a47011dea19170420a26a954591f02e8c53 /nuttx/examples/nsh/nsh.h
parentb588aaaa96a83162f43a4ea409be382a01aa3812 (diff)
downloadpx4-nuttx-872cf9f99f8b6e2a64781c0c6bc8aee6e35f5cb7.tar.gz
px4-nuttx-872cf9f99f8b6e2a64781c0c6bc8aee6e35f5cb7.tar.bz2
px4-nuttx-872cf9f99f8b6e2a64781c0c6bc8aee6e35f5cb7.zip
Added ch and pwd to NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@841 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nsh/nsh.h')
-rw-r--r--nuttx/examples/nsh/nsh.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/nuttx/examples/nsh/nsh.h b/nuttx/examples/nsh/nsh.h
index 33f6d3d4d..7ee0d7192 100644
--- a/nuttx/examples/nsh/nsh.h
+++ b/nuttx/examples/nsh/nsh.h
@@ -100,6 +100,12 @@
#undef CONFIG_EXAMPLES_NSH_TELNETD_DUMPBUFFER
#undef CONFIG_EXAMPLES_NSH_FULLPATH
+/* Make sure that the home directory is defined */
+
+#ifndef CONFIG_LIB_HOMEDIR
+# define CONFIG_LIB_HOMEDIR "/"
+#endif
+
#define nsh_clone(v) (v)->clone(v)
#define nsh_addref(v) (v)->addref(v)
#define nsh_release(v) (v)->release(v)
@@ -116,6 +122,13 @@
#define SAVE_SIZE (sizeof(int) + sizeof(FILE*) + sizeof(boolean))
+/* Stubs used when working directory is not supported */
+
+#if CONFIG_NFILE_DESCRIPTORS <= 0 || defined(CONFIG_DISABLE_ENVIRON)
+# define nsh_getfullpath(v,p) (p)
+# define nsh_freefullpath(p)
+#endif
+
/****************************************************************************
* Public Types
****************************************************************************/
@@ -211,6 +224,14 @@ extern int nsh_consolemain(int argc, char *argv[]);
extern int nsh_telnetmain(int argc, char *argv[]);
#endif
+/* Working directory support */
+
+#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
+extern FAR const char *nsh_getcwd(void);
+extern char *nsh_getfullpath(FAR struct nsh_vtbl_s *vtbl, const char *relpath);
+extern void nsh_freefullpath(char *relpath);
+#endif
+
/* Shell command handlers */
extern int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
@@ -238,6 +259,10 @@ extern int cmd_ps(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
extern int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif /* CONFIG_FS_FAT */
# endif /* !CONFIG_DISABLE_MOUNTPOINT */
+# if !defined(CONFIG_DISABLE_ENVIRON)
+ extern int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
+ extern int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
+# endif /* !CONFIG_DISABLE_MOUNTPOINT */
#endif /* CONFIG_NFILE_DESCRIPTORS */
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0