Clean configuration varialbe names

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@816 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-08-11 23:07:26 +00:00
parent 2b2b7f7f0b
commit 4b40c96323
6 changed files with 33 additions and 27 deletions

View File

@ -57,14 +57,17 @@ examples/nsh
Other behavior of NSH can be modified with the following settings in Other behavior of NSH can be modified with the following settings in
the configs/<board-name>/defconfig file: the configs/<board-name>/defconfig file:
* CONFIG_NSH_IOBUFFERSIZE * CONFIG_EXAMPLES_NSH_FILEIOSIZE
Size of a static I/O buffer used for file access (ignored if Size of a static I/O buffer used for file access (ignored if
there is no filesystem). there is no filesystem).
* CONFIG_NSH_STRERROR * CONFIG_EXAMPLES_NSH_STRERROR
strerror(errno) makes more readable output but strerror() is strerror(errno) makes more readable output but strerror() is
very large and will not be used unless this setting is 'y' very large and will not be used unless this setting is 'y'
* CONFIG_EXAMPLES_NSH_LINELEN
The maximum length of one command line. Default: 80
* CONFIG_EXAMPLES_NSH_TELNET * CONFIG_EXAMPLES_NSH_TELNET
By default, NSH is configured to use the serial console. By default, NSH is configured to use the serial console.
If CONFIG_EXAMPLES_NSH_TELNET is set to 'y', then a TELENET If CONFIG_EXAMPLES_NSH_TELNET is set to 'y', then a TELENET

View File

