summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-08-10 12:10:17 +0200
committerPali Rohár <pali.rohar@gmail.com>2012-08-10 12:10:17 +0200
commite4858deccdaf6893520fe74b51a5bb738d0b2b32 (patch)
tree9cbae4d943f7a3938c9ca10365b9294042133eee
parent3ce8ca13f1fa1b8e694b23a4e287f146e7311a85 (diff)
download0xFFFF-e4858deccdaf6893520fe74b51a5bb738d0b2b32.tar.bz2
console: Prepair for new code
-rw-r--r--src/console.c24
-rw-r--r--src/console.h25
-rw-r--r--src/main.c2
3 files changed, 39 insertions, 12 deletions
diff --git a/src/console.c b/src/console.c
index be29d94..e8eac88 100644
--- a/src/console.c
+++ b/src/console.c
@@ -1,6 +1,7 @@
/*
* 0xFFFF - Open Free Fiasco Firmware Flasher
* Copyright (C) 2007, 2008 pancake <pancake@youterm.com>
+ * Copyright (C) 2012 Pali Rohár <pali.rohar@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,15 +25,16 @@
#include <getopt.h>
#include <unistd.h>
+#include "console.h"
#include "nolo.h"
#include "dump.h"
-void cmd_exit(char *line)
+static void cmd_exit(char *line)
{
exit(0);
}
-void cmd_help(char *line)
+static void cmd_help(char *line)
{
printf("connect connects via usb to nolo\n");
printf("reboot reboots remote host\n");
@@ -47,7 +49,7 @@ void cmd_help(char *line)
fflush(stdout);
}
-void cmd_info(char *line)
+static void cmd_info(char *line)
{
char *p, str[128];
get_sw_version();
@@ -62,7 +64,7 @@ void cmd_info(char *line)
get_rd_flags();
}
-void cmd_nanddump(char *line)
+static void cmd_nanddump(char *line)
{
char dev[128];
int from;
@@ -83,7 +85,7 @@ void cmd_nanddump(char *line)
nanddump(dev, from, length, out, ignbb, ignoob);
}
-void cmd_dump(char *line)
+static void cmd_dump(char *line)
{
if (!line[0]) {
printf("Usage: dump [path]\n");
@@ -93,7 +95,7 @@ void cmd_dump(char *line)
reverse_extract_pieces(line);
}
-void cmd_badblocks(char *line)
+static void cmd_badblocks(char *line)
{
if (!line[0]) {
printf("Usage: dump [path]\n");
@@ -103,17 +105,17 @@ void cmd_badblocks(char *line)
check_badblocks(line);
}
-void cmd_connect(char *line)
+static void cmd_connect(char *line)
{
connect_via_usb();
}
-void cmd_reboot(char *line)
+static void cmd_reboot(char *line)
{
reboot_board();
}
-void cmd_shell(char *line)
+static void cmd_shell(char *line)
{
system("/bin/sh");
}
@@ -123,7 +125,7 @@ void cmd_shell(char *line)
#define CALL_CMD(x) console_commands[x].callback((char *)line)
#define FOREACH_CMD(x) for(x=0;x<CMDS;x++)
-struct cmd_t {
+static struct cmd_t {
char *name;
void (*callback)(char *);
} console_commands[CMDS] = {
@@ -156,7 +158,7 @@ static int console_command(const char *line)
return 1;
}
-int console_prompt()
+int console_prompt(void)
{
char line[1024];
diff --git a/src/console.h b/src/console.h
new file mode 100644
index 0000000..456febd
--- /dev/null
+++ b/src/console.h
@@ -0,0 +1,25 @@
+/*
+ * 0xFFFF - Open Free Fiasco Firmware Flasher
+ * Copyright (C) 2007, 2008 pancake <pancake@youterm.com>
+ * Copyright (C) 2012 Pali Rohár <pali.rohar@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef CONSOLE_H
+#define CONSOLE_H
+
+int console_prompt(void);
+
+#endif
diff --git a/src/main.c b/src/main.c
index c643f1b..39d6e1b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -564,7 +564,7 @@ int main(int argc, char **argv)
}
// if (info)
- cmd_info("");
+// cmd_info("");
/* if (pcs_n) {
char version[64];