apps/examples/telnetd: Naming confusion fixed: shell vs telnetd

This commit is contained in:
Gregory Nutt 2014-04-28 07:20:32 -06:00
parent 5f087ca589
commit b949ba8356
4 changed files with 38 additions and 34 deletions

View File

@ -894,3 +894,7 @@
instead of using the stack. From Bob Doiron (2014-4-21). instead of using the stack. From Bob Doiron (2014-4-21).
* apps/examples/cpuhog, serialblaster, and serialrx: Stress test * apps/examples/cpuhog, serialblaster, and serialrx: Stress test
examples added by Bob Doiron (2014-4-22). examples added by Bob Doiron (2014-4-22).
* apps/examples/telnetd: Naming is confused. In someplaces 'telnetd',
and in others 'shell.' All changes to telnetd. Noted by Pelle
Windestam (2014-4-38).

View File

@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
# Hello, World! Example # Hello, World! Example
ASRCS = ASRCS =
CSRCS = shell.c CSRCS = telnetd.c
AOBJS = $(ASRCS:.S=$(OBJEXT)) AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT))

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* examples/telnetd/shell.c * examples/telnetd/telnetd.c
* *
* Copyright (C) 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
@ -50,7 +50,7 @@
#include <apps/netutils/telnetd.h> #include <apps/netutils/telnetd.h>
#include <apps/netutils/uiplib.h> #include <apps/netutils/uiplib.h>
#include "shell.h" #include "telnetd.h"
/**************************************************************************** /****************************************************************************
* Definitions * Definitions
@ -70,10 +70,10 @@ struct ptentry_s
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static void shell_help(int argc, char **argv); static void telnetd_help(int argc, char **argv);
static void shell_quit(int argc, char **argv); static void telnetd_quit(int argc, char **argv);
static void shell_unknown(int argc, char **argv); static void telnetd_unknown(int argc, char **argv);
static void shell_parse(FAR char *line, int len); static void telnetd_parse(FAR char *line, int len);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -81,10 +81,10 @@ static void shell_parse(FAR char *line, int len);
static struct ptentry_s g_parsetab[] = static struct ptentry_s g_parsetab[] =
{ {
{"help", shell_help}, {"help", telnetd_help},
{"exit", shell_quit}, {"exit", telnetd_quit},
{"?", shell_help}, {"?", telnetd_help},
{NULL, shell_unknown} {NULL, telnetd_unknown}
}; };
/**************************************************************************** /****************************************************************************
@ -92,10 +92,10 @@ static struct ptentry_s g_parsetab[] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: shell_help * Name: telnetd_help
****************************************************************************/ ****************************************************************************/
static void shell_help(int argc, char **argv) static void telnetd_help(int argc, char **argv)
{ {
printf("Available commands:\n"); printf("Available commands:\n");
printf(" help, ? - show help\n"); printf(" help, ? - show help\n");
@ -103,10 +103,10 @@ static void shell_help(int argc, char **argv)
} }
/**************************************************************************** /****************************************************************************
* Name: shell_help * Name: telnetd_help
****************************************************************************/ ****************************************************************************/
static void shell_unknown(int argc, char **argv) static void telnetd_unknown(int argc, char **argv)
{ {
if (argv[0]) if (argv[0])
{ {
@ -115,20 +115,20 @@ static void shell_unknown(int argc, char **argv)
} }
/**************************************************************************** /****************************************************************************
* Name: shell_quit * Name: telnetd_quit
****************************************************************************/ ****************************************************************************/
static void shell_quit(int argc, char **argv) static void telnetd_quit(int argc, char **argv)
{ {
printf("Bye!\n"); printf("Bye!\n");
exit(0); exit(0);
} }
/**************************************************************************** /****************************************************************************
* Name: shell_parse * Name: telnetd_parse
****************************************************************************/ ****************************************************************************/
static void shell_parse(FAR char *line, int len) static void telnetd_parse(FAR char *line, int len)
{ {
struct ptentry_s *entry; struct ptentry_s *entry;
FAR char *cmd; FAR char *cmd;
@ -154,10 +154,10 @@ static void shell_parse(FAR char *line, int len)
} }
/**************************************************************************** /****************************************************************************
* Name: shell_session * Name: telnetd_session
****************************************************************************/ ****************************************************************************/
int shell_session(int argc, char *argv[]) int telnetd_session(int argc, char *argv[])
{ {
char line[128]; char line[128];
@ -174,17 +174,17 @@ int shell_session(int argc, char *argv[])
break; break;
} }
shell_parse(line, 128); telnetd_parse(line, 128);
} }
return 0; return 0;
} }
/**************************************************************************** /****************************************************************************
* Name: shell_netinit * Name: telnetd_netinit
****************************************************************************/ ****************************************************************************/
static void shell_netinit(void) static void telnetd_netinit(void)
{ {
struct in_addr addr; struct in_addr addr;
#ifdef CONFIG_EXAMPLES_TELNETD_NOMAC #ifdef CONFIG_EXAMPLES_TELNETD_NOMAC
@ -223,15 +223,15 @@ static void shell_netinit(void)
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
int shell_main(int argc, char *argv[]) int telnetd_main(int argc, char *argv[])
{ {
struct telnetd_config_s config; struct telnetd_config_s config;
int ret; int ret;
/* Configure the network */ /* Configure the network */
printf("shell_main: Initializing the network\n"); printf("telnetd_main: Initializing the network\n");
shell_netinit(); telnetd_netinit();
/* Configure the telnet daemon */ /* Configure the telnet daemon */
@ -240,17 +240,17 @@ int shell_main(int argc, char *argv[])
config.d_stacksize = CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE; config.d_stacksize = CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE;
config.t_priority = CONFIG_EXAMPLES_TELNETD_CLIENTPRIO; config.t_priority = CONFIG_EXAMPLES_TELNETD_CLIENTPRIO;
config.t_stacksize = CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE; config.t_stacksize = CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE;
config.t_entry = shell_session; config.t_entry = telnetd_session;
/* Start the telnet daemon */ /* Start the telnet daemon */
printf("shell_main: Starting the Telnet daemon\n"); printf("telnetd_main: Starting the Telnet daemon\n");
ret = telnetd_start(&config); ret = telnetd_start(&config);
if (ret < 0) if (ret < 0)
{ {
printf("Failed to tart the Telnet daemon\n"); printf("Failed to tart the Telnet daemon\n");
} }
printf("shell_main: Exiting\n"); printf("telnetd_main: Exiting\n");
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* apps/examples/telnetd/shell.h * apps/examples/telnetd/telnetd.h
* Interface for the Contiki shell. * Interface for the Contiki shell.
* *
* Copyright (C) 2012 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Gregory Nutt. All rights reserved.
@ -32,8 +32,8 @@
* *
****************************************************************************/ ****************************************************************************/
#ifndef __APPS_EXAMPLES_TELNETD_SHELL_H #ifndef __APPS_EXAMPLES_TELNETD_TELNETL_H
#define __APPS_EXAMPLES_TELNETD_SHELL_H #define __APPS_EXAMPLES_TELNETD_TELNETL_H
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -89,4 +89,4 @@
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
#endif /* __APPS_EXAMPLES_TELNETD_SHELL_H */ #endif /* __APPS_EXAMPLES_TELNETD_TELNETL_H */