From e8ddc6889320a6097fc00afe88ff235580b9c778 Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 27 Oct 2016 17:11:24 +0200 Subject: [PATCH] Add autocompletion for wxf and wtf --- libr/core/cmd_eval.c | 1 - libr/core/cmd_write.c | 7 +++++-- libr/core/core.c | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libr/core/cmd_eval.c b/libr/core/cmd_eval.c index 09aa0b6fc9..16f2ee29c5 100644 --- a/libr/core/cmd_eval.c +++ b/libr/core/cmd_eval.c @@ -49,7 +49,6 @@ R_API RList *r_core_list_themes(RCore *core) { RList *files = NULL; RListIter *iter; const char *fn; - int ctr = 0; char *home = r_str_home (".config/radare2/cons/"); RList *list = r_list_new (); diff --git a/libr/core/cmd_write.c b/libr/core/cmd_write.c index ad01358e71..d69690c004 100644 --- a/libr/core/cmd_write.c +++ b/libr/core/cmd_write.c @@ -973,6 +973,9 @@ static int cmd_write(void *data, const char *input) { } } else if (*str == '?' || *str == '\0') { eprintf ("Usage: wt[a] file [size] write 'size' bytes in current block to file\n"); + eprintf (" wta [filename] - append to file\n"); + eprintf (" wtf [filename] - write to file (see also wxf and wf?\n"); + eprintf (" wt [filename] - alias for wtf\n"); free (ostr); return 0; } else { @@ -988,8 +991,8 @@ static int cmd_write(void *data, const char *input) { } else if (*str=='a') { // "wta" append = 1; str++; - if (str[0]==' ') { - filename = str+1; + if (str[0] == ' ') { + filename = str + 1; } else { const char* prefix = r_config_get (core->config, "cfg.prefixdump"); snprintf (_fn, sizeof (_fn), "%s.0x%08"PFMT64x, prefix, core->offset); diff --git a/libr/core/core.c b/libr/core/core.c index 220f3e4bde..be700e5006 100644 --- a/libr/core/core.c +++ b/libr/core/core.c @@ -548,7 +548,7 @@ static const char *radare_argv[] = { "q", "q!", "f", "fl", "fr", "f-", "f*", "fs", "fS", "fr", "fo", "f?", "m", "m*", "ml", "m-", "my", "mg", "md", "mp", "m?", - "o", "o+", "oc", "on", "op", "o-", "x", "wf", "wF", "wt", "wp", + "o", "o+", "oc", "on", "op", "o-", "x", "wf", "wF", "wta", "wtf", "wp", "t", "to ", "t-", "tf", "td", "td-", "tb", "te", "tl", "tk", "ts", "(", "(*", "(-", "()", ".", ".!", ".(", "./", "r", "r+", "r-", @@ -671,7 +671,6 @@ static int autocomplete(RLine *line) { line->completion.argv = tmp_argv; } else if ((!strncmp (line->buffer.data, "eco ", 4))) { int i = 0; - int chr = 4; int len = strlen (line->buffer.data + 4); char *theme; RList *themes = r_core_list_themes (core); @@ -719,7 +718,9 @@ static int autocomplete(RLine *line) { !strncmp (line->buffer.data, "wF ", 3) || !strncmp (line->buffer.data, "cat ", 4) || !strncmp (line->buffer.data, "less ", 5) || - !strncmp (line->buffer.data, "wt ", 3) || + !strncmp (line->buffer.data, "wta ", 4) || + !strncmp (line->buffer.data, "wtf ", 4) || + !strncmp (line->buffer.data, "wxf ", 4) || !strncmp (line->buffer.data, "wp ", 3) || !strncmp (line->buffer.data, "Sd ", 3) || !strncmp (line->buffer.data, "Sl ", 3) ||