diff --git a/librz/core/cmd.c b/librz/core/cmd.c index c954de5d326..937c85e76bb 100644 --- a/librz/core/cmd.c +++ b/librz/core/cmd.c @@ -6638,7 +6638,7 @@ RZ_API void rz_core_cmd_init(RzCore *core) { { "z", "zignatures", rz_cmd_zign }, }; - core->rcmd = rz_cmd_new(!!core->cons, true); + core->rcmd = rz_cmd_new(!!core->cons); core->rcmd->macro.user = core; core->rcmd->macro.num = core->num; core->rcmd->macro.cmd = core_cmd0_wrapper; diff --git a/librz/core/cmd_api.c b/librz/core/cmd_api.c index 7d14311d186..56f00645848 100644 --- a/librz/core/cmd_api.c +++ b/librz/core/cmd_api.c @@ -161,7 +161,7 @@ RZ_API void rz_cmd_alias_init(RzCmd *cmd) { cmd->aliases.values = NULL; } -RZ_API RzCmd *rz_cmd_new(bool has_cons, bool add_core_plugins) { +RZ_API RzCmd *rz_cmd_new(bool has_cons) { int i; RzCmd *cmd = RZ_NEW0(RzCmd); if (!cmd) { @@ -175,9 +175,6 @@ RZ_API RzCmd *rz_cmd_new(bool has_cons, bool add_core_plugins) { cmd->nullcallback = cmd->data = NULL; cmd->ht_cmds = ht_pp_new0(); cmd->root_cmd_desc = create_cmd_desc(cmd, NULL, RZ_CMD_DESC_TYPE_GROUP, "", &root_help, true); - if (add_core_plugins) { - rz_core_plugin_init(cmd); - } rz_cmd_macro_init(&cmd->macro); rz_cmd_alias_init(cmd); return cmd; @@ -192,9 +189,6 @@ RZ_API RzCmd *rz_cmd_free(RzCmd *cmd) { rz_cmd_alias_free(cmd); rz_cmd_macro_fini(&cmd->macro); ht_pp_free(cmd->ht_cmds); - // dinitialize plugin commands - rz_core_plugin_fini(cmd); - rz_list_free(cmd->plist); rz_list_free(cmd->lcmds); for (i = 0; i < NCMDS; i++) { if (cmd->cmds[i]) { @@ -417,8 +411,6 @@ RZ_API int rz_cmd_del(RzCmd *cmd, const char *command) { RZ_API int rz_cmd_call(RzCmd *cmd, const char *input) { struct rz_cmd_item_t *c; int ret = -1; - RzListIter *iter; - RzCorePlugin *cp; rz_return_val_if_fail(cmd && input, -1); if (!*input) { if (cmd->nullcallback) { @@ -436,12 +428,6 @@ RZ_API int rz_cmd_call(RzCmd *cmd, const char *input) { input = nstr; } } - rz_list_foreach (cmd->plist, iter, cp) { - if (cp->call && cp->call(cmd->data, input)) { - free(nstr); - return true; - } - } if (!*input) { free(nstr); return -1; @@ -626,26 +612,6 @@ static RzCmdStatus call_cd(RzCmd *cmd, RzCmdDesc *cd, RzCmdParsedArgs *args) { } RZ_API RzCmdStatus rz_cmd_call_parsed_args(RzCmd *cmd, RzCmdParsedArgs *args) { - RzCmdStatus res = RZ_CMD_STATUS_INVALID; - - // As old RzCorePlugin do not register new commands in RzCmd, we have no - // way of knowing if one of those is able to handle the input, so we - // have to pass the input to all of them before looking into the - // RzCmdDesc tree - RzListIter *iter; - RzCorePlugin *cp; - char *exec_string = rz_cmd_parsed_args_execstr(args); - rz_list_foreach (cmd->plist, iter, cp) { - if (cp->call && cp->call(cmd->data, exec_string)) { - res = RZ_CMD_STATUS_OK; - break; - } - } - RZ_FREE(exec_string); - if (res == RZ_CMD_STATUS_OK) { - return res; - } - RzCmdDesc *cd = rz_cmd_get_desc(cmd, rz_cmd_parsed_args_cmd(args)); if (!cd) { return RZ_CMD_STATUS_NONEXISTINGCMD; diff --git a/librz/core/cmd_plugins.c b/librz/core/cmd_plugins.c index b414563e804..cf021085903 100644 --- a/librz/core/cmd_plugins.c +++ b/librz/core/cmd_plugins.c @@ -71,7 +71,7 @@ RZ_IPI int rz_cmd_plugins(void *data, const char *input) { case 'j': { rz_cons_printf("["); bool is_first_element = true; - rz_list_foreach (core->rcmd->plist, iter, cp) { + rz_list_foreach (core->plugins, iter, cp) { rz_cons_printf("%s{\"Name\":\"%s\",\"Description\":\"%s\"}", is_first_element ? "" : ",", cp->name, cp->desc); is_first_element = false; @@ -81,7 +81,7 @@ RZ_IPI int rz_cmd_plugins(void *data, const char *input) { } case 0: rz_lib_list(core->lib); - rz_list_foreach (core->rcmd->plist, iter, cp) { + rz_list_foreach (core->plugins, iter, cp) { rz_cons_printf("%s: %s\n", cp->name, cp->desc); } break; diff --git a/librz/core/core.c b/librz/core/core.c index d4f23a9bee9..78eb8afb96c 100644 --- a/librz/core/core.c +++ b/librz/core/core.c @@ -2605,6 +2605,8 @@ RZ_API bool rz_core_init(RzCore *core) { core->offset = 0LL; core->prompt_offset = 0LL; rz_core_cmd_init(core); + rz_core_plugin_init(core); + core->dbg = rz_debug_new(true); rz_io_bind(core->io, &(core->dbg->iob)); @@ -2680,6 +2682,7 @@ RZ_API void rz_core_fini(RzCore *c) { if (!c) { return; } + rz_core_plugin_fini(c); rz_core_task_break_all(&c->tasks); rz_core_task_join(&c->tasks, NULL, -1); rz_core_wait(c); diff --git a/librz/core/cplugin.c b/librz/core/cplugin.c index 4fec3755a83..78cac62890e 100644 --- a/librz/core/cplugin.c +++ b/librz/core/cplugin.c @@ -1,61 +1,48 @@ // SPDX-License-Identifier: LGPL-3.0-only -/* covardly copied from rz_cmd */ - #include #include #include #include #include -static RzCorePlugin *cmd_static_plugins[] = { +static RzCorePlugin *core_static_plugins[] = { RZ_CORE_STATIC_PLUGINS }; -RZ_API int rz_core_plugin_fini(RzCmd *cmd) { +RZ_API bool rz_core_plugin_fini(RzCore *core) { + rz_return_val_if_fail(core->plugins, false); + RzListIter *iter; RzCorePlugin *plugin; - if (!cmd->plist) { - return false; - } - rz_list_foreach (cmd->plist, iter, plugin) { - if (plugin && plugin->fini) { - plugin->fini(cmd, NULL); + rz_list_foreach (core->plugins, iter, plugin) { + if (plugin->fini) { + plugin->fini(core); } } - /* empty the list */ - rz_list_free(cmd->plist); - cmd->plist = NULL; + rz_list_free(core->plugins); + core->plugins = NULL; return true; } -RZ_API int rz_core_plugin_add(RzCmd *cmd, RzCorePlugin *plugin) { - if (!cmd || (plugin && plugin->init && !plugin->init(cmd, NULL))) { +RZ_API bool rz_core_plugin_add(RzCore *core, RzCorePlugin *plugin) { + rz_return_val_if_fail(core, false); + rz_return_val_if_fail(plugin && plugin->init && plugin->name && plugin->author && plugin->license, false); + if (!plugin->init(core)) { return false; } - rz_list_append(cmd->plist, plugin); + rz_list_append(core->plugins, plugin); return true; } -RZ_API int rz_core_plugin_init(RzCmd *cmd) { +RZ_API bool rz_core_plugin_init(RzCore *core) { int i; - cmd->plist = rz_list_newf(NULL); // memleak or dblfree - for (i = 0; cmd_static_plugins[i]; i++) { - if (!rz_core_plugin_add(cmd, cmd_static_plugins[i])) { - eprintf("Error loading cmd plugin\n"); + core->plugins = rz_list_newf(NULL); // memleak or dblfree + for (i = 0; core_static_plugins[i]; i++) { + if (!rz_core_plugin_add(core, core_static_plugins[i])) { + eprintf("Error loading core plugin\n"); return false; } } return true; -} - -RZ_API int rz_core_plugin_check(RzCmd *cmd, const char *a0) { - RzListIter *iter; - RzCorePlugin *cp; - rz_list_foreach (cmd->plist, iter, cp) { - if (cp->call(NULL, a0)) { - return true; - } - } - return false; -} +} \ No newline at end of file diff --git a/librz/core/libs.c b/librz/core/libs.c index 6d5382b5033..2f5ba459b3b 100644 --- a/librz/core/libs.c +++ b/librz/core/libs.c @@ -26,10 +26,20 @@ static int __lib_##x##_dt(RzLibPlugin *pl, void *p, void *u) { return true; } // XXX api consistency issues +static int __lib_core_cb(RzLibPlugin *pl, void *user, void *data) { + struct rz_core_plugin_t *hand = (struct rz_core_plugin_t *)data; + RzCore *core = (RzCore *)user; + pl->free = NULL; + rz_core_plugin_add(core, hand); + return true; +} + +static int __lib_core_dt(RzLibPlugin *pl, void *p, void *u) { + return true; +} + #define rz_io_add rz_io_plugin_add CB_COPY(io, io) -#define rz_core_add rz_core_plugin_add -CB(core, rcmd) #define rz_debug_add rz_debug_plugin_add CB(debug, dbg) #define rz_bp_add rz_bp_plugin_add diff --git a/librz/core/p/core_java.c b/librz/core/p/core_java.c index e3ba2f303a5..7e7f9142426 100644 --- a/librz/core/p/core_java.c +++ b/librz/core/p/core_java.c @@ -1643,12 +1643,8 @@ static const RzCmdDescHelp cmd_java_help = { .args = cmd_java_args, }; -static int rz_cmd_java_init_handler(void *user, const char *unused) { - RzCmd *cmd = (RzCmd *)user; - if (!cmd) { - return false; - } - +static bool rz_cmd_java_init_handler(RzCore *core) { + RzCmd *cmd = core->rcmd; RzCmdDesc *root_cd = rz_cmd_get_root(cmd); if (!root_cd) { return false; @@ -1659,17 +1655,13 @@ static int rz_cmd_java_init_handler(void *user, const char *unused) { return cmd_java_cd != NULL; } -static int rz_cmd_java_call_handler(void *user, const char *unused) { - return false; -} - // PLUGIN Definition Info RzCorePlugin rz_core_plugin_java = { .name = "java", .desc = "Suite of java commands, java help for more info", + .author = "RizinOrg", .license = "Apache", .init = rz_cmd_java_init_handler, - .call = rz_cmd_java_call_handler, }; #ifndef RZ_PLUGIN_INCORE diff --git a/librz/include/rz_cmd.h b/librz/include/rz_cmd.h index b2d2d3cd313..a89ac9ed9cf 100644 --- a/librz/include/rz_cmd.h +++ b/librz/include/rz_cmd.h @@ -397,7 +397,6 @@ typedef struct rz_cmd_t { RzCmdItem *cmds[UT8_MAX]; RzCmdMacro macro; RzList *lcmds; - RzList *plist; RzCmdAlias aliases; void *language; // used to store TSLanguage * HtUP *ts_symbols_ht; @@ -420,27 +419,10 @@ typedef struct rz_cmd_descriptor_t { struct rz_cmd_descriptor_t *sub[127]; } RzCmdDescriptor; -// TODO: move into rz_core.h -typedef struct rz_core_plugin_t { - const char *name; - const char *desc; - const char *license; - const char *author; - const char *version; - RzCmdCb call; // returns true if command was handled, false otherwise. - RzCmdCb init; - RzCmdCb fini; -} RzCorePlugin; - typedef bool (*RzCmdForeachNameCb)(RzCmd *cmd, const RzCmdDesc *desc, void *user); #ifdef RZ_API -RZ_API int rz_core_plugin_init(RzCmd *cmd); -RZ_API int rz_core_plugin_add(RzCmd *cmd, RzCorePlugin *plugin); -RZ_API int rz_core_plugin_check(RzCmd *cmd, const char *a0); -RZ_API int rz_core_plugin_fini(RzCmd *cmd); - -RZ_API RzCmd *rz_cmd_new(bool has_cons, bool add_core_plugins); +RZ_API RzCmd *rz_cmd_new(bool has_cons); RZ_API RzCmd *rz_cmd_free(RzCmd *cmd); RZ_API int rz_cmd_set_data(RzCmd *cmd, void *data); RZ_API int rz_cmd_add(RzCmd *cmd, const char *command, RzCmdCb callback); diff --git a/librz/include/rz_core.h b/librz/include/rz_core.h index 7fdedf39b88..b6fb5c0a956 100644 --- a/librz/include/rz_core.h +++ b/librz/include/rz_core.h @@ -94,6 +94,19 @@ typedef enum { RZ_CORE_VISUAL_MODE_CD = 4 } RzCoreVisualMode; +typedef bool (*RzCorePluginInit)(RzCore *core); +typedef bool (*RzCorePluginFini)(RzCore *core); + +typedef struct rz_core_plugin_t { + const char *name; + const char *desc; + const char *license; + const char *author; + const char *version; + RzCorePluginInit init; + RzCorePluginFini fini; +} RzCorePlugin; + typedef struct rz_core_rtr_host_t { int proto; char host[512]; @@ -251,6 +264,7 @@ typedef struct rz_core_seek_history_t { struct rz_core_t { RzBin *bin; + RzList *plugins; ///< List of registered core plugins RzConfig *config; ut64 offset; // current seek ut64 prompt_offset; // temporarily set to offset to have $$ in expressions always stay the same during temp seeks @@ -382,6 +396,10 @@ typedef struct rz_core_cmpwatch_t { typedef int (*RzCoreSearchCallback)(RzCore *core, ut64 from, ut8 *buf, int len); #ifdef RZ_API +RZ_API bool rz_core_plugin_init(RzCore *core); +RZ_API bool rz_core_plugin_add(RzCore *core, RzCorePlugin *plugin); +RZ_API bool rz_core_plugin_fini(RzCore *core); + //#define rz_core_ncast(x) (RzCore*)(size_t)(x) RZ_API RzList *rz_core_list_themes(RzCore *core); RZ_API char *rz_core_get_theme(void); diff --git a/test/unit/test_autocmplt.c b/test/unit/test_autocmplt.c index 22d4413a527..59086f29b13 100644 --- a/test/unit/test_autocmplt.c +++ b/test/unit/test_autocmplt.c @@ -55,7 +55,7 @@ static RzCore *fake_core_new(void) { mu_assert_notnull(cf, "file should be opened"); rz_core_bin_load(core, "bins/elf/hello_world", 0); rz_cmd_free(core->rcmd); - RzCmd *cmd = rz_cmd_new(true, false); + RzCmd *cmd = rz_cmd_new(true); mu_assert_notnull(cmd, "cmd should be created"); RzCmdDesc *root = rz_cmd_get_root(cmd); mu_assert_notnull(root, "root should be present"); diff --git a/test/unit/test_cmd.c b/test/unit/test_cmd.c index c80a95913c2..d8951161378 100644 --- a/test/unit/test_cmd.c +++ b/test/unit/test_cmd.c @@ -92,7 +92,7 @@ static RzCmdStatus afl_argv_handler(RzCore *core, int argc, const char **argv) { } bool test_cmd_descriptor_argv(void) { - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *cd = rz_cmd_desc_argv_new(cmd, root, "afl", afl_argv_handler, &fake_help); mu_assert_notnull(cd, "cmddesc created"); @@ -106,7 +106,7 @@ bool test_cmd_descriptor_argv(void) { } bool test_cmd_descriptor_argv_nested(void) { - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *af_cd = rz_cmd_desc_group_new(cmd, root, "af", NULL, NULL, &fake_help); rz_cmd_desc_argv_new(cmd, root, "af2", NULL, &fake_help); @@ -122,7 +122,7 @@ static int a_oldinput_cb(void *user, const char *input) { } bool test_cmd_descriptor_oldinput(void) { - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *cd = rz_cmd_desc_oldinput_new(cmd, root, "a", a_oldinput_cb, NULL); mu_assert_notnull(cd, "cmddesc created"); @@ -147,7 +147,7 @@ bool test_cmd_descriptor_group(void) { const RzCmdDescHelp a_exec_help = { .summary = "a exec help", .args = fake_args }; const RzCmdDescHelp a_group_help = { .summary = "a group help" }; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *cd = rz_cmd_desc_group_new(cmd, root, "a", a_exec_cb, &a_exec_help, &a_group_help); rz_cmd_desc_argv_new(cmd, cd, "ab", ab_cb, &ab_help); @@ -197,7 +197,7 @@ static int w_handler(void *user, const char *input) { } bool test_cmd_descriptor_tree(void) { - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *a_cd = rz_cmd_desc_group_new(cmd, root, "a", NULL, NULL, &fake_help); rz_cmd_desc_argv_new(cmd, a_cd, "ap", ap_handler, &fake_help); @@ -214,7 +214,7 @@ bool test_cmd_descriptor_tree(void) { } bool test_cmd_get_desc(void) { - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *a_cd = rz_cmd_desc_group_new(cmd, root, "a", NULL, NULL, &fake_help); RzCmdDesc *ap_cd = rz_cmd_desc_group_new(cmd, a_cd, "ap", ap_handler, NULL, &fake_help); @@ -279,7 +279,7 @@ bool test_cmd_call_desc(void) { .args = pd_help_args, }; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *p_cd = rz_cmd_desc_group_new(cmd, root, "p", NULL, NULL, &fake_help); rz_cmd_desc_argv_new(cmd, p_cd, "pd", pd_handler, &pd_help); @@ -348,7 +348,7 @@ bool test_cmd_help(void) { .args = fake_args, }; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *p_cd = rz_cmd_desc_group_new(cmd, root, "p", NULL, NULL, &p_group_help); rz_cmd_desc_argv_new(cmd, p_cd, "pd", pd_handler, &pd_help); @@ -415,7 +415,7 @@ bool test_cmd_group_help(void) { .args = fake_args, }; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *p_cd = rz_cmd_desc_group_new(cmd, root, "p", p_handler_argv, &p_help, &p_group_help); rz_cmd_desc_argv_new(cmd, p_cd, "pd", pd_handler, &pd_help); @@ -437,7 +437,7 @@ bool test_cmd_group_help(void) { bool test_cmd_oldinput_help(void) { rz_cons_new(); - RzCmd *cmd = rz_cmd_new(true, false); + RzCmd *cmd = rz_cmd_new(true); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *p_cd = rz_cmd_desc_group_new(cmd, root, "p", NULL, NULL, &fake_help); rz_cmd_desc_argv_new(cmd, p_cd, "pd", pd_handler, &fake_help); @@ -457,7 +457,7 @@ bool test_cmd_oldinput_help(void) { } bool test_remove_cmd(void) { - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *x_cd = rz_cmd_desc_argv_new(cmd, root, "x", NULL, &fake_help); RzCmdDesc *p_cd = rz_cmd_desc_group_new(cmd, root, "p", NULL, NULL, &fake_help); @@ -496,7 +496,7 @@ bool test_cmd_args(void) { x_help.summary = "x summary"; x_help.args = x_args; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *x_cd = rz_cmd_desc_argv_new(cmd, root, "x", NULL, &x_help); @@ -522,7 +522,7 @@ bool test_cmd_argv_modes(void) { z_help.summary = "z summary"; z_help.args = z_args; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *z_cd = rz_cmd_desc_argv_modes_new(cmd, root, "z", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_LONG_JSON, z_modes_handler, &z_help); @@ -567,7 +567,7 @@ bool test_cmd_group_argv_modes(void) { RzCmdDescHelp z_group_help = { 0 }; z_group_help.summary = "z group summary"; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *z_cd = rz_cmd_desc_group_modes_new(cmd, root, "z", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET, z_modes_handler, &z_help, &z_group_help); RzCmdDesc *zd_cd = rz_cmd_desc_argv_new(cmd, z_cd, "zd", zd_handler, &fake_help); @@ -605,7 +605,7 @@ static bool foreach_cmdname_cb(RzCmd *cmd, const RzCmdDesc *desc, void *user) { } bool test_foreach_cmdname(void) { - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *z_cd = rz_cmd_desc_group_modes_new(cmd, root, "z", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET, z_modes_handler, &fake_help, &fake_help); rz_cmd_desc_argv_new(cmd, z_cd, "zd", zd_handler, &fake_help); @@ -646,7 +646,7 @@ bool test_foreach_cmdname(void) { } bool test_foreach_cmdname_begin(void) { - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *z_cd = rz_cmd_desc_group_modes_new(cmd, root, "z", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET, z_modes_handler, &fake_help, &fake_help); rz_cmd_desc_argv_new(cmd, z_cd, "zd", zd_handler, &fake_help); @@ -786,7 +786,7 @@ bool test_arg_flags(void) { RzCmdDescHelp x_help = { 0 }; x_help.summary = "x summary"; x_help.args = x_args; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); rz_cmd_desc_argv_new(cmd, root, "z", z_last_handler, &z_help); rz_cmd_desc_argv_new(cmd, root, "x", x_array_handler, &x_help); @@ -825,7 +825,7 @@ bool test_get_arg(void) { RzCmdDescHelp x_help = { 0 }; x_help.summary = "x summary"; x_help.args = x_args; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *z_cd = rz_cmd_desc_argv_new(cmd, root, "z", z_last_handler, &z_help); RzCmdDesc *x_cd = rz_cmd_desc_argv_new(cmd, root, "x", x_array_handler, &x_help); @@ -867,7 +867,7 @@ bool test_parent_details(void) { RzCmdDescHelp zx_help = { 0 }; zx_help.summary = "x summary"; zx_help.args = zx_args; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); RzCmdDesc *z_cd = rz_cmd_desc_group_new(cmd, root, "z", NULL, NULL, &z_group_help); rz_cmd_desc_argv_new(cmd, z_cd, "zx", x_array_handler, &zx_help); @@ -896,7 +896,7 @@ bool test_default_value(void) { RzCmdDescHelp z_help = { 0 }; z_help.summary = "z summary"; z_help.args = z_args; - RzCmd *cmd = rz_cmd_new(false, false); + RzCmd *cmd = rz_cmd_new(false); RzCmdDesc *root = rz_cmd_get_root(cmd); rz_cmd_desc_argv_new(cmd, root, "z", default_value_handler, &z_help); diff --git a/test/unit/test_core_cmd.c b/test/unit/test_core_cmd.c index c15d069d21a..59b587cff3f 100644 --- a/test/unit/test_core_cmd.c +++ b/test/unit/test_core_cmd.c @@ -68,7 +68,7 @@ static RzCmdStatus cmd_last_opt_handler(RzCore *core, int argc, const char **arg static RzCore *fake_core_new(void) { RzCore *core = rz_core_new(); rz_cmd_free(core->rcmd); - core->rcmd = rz_cmd_new(true, false); + core->rcmd = rz_cmd_new(true); core->rcmd->data = core; RzCmdDesc *root = rz_cmd_get_root(core->rcmd); rz_cmd_desc_argv_new(core->rcmd, root, "string", string_handler, &string_help);