summaryrefslogtreecommitdiff
path: root/nuttx/examples/nsh/nsh_fscmds.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-08-11 23:07:26 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-08-11 23:07:26 +0000
commit258b47ea9b8686f71788ac804c9be909815f6934 (patch)
treeacd4ae9a714326c741d43e34c9ccc2df26242daf /nuttx/examples/nsh/nsh_fscmds.c
parent2ca9507eddbf4ae56a45983c551a84d37cd6db05 (diff)
downloadnuttx-258b47ea9b8686f71788ac804c9be909815f6934.tar.gz
nuttx-258b47ea9b8686f71788ac804c9be909815f6934.tar.bz2
nuttx-258b47ea9b8686f71788ac804c9be909815f6934.zip
Clean configuration varialbe names
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@816 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nsh/nsh_fscmds.c')
-rw-r--r--nuttx/examples/nsh/nsh_fscmds.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/nuttx/examples/nsh/nsh_fscmds.c b/nuttx/examples/nsh/nsh_fscmds.c
index 45426604f..2cfb24098 100644
--- a/nuttx/examples/nsh/nsh_fscmds.c
+++ b/nuttx/examples/nsh/nsh_fscmds.c
@@ -76,14 +76,14 @@
*/
#if CONFIG_NFILE_DESCRIPTORS > 0
-# ifdef CONFIG_NSH_IOBUFFERSIZE
-# if CONFIG_NSH_IOBUFFERSIZE > (PATH_MAX + 1)
-# define IOBUFFERSIZE CONFIG_NSH_IOBUFFERSIZE
+# ifdef CONFIG_EXAMPLES_NSH_FILEIOSIZE
+# if CONFIG_EXAMPLES_NSH_FILEIOSIZE > (PATH_MAX + 1)
+# define IOBUFFERSIZE CONFIG_EXAMPLES_NSH_FILEIOSIZE
# else
# define IOBUFFERSIZE (PATH_MAX + 1)
# endif
# else
-# define IOBUFFERSIZE 1024
+# define IOBUFFERSIZE 1024
# endif
# else
# define IOBUFFERSIZE (PATH_MAX + 1)
@@ -103,6 +103,12 @@ typedef int (*direntry_handler_t)(FAR void *, const char *, struct dirent *, voi
* Private Data
****************************************************************************/
+/* Common buffer for file I/O. Note the use of this common buffer precludes
+ * multiple copies of NSH running concurrently. It should be allocated per
+ * NSH instance and retained in the "handle" as is done for the telnet
+ * connection.
+ */
+
static char g_iobuffer[IOBUFFERSIZE];
/****************************************************************************
@@ -163,7 +169,7 @@ static int foreach_direntry(FAR void *handle, const char *cmd, const char *dirpa
/* Trim trailing '/' from directory names */
-#ifdef CONFIG_FULL_PATH
+#ifdef CONFIG_EXAMPLES_NSH_FULLPATH
trim_dir(arg);
#endif
@@ -306,7 +312,7 @@ static int ls_handler(FAR void *handle, const char *dirpath, struct dirent *entr
/* then provide the filename that is common to normal and verbose output */
-#ifdef CONFIG_FULL_PATH
+#ifdef CONFIG_EXAMPLES_NSH_FULLPATH
nsh_output(handle, " %s/%s", arg, entryp->d_name);
#else
nsh_output(handle, " %s", entryp->d_name);
@@ -365,7 +371,7 @@ static int ls_recursive(FAR void *handle, const char *dirpath, struct dirent *en
#if CONFIG_NFILE_DESCRIPTORS > 0
void cmd_cat(FAR void *handle, int argc, char **argv)
{
- char buffer[1024];
+ char buffer[IOBUFFERSIZE];
/* Open the file for reading */
@@ -380,7 +386,7 @@ void cmd_cat(FAR void *handle, int argc, char **argv)
for (;;)
{
- int nbytesread = read(fd, buffer, 1024);
+ int nbytesread = read(fd, buffer, IOBUFFERSIZE);
/* Check for read errors */