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:
parent
2b2b7f7f0b
commit
4b40c96323
@ -57,14 +57,17 @@ examples/nsh
|
||||
Other behavior of NSH can be modified with the following settings in
|
||||
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
|
||||
there is no filesystem).
|
||||
|
||||
* CONFIG_NSH_STRERROR
|
||||
* CONFIG_EXAMPLES_NSH_STRERROR
|
||||
strerror(errno) makes more readable output but strerror() is
|
||||
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
|
||||
By default, NSH is configured to use the serial console.
|
||||
If CONFIG_EXAMPLES_NSH_TELNET is set to 'y', then a TELENET
|
||||
|
@ -55,15 +55,21 @@
|
||||
#define NSH_MAX_ARGUMENTS 6
|
||||
|
||||
/* 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)
|
||||
#else
|
||||
# define NSH_ERRNO errno
|
||||
#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 */
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NSH_IOBUFFER_SIZE
|
||||
@ -85,10 +91,7 @@
|
||||
/* Define to enable dumping of all input/output buffers */
|
||||
|
||||
#undef CONFIG_EXAMPLES_NSH_TELNETD_DUMPBUFFER
|
||||
|
||||
/* Sizing */
|
||||
|
||||
#define NSH_MAX_LINELEN 80
|
||||
#undef CONFIG_EXAMPLES_NSH_FULLPATH
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -52,9 +52,6 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define CONFIG_NSH_LINE_SIZE 80
|
||||
#undef CONFIG_FULL_PATH
|
||||
|
||||
/****************************************************************************
|
||||
* 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_fmtnosuch[] = "nsh: %s: no such %s: %s\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";
|
||||
#else
|
||||
const char g_fmtcmdfailed[] = "nsh: %s: %s failed: %d\n";
|
||||
|
@ -50,9 +50,6 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define CONFIG_NSH_LINE_SIZE 80
|
||||
#undef CONFIG_FULL_PATH
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@ -74,7 +71,7 @@ struct cmdmap_s
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static char line[CONFIG_NSH_LINE_SIZE];
|
||||
static char line[CONFIG_EXAMPLES_NSH_LINELEN];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
@ -106,7 +103,7 @@ int nsh_serialmain(void)
|
||||
|
||||
/* Get the next line of input */
|
||||
|
||||
fgets(line, CONFIG_NSH_LINE_SIZE, stdin);
|
||||
fgets(line, CONFIG_EXAMPLES_NSH_LINELEN, stdin);
|
||||
|
||||
/* Parse process the command */
|
||||
|
||||
|
@ -511,7 +511,7 @@ int nsh_telnetout(FAR void *handle, const char *fmt, ...)
|
||||
va_list ap;
|
||||
|
||||
/* 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);
|
||||
@ -542,7 +542,7 @@ int nsh_telnetout(FAR void *handle, const char *fmt, ...)
|
||||
* 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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user