adjusted shell for the generic remove command.

This commit is contained in:
nvt-se 2008-11-24 15:18:27 +00:00
parent 55280131fc
commit 1389555ad5
2 changed files with 18 additions and 18 deletions

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: shell-coffee.c,v 1.2 2008/07/03 21:13:13 adamdunkels Exp $ * $Id: shell-coffee.c,v 1.3 2008/11/24 15:18:27 nvt-se Exp $
*/ */
/** /**
@ -52,11 +52,6 @@ SHELL_COMMAND(format_command,
"format", "format",
"format: format the flash-based Coffee file system", "format: format the flash-based Coffee file system",
&shell_format_process); &shell_format_process);
PROCESS(shell_rm_process, "rm");
SHELL_COMMAND(rm_command,
"rm",
"rm <filename>: remove the file named filename",
&shell_rm_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_format_process, ev, data) PROCESS_THREAD(shell_format_process, ev, data)
{ {
@ -81,20 +76,9 @@ PROCESS_THREAD(shell_format_process, ev, data)
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_rm_process, ev, data)
{
PROCESS_BEGIN();
if(data != NULL) {
cfs_coffee_remove(data);
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
void void
shell_coffee_init(void) shell_coffee_init(void)
{ {
shell_register_command(&format_command); shell_register_command(&format_command);
shell_register_command(&rm_command);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: shell-file.c,v 1.6 2008/07/06 10:34:44 oliverschmidt Exp $ * $Id: shell-file.c,v 1.7 2008/11/24 15:18:27 nvt-se Exp $
*/ */
/** /**
@ -68,6 +68,11 @@ SHELL_COMMAND(read_command,
"read", "read",
"read <filename> [offset]: read from file, with an optional offset", "read <filename> [offset]: read from file, with an optional offset",
&shell_read_process); &shell_read_process);
PROCESS(shell_rm_process, "rm");
SHELL_COMMAND(rm_command,
"rm",
"rm <filename>: remove the file named filename",
&shell_rm_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_ls_process, ev, data) PROCESS_THREAD(shell_ls_process, ev, data)
{ {
@ -238,6 +243,16 @@ PROCESS_THREAD(shell_read_process, ev, data)
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_rm_process, ev, data)
{
PROCESS_BEGIN();
if(data != NULL) {
cfs_remove(data);
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
void void
shell_file_init(void) shell_file_init(void)
{ {
@ -245,5 +260,6 @@ shell_file_init(void)
shell_register_command(&write_command); shell_register_command(&write_command);
shell_register_command(&append_command); shell_register_command(&append_command);
shell_register_command(&read_command); shell_register_command(&read_command);
shell_register_command(&rm_command);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/