mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-18 03:30:31 +00:00
the third read parameter must be checked for existence.
updated the documentation to cover the third parameter.
This commit is contained in:
parent
7bd7cd64b3
commit
79b7cab36e
@ -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.11 2009/03/19 20:42:39 nvt-se Exp $
|
* $Id: shell-file.c,v 1.12 2009/05/12 14:22:58 nvt-se Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +67,7 @@ SHELL_COMMAND(write_command,
|
|||||||
PROCESS(shell_read_process, "read");
|
PROCESS(shell_read_process, "read");
|
||||||
SHELL_COMMAND(read_command,
|
SHELL_COMMAND(read_command,
|
||||||
"read",
|
"read",
|
||||||
"read <filename> [offset]: read from file, with an optional offset",
|
"read <filename> [offset] [block size]: read from a file, with the offset and the block size as options",
|
||||||
&shell_read_process);
|
&shell_read_process);
|
||||||
PROCESS(shell_rm_process, "rm");
|
PROCESS(shell_rm_process, "rm");
|
||||||
SHELL_COMMAND(rm_command,
|
SHELL_COMMAND(rm_command,
|
||||||
@ -208,14 +208,15 @@ PROCESS_THREAD(shell_read_process, ev, data)
|
|||||||
filename[len] = 0;
|
filename[len] = 0;
|
||||||
|
|
||||||
offset = shell_strtolong(next, NULL);
|
offset = shell_strtolong(next, NULL);
|
||||||
|
|
||||||
next++;
|
next++;
|
||||||
next = strchr(next, ' ');
|
next = strchr(next, ' ');
|
||||||
block_size = shell_strtolong(next, NULL);
|
if(next != NULL) {
|
||||||
if(block_size > MAX_BLOCKSIZE) {
|
block_size = shell_strtolong(next, NULL);
|
||||||
shell_output_str(&read_command,
|
if(block_size > MAX_BLOCKSIZE) {
|
||||||
"read: block size too large: ", data);
|
shell_output_str(&read_command,
|
||||||
PROCESS_EXIT();
|
"read: block size too large: ", data);
|
||||||
|
PROCESS_EXIT();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user