summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-10-15 17:24:47 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-10-15 17:24:47 +0000
commit236963fb66550dae170d76aa51ef4f5aec99185d (patch)
treeb5c385bc1479010196a95ac35135077a172133f9
parent07ee042fd43c1ee5f85f172eb0d1e52db9b835b0 (diff)
2008-10-15 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1331/networking * init.c: Improve comments and explanation of options to rtems_telnetd_initialize.
-rw-r--r--telnetd/ChangeLog6
-rw-r--r--telnetd/init.c43
2 files changed, 37 insertions, 12 deletions
diff --git a/telnetd/ChangeLog b/telnetd/ChangeLog
index acf0d53..52e2020 100644
--- a/telnetd/ChangeLog
+++ b/telnetd/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-15 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ PR 1331/networking
+ * init.c: Improve comments and explanation of options to
+ rtems_telnetd_initialize.
+
2008-09-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* init.c: Rename STACK_CHECKER_ON to more appropriate
diff --git a/telnetd/init.c b/telnetd/init.c
index cbcf0da..f954306 100644
--- a/telnetd/init.c
+++ b/telnetd/init.c
@@ -83,6 +83,13 @@ rtems_task Init(
#include <sys/socket.h>
#include "../networkconfig.h"
+/*
+ * If true, listen on socket(s).
+ * If false, remain on console.
+ */
+/* #define REMAIN_ON_CONSOLE */
+bool remain_on_console = false;
+
#if defined(USE_ECHO_SHELL)
#define SHELL_HELP_MSG \
@@ -168,9 +175,13 @@ void rtemsShell(
void *cmd_arg
)
{
- printk("============== Starting Shell ==============\n");
+ if ( !remain_on_console )
+ printk("============== Starting Shell ==============\n");
+
rtems_shell_main_loop( NULL );
- printk("============== Exiting Shell ==============\n");
+
+ if ( !remain_on_console )
+ printk("============== Exiting Shell ==============\n");
}
#define SHELL_ENTRY rtemsShell
@@ -184,28 +195,36 @@ rtems_task Init(
rtems_task_argument argument
)
{
- printf("\n\n*** Telnetd Server Test ***\n\r" );
+ fprintf(stderr, "\n\n*** Telnetd Server Test ***\n\r" );
- printf("============== Initializing Network ==============\n");
+ fprintf(stderr, "============== Initializing Network ==============\n");
rtems_bsdnet_initialize_network ();
- printf("============== Add Route ==============\n");
+ fprintf(stderr, "============== Add Route ==============\n");
rtems_bsdnet_show_inet_routes ();
- printf("============== Start Telnetd ==============\n");
+ fprintf(stderr, "============== Start Telnetd ==============\n");
printk( SHELL_HELP_MSG );
+ #if defined(REMAIN_ON_CONSOLE)
+ remain_on_console = true;
+ #endif
+
rtems_telnetd_initialize(
- SHELL_ENTRY, /* "shell" function */
- NULL, /* no context necessary for echoShell */
- FALSE, /* spawn a new thread */
+ SHELL_ENTRY, /* "shell" function */
+ NULL, /* no context necessary for echoShell */
+ remain_on_console, /* true == remain on console */
+ /* false == listen on sockets */
RTEMS_MINIMUM_STACK_SIZE * 20, /* shell needs a large stack */
- 1, /* priority .. we feel important today */
- 0 /* do not ask for password */
+ 1, /* priority .. we feel important today */
+ false /* false = telnetd does NOT ask for password */
+ /* true = telnetd asks for password */
+ /* RTEMS Shell always asks for user/passwd */
);
- printf("============== Deleting Init Task ==============\n");
+ if ( !remain_on_console )
+ fprintf(stderr, "============== Deleting Init Task ==============\n");
rtems_task_delete(RTEMS_SELF);
}