Added a shell_quit() function that cleanly exits the shell (currently untested though)
This commit is contained in:
parent
0fc8481f15
commit
6479f001fa
2 changed files with 23 additions and 5 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: shell.c,v 1.8 2008/02/24 20:35:03 adamdunkels Exp $
|
||||
* $Id: shell.c,v 1.9 2008/02/28 23:29:07 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -101,11 +101,10 @@ command_kill(struct shell_command *c)
|
|||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_killall_process, ev, data)
|
||||
static void
|
||||
killall(void)
|
||||
{
|
||||
struct shell_command *c;
|
||||
PROCESS_BEGIN();
|
||||
|
||||
for(c = list_head(commands);
|
||||
c != NULL;
|
||||
c = c->next) {
|
||||
|
@ -113,6 +112,14 @@ PROCESS_THREAD(shell_killall_process, ev, data)
|
|||
command_kill(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_killall_process, ev, data)
|
||||
{
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
killall();
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
|
@ -519,3 +526,11 @@ shell_start(void)
|
|||
shell_prompt("Contiki> ");
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
shell_quit(void)
|
||||
{
|
||||
killall();
|
||||
process_exit(&shell_process);
|
||||
process_exit(&shell_server_process);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: shell.h,v 1.5 2008/02/24 20:35:03 adamdunkels Exp $
|
||||
* $Id: shell.h,v 1.6 2008/02/28 23:29:07 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -78,6 +78,9 @@ unsigned long shell_strtolong(const char *str, const char **retstr);
|
|||
unsigned long shell_time(void);
|
||||
void shell_set_time(unsigned long seconds);
|
||||
|
||||
void shell_quit(void);
|
||||
|
||||
|
||||
#define SHELL_COMMAND(name, command, description, process) \
|
||||
static struct shell_command name = { NULL, command, \
|
||||
description, process }
|
||||
|
|
Loading…
Reference in a new issue