summaryrefslogtreecommitdiffstats
path: root/utils/imxtools/hwemul
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-01-29 23:58:45 +0000
committerAmaury Pouly <amaury.pouly@gmail.com>2013-01-29 23:58:45 +0000
commit9d2631854c2131ad0f79962500771f5e085d66b1 (patch)
tree55d293ec17fff2ed8487c32bca42a672f34f7872 /utils/imxtools/hwemul
parent6d5b1b2448043f34ba0bbafce7ea1768cc5a79a7 (diff)
downloadrockbox-9d2631854c2131ad0f79962500771f5e085d66b1.tar.gz
rockbox-9d2631854c2131ad0f79962500771f5e085d66b1.zip
imxtools/hwemul: add readline support
Change-Id: If2e86bf8b520a8d4c38a56ac969918fdeb2c6f91
Diffstat (limited to 'utils/imxtools/hwemul')
-rw-r--r--utils/imxtools/hwemul/tools/Makefile2
-rwxr-xr-xutils/imxtools/hwemul/tools/hwemul_toolbin1354604 -> 0 bytes
-rw-r--r--utils/imxtools/hwemul/tools/hwemul_tool.c36
3 files changed, 19 insertions, 19 deletions
diff --git a/utils/imxtools/hwemul/tools/Makefile b/utils/imxtools/hwemul/tools/Makefile
index 80a2f405bb..39f0c61c2a 100644
--- a/utils/imxtools/hwemul/tools/Makefile
+++ b/utils/imxtools/hwemul/tools/Makefile
@@ -2,7 +2,7 @@ CC=gcc
AR=ar
HWEMUL_LIB_DIR=../lib
CFLAGS=-W -Wall -O2 `pkg-config --cflags libusb-1.0` -std=c99 -g -I$(HWEMUL_LIB_DIR)
-LDFLAGS=`pkg-config --libs libusb-1.0`
+LDFLAGS=`pkg-config --libs libusb-1.0` -lreadline
EXEC=hwemul_tool
HWEMUL_LIB=$(HWEMUL_LIB_DIR)/libhwemul.a
SRC=$(wildcard *.c)
diff --git a/utils/imxtools/hwemul/tools/hwemul_tool b/utils/imxtools/hwemul/tools/hwemul_tool
deleted file mode 100755
index 1690385c6a..0000000000
--- a/utils/imxtools/hwemul/tools/hwemul_tool
+++ /dev/null
Binary files differ
diff --git a/utils/imxtools/hwemul/tools/hwemul_tool.c b/utils/imxtools/hwemul/tools/hwemul_tool.c
index c6056edf96..d75cd7a957 100644
--- a/utils/imxtools/hwemul/tools/hwemul_tool.c
+++ b/utils/imxtools/hwemul/tools/hwemul_tool.c
@@ -24,6 +24,8 @@
#include <string.h>
#include <getopt.h>
#include <stdbool.h>
+#include <readline/readline.h>
+#include <readline/history.h>
bool g_quiet = false;
struct hwemul_device_t hwdev;
@@ -326,22 +328,20 @@ int parse_command(char *cmd)
return syntax_error(cmd);
}
-int do_command()
+void interactive_mode(void)
{
- char *line = NULL;
- int size = 0;
- getline(&line, &size, stdin);
- char *end = strchr(line, '\n');
- if(end)
- *end = 0;
- char *pch = strtok(line, " ");
- int ret;
- if(pch)
- ret = parse_command(pch);
- else
- ret = print_help();
- free(line);
- return ret;
+ rl_bind_key('\t', rl_complete);
+ while(1)
+ {
+ char *input = readline("> ");
+ if(!input)
+ break;
+ add_history(input);
+ int ret = parse_command(input);
+ free(input);
+ if(ret == 0)
+ break;
+ }
}
void usage(void)
@@ -543,9 +543,9 @@ int main(int argc, char **argv)
if(!g_quiet)
printf("Starting interactive session. Type 'help' to get help.\n");
- while(1)
- if(!do_command())
- break;
+
+ interactive_mode();
+
Lerr:
if(features.feature_mask & HWEMUL_FEATURE_LOG)
{