Remove cat command from shell
This commit is contained in:
parent
694a78982a
commit
8a764f599b
@ -334,57 +334,6 @@ static shellmatta_retCode_t shell_cmd_reset(const shellmatta_handle_t handle, co
|
||||
return SHELLMATTA_BUSY;
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_cat(const shellmatta_handle_t handle, const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
|
||||
#ifdef IMPLEMENT_SHELL_CAT
|
||||
FIL file;
|
||||
char path_buff[256];
|
||||
const char *path;
|
||||
UINT bytes_read;
|
||||
FRESULT res;
|
||||
|
||||
strncpy(path_buff, arguments, MIN(sizeof(path_buff), length));
|
||||
path_buff[MIN(length, sizeof(path_buff)-1)] = 0;
|
||||
path = strtok(path_buff, " ");
|
||||
path = strtok(NULL, " ");
|
||||
|
||||
if (strlen(path) == 0) {
|
||||
shellmatta_printf(handle, "Specify path!\r\n");
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
res = f_open(&file, path, FA_READ);
|
||||
if (res == FR_OK) {
|
||||
shellmatta_write(handle, "\r\n", 2U);
|
||||
do {
|
||||
res = f_read(&file, path_buff, sizeof(path_buff), &bytes_read);
|
||||
if (bytes_read > 0)
|
||||
shellmatta_write(handle, path_buff, bytes_read);
|
||||
else
|
||||
break;
|
||||
} while (res == FR_OK);
|
||||
|
||||
shellmatta_write(handle, "\r\n", 2U);
|
||||
}
|
||||
|
||||
if (res != FR_OK) {
|
||||
shellmatta_printf(handle, "Error reading file\r\n");
|
||||
}
|
||||
|
||||
f_close(&file);
|
||||
|
||||
#else
|
||||
(void)length;
|
||||
(void)arguments;
|
||||
|
||||
shellmatta_printf(handle, "cat not implemented!\r\n");
|
||||
#endif
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_read_flags(const shellmatta_handle_t handle, const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
@ -701,7 +650,7 @@ shellmatta_retCode_t shell_cmd_update(const shellmatta_handle_t handle, const ch
|
||||
// shellmatta_cmdFct_t cmdFct; /**< pointer to the cmd callack function */
|
||||
// struct shellmatta_cmd *next; /**< pointer to next command or NULL */
|
||||
//} shellmatta_cmd_t;
|
||||
static shellmatta_cmd_t cmd[20] = {
|
||||
static shellmatta_cmd_t cmd[19] = {
|
||||
{
|
||||
.cmd = "version",
|
||||
.cmdAlias = "ver",
|
||||
@ -790,21 +739,13 @@ static shellmatta_cmd_t cmd[20] = {
|
||||
.cmdFct = shell_cmd_reset,
|
||||
.next = &cmd[11],
|
||||
},
|
||||
{
|
||||
.cmd = "cat",
|
||||
.cmdAlias = NULL,
|
||||
.helpText = "Print file contents",
|
||||
.usageText = "cat <path>",
|
||||
.cmdFct = shell_cmd_cat,
|
||||
.next = &cmd[12],
|
||||
},
|
||||
{
|
||||
.cmd = "safety-flags",
|
||||
.cmdAlias = "flags",
|
||||
.helpText = "Reads and may clear safety flags",
|
||||
.usageText = "flags [--ack]",
|
||||
.cmdFct = shell_cmd_read_flags,
|
||||
.next = &cmd[13],
|
||||
.next = &cmd[12],
|
||||
},
|
||||
{
|
||||
.cmd = "save-calibration",
|
||||
@ -812,7 +753,7 @@ static shellmatta_cmd_t cmd[20] = {
|
||||
.helpText = "",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_save_cal,
|
||||
.next = &cmd[14],
|
||||
.next = &cmd[13],
|
||||
},
|
||||
{
|
||||
.cmd = "hang",
|
||||
@ -820,7 +761,7 @@ static shellmatta_cmd_t cmd[20] = {
|
||||
.helpText = "",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_hang,
|
||||
.next = &cmd[15],
|
||||
.next = &cmd[14],
|
||||
},
|
||||
{
|
||||
.cmd = "ui-emulate",
|
||||
@ -828,7 +769,7 @@ static shellmatta_cmd_t cmd[20] = {
|
||||
.helpText = "",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_ui_emulation,
|
||||
.next = &cmd[16],
|
||||
.next = &cmd[15],
|
||||
},
|
||||
{
|
||||
.cmd = "panic",
|
||||
@ -836,7 +777,7 @@ static shellmatta_cmd_t cmd[20] = {
|
||||
.helpText = "Panic Mode!",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_panic,
|
||||
.next = &cmd[17],
|
||||
.next = &cmd[16],
|
||||
},
|
||||
{
|
||||
.cmd = "safety-mem-dump",
|
||||
@ -844,7 +785,7 @@ static shellmatta_cmd_t cmd[20] = {
|
||||
.helpText = "",
|
||||
.usageText = "safety-mem-dump [output-file]",
|
||||
.cmdFct = shell_cmd_dump_safety_mem,
|
||||
.next = &cmd[18],
|
||||
.next = &cmd[17],
|
||||
},
|
||||
{
|
||||
.cmd = "reset-cal",
|
||||
@ -852,7 +793,7 @@ static shellmatta_cmd_t cmd[20] = {
|
||||
.helpText = "Reset Calibration",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_cmd_reset_cal,
|
||||
.next = &cmd[19],
|
||||
.next = &cmd[18],
|
||||
},
|
||||
{
|
||||
.cmd = "update",
|
||||
|
Loading…
Reference in New Issue
Block a user