the third read parameter must be checked for existence.

updated the documentation to cover the third parameter.
This commit is contained in:
nvt-se 2009-05-12 14:22:58 +00:00
parent 7bd7cd64b3
commit 79b7cab36e

View File

@ -28,7 +28,7 @@
*
* 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");
SHELL_COMMAND(read_command,
"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);
PROCESS(shell_rm_process, "rm");
SHELL_COMMAND(rm_command,
@ -208,9 +208,9 @@ PROCESS_THREAD(shell_read_process, ev, data)
filename[len] = 0;
offset = shell_strtolong(next, NULL);
next++;
next = strchr(next, ' ');
if(next != NULL) {
block_size = shell_strtolong(next, NULL);
if(block_size > MAX_BLOCKSIZE) {
shell_output_str(&read_command,
@ -218,6 +218,7 @@ PROCESS_THREAD(shell_read_process, ev, data)
PROCESS_EXIT();
}
}
}
fd = cfs_open(filename, CFS_READ);
cfs_seek(fd, offset, CFS_SEEK_SET);