Implemented pmj (#15864) ##print

This commit is contained in:
dodococo 2020-01-21 04:09:04 +05:30 committed by radare
parent 05d5e77f24
commit 5aa8ab5c75
2 changed files with 10 additions and 3 deletions

View File

@ -190,11 +190,14 @@ seek_exit:
return ret;
}
static void r_core_magic(RCore *core, const char *file, int v) {
static void r_core_magic(RCore *core, const char *file, int v, int json) {
ut64 addr = core->offset;
int hits = 0;
magicdepth = r_config_get_i (core->config, "magic.depth"); // TODO: do not use global var here
r_core_magic_at (core, file, addr, magicdepth, v, false, &hits);
r_core_magic_at (core, file, addr, magicdepth, v, json, &hits);
if (json) {
r_cons_newline ();
}
if (addr != core->offset) {
r_core_seek (core, addr, true);
}

View File

@ -6180,10 +6180,14 @@ l = use_blocksize;
"| e dir.magic # defaults to " R_JOIN_2_PATHS ("{R2_PREFIX}", R2_SDB_MAGIC) "\n"
"| /m # search for magic signatures\n"
);
} else if (input[1] == 'j') { // "pmj"
if (l > 0) {
r_core_magic (core, input + 2, true, true);
}
} else {
// XXX: need cmd_magic header for r_core_magic
if (l > 0) {
r_core_magic (core, input + 1, true);
r_core_magic (core, input + 1, true, false);
}
}
break;