omfg runs omm if no map is set ##io

This commit is contained in:
pancake 2022-11-22 03:03:54 +01:00 committed by GitHub
parent 60e2d53b2c
commit 7363499cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -544,6 +544,11 @@ static void cmd_omfg(RCore *core, const char *input) {
: r_str_rwx (input) : 7;
ut32 mapid;
if (!r_id_storage_get_lowest (core->io->maps, &mapid)) {
ut32 fd = r_io_fd_get_current (core->io);
RIODesc *desc = r_io_desc_get (core->io, fd);
if (desc) {
r_core_cmd0 (core, "omm");
}
return;
}
switch (*input) {
@ -1063,7 +1068,9 @@ static void cmd_open_map(RCore *core, const char *input) {
}
break;
case 'm': // "omm"
{
if (input[2] == '?') {
r_core_cmd_help_match (core, help_msg_om, "omm", false);
} else {
ut32 fd = input[2]? r_num_math (core->num, input + 2): r_io_fd_get_current (core->io);
RIODesc *desc = r_io_desc_get (core->io, fd);
if (desc) {
@ -1073,7 +1080,7 @@ static void cmd_open_map(RCore *core, const char *input) {
r_io_map_set_name (map, desc->name);
}
} else {
r_core_cmd_help_match (core, help_msg_om, "omm", false);
R_LOG_DEBUG ("Cannot find any fd to map");
}
}
break;