@ -55,15 +55,21 @@
#define NSH_MAX_ARGUMENTS 6 #define NSH_MAX_ARGUMENTS 6
/* strerror() produces much nicer output but is, however, quite large and /* strerror() produces much nicer output but is, however, quite large and
* will only be used if CONFIG_NSH_STRERROR is defined. * will only be used if CONFIG_EXAMPLES_NSH_STRERROR is defined.
*/ */
#ifdef CONFIG_NSH_STRERROR #ifdef CONFIG_EXAMPLES_NSH_STRERROR
# define NSH_ERRNO strerror(errno) # define NSH_ERRNO strerror(errno)
#else #else
# define NSH_ERRNO errno # define NSH_ERRNO errno
#endif #endif
/* Maximum size of one command line (telnet or serial) */
#ifndef CONFIG_EXAMPLES_NSH_LINELEN
# define CONFIG_EXAMPLES_NSH_LINELEN 80
#endif
/* The following two settings are used only in the telnetd interface */ /* The following two settings are used only in the telnetd interface */
#ifndef CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE #ifndef CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE
@ -85,10 +91,7 @@
/* Define to enable dumping of all input/output buffers */ /* Define to enable dumping of all input/output buffers */
#undef CONFIG_EXAMPLES_NSH_TELNETD_DUMPBUFFER #undef CONFIG_EXAMPLES_NSH_TELNETD_DUMPBUFFER
#undef CONFIG_EXAMPLES_NSH_FULLPATH
/* Sizing */
#define NSH_MAX_LINELEN 80
/**************************************************************************** /****************************************************************************
* Public Types * Public Types

View File

@ -76,9 +76,9 @@
*/ */
#if CONFIG_NFILE_DESCRIPTORS > 0 #if CONFIG_NFILE_DESCRIPTORS > 0
# ifdef CONFIG_NSH_IOBUFFERSIZE # ifdef CONFIG_EXAMPLES_NSH_FILEIOSIZE
# if CONFIG_NSH_IOBUFFERSIZE > (PATH_MAX + 1) # if CONFIG_EXAMPLES_NSH_FILEIOSIZE > (PATH_MAX + 1)
# define IOBUFFERSIZE CONFIG_NSH_IOBUFFERSIZE # define IOBUFFERSIZE CONFIG_EXAMPLES_NSH_FILEIOSIZE
# else # else
# define IOBUFFERSIZE (PATH_MAX + 1) # define IOBUFFERSIZE (PATH_MAX + 1)
# endif # endif
@ -103,6 +103,12 @@ typedef int (*direntry_handler_t)(FAR void *, const char *, struct dirent *, voi
* Private Data * 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]; 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 */ /* Trim trailing '/' from directory names */
#ifdef CONFIG_FULL_PATH #ifdef CONFIG_EXAMPLES_NSH_FULLPATH
trim_dir(arg); trim_dir(arg);
#endif #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 */ /* 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); nsh_output(handle, " %s/%s", arg, entryp->d_name);
#else #else
nsh_output(handle, " %s", entryp->d_name); 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 #if CONFIG_NFILE_DESCRIPTORS > 0
void cmd_cat(FAR void *handle, int argc, char **argv) void cmd_cat(FAR void *handle, int argc, char **argv)
{ {
char buffer[1024]; char buffer[IOBUFFERSIZE];
/* Open the file for reading */ /* Open the file for reading */
@ -380,7 +386,7 @@ void cmd_cat(FAR void *handle, int argc, char **argv)
for (;;) for (;;)
{ {
int nbytesread = read(fd, buffer, 1024); int nbytesread = read(fd, buffer, IOBUFFERSIZE);
/* Check for read errors */ /* Check for read errors */

View File

@ -52,9 +52,6 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
#define CONFIG_NSH_LINE_SIZE 80
#undef CONFIG_FULL_PATH
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -147,7 +144,7 @@ const char g_fmtcmdnotfound[] = "nsh: %s: command not found\n";
const char g_fmtcmdnotimpl[] = "nsh: %s: command not implemented\n"; const char g_fmtcmdnotimpl[] = "nsh: %s: command not implemented\n";
const char g_fmtnosuch[] = "nsh: %s: no such %s: %s\n"; const char g_fmtnosuch[] = "nsh: %s: no such %s: %s\n";
const char g_fmttoomanyargs[] = "nsh: %s: too many arguments\n"; const char g_fmttoomanyargs[] = "nsh: %s: too many arguments\n";
#ifdef CONFIG_NSH_STRERROR #ifdef CONFIG_EXAMPLES_NSH_STRERROR
const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %s\n"; const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %s\n";
#else #else
const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %d\n"; const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %d\n";

View File

@ -50,9 +50,6 @@
* Definitions * Definitions
****************************************************************************/ ****************************************************************************/
#define CONFIG_NSH_LINE_SIZE 80
#undef CONFIG_FULL_PATH
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -74,7 +71,7 @@ struct cmdmap_s
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
static char line[CONFIG_NSH_LINE_SIZE]; static char line[CONFIG_EXAMPLES_NSH_LINELEN];
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
@ -106,7 +103,7 @@ int nsh_serialmain(void)
/* Get the next line of input */ /* Get the next line of input */
fgets(line, CONFIG_NSH_LINE_SIZE, stdin); fgets(line, CONFIG_EXAMPLES_NSH_LINELEN, stdin);
/* Parse process the command */ /* Parse process the command */

View File

@ -511,7 +511,7 @@ int nsh_telnetout(FAR void *handle, const char *fmt, ...)
va_list ap; va_list ap;
/* Put the new info into the buffer. Here we are counting on the fact that /* Put the new info into the buffer. Here we are counting on the fact that
* no output strings will exceed NSH_MAX_LINELEN! * no output strings will exceed CONFIG_EXAMPLES_NSH_LINELEN!
*/ */
va_start(ap, fmt); va_start(ap, fmt);
@ -542,7 +542,7 @@ int nsh_telnetout(FAR void *handle, const char *fmt, ...)
* maximum length string. * maximum length string.
*/ */
if (nbytes > CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE - NSH_MAX_LINELEN) if (nbytes > CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE - CONFIG_EXAMPLES_NSH_LINELEN)
{ {
nsh_flush(pstate); nsh_flush(pstate);
} }