Changeset 236963f in network-demos for telnetd/init.c


Ignore:
Timestamp:
Oct 15, 2008, 5:24:47 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master, network-demos-4-10-branch
Children:
d7de1ab
Parents:
07ee042
Message:

2008-10-15 Joel Sherrill <joel.sherrill@…>

PR 1331/networking

  • init.c: Improve comments and explanation of options to rtems_telnetd_initialize.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • telnetd/init.c

    r07ee042 r236963f  
    8383#include <sys/socket.h>
    8484#include "../networkconfig.h"
     85
     86/*
     87 *  If true, listen on socket(s).
     88 *  If false, remain on console.
     89 */
     90/* #define REMAIN_ON_CONSOLE */
     91bool remain_on_console = false;
    8592
    8693#if defined(USE_ECHO_SHELL)
     
    169176)
    170177{
    171   printk("============== Starting Shell ==============\n");
     178  if ( !remain_on_console )
     179    printk("============== Starting Shell ==============\n");
     180
    172181  rtems_shell_main_loop( NULL );
    173   printk("============== Exiting Shell ==============\n");
     182
     183  if ( !remain_on_console )
     184    printk("============== Exiting Shell ==============\n");
    174185}
    175186
     
    185196)
    186197{
    187   printf("\n\n*** Telnetd Server Test ***\n\r" );
    188 
    189   printf("============== Initializing Network ==============\n");
     198  fprintf(stderr, "\n\n*** Telnetd Server Test ***\n\r" );
     199
     200  fprintf(stderr, "============== Initializing Network ==============\n");
    190201  rtems_bsdnet_initialize_network ();
    191202
    192   printf("============== Add Route ==============\n");
     203  fprintf(stderr, "============== Add Route ==============\n");
    193204  rtems_bsdnet_show_inet_routes ();
    194205
    195   printf("============== Start Telnetd ==============\n");
     206  fprintf(stderr, "============== Start Telnetd ==============\n");
    196207
    197208  printk( SHELL_HELP_MSG );
    198209
     210  #if defined(REMAIN_ON_CONSOLE)
     211    remain_on_console = true;
     212  #endif
     213 
    199214  rtems_telnetd_initialize(
    200     SHELL_ENTRY,               /* "shell" function */
    201     NULL,                      /* no context necessary for echoShell */
    202     FALSE,                     /* spawn a new thread */
     215    SHELL_ENTRY,                    /* "shell" function */
     216    NULL,                           /* no context necessary for echoShell */
     217    remain_on_console,              /* true == remain on console */
     218                                    /* false == listen on sockets */
    203219    RTEMS_MINIMUM_STACK_SIZE * 20,  /* shell needs a large stack */
    204     1,                         /* priority .. we feel important today */
    205     0                          /* do not ask for password */
     220    1,                              /* priority .. we feel important today */
     221    false                        /* false = telnetd does NOT ask for password */
     222                                 /* true = telnetd asks for password */
     223                                 /* RTEMS Shell always asks for user/passwd */
    206224  );
    207225
    208   printf("============== Deleting Init Task ==============\n");
     226  if ( !remain_on_console )
     227    fprintf(stderr, "============== Deleting Init Task ==============\n");
    209228  rtems_task_delete(RTEMS_SELF);
    210229}
Note: See TracChangeset for help on using the changeset viewer.