Providing a dummy program_handler_load() made made the telnet server work without program-handler but on the other hand incompatible with an exsistng program handler :-(

Therefore I replaced that hack with a clean CONF macro, which by the way really removes the run() and exec() functionality instead of just implementing it empty.
This commit is contained in:
oliverschmidt 2007-04-13 21:04:52 +00:00
parent 87971c35db
commit 7aae71934d
4 changed files with 25 additions and 7 deletions

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki desktop OS. * This file is part of the Contiki desktop OS.
* *
* $Id: shell.c,v 1.2 2006/08/30 22:06:18 oliverschmidt Exp $ * $Id: shell.c,v 1.3 2007/04/13 21:05:57 oliverschmidt Exp $
* *
*/ */
@ -133,6 +133,7 @@ nullterminate(char *str)
return nt; return nt;
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
#ifdef SHELL_CONF_WITH_PROGRAM_HANDLER
static void static void
runfile(char *str) runfile(char *str)
{ {
@ -153,6 +154,7 @@ execfile(char *str)
runfile(str); runfile(str);
shell_quit(NULL); shell_quit(NULL);
} }
#endif /* SHELL_CONF_WITH_PROGRAM_HANDLER */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
static void static void
killproc(char *str) killproc(char *str)
@ -179,8 +181,10 @@ static void
help(char *str) help(char *str)
{ {
shell_output("Available commands:", ""); shell_output("Available commands:", "");
#ifdef SHELL_CONF_WITH_PROGRAM_HANDLER
shell_output("run - start program", ""); shell_output("run - start program", "");
shell_output("exec - start program & exit shell", ""); shell_output("exec - start program & exit shell", "");
#endif
shell_output("ps - show processes", ""); shell_output("ps - show processes", "");
shell_output("kill - kill process", ""); shell_output("kill - kill process", "");
shell_output("ls - display directory", ""); shell_output("ls - display directory", "");
@ -209,8 +213,11 @@ none(char *str)
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
static struct ptentry configparsetab[] = static struct ptentry configparsetab[] =
{{'e', 'E', execfile}, {
#ifdef SHELL_CONF_WITH_PROGRAM_HANDLER
{'e', 'E', execfile},
{'r', 'R', runfile}, {'r', 'R', runfile},
#endif
{'k', 'K', killproc}, {'k', 'K', killproc},
{'p', 'P', processes}, {'p', 'P', processes},
{'l', 'L', directory}, {'l', 'L', directory},

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki desktop OS. * This file is part of the Contiki desktop OS.
* *
* $Id: telnetd.c,v 1.1 2006/06/17 22:41:13 adamdunkels Exp $ * $Id: telnetd.c,v 1.2 2007/04/13 21:04:52 oliverschmidt Exp $
* *
*/ */
@ -394,6 +394,3 @@ telnetd_appcall(void *ts)
} }
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void
program_handler_load(char *name, char *arg)
{}

View File

@ -99,6 +99,11 @@ typedef unsigned long clock_time_t;
#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10 #define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10
#define SHELL_CONF_WITH_PROGRAM_HANDLER 1
#define SHELL_GUI_CONF_XSIZE 46 #define SHELL_GUI_CONF_XSIZE 46
#define SHELL_GUI_CONF_YSIZE 22 #define SHELL_GUI_CONF_YSIZE 22

View File

@ -105,6 +105,10 @@ typedef unsigned long clock_time_t;
#define SHELL_CONF_WITH_PROGRAM_HANDLER 1
#define SHELL_GUI_CONF_XSIZE 46 #define SHELL_GUI_CONF_XSIZE 46
#define SHELL_GUI_CONF_YSIZE 22 #define SHELL_GUI_CONF_YSIZE 22
@ -137,4 +141,9 @@ typedef unsigned short uip_stats_t;
#define WWW_CONF_MAX_INPUTNAMELEN 200 #define WWW_CONF_MAX_INPUTNAMELEN 200
#define WWW_CONF_MAX_INPUTVALUELEN 240 #define WWW_CONF_MAX_INPUTVALUELEN 240
#define TELNETD_CONF_LINELEN 64
#define TELNETD_CONF_NUMLINES 16
#endif /* __CONTIKI_CONF_H__ */ #endif /* __CONTIKI_CONF_H__ */