mirror of
https://github.com/radareorg/radare2.git
synced 2025-04-01 17:11:51 +00:00
Add support for RTable.query in i ##bin
This commit is contained in:
parent
58136e0dd8
commit
14c14e7c36
@ -417,7 +417,12 @@ static void _print_strings(RCore *r, RList *list, int mode, int va) {
|
||||
r_cons_break_pop ();
|
||||
}
|
||||
if (IS_MODE_NORMAL (mode)) {
|
||||
r_cons_printf ("%s", r_table_tostring (table));
|
||||
if (r->table_query) {
|
||||
r_table_query (table, r->table_query);
|
||||
}
|
||||
char *s = r_table_tostring (table);
|
||||
r_cons_printf ("%s", s);
|
||||
free (s);
|
||||
|
||||
}
|
||||
r_table_free (table);
|
||||
@ -1653,7 +1658,12 @@ static int bin_relocs(RCore *r, int mode, int va) {
|
||||
r_cons_println (pj_string (pj));
|
||||
}
|
||||
if (IS_MODE_NORMAL (mode)) {
|
||||
r_cons_printf ("\n%s\n", r_table_tostring (table));
|
||||
if (r->table_query) {
|
||||
r_table_query (table, r->table_query);
|
||||
}
|
||||
char *s = r_table_tostring (table);
|
||||
r_cons_printf ("\n%s\n", s);
|
||||
free (s);
|
||||
r_cons_printf ("\n%i relocations\n", i);
|
||||
|
||||
}
|
||||
@ -1870,7 +1880,12 @@ static int bin_imports(RCore *r, int mode, int va, const char *name) {
|
||||
if (IS_MODE_JSON (mode)) {
|
||||
r_cons_print ("]");
|
||||
} else if (IS_MODE_NORMAL (mode)) {
|
||||
r_cons_printf ("%s\n", r_table_tostring (table));
|
||||
if (r->table_query) {
|
||||
r_table_query (table, r->table_query);
|
||||
}
|
||||
char *s = r_table_tostring (table);
|
||||
r_cons_printf ("%s\n", s);
|
||||
free (s);
|
||||
}
|
||||
r_table_free (table);
|
||||
#if MYDB
|
||||
@ -2271,7 +2286,12 @@ next:
|
||||
}
|
||||
}
|
||||
if (IS_MODE_NORMAL (mode)){
|
||||
r_cons_printf ("\n%s", r_table_tostring (table));
|
||||
if (r->table_query) {
|
||||
r_table_query (table, r->table_query);
|
||||
}
|
||||
char *s = r_table_tostring (table);
|
||||
r_cons_printf ("\n%s", s);
|
||||
free (s);
|
||||
}
|
||||
if (count == 0 && IS_MODE_JSON (mode)) {
|
||||
r_cons_printf ("{}");
|
||||
@ -2485,7 +2505,14 @@ static int bin_sections(RCore *r, int mode, ut64 laddr, int va, ut64 at, const c
|
||||
}
|
||||
RTable *table = r_core_table (r);
|
||||
r_table_visual_list (table, list, r->offset, -1, cols, r->io->va);
|
||||
r_cons_printf ("\n%s\n", r_table_tostring (table));
|
||||
if (r->table_query) {
|
||||
r_table_query (table, r->table_query);
|
||||
}
|
||||
{
|
||||
char *s = r_table_tostring (table);
|
||||
r_cons_printf ("\n%s\n", s);
|
||||
free (s);
|
||||
}
|
||||
r_table_free (table);
|
||||
r_list_free (list);
|
||||
goto out;
|
||||
@ -2752,8 +2779,12 @@ static int bin_sections(RCore *r, int mode, ut64 laddr, int va, ut64 at, const c
|
||||
ret = true;
|
||||
out:
|
||||
if (IS_MODE_NORMAL (mode)) {
|
||||
r_cons_printf ("\n%s\n", r_table_tostring (table));
|
||||
|
||||
if (r->table_query) {
|
||||
r_table_query (table, r->table_query);
|
||||
}
|
||||
char *s = r_table_tostring (table);
|
||||
r_cons_printf ("\n%s\n", s);
|
||||
free (s);
|
||||
}
|
||||
r_table_free (table);
|
||||
ht_pp_free (dup_chk_ht);
|
||||
|
@ -480,7 +480,7 @@ static int cmd_info(void *data, const char *input) {
|
||||
}
|
||||
char *question = strchr (input, '?');
|
||||
const char *space = strchr (input, ' ');
|
||||
if (!space) {
|
||||
if (!space && question) {
|
||||
space = question + 1;
|
||||
}
|
||||
if (question < space && question > input) {
|
||||
@ -488,7 +488,14 @@ static int cmd_info(void *data, const char *input) {
|
||||
r_core_cmdf (core, "i?~& i%c", *question);
|
||||
goto done;
|
||||
}
|
||||
R_FREE (core->table_query);
|
||||
if (space && *space == ' ') {
|
||||
core->table_query = r_str_trim_dup (space + 1);
|
||||
}
|
||||
while (*input) {
|
||||
if (*input == ' ') {
|
||||
break;
|
||||
}
|
||||
switch (*input) {
|
||||
case 'b': // "ib"
|
||||
{
|
||||
|
@ -2886,6 +2886,7 @@ R_API RCore *r_core_fini(RCore *c) {
|
||||
// TODO: sync all dbs?
|
||||
//r_core_file_free (c->file);
|
||||
//c->file = NULL;
|
||||
R_FREE (c->table_query);
|
||||
r_list_free (c->files);
|
||||
r_list_free (c->watchers);
|
||||
r_list_free (c->scriptstack);
|
||||
|
@ -324,6 +324,7 @@ typedef struct r_core_t {
|
||||
bool fixedbits;
|
||||
bool fixedarch;
|
||||
bool fixedblock;
|
||||
char *table_query;
|
||||
int sync_index; // used for http.sync and T=
|
||||
struct r_core_t *c2;
|
||||
RCoreAutocomplete *autocomplete;
|
||||
|
Loading…
x
Reference in New Issue
Block a user