summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-01-30 22:20:42 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-01-30 22:20:42 +0000
commit9d5a2de3b28f61877858489604ddbaaf727e5409 (patch)
treefe3d918b2d1dec3f298c02e9ac77527b7c5a6f3d /apps
parent9ddfc032d424842691e1f4a30960547b578c9036 (diff)
downloadnuttx-9d5a2de3b28f61877858489604ddbaaf727e5409.tar.gz
nuttx-9d5a2de3b28f61877858489604ddbaaf727e5409.tar.bz2
nuttx-9d5a2de3b28f61877858489604ddbaaf727e5409.zip
A few more telnet updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4348 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps')
-rwxr-xr-xapps/ChangeLog.txt2
-rw-r--r--apps/examples/telnetd/shell.c10
-rw-r--r--apps/include/netutils/telnetd.h12
-rw-r--r--apps/netutils/telnetd/telnetd_driver.c12
4 files changed, 23 insertions, 13 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 1179e2614..248e6b5fe 100755
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -173,4 +173,4 @@
telnet infrastructure. The new telnet daemon creates sessions that are
"wrapped" as character devices and mapped to stdin, stdout, and stderr.
Now the telnet session can be inherited by spawned tasks.
- * examples/telnetd: Add a test for the nte telnet daemon.
+ * examples/telnetd: Add a test for the new telnet daemon.
diff --git a/apps/examples/telnetd/shell.c b/apps/examples/telnetd/shell.c
index 69f348615..356c33738 100644
--- a/apps/examples/telnetd/shell.c
+++ b/apps/examples/telnetd/shell.c
@@ -93,9 +93,9 @@ static struct ptentry_s g_parsetab[] =
static void shell_help(int argc, char **argv)
{
- printf("Available commands:");
- printf(" help, ? - show help");
- printf(" exit - exit shell");
+ printf("Available commands:\n");
+ printf(" help, ? - show help\n");
+ printf(" exit - exit shell\n");
}
/****************************************************************************
@@ -157,8 +157,8 @@ int shell_session(int argc, char *argv[])
{
char line[128];
- printf("uIP command shell -- NuttX style");
- printf("Type '?' and return for help");
+ printf("uIP command shell -- NuttX style\n");
+ printf("Type '?' and return for help\n");
for(;;)
{
diff --git a/apps/include/netutils/telnetd.h b/apps/include/netutils/telnetd.h
index 37e7dfd4f..f875a5edc 100644
--- a/apps/include/netutils/telnetd.h
+++ b/apps/include/netutils/telnetd.h
@@ -50,6 +50,10 @@
* CONFIG_TELNETD_NPOLLWAITERS - If the poll method is enabled, then this
* value will defined the maximum number of threads that can be waiting
* for events. Default: 1
+ * CONFIG_TELNETD_RXBUFFER_SIZE - The size of the telnet receive buffer.
+ * Default: 256 bytes.
+ * CONFIG_TELNETD_TXBUFFER_SIZE - The size of the telnet transmit buffer.
+ * Default: 256 bytes.
* CONFIG_TELNETD_DUMPBUFFER - dumping of all input/output buffers.
*/
@@ -59,8 +63,12 @@
/* Configurable settings */
-#ifndef CONFIG_TELNETD_IOBUFFER_SIZE
-# define CONFIG_TELNETD_IOBUFFER_SIZE 512
+#ifndef CONFIG_TELNETD_RXBUFFER_SIZE
+# define CONFIG_TELNETD_RXBUFFER_SIZE 256
+#endif
+
+#ifndef CONFIG_TELNETD_TXBUFFER_SIZE
+# define CONFIG_TELNETD_TXBUFFER_SIZE 256
#endif
/****************************************************************************
diff --git a/apps/netutils/telnetd/telnetd_driver.c b/apps/netutils/telnetd/telnetd_driver.c
index efa693cdb..f74a97d4e 100644
--- a/apps/netutils/telnetd/telnetd_driver.c
+++ b/apps/netutils/telnetd/telnetd_driver.c
@@ -107,8 +107,8 @@ struct telnetd_dev_s
uint8_t td_offset; /* Offset to the valid, pending bytes in the rxbuffer */
uint8_t td_crefs; /* The number of open references to the session */
FAR struct socket *td_psock; /* A reference to the internal socket structure */
- char td_rxbuffer[CONFIG_TELNETD_IOBUFFER_SIZE];
- char td_txbuffer[CONFIG_TELNETD_IOBUFFER_SIZE];
+ char td_rxbuffer[CONFIG_TELNETD_RXBUFFER_SIZE];
+ char td_txbuffer[CONFIG_TELNETD_TXBUFFER_SIZE];
};
/****************************************************************************
@@ -518,7 +518,7 @@ static ssize_t telnetd_read(FAR struct file *filep, FAR char *buffer, size_t len
else
{
ret = psock_recv(priv->td_psock, priv->td_rxbuffer,
- CONFIG_TELNETD_IOBUFFER_SIZE, 0);
+ CONFIG_TELNETD_RXBUFFER_SIZE, 0);
if (ret > 0)
{
/* Process the received telnet data */
@@ -558,9 +558,11 @@ static ssize_t telnetd_write(FAR struct file *filep, FAR const char *buffer, siz
eol = telnetd_putchar(priv, ch, &ncopied);
- /* Was that the end of a line? */
+ /* Was that the end of a line? Or is the buffer too full to hold the
+ * next largest character sequence ("\r\n\0")?
+ */
- if (eol)
+ if (eol || ncopied > CONFIG_TELNETD_TXBUFFER_SIZE-3)
{
/* Yes... send the data now */