From 83b41f9371fa221ee701bb83cf5c72f5984dcfaa Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 10 Jun 2007 16:15:30 +0200 Subject: * Initial implementation of the "badblocks" (-C) command. * Initial work on the reorganization of the dump.c code to avoid spagetti code. ATM is just a draft * Dump now shows you more info --- src/console.c | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'src/console.c') diff --git a/src/console.c b/src/console.c index 977ffba..f0fbfb4 100644 --- a/src/console.c +++ b/src/console.c @@ -32,12 +32,13 @@ void cmd_exit(char *line) void cmd_help(char *line) { - printf("connect connects via usb to nolo\n"); - printf("info shows info of the remote system\n"); - printf("linfo shows info of the local system\n"); - printf("shell opens a shell (/bin/sh)\n"); - printf("dump [dir] dumps the contents of /dev/mtd to dir\n"); - printf("exit exits the shell\n"); + printf("connect connects via usb to nolo\n"); + printf("info shows info of the remote system\n"); + printf("linfo shows info of the local system\n"); + printf("shell opens a shell (/bin/sh)\n"); + printf("badblocks [dev] checks bad blocks on mtd (/dev/mtd1)\n"); + printf("dump [dir] dumps the contents of /dev/mtd to dir\n"); + printf("exit exits the shell\n"); fflush(stdout); } @@ -56,9 +57,20 @@ void cmd_dump(char *line) printf("Usage: dump [path]\n"); return; } + while(line[0]==' ') line = line +1; reverse_extract_pieces(line); } +void cmd_badblocks(char *line) +{ + if (!line[0]) { + printf("Usage: dump [path]\n"); + return; + } + while(line[0]==' ') line = line +1; + check_badblocks(line); +} + void cmd_connect(char *line) { connect_via_usb(); @@ -69,7 +81,7 @@ void cmd_shell(char *line) system("/bin/sh"); } -#define CMDS 8 +#define CMDS 9 #define IS_CMD(x) !strcmp(console_commands[i].name, x) #define CALL_CMD(x) console_commands[x].callback((char *)line) #define FOREACH_CMD(x) for(x=0;x