diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-01-29 23:58:45 +0000 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-01-29 23:58:45 +0000 |
commit | 9d2631854c2131ad0f79962500771f5e085d66b1 (patch) | |
tree | 55d293ec17fff2ed8487c32bca42a672f34f7872 /utils/imxtools | |
parent | 6d5b1b2448043f34ba0bbafce7ea1768cc5a79a7 (diff) | |
download | rockbox-9d2631854c2131ad0f79962500771f5e085d66b1.tar.gz rockbox-9d2631854c2131ad0f79962500771f5e085d66b1.zip |
imxtools/hwemul: add readline support
Change-Id: If2e86bf8b520a8d4c38a56ac969918fdeb2c6f91
Diffstat (limited to 'utils/imxtools')
-rw-r--r-- | utils/imxtools/hwemul/tools/Makefile | 2 | ||||
-rwxr-xr-x | utils/imxtools/hwemul/tools/hwemul_tool | bin | 1354604 -> 0 bytes | |||
-rw-r--r-- | utils/imxtools/hwemul/tools/hwemul_tool.c | 36 |
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 | |||
2 | AR=ar | 2 | AR=ar |
3 | HWEMUL_LIB_DIR=../lib | 3 | HWEMUL_LIB_DIR=../lib |
4 | CFLAGS=-W -Wall -O2 `pkg-config --cflags libusb-1.0` -std=c99 -g -I$(HWEMUL_LIB_DIR) | 4 | CFLAGS=-W -Wall -O2 `pkg-config --cflags libusb-1.0` -std=c99 -g -I$(HWEMUL_LIB_DIR) |
5 | LDFLAGS=`pkg-config --libs libusb-1.0` | 5 | LDFLAGS=`pkg-config --libs libusb-1.0` -lreadline |
6 | EXEC=hwemul_tool | 6 | EXEC=hwemul_tool |
7 | HWEMUL_LIB=$(HWEMUL_LIB_DIR)/libhwemul.a | 7 | HWEMUL_LIB=$(HWEMUL_LIB_DIR)/libhwemul.a |
8 | SRC=$(wildcard *.c) | 8 | 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 @@ | |||
24 | #include <string.h> | 24 | #include <string.h> |
25 | #include <getopt.h> | 25 | #include <getopt.h> |
26 | #include <stdbool.h> | 26 | #include <stdbool.h> |
27 | #include <readline/readline.h> | ||
28 | #include <readline/history.h> | ||
27 | 29 | ||
28 | bool g_quiet = false; | 30 | bool g_quiet = false; |
29 | struct hwemul_device_t hwdev; | 31 | struct hwemul_device_t hwdev; |
@@ -326,22 +328,20 @@ int parse_command(char *cmd) | |||
326 | return syntax_error(cmd); | 328 | return syntax_error(cmd); |
327 | } | 329 | } |
328 | 330 | ||
329 | int do_command() | 331 | void interactive_mode(void) |
330 | { | 332 | { |
331 | char *line = NULL; | 333 | rl_bind_key('\t', rl_complete); |
332 | int size = 0; | 334 | while(1) |
333 | getline(&line, &size, stdin); | 335 | { |
334 | char *end = strchr(line, '\n'); | 336 | char *input = readline("> "); |
335 | if(end) | 337 | if(!input) |
336 | *end = 0; | 338 | break; |
337 | char *pch = strtok(line, " "); | 339 | add_history(input); |
338 | int ret; | 340 | int ret = parse_command(input); |
339 | if(pch) | 341 | free(input); |
340 | ret = parse_command(pch); | 342 | if(ret == 0) |
341 | else | 343 | break; |
342 | ret = print_help(); | 344 | } |
343 | free(line); | ||
344 | return ret; | ||
345 | } | 345 | } |
346 | 346 | ||
347 | void usage(void) | 347 | void usage(void) |
@@ -543,9 +543,9 @@ int main(int argc, char **argv) | |||
543 | 543 | ||
544 | if(!g_quiet) | 544 | if(!g_quiet) |
545 | printf("Starting interactive session. Type 'help' to get help.\n"); | 545 | printf("Starting interactive session. Type 'help' to get help.\n"); |
546 | while(1) | 546 | |
547 | if(!do_command()) | 547 | interactive_mode(); |
548 | break; | 548 | |
549 | Lerr: | 549 | Lerr: |
550 | if(features.feature_mask & HWEMUL_FEATURE_LOG) | 550 | if(features.feature_mask & HWEMUL_FEATURE_LOG) |
551 | { | 551 | { |