Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_cmd.h>
#include <rz_util.h>
#include <stdio.h>
#include <rz_cons.h>
#include <rz_core.h>
Go to the source code of this file.
Classes | |
struct | argv_modes_t |
Macros | |
#define | MAX_CHILDREN_SHOW 7 |
#define | MIN_SUMMARY_WIDTH 6 |
#define | MAX_RIGHT_ALIGHNMENT 20 |
#define | NCMDS (sizeof(cmd->cmds) / sizeof(*cmd->cmds)) |
#define | CASE_TYPE(x, y) |
#define | CASE_CDTYPE(x, y) |
Variables | |
static const char * | SPECIAL_CHARS_REGULAR = "@;~$#|`\"'()<>" |
static const char * | SPECIAL_CHARS_REGULAR_SINGLE = "@;~$#|`\"'()<> " |
static const char * | SPECIAL_CHARS_PF = "@;~$#|`\"'<>" |
static const char * | SPECIAL_CHARS_DOUBLE_QUOTED = "\"$()`" |
static const char * | SPECIAL_CHARS_SINGLE_QUOTED = "'" |
static const RzCmdDescHelp | not_defined_help |
static const RzCmdDescHelp | root_help |
static const struct argv_modes_t | argv_modes [] |
static int | value = 0 |
#define CASE_CDTYPE | ( | x, | |
y | |||
) |
#define MAX_CHILDREN_SHOW 7 |
Number of sub-commands to show as options when displaying the help of a command. When a command has more options than MAX_CHILDREN_SHOW, ?
is shown instead.
Example with MAX_CHILDREN_SHOW=3: w -> wa -> wb -> wc
When doing ?
, you would see: w[abc]
If there is also: -> wd you would see: w[?]
|
static |
Performs a preprocessing step on the user arguments.
This is used to group together some arguments that are returned by the parser as multiple arguments but we want to let the command handler see them as a single one to make life easier for users.
It can also provide default arguments as specified by the command descriptor.
For example: cmdid pd 10
would be considered as having 2 arguments, "pd" and "10". However, if <cmdid> was defined to have as argument RZ_CMD_ARG_FLAG_LAST, we want to group "pd" and "10" in one single argument "pd 10" and pass that to <cmdid> handler.
Definition at line 667 of file cmd_api.c.
References arg(), args, cd, free(), i, arg::name, RZ_CMD_ARG_FLAG_LAST, RZ_CMD_ARG_TYPE_CMD, rz_cmd_escape_arg(), RZ_CMD_ESCAPE_ONE_ARG, rz_cmd_parsed_args_addarg(), rz_str_array_join(), s, and autogen_x86imm::tmp.
Referenced by argv_call_cb().
|
static |
Definition at line 704 of file cmd_api.c.
References args, args_preprocessing(), cd, cd_suffix2mode(), cmd, i, rz_cmd_desc_has_handler(), RZ_CMD_DESC_TYPE_ARGV, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, rz_cmd_parsed_args_cmd(), rz_cmd_state_output_fini(), rz_cmd_state_output_init(), rz_cmd_state_output_print(), RZ_CMD_STATUS_INVALID, RZ_CMD_STATUS_NONEXISTINGCMD, RZ_CMD_STATUS_OK, RZ_CMD_STATUS_WRONG_ARGS, RZ_LOG_DEBUG, RZ_OUTPUT_MODE_TABLE, rz_table_query(), and s.
Referenced by call_cd().
Definition at line 1266 of file cmd_api.c.
References cd, cmd, rz_cons_t::context, fill_argv_modes_help_strbuf(), fill_colored_args(), fill_details(), fill_usage_strbuf(), NULL, rz_cons_context_t::pal, rz_cons_printable_palette_t::reset, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, rz_cons_singleton(), rz_strbuf_append(), rz_strbuf_drain(), rz_strbuf_free(), rz_strbuf_new(), and sb.
Referenced by fake_get_help(), and get_help().
|
static |
Definition at line 2158 of file cmd_api.c.
References rz_cmd_desc_t::argv_modes_data, cb, cmd, create_cmd_desc(), rz_cmd_desc_t::d, get_minmax_argc(), cmd_descs_generate::help, NULL, RZ_CMD_DESC_TYPE_ARGV_MODES, and RZ_OUTPUT_MODE_STANDARD.
Referenced by rz_cmd_desc_argv_modes_new(), and rz_cmd_desc_group_modes_new().
|
static |
Definition at line 2142 of file cmd_api.c.
References rz_cmd_desc_t::argv_data, cb, cmd, create_cmd_desc(), rz_cmd_desc_t::d, get_minmax_argc(), cmd_descs_generate::help, NULL, and RZ_CMD_DESC_TYPE_ARGV.
Referenced by rz_cmd_desc_argv_new(), and rz_cmd_desc_group_new().
|
static |
Definition at line 2171 of file cmd_api.c.
References rz_cmd_desc_t::argv_state_data, cb, cmd, create_cmd_desc(), rz_cmd_desc_t::d, get_minmax_argc(), cmd_descs_generate::help, NULL, RZ_CMD_DESC_TYPE_ARGV_STATE, and RZ_OUTPUT_MODE_STANDARD.
Referenced by rz_cmd_desc_argv_state_new(), and rz_cmd_desc_group_state_new().
|
static |
Definition at line 1051 of file cmd_api.c.
References cd, fill_args(), fill_children_chars(), rz_strbuf_fini(), rz_strbuf_init(), rz_strbuf_length(), sb, show_children_shortcut(), and strlen0().
Referenced by do_print_child_help(), and update_minmax_len().
|
static |
Definition at line 763 of file cmd_api.c.
References args, argv_call_cb(), cd, cmd, i, int2cmdstatus(), RZ_CMD_DESC_TYPE_ARGV, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, RZ_CMD_DESC_TYPE_GROUP, RZ_CMD_DESC_TYPE_OLDINPUT, rz_cmd_parsed_args_execstr(), RZ_CMD_STATUS_INVALID, RZ_CMD_STATUS_NONEXISTINGCMD, RZ_FREE, RZ_LOG_DEBUG, RZ_LOG_ERROR, and s.
Referenced by rz_cmd_call_parsed_args().
Definition at line 100 of file cmd_api.c.
References a, b, cb, rz_cmd_desc_t::name, and rz_str_casecmp().
Referenced by cmd_desc_set_parent(), and sort_groups().
|
static |
Definition at line 640 of file cmd_api.c.
References cd, get_cd_default_mode(), has_cd_default_mode(), has_cd_submodes(), RZ_OUTPUT_MODE_STANDARD, and suffix2mode().
Referenced by argv_call_cb().
Definition at line 939 of file cmd_api.c.
References rz_strbuf_append(), and sb.
Referenced by fill_args().
|
static |
Definition at line 151 of file cmd_api.c.
References cd, free(), and rz_pvector_clear().
Referenced by create_cmd_desc(), rz_cmd_desc_remove(), and rz_cmd_free().
Definition at line 141 of file cmd_api.c.
References cd, cmd, and rz_return_if_fail.
Referenced by rz_cmd_desc_remove().
Definition at line 106 of file cmd_api.c.
References cd, cd_sort(), rz_cmd_desc_t::children, cmd, rz_cmd_desc_t::help, rz_cmd_desc_t::n_children, RZ_CMD_DESC_TYPE_ARGV, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, RZ_CMD_DESC_TYPE_FAKE, RZ_CMD_DESC_TYPE_GROUP, RZ_CMD_DESC_TYPE_INNER, RZ_CMD_DESC_TYPE_OLDINPUT, rz_pvector_push(), rz_pvector_sort(), rz_return_val_if_fail, rz_warn_if_reached, rz_cmd_desc_help_t::sort_subcommands, and rz_cmd_desc_t::type.
Referenced by create_cmd_desc().
|
static |
Definition at line 133 of file cmd_api.c.
References cd, rz_cmd_desc_t::children, rz_cmd_desc_t::n_children, NULL, rz_pvector_remove_data(), and rz_return_if_fail.
Referenced by rz_cmd_desc_remove().
|
static |
Definition at line 2427 of file cmd_api.c.
References cb, cd, cmd, cmd_foreach_cmdname_modes(), rz_cmd_desc_has_handler(), RZ_CMD_DESC_TYPE_ARGV, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, RZ_CMD_DESC_TYPE_FAKE, RZ_CMD_DESC_TYPE_GROUP, RZ_CMD_DESC_TYPE_INNER, and RZ_CMD_DESC_TYPE_OLDINPUT.
Referenced by rz_cmd_foreach_cmdname().
|
static |
Definition at line 2406 of file cmd_api.c.
References argv_modes, cb, cd, cmd, free(), i, mode_cmd_desc_help(), name, RZ_ARRAY_SIZE, rz_str_newf(), suffix, and rz_cmd_desc_help_t::summary.
Referenced by cmd_foreach_cmdname().
|
static |
Definition at line 303 of file cmd_api.c.
References cd, cmd, free(), is_valid_argv_modes(), NULL, out, rz_cmd_desc_get_exec(), RZ_CMD_DESC_TYPE_ARGV, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, RZ_CMD_DESC_TYPE_FAKE, RZ_CMD_DESC_TYPE_GROUP, RZ_CMD_DESC_TYPE_INNER, RZ_CMD_DESC_TYPE_OLDINPUT, rz_return_val_if_fail, and strdup().
Referenced by rz_cmd_get_desc(), and rz_cmd_get_desc_best().
|
static |
Definition at line 161 of file cmd_api.c.
References rz_cmd_desc_t::children, cmd, cmd_desc_free(), cmd_desc_set_parent(), err, cmd_descs_generate::help, rz_cmd_desc_t::help, rz_cmd_desc_t::n_children, rz_cmd_desc_t::name, not_defined_help, NULL, RZ_NEW0, rz_pvector_init(), strdup(), type, and rz_cmd_desc_t::type.
Referenced by argv_modes_new(), argv_new(), argv_state_new(), rz_cmd_desc_fake_new(), rz_cmd_desc_group_modes_new(), rz_cmd_desc_group_new(), rz_cmd_desc_group_state_new(), rz_cmd_desc_inner_new(), rz_cmd_desc_oldinput_new(), and rz_cmd_new().
|
static |
Definition at line 1080 of file cmd_api.c.
References rz_cons_printable_palette_t::args, calc_padding_len(), cd, cmd, rz_cons_t::context, fill_args(), fill_children_chars(), fill_wrapped_comment(), rz_cons_printable_palette_t::help, rz_cons_printable_palette_t::input, rz_cons_context_t::pal, rz_cons_printable_palette_t::reset, rz_cons_singleton(), rz_strbuf_append(), rz_strbuf_appendf(), sb, show_children_shortcut(), strbuf_append_calc(), and summary.
Referenced by fill_argv_modes_help_strbuf(), print_child_help(), and rz_cmd_get_help_strbuf().
Definition at line 1297 of file cmd_api.c.
References argv_get_help(), cd, and cmd.
Referenced by get_help().
Definition at line 946 of file cmd_api.c.
References arg(), cd, close_optionals(), len, arg::name, RZ_CMD_ARG_FLAG_ARRAY, RZ_CMD_ARG_FLAG_OPTION, RZ_CMD_ARG_TYPE_FAKE, rz_strbuf_append(), rz_strbuf_appendf(), rz_warn_if_reached, and sb.
Referenced by calc_padding_len(), do_print_child_help(), fill_usage_strbuf(), and rz_cmd_get_help_json().
Definition at line 1353 of file cmd_api.c.
References arg(), CASE_TYPE, cd, cmd, free(), arg::name, NULL, pj_end(), pj_ka(), pj_kb(), pj_ks(), pj_o(), pj_s(), RZ_CMD_ARG_FLAG_ARRAY, RZ_CMD_ARG_FLAG_LAST, RZ_CMD_ARG_FLAG_OPTION, RZ_CMD_ARG_TYPE_CHOICES, RZ_CMD_ARG_TYPE_CMD, RZ_CMD_ARG_TYPE_ENV, RZ_CMD_ARG_TYPE_EVAL_FULL, RZ_CMD_ARG_TYPE_EVAL_KEY, RZ_CMD_ARG_TYPE_FAKE, RZ_CMD_ARG_TYPE_FCN, RZ_CMD_ARG_TYPE_FILE, RZ_CMD_ARG_TYPE_MACRO, RZ_CMD_ARG_TYPE_NUM, RZ_CMD_ARG_TYPE_OPTION, RZ_CMD_ARG_TYPE_RZNUM, RZ_CMD_ARG_TYPE_STRING, and rz_warn_if_reached.
Referenced by rz_cmd_get_help_json().
|
static |
Definition at line 1148 of file cmd_api.c.
References argv_modes, cd, cmd, do_print_child_help(), free(), i, MAX_RIGHT_ALIGHNMENT, argv_modes_t::mode, RZ_ARRAY_SIZE, rz_str_newf(), sb, SIZE_MAX, argv_modes_t::suffix, summary, argv_modes_t::summary_suffix, and update_minmax_len().
Referenced by argv_get_help().
Definition at line 823 of file cmd_api.c.
References cd, fill_modes_children_chars(), free(), MAX_CHILDREN_SHOW, rz_cmd_desc_t::name, rz_cmd_desc_get_exec(), rz_cmd_desc_has_handler(), RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, rz_str_startswith(), rz_strbuf_append(), rz_strbuf_appendf(), rz_strbuf_drain_nofree(), rz_strbuf_fini(), rz_strbuf_init(), rz_strbuf_is_empty(), rz_strbuf_length(), rz_strbuf_prepend(), rz_strbuf_set(), s, sb, strbuf_append_calc(), and rz_cmd_desc_t::type.
Referenced by calc_padding_len(), do_print_child_help(), and fill_usage_strbuf().
|
static |
Definition at line 882 of file cmd_api.c.
References rz_cons_printable_palette_t::args, cmd, rz_cons_t::context, setup::line, NULL, rz_cons_context_t::pal, rz_cons_singleton(), rz_strbuf_append(), rz_strbuf_appendf(), and sb.
Referenced by argv_get_help(), and fill_wrapped_comment().
Definition at line 1261 of file cmd_api.c.
References cd, cmd, fill_details_cb(), fill_details_static(), and sb.
Referenced by argv_get_help(), and group_get_help().
Definition at line 1252 of file cmd_api.c.
References cd, cmd, fill_details_do(), get_cd_details_cb(), rz_cmd_desc_details_free(), and sb.
Referenced by fill_details().
|
static |
Definition at line 1189 of file cmd_api.c.
References rz_cmd_desc_detail_entry_t::arg_str, rz_cons_printable_palette_t::args, cmd, rz_cmd_desc_detail_entry_t::comment, rz_cons_t::context, rz_cmd_desc_detail_t::entries, fill_wrapped_comment(), rz_cons_printable_palette_t::help, rz_cons_printable_palette_t::input, rz_cons_printable_palette_t::label, len, MAX_RIGHT_ALIGHNMENT, rz_cmd_desc_detail_t::name, rz_cons_context_t::pal, rz_cons_printable_palette_t::reset, rz_cons_singleton(), RZ_STR_ISEMPTY, rz_strbuf_appendf(), sb, SIZE_MAX, strlen0(), and rz_cmd_desc_detail_entry_t::text.
Referenced by fill_details_cb(), and fill_details_static().
|
static |
Definition at line 1244 of file cmd_api.c.
References cd, cmd, fill_details_do(), get_cd_details(), and sb.
Referenced by fill_details().
Definition at line 812 of file cmd_api.c.
References argv_modes, cd, i, argv_modes_t::mode, RZ_ARRAY_SIZE, rz_strbuf_append(), sb, and suffix.
Referenced by fill_children_chars().
Definition at line 997 of file cmd_api.c.
References rz_cons_printable_palette_t::args, cd, cmd, rz_cons_t::context, fill_args(), fill_children_chars(), fill_wrapped_comment(), get_cd_default_mode(), has_cd_default_mode(), rz_cons_printable_palette_t::help, rz_cons_printable_palette_t::input, rz_cons_printable_palette_t::label, rz_cons_context_t::pal, rz_cons_printable_palette_t::reset, rz_cons_singleton(), rz_output_mode_to_summary(), rz_strbuf_append(), rz_strbuf_appendf(), rz_strbuf_free(), rz_strbuf_get(), rz_strbuf_new(), sb, show_children_shortcut(), and strbuf_append_calc().
Referenced by argv_get_help(), and group_get_help().
|
static |
Definition at line 906 of file cmd_api.c.
References cmd, rz_cons_t::context, fill_colored_args(), free(), rz_cons_printable_palette_t::help, setup::line, MIN_SUMMARY_WIDTH, rz_cons_context_t::pal, rz_cons_get_size(), rz_cons_is_interactive(), rz_cons_singleton(), rz_list_free(), RZ_STR_ISEMPTY, rz_str_wrap(), rz_strbuf_append(), rz_strbuf_appendf(), sb, strdup(), and create_tags_rz::text.
Referenced by do_print_child_help(), fill_details_do(), and fill_usage_strbuf().
|
static |
Definition at line 2049 of file cmd_api.c.
References syscall_preprocessing::arr, free(), i, and n.
Referenced by rz_cmd_parsed_args_setargs().
|
static |
Definition at line 625 of file cmd_api.c.
References cd, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, and RZ_OUTPUT_MODE_STANDARD.
Referenced by cd_suffix2mode(), fill_usage_strbuf(), and has_cd_default_mode().
|
static |
|
static |
Definition at line 1178 of file cmd_api.c.
References argv, cd, cmd, and NULL.
Referenced by fill_details_cb().
|
static |
Definition at line 1324 of file cmd_api.c.
References args, argv_get_help(), cd, cmd, fake_get_help(), group_get_help(), NULL, oldinput_get_help(), RZ_CMD_DESC_TYPE_ARGV, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, RZ_CMD_DESC_TYPE_FAKE, RZ_CMD_DESC_TYPE_GROUP, RZ_CMD_DESC_TYPE_INNER, RZ_CMD_DESC_TYPE_OLDINPUT, and rz_warn_if_reached.
Referenced by rz_cmd_get_help().
Definition at line 592 of file cmd_api.c.
References cd, INT_MAX, arg::name, RZ_CMD_ARG_FLAG_ARRAY, RZ_CMD_ARG_FLAG_LAST, and RZ_CMD_ARG_TYPE_FAKE.
Referenced by argv_modes_new(), argv_new(), and argv_state_new().
Definition at line 1124 of file cmd_api.c.
References cd, cmd, fill_details(), fill_usage_strbuf(), MAX_RIGHT_ALIGHNMENT, NULL, print_child_help(), rz_strbuf_drain(), rz_strbuf_new(), sb, SIZE_MAX, and update_minmax_len().
Referenced by get_help().
Definition at line 636 of file cmd_api.c.
References cd, get_cd_default_mode(), and RZ_OUTPUT_MODE_STANDARD.
Referenced by cd_suffix2mode(), and fill_usage_strbuf().
Definition at line 279 of file cmd_api.c.
References cd, RZ_CMD_DESC_TYPE_ARGV_MODES, and RZ_CMD_DESC_TYPE_ARGV_STATE.
Referenced by cd_suffix2mode(), is_valid_argv_modes(), and show_children_shortcut().
|
static |
Definition at line 582 of file cmd_api.c.
References RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_EXIT, RZ_CMD_STATUS_OK, and v.
Referenced by call_cd().
Definition at line 283 of file cmd_api.c.
References cd, has_cd_submodes(), suffix, and suffix2mode().
Referenced by cmd_get_desc_best().
|
static |
Definition at line 1853 of file cmd_api.c.
References args, rz_cmd_macro_t::brk, test_evm::end, free(), regress::m, MACRO_LABELS, MACRO_LIMIT, rz_cmd_macro_t::macros, cmd_descs_generate::nargs, NULL, rz_cmd_macro_t::num, rz_cmd_macro_label_t::ptr, r, rz_cmd_macro_cmd_args(), rz_cmd_macro_label_process(), rz_cons_break_pop(), rz_cons_break_push(), rz_cons_flush(), rz_cons_is_breaked(), RZ_LOG_ERROR, rz_str_word_get0(), rz_str_word_set0(), cmd_descs_generate::str, strdup(), value, and rz_num_t::value.
Referenced by rz_cmd_macro_call(), and rz_cmd_macro_call_multiple().
|
static |
Definition at line 2395 of file cmd_api.c.
References dst, rz_str_newf(), src, and suffix.
Referenced by cmd_foreach_cmdname_modes().
|
static |
Definition at line 1302 of file cmd_api.c.
References a, cmd, NULL, rz_cmd_call_parsed_args(), RZ_CMD_STATUS_OK, rz_cons_filter(), rz_cons_get_buffer_dup(), rz_cons_pop(), rz_cons_push(), rz_cons_set_flush(), status, and strdup().
Referenced by get_help().
|
static |
Definition at line 2105 of file cmd_api.c.
References a, i, rz_strbuf_append(), and sb.
Referenced by rz_cmd_parsed_args_argstr(), and rz_cmd_parsed_args_execstr().
|
static |
Definition at line 1120 of file cmd_api.c.
References cd, cmd, do_print_child_help(), and sb.
Referenced by group_get_help().
Definition at line 528 of file cmd_api.c.
References c, rz_cmd_item_t::callback, cb, rz_cmd_item_t::cmd, cmd, setup::idx, RZ_NEW0, and ut8.
Referenced by rz_core_cmd_init().
Definition at line 501 of file cmd_api.c.
References cmd, i, k, and NULL.
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), getFileData(), rz_cmd_alias(), rz_cmd_call(), rz_cmd_shell_cat_handler(), and rz_core_cmd_subst_i().
Definition at line 412 of file cmd_api.c.
References cmd.
Referenced by autocomplete_minus(), and rz_cmd_alias().
Definition at line 458 of file cmd_api.c.
References cmd, free(), i, k, NULL, R, realloc(), rz_base64_decode_dyn(), s, strdup(), v, and V.
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), rz_cmd_alias(), and rz_core_cmd_subst_i().
Mark the end of the batched changes to RzCmd.
All groups are sorted, if necessary. Call rz_cmd_batch_start
before using this function.
Definition at line 264 of file cmd_api.c.
References cmd, rz_cmd_get_root(), and sort_groups().
Referenced by rzshell_cmddescs_init().
Mark the start of the batched changes to RzCmd.
Commands added after this call won't be sorted until rz_cmd_batch_end
is called.
Definition at line 240 of file cmd_api.c.
References cmd.
Referenced by rzshell_cmddescs_init().
Definition at line 546 of file cmd_api.c.
References c, cmd, free(), input(), NULL, rz_cmd_alias_get(), rz_cons_strcat(), rz_return_val_if_fail, rz_str_newf(), and ut8.
Referenced by rz_core_cmd_subst_i().
RZ_API RzCmdStatus rz_cmd_call_parsed_args | ( | RzCmd * | cmd, |
RzCmdParsedArgs * | args | ||
) |
Definition at line 794 of file cmd_api.c.
References args, call_cd(), cd, cmd, rz_cmd_get_desc(), rz_cmd_parsed_args_cmd(), and RZ_CMD_STATUS_NONEXISTINGCMD.
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), and oldinput_get_help().
RZ_API RzCmdDesc* rz_cmd_desc_argv_modes_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
int | modes, | ||
RzCmdArgvModesCb | cb, | ||
const RzCmdDescHelp * | help | ||
) |
Create a new command descriptor for a command that supports multiple output modes (e.g. rizin commands, json, csv, etc.).
cmd | reference to the RzCmd |
parent | Parent command descriptor of the command being added |
name | Base name of the command. New commands will be created with the proper suffix based on the supported modes |
modes | Modes supported by the handler (see RzOutputMode). They can be put in OR to support multiple modes |
cb | Callback that actually executes the command |
help | Help structure used to describe the command when using ? and ?? |
Definition at line 2195 of file cmd_api.c.
References argv_modes_new(), cb, cmd, cmd_descs_generate::help, NULL, and rz_return_val_if_fail.
Referenced by rzshell_cmddescs_init().
RZ_API RzCmdDesc* rz_cmd_desc_argv_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
RzCmdArgvCb | cb, | ||
const RzCmdDescHelp * | help | ||
) |
Definition at line 2153 of file cmd_api.c.
References argv_new(), cb, cmd, cmd_descs_generate::help, NULL, and rz_return_val_if_fail.
Referenced by rz_cmd_example_init(), and rzshell_cmddescs_init().
RZ_API RzCmdDesc* rz_cmd_desc_argv_state_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
int | modes, | ||
RzCmdArgvStateCb | cb, | ||
const RzCmdDescHelp * | help | ||
) |
Create a new command descriptor for a command that supports multiple output modes (e.g. rizin commands, json, csv, etc.), where the state of the output is handled by RzCmd itself.
cmd | reference to the RzCmd |
parent | Parent command descriptor of the command being added |
name | Base name of the command. New commands will be created with the proper suffix based on the supported modes |
modes | Modes supported by the handler (see RzOutputMode). They can be put in OR to support multiple modes |
cb | Callback that actually executes the command |
help | Help structure used to describe the command when using ? and ?? |
Definition at line 2212 of file cmd_api.c.
References argv_state_new(), cb, cmd, cmd_descs_generate::help, NULL, and rz_return_val_if_fail.
Referenced by rzshell_cmddescs_init().
RZ_API void rz_cmd_desc_details_free | ( | RzCmdDescDetail * | details | ) |
Free an array of RzCmdDescDetail
sections.
Usually command handlers do not need to free the details
sections because they are const, but due to details_cb
those sections could be dynamically generated. In that case all the data within the details should be dynamically allocated memory, even the one marked as const, as they are going to be freed anyway.
entries | Pointer to the array of RzCmdDescDetails |
Definition at line 2698 of file cmd_api.c.
References entry::comment, rz_cmd_desc_detail_t::entries, free(), rz_cmd_desc_detail_t::name, and while().
Referenced by fill_details_cb(), and rz_hash_bang_details_cb().
RZ_API RzCmdDesc* rz_cmd_desc_fake_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
const RzCmdDescHelp * | help | ||
) |
Definition at line 2326 of file cmd_api.c.
References cmd, create_cmd_desc(), cmd_descs_generate::help, NULL, RZ_CMD_DESC_TYPE_FAKE, and rz_return_val_if_fail.
Referenced by rzshell_cmddescs_init().
Get a reference to the i-th argument of a command descriptor.
Get a reference to the i-th argument of a command. This function is useful to know which RzCmdDescArg an argument actually belongs to. In particular, it deals with arguments with special flags like RZ_CMD_ARG_FLAG_LAST
or RZ_CMD_ARG_FLAG_ARRAY
, where even if there is just one RzCmdDescArg, everything is considered as part of the same RzCmdDescArg.
Definition at line 2375 of file cmd_api.c.
References arg(), cd, i, arg::name, NULL, RZ_CMD_ARG_FLAG_ARRAY, RZ_CMD_ARG_FLAG_LAST, and RZ_CMD_ARG_TYPE_FAKE.
Referenced by autocmplt_cmd_arg(), and fill_autocmplt_data_cmdarg().
Definition at line 291 of file cmd_api.c.
References cd, NULL, and RZ_CMD_DESC_TYPE_GROUP.
Referenced by cmd_get_desc_best(), fill_children_chars(), get_cd_from_cmdid(), and rz_cmd_desc_set_default_mode().
RZ_API RzCmdDesc* rz_cmd_desc_group_modes_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
int | modes, | ||
RzCmdArgvModesCb | cb, | ||
const RzCmdDescHelp * | help, | ||
const RzCmdDescHelp * | group_help | ||
) |
Create a new command descriptor for a name that is used both as a group but that has a sub-command with the same name as well. The sub-command supports multiple output modes (e.g. rizin commands, json, csv, etc.).
cmd | reference to the RzCmd |
parent | Parent command descriptor of the command being added |
name | Base name of the group/sub-command. New commands will be created with the proper suffix based on the supported modes |
modes | Modes supported by the handler (see RzOutputMode). They can be put in OR to support multiple modes |
cb | Callback that actually executes the command |
help | Help structure used to describe the command when using ? and ?? |
group_help | Help structure used to describe the group |
Definition at line 2268 of file cmd_api.c.
References argv_modes_new(), cb, cmd, create_cmd_desc(), rz_cmd_desc_t::d, rz_cmd_desc_t::group_data, cmd_descs_generate::help, NULL, rz_cmd_desc_remove(), RZ_CMD_DESC_TYPE_GROUP, and rz_return_val_if_fail.
Referenced by rzshell_cmddescs_init().
RZ_API RzCmdDesc* rz_cmd_desc_group_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
RzCmdArgvCb | cb, | ||
const RzCmdDescHelp * | help, | ||
const RzCmdDescHelp * | group_help | ||
) |
Create a new command descriptor for a name that is used both as a group but that has a sub-command with the same name as well.
cmd | reference to the RzCmd |
parent | Parent command descriptor of the command being added |
name | Base name of the group/sub-command. |
cb | Callback that actually executes the command |
help | Help structure used to describe the command when using ? and ?? |
group_help | Help structure used to describe the group |
Definition at line 2233 of file cmd_api.c.
References argv_new(), cb, cmd, create_cmd_desc(), rz_cmd_desc_t::d, rz_cmd_desc_t::group_data, cmd_descs_generate::help, NULL, rz_cmd_desc_remove(), RZ_CMD_DESC_TYPE_GROUP, and rz_return_val_if_fail.
Referenced by rz_cmd_dex_init_handler(), rz_cmd_java_init_handler(), and rzshell_cmddescs_init().
RZ_API RzCmdDesc* rz_cmd_desc_group_state_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
int | modes, | ||
RzCmdArgvStateCb | cb, | ||
const RzCmdDescHelp * | help, | ||
const RzCmdDescHelp * | group_help | ||
) |
Create a new command descriptor for a name that is used both as a group but that has a sub-command with the same name as well. The sub-command supports multiple output modes (e.g. rizin commands, json, csv, etc.), where the state of the output is handled by RzCmd itself.
cmd | reference to the RzCmd |
parent | Parent command descriptor of the command being added |
name | Base name of the group/sub-command. New commands will be created with the proper suffix based on the supported modes |
modes | Modes supported by the handler (see RzOutputMode). They can be put in OR to support multiple modes |
cb | Callback that actually executes the command |
help | Help structure used to describe the command when using ? and ?? |
group_help | Help structure used to describe the group |
Definition at line 2299 of file cmd_api.c.
References argv_state_new(), cb, cmd, create_cmd_desc(), rz_cmd_desc_t::d, rz_cmd_desc_t::group_data, cmd_descs_generate::help, NULL, rz_cmd_desc_remove(), RZ_CMD_DESC_TYPE_GROUP, and rz_return_val_if_fail.
Referenced by rzshell_cmddescs_init().
Definition at line 2336 of file cmd_api.c.
References cd, RZ_CMD_DESC_TYPE_ARGV, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, RZ_CMD_DESC_TYPE_FAKE, RZ_CMD_DESC_TYPE_GROUP, RZ_CMD_DESC_TYPE_INNER, RZ_CMD_DESC_TYPE_OLDINPUT, and rz_return_val_if_fail.
Referenced by argv_call_cb(), cmd_foreach_cmdname(), and fill_children_chars().
RZ_API RzCmdDesc* rz_cmd_desc_inner_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
const RzCmdDescHelp * | help | ||
) |
Definition at line 2217 of file cmd_api.c.
References cmd, create_cmd_desc(), cmd_descs_generate::help, NULL, RZ_CMD_DESC_TYPE_INNER, and rz_return_val_if_fail.
Referenced by rzshell_cmddescs_init().
RZ_API RzCmdDesc* rz_cmd_desc_oldinput_new | ( | RzCmd * | cmd, |
RzCmdDesc * | parent, | ||
const char * | name, | ||
RzCmdCb | cb, | ||
const RzCmdDescHelp * | help | ||
) |
Definition at line 2316 of file cmd_api.c.
References cb, cmd, create_cmd_desc(), rz_cmd_desc_t::d, cmd_descs_generate::help, NULL, rz_cmd_desc_t::oldinput_data, RZ_CMD_DESC_TYPE_OLDINPUT, and rz_return_val_if_fail.
Referenced by rzshell_cmddescs_init().
Definition at line 2331 of file cmd_api.c.
References cd, NULL, and rz_return_val_if_fail.
Definition at line 2356 of file cmd_api.c.
References cd, cmd, cmd_desc_free(), cmd_desc_remove_from_ht_cmds(), cmd_desc_unset_parent(), and rz_return_val_if_fail.
Referenced by rz_cmd_desc_group_modes_new(), rz_cmd_desc_group_new(), and rz_cmd_desc_group_state_new().
RZ_API bool rz_cmd_desc_set_default_mode | ( | RzCmdDesc * | cd, |
RzOutputMode | mode | ||
) |
Set the default mode of the command descriptor, if the type allows it.
Command descriptors that support multiple output modes can also have a default one. This function can be used to set it.
Definition at line 384 of file cmd_api.c.
References cd, rz_cmd_desc_get_exec(), RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, RZ_CMD_DESC_TYPE_GROUP, RZ_OUTPUT_MODE_STANDARD, and rz_return_val_if_fail.
Referenced by rzshell_cmddescs_init().
RZ_API char* rz_cmd_escape_arg | ( | const char * | arg, |
RzCmdEscape | esc | ||
) |
Returns an heap-allocated string with special characters considered by the rizin grammar as special characters escaped. Use this when you need to escape a string that should appear as argument of a command.
Definition at line 2516 of file cmd_api.c.
References escape_special_chars(), RZ_CMD_ESCAPE_DOUBLE_QUOTED_ARG, RZ_CMD_ESCAPE_MULTI_ARG, RZ_CMD_ESCAPE_ONE_ARG, RZ_CMD_ESCAPE_PF_ARG, RZ_CMD_ESCAPE_SINGLE_QUOTED_ARG, rz_return_val_if_reached, SPECIAL_CHARS_DOUBLE_QUOTED, SPECIAL_CHARS_PF, SPECIAL_CHARS_REGULAR, SPECIAL_CHARS_REGULAR_SINGLE, SPECIAL_CHARS_SINGLE_QUOTED, and strdup().
Referenced by args_preprocessing(), config_print_node(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), handle_cmd_substitution_arg(), and rz_reopen_debug_handler().
RZ_API void rz_cmd_foreach_cmdname | ( | RzCmd * | cmd, |
RzCmdDesc * | begin, | ||
RzCmdForeachNameCb | cb, | ||
void * | user | ||
) |
Execute a callback function on each possible command the user can execute.
Only command names that can actually execute something are iterated. Help commands (e.g. ?, h?, etc.) are ignored.
cmd | Reference to RzCmd |
begin | Reference to RzCmdDesc from where to begin the for loop; if NULL the root will be used. |
cb | Callback function that is called for each command name. |
user | Additional user data that is passed to the callback cb . |
Definition at line 2474 of file cmd_api.c.
References cb, cd, cmd, cmd_foreach_cmdname(), and rz_cmd_get_root().
Referenced by autocmplt_cmdidentifier(), and rz_cmd_help_search_handler().
Definition at line 208 of file cmd_api.c.
References cmd, cmd_desc_free(), free(), i, NCMDS, NULL, rz_cmd_alias_free(), rz_cmd_macro_fini(), and RZ_FREE.
Referenced by rz_core_fini().
Retrieve the command descriptor for the command named cmd_identifier
.
Check if there is a command with exactly the name cmd_identifier
.
If there isn't, it removes one letter at a time to be compatible with radare2 behaviour until all commands are converted to rzshell. This best-matching works only to find OLDINPUT command references.
cmd | Reference to RzCmd instance |
cmd_identifier | Name of the command to search |
Definition at line 372 of file cmd_api.c.
References cmd, and cmd_get_desc_best().
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), get_cd_from_cmdid(), rz_cmd_call_parsed_args(), rz_cmd_get_help(), and rz_cmd_help_search_handler().
Retrieve the command descriptor that best matches the name cmd_identifier
.
Check if there is a command with exactly the name cmd_identifier
. If there isn't, it tries to find the best matching one (right now by by removing one letter at a time, but this matching algorithm may be improved later).
cmd | Reference to RzCmd instance |
cmd_identifier | Name of the command to search |
Definition at line 355 of file cmd_api.c.
References cmd, and cmd_get_desc_best().
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL().
RZ_API char* rz_cmd_get_help | ( | RzCmd * | cmd, |
RzCmdParsedArgs * | args, | ||
bool | use_color | ||
) |
Definition at line 1494 of file cmd_api.c.
References args, cd, cmd, err, free(), get_help(), NULL, rz_cmd_get_desc(), rz_cmd_get_root(), rz_cmd_parsed_args_cmd(), and strdup().
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), and get_help_wrong_cmd().
Generates a JSON output of the given help message description.
cmd | reference to RzCmd |
cd | reference to RzCmdDesc |
j | reference to PJ |
Definition at line 1439 of file cmd_api.c.
References args, CASE_CDTYPE, cd, cmd, fill_args(), fill_args_json(), free(), NULL, pj_end(), pj_ko(), pj_ks(), RZ_CMD_DESC_TYPE_ARGV, RZ_CMD_DESC_TYPE_ARGV_MODES, RZ_CMD_DESC_TYPE_ARGV_STATE, RZ_CMD_DESC_TYPE_FAKE, RZ_CMD_DESC_TYPE_GROUP, RZ_CMD_DESC_TYPE_INNER, RZ_CMD_DESC_TYPE_OLDINPUT, rz_return_val_if_fail, rz_strbuf_drain(), rz_strbuf_new(), sb, and type.
Referenced by help_search_cmd_desc_entry().
RZ_API bool rz_cmd_get_help_strbuf | ( | RzCmd * | cmd, |
const RzCmdDesc * | cd, | ||
bool | use_color, | ||
RzStrBuf * | sb | ||
) |
Generates a text output of the given help message description (summary format)
cmd | reference to RzCmd |
cd | reference to RzCmdDesc |
use_color | output strings with color codes. |
sb | reference to RzStrBuf |
Definition at line 1488 of file cmd_api.c.
References cd, cmd, do_print_child_help(), MAX_RIGHT_ALIGHNMENT, rz_return_val_if_fail, and sb.
Referenced by help_search_cmd_desc_entry().
Get the root command descriptor.
Definition at line 230 of file cmd_api.c.
References cmd.
Referenced by rz_cmd_batch_end(), rz_cmd_dex_init_handler(), rz_cmd_example_init(), rz_cmd_foreach_cmdname(), rz_cmd_get_help(), rz_cmd_java_init_handler(), and rzshell_cmddescs_init().
RZ_API int rz_cmd_macro_add | ( | RzCmdMacro * | mac, |
const char * | oname | ||
) |
Definition at line 1558 of file cmd_api.c.
References args, macro::args, eprintf, free(), regress::m, rz_cmd_macro_t::macros, malloc(), name, macro::name, NULL, rz_cmd_macro_item_new(), rz_cmd_macro_list(), rz_list_append(), rz_str_word_set0(), and strdup().
Referenced by rz_cmd_macro().
RZ_API int rz_cmd_macro_break | ( | RzCmdMacro * | mac, |
const char * | value | ||
) |
Definition at line 2001 of file cmd_api.c.
References rz_cmd_macro_t::_brk_value, rz_cmd_macro_t::brk, rz_cmd_macro_t::brk_value, NULL, rz_cmd_macro_t::num, rz_num_math(), ut64(), and value.
Referenced by rz_cmd_macro().
RZ_API int rz_cmd_macro_call | ( | RzCmdMacro * | mac, |
const char * | name | ||
) |
Definition at line 1993 of file cmd_api.c.
References macro_call().
Referenced by rz_cmd_macro(), rz_core_cmd_foreach(), and rz_interpret_macro_handler().
RZ_API int rz_cmd_macro_call_multiple | ( | RzCmdMacro * | mac, |
const char * | name | ||
) |
Definition at line 1997 of file cmd_api.c.
References macro_call().
Referenced by rz_interpret_macro_multiple_handler().
RZ_API int rz_cmd_macro_cmd_args | ( | RzCmdMacro * | mac, |
const char * | ptr, | ||
const char * | args, | ||
int | nargs | ||
) |
Definition at line 1729 of file cmd_api.c.
References args, rz_cmd_macro_t::cmd, cmd, rz_cmd_macro_t::counter, eprintf, i, memcpy(), off, RZ_CMD_MAXLEN, rz_str_word_get0(), snprintf, rz_cmd_macro_t::user, and w.
Referenced by macro_call().
RZ_API void rz_cmd_macro_fini | ( | RzCmdMacro * | mac | ) |
Definition at line 1551 of file cmd_api.c.
References rz_cmd_macro_t::macros, NULL, and rz_list_free().
Referenced by rz_cmd_free().
RZ_API void rz_cmd_macro_init | ( | RzCmdMacro * | mac | ) |
Definition at line 1540 of file cmd_api.c.
References rz_cmd_macro_t::_brk_value, rz_cmd_macro_t::brk_value, rz_cmd_macro_t::cb_printf, rz_cmd_macro_t::cmd, rz_cmd_macro_t::counter, rz_cmd_macro_t::macros, NULL, rz_cmd_macro_t::num, printf(), rz_cmd_macro_item_free(), rz_list_newf(), and rz_cmd_macro_t::user.
Referenced by rz_cmd_new().
RZ_API void rz_cmd_macro_item_free | ( | RzCmdMacroItem * | item | ) |
Definition at line 1530 of file cmd_api.c.
References rz_cmd_macro_item_t::args, rz_cmd_macro_item_t::code, free(), and rz_cmd_macro_item_t::name.
Referenced by rz_cmd_macro_init().
RZ_API RzCmdMacroItem* rz_cmd_macro_item_new | ( | void | ) |
macro.c
Definition at line 1526 of file cmd_api.c.
References RZ_NEW0.
Referenced by rz_cmd_macro_add().
RZ_API char* rz_cmd_macro_label_process | ( | RzCmdMacro * | mac, |
RzCmdMacroLabel * | labels, | ||
int * | labels_n, | ||
char * | ptr | ||
) |
Definition at line 1780 of file cmd_api.c.
References i, NULL, rz_cmd_macro_t::num, rz_cmd_macro_label_t::ptr, and rz_num_t::value.
Referenced by macro_call().
RZ_API void rz_cmd_macro_list | ( | RzCmdMacro * | mac | ) |
Definition at line 1680 of file cmd_api.c.
References rz_cmd_macro_t::cb_printf, setup::idx, regress::m, and rz_cmd_macro_t::macros.
Referenced by rz_cmd_macro(), and rz_cmd_macro_add().
RZ_API void rz_cmd_macro_meta | ( | RzCmdMacro * | mac | ) |
Definition at line 1699 of file cmd_api.c.
References rz_cmd_macro_t::cb_printf, regress::m, and rz_cmd_macro_t::macros.
Referenced by rz_cmd_macro().
RZ_API int rz_cmd_macro_rm | ( | RzCmdMacro * | mac, |
const char * | _name | ||
) |
Definition at line 1655 of file cmd_api.c.
References eprintf, free(), regress::m, rz_cmd_macro_t::macros, rz_list_delete(), and strdup().
Referenced by rz_cmd_macro().
Definition at line 190 of file cmd_api.c.
References cmd, create_cmd_desc(), i, NCMDS, NULL, root_help, rz_cmd_alias_init(), RZ_CMD_DESC_TYPE_GROUP, rz_cmd_macro_init(), and RZ_NEW0.
Referenced by rz_core_cmd_new().
RZ_API bool rz_cmd_parsed_args_addarg | ( | RzCmdParsedArgs * | a, |
const char * | arg | ||
) |
Definition at line 2081 of file cmd_api.c.
References a, NULL, realloc(), strdup(), and autogen_x86imm::tmp.
Referenced by args_preprocessing().
RZ_API char* rz_cmd_parsed_args_argstr | ( | RzCmdParsedArgs * | a | ) |
Definition at line 2115 of file cmd_api.c.
References a, NULL, parsed_args_iterateargs(), rz_return_val_if_fail, rz_strbuf_drain(), rz_strbuf_new(), and sb.
Referenced by ts_node_handle_arg().
RZ_API const char* rz_cmd_parsed_args_cmd | ( | RzCmdParsedArgs * | a | ) |
Definition at line 2135 of file cmd_api.c.
References a, NULL, and rz_return_val_if_fail.
Referenced by argv_call_cb(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), rz_cmd_call_parsed_args(), and rz_cmd_get_help().
RZ_API char* rz_cmd_parsed_args_execstr | ( | RzCmdParsedArgs * | a | ) |
Definition at line 2122 of file cmd_api.c.
References a, NULL, parsed_args_iterateargs(), rz_return_val_if_fail, rz_strbuf_append(), rz_strbuf_drain(), rz_strbuf_new(), and sb.
Referenced by call_cd().
RZ_API void rz_cmd_parsed_args_free | ( | RzCmdParsedArgs * | a | ) |
Definition at line 2036 of file cmd_api.c.
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), get_help_wrong_cmd(), iter_offsets_common(), and ts_node_handle_arg().
RZ_API RzCmdParsedArgs* rz_cmd_parsed_args_new | ( | const char * | cmd, |
int | n_args, | ||
char ** | args | ||
) |
Definition at line 2013 of file cmd_api.c.
References rz_cmd_parsed_args_t::argc, args, rz_cmd_parsed_args_t::argv, cmd, rz_cmd_parsed_args_t::has_space_after_cmd, i, NULL, RZ_NEW0, RZ_NEWS0, rz_return_val_if_fail, and strdup().
Referenced by rz_cmd_parsed_args_newargs(), and rz_cmd_parsed_args_newcmd().
RZ_API RzCmdParsedArgs* rz_cmd_parsed_args_newargs | ( | int | n_args, |
char ** | args | ||
) |
Definition at line 2032 of file cmd_api.c.
References args, and rz_cmd_parsed_args_new().
Referenced by parse_args().
RZ_API RzCmdParsedArgs* rz_cmd_parsed_args_newcmd | ( | const char * | cmd | ) |
Definition at line 2028 of file cmd_api.c.
References cmd, NULL, and rz_cmd_parsed_args_new().
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), and get_help_wrong_cmd().
RZ_API bool rz_cmd_parsed_args_setargs | ( | RzCmdParsedArgs * | a, |
int | n_args, | ||
char ** | args | ||
) |
Definition at line 2057 of file cmd_api.c.
References a, args, err, free_array(), i, NULL, RZ_NEWS0, rz_return_val_if_fail, strdup(), and autogen_x86imm::tmp.
RZ_API bool rz_cmd_parsed_args_setcmd | ( | RzCmdParsedArgs * | a, |
const char * | cmd | ||
) |
Definition at line 2094 of file cmd_api.c.
References a, cmd, free(), rz_return_val_if_fail, strdup(), and autogen_x86imm::tmp.
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL().
RZ_API void rz_cmd_state_output_array_end | ( | RzCmdStateOutput * | state | ) |
Mark the end of an array of elements in the output.
Output modes that support arrays will use this to mark the end of an array (e.g. JSON). Used by command handlers after "printing" a list of elements.
Definition at line 2572 of file cmd_api.c.
References pj_end(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_LONG_JSON, and rz_return_if_fail.
Referenced by cmd_debug_modules(), core_disassembly(), entries_initfini_print(), flag_zone_list(), open_maps_list(), print_source_info(), rz_analysis_basic_block_find_paths_handler(), rz_analysis_basic_block_list_handler(), rz_analysis_syscall_print_handler(), rz_analysis_var_global_list_show(), rz_cmd_debug_display_bt_handler(), rz_cmd_debug_list_bp_handler(), rz_cmd_disassemble_recursively_from_current_block_handler(), rz_cmd_disassemble_recursively_handler(), rz_cmd_disassemble_recursively_no_function_handler(), rz_cmd_disassemble_ropchain_handler(), rz_cmd_disassembly_all_possible_opcodes_handler(), rz_cmd_disassembly_basic_block_handler(), rz_cmd_info_demangle_list_handler(), rz_cmd_sizes_of_n_instructions_handler(), rz_core_analysis_bbs_info_print(), rz_core_asm_plugins_print(), rz_core_bin_archs_print(), rz_core_bin_basefind_print(), rz_core_bin_class_fields_print(), rz_core_bin_class_methods_print(), rz_core_bin_classes_print(), rz_core_bin_fields_print(), rz_core_bin_imports_print(), rz_core_bin_libs_print(), rz_core_bin_memory_print(), rz_core_bin_plugins_print(), rz_core_bin_print_source_line_info(), rz_core_bin_relocs_print(), rz_core_bin_resources_print(), rz_core_bin_sections_mapping_print(), rz_core_bin_sections_print(), rz_core_bin_segments_print(), rz_core_binfiles_print(), rz_core_core_plugins_print(), rz_core_debug_map_print(), rz_core_debug_plugins_print(), rz_core_disasm_pde(), rz_core_hash_plugins_print(), rz_core_io_plugins_print(), rz_core_lang_plugins_print(), rz_core_meta_print_list_all(), rz_core_meta_print_list_at(), rz_core_meta_print_list_in_function(), rz_core_parser_plugins_print(), rz_core_pdb_info_print(), rz_core_spaces_print(), rz_flag_describe_at_handler(), rz_flag_local_list_all_handler(), rz_flag_local_list_handler(), rz_flag_tag_list_handler(), rz_open_list_handler(), rz_seek_history_list_handler(), strings_print(), and symbols_print().
RZ_API void rz_cmd_state_output_array_start | ( | RzCmdStateOutput * | state | ) |
Mark the start of an array of elements in the output.
Output modes that support arrays will use this to mark the start of an array (e.g. JSON). Used by command handlers before "printing" a list of elements.
Definition at line 2558 of file cmd_api.c.
References pj_a(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_LONG_JSON, and rz_return_if_fail.
Referenced by cmd_debug_modules(), core_disassembly(), entries_initfini_print(), flag_zone_list(), open_maps_list(), print_source_info(), rz_analysis_basic_block_find_paths_handler(), rz_analysis_basic_block_list_handler(), rz_analysis_syscall_print_handler(), rz_analysis_var_global_list_show(), rz_cmd_debug_display_bt_handler(), rz_cmd_debug_list_bp_handler(), rz_cmd_disassemble_recursively_from_current_block_handler(), rz_cmd_disassemble_recursively_handler(), rz_cmd_disassemble_recursively_no_function_handler(), rz_cmd_disassemble_ropchain_handler(), rz_cmd_disassembly_all_possible_opcodes_handler(), rz_cmd_disassembly_basic_block_handler(), rz_cmd_info_demangle_list_handler(), rz_cmd_sizes_of_n_instructions_handler(), rz_core_analysis_bbs_info_print(), rz_core_asm_plugins_print(), rz_core_bin_archs_print(), rz_core_bin_basefind_print(), rz_core_bin_class_fields_print(), rz_core_bin_class_methods_print(), rz_core_bin_classes_print(), rz_core_bin_fields_print(), rz_core_bin_imports_print(), rz_core_bin_libs_print(), rz_core_bin_memory_print(), rz_core_bin_plugins_print(), rz_core_bin_print_source_line_info(), rz_core_bin_relocs_print(), rz_core_bin_resources_print(), rz_core_bin_sections_mapping_print(), rz_core_bin_sections_print(), rz_core_bin_segments_print(), rz_core_binfiles_print(), rz_core_core_plugins_print(), rz_core_debug_map_print(), rz_core_debug_plugins_print(), rz_core_disasm_pde(), rz_core_hash_plugins_print(), rz_core_io_plugins_print(), rz_core_lang_plugins_print(), rz_core_meta_print_list_all(), rz_core_meta_print_list_at(), rz_core_meta_print_list_in_function(), rz_core_parser_plugins_print(), rz_core_pdb_info_print(), rz_core_spaces_print(), rz_flag_describe_at_handler(), rz_flag_local_list_all_handler(), rz_flag_local_list_handler(), rz_flag_tag_list_handler(), rz_open_list_handler(), rz_seek_history_list_handler(), strings_print(), and symbols_print().
RZ_API void rz_cmd_state_output_fini | ( | RZ_NONNULL RzCmdStateOutput * | state | ) |
Clear the inner fields of RzCmdStateOutput structure, but do not free it.
Definition at line 2603 of file cmd_api.c.
References NULL, pj_free(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_LONG_JSON, RZ_OUTPUT_MODE_TABLE, rz_return_if_fail, and rz_table_free().
Referenced by __listPlugins(), argv_call_cb(), cb_asmarch(), cb_asmcpu(), cb_dbgbackend(), get_bin_info(), rz_analysis_function_list_handler(), rz_cmd_debug_dmi(), rz_cmd_debug_map_current_handler(), rz_cmd_eval_color_highlight_list_current_handler(), rz_cmd_eval_color_highlight_list_handler(), rz_cmd_heap_chunks_graph_handler(), rz_cmd_state_output_free(), rz_core_visual_xrefs(), rz_eval_getset_handler(), rz_main_rizin(), rz_main_rz_asm(), and rz_main_rz_bin().
RZ_API void rz_cmd_state_output_free | ( | RZ_NONNULL RzCmdStateOutput * | state | ) |
Free the RzCmdStateOutput structure and its inner fields appropriately.
Definition at line 2624 of file cmd_api.c.
References free(), rz_cmd_state_output_fini(), and rz_return_if_fail.
Referenced by add_footer(), and rz_core_bin_print().
RZ_API bool rz_cmd_state_output_init | ( | RZ_NONNULL RzCmdStateOutput * | state, |
RzOutputMode | mode | ||
) |
Initialize a RzCmdStateOutput structure and its inner fields based on the provided mode.
Definition at line 2634 of file cmd_api.c.
References memset(), pj_new(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_LONG_JSON, RZ_OUTPUT_MODE_TABLE, rz_return_val_if_fail, and rz_table_new().
Referenced by __listPlugins(), add_header(), argv_call_cb(), cb_asmarch(), cb_asmcpu(), cb_dbgbackend(), get_bin_info(), rz_analysis_function_list_handler(), rz_cmd_debug_dmi(), rz_cmd_debug_map_current_handler(), rz_cmd_eval_color_highlight_list_current_handler(), rz_cmd_eval_color_highlight_list_handler(), rz_cmd_heap_chunks_graph_handler(), rz_core_visual_xrefs(), rz_eval_getset_handler(), rz_main_rizin(), rz_main_rz_asm(), and rz_main_rz_bin().
RZ_API void rz_cmd_state_output_print | ( | RZ_NONNULL RzCmdStateOutput * | state | ) |
Print the output accumulated in state
to RzCons, if necessary.
Some output modes like JSON and TABLE accumulate their output in their respective data structures, thus it is needed to print them to have the output on screen. This function takes care of that, doing nothing in case the output was already printed to console for those types that output as they go (e.g. STANDARD, QUIET).
Definition at line 2668 of file cmd_api.c.
References free(), pj_string(), rz_cons_printf(), rz_cons_println(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_LONG_JSON, RZ_OUTPUT_MODE_TABLE, rz_return_if_fail, rz_table_tostring(), and s.
Referenced by __listPlugins(), argv_call_cb(), cb_asmarch(), cb_asmcpu(), cb_dbgbackend(), get_bin_info(), rz_cmd_debug_dmi(), rz_cmd_debug_map_current_handler(), rz_cmd_eval_color_highlight_list_current_handler(), rz_cmd_eval_color_highlight_list_handler(), rz_cmd_heap_chunks_graph_handler(), rz_eval_getset_handler(), rz_main_rizin(), and rz_main_rz_asm().
RZ_API void rz_cmd_state_output_set_columnsf | ( | RzCmdStateOutput * | state, |
const char * | fmt, | ||
... | |||
) |
Specify the columns of the command output.
state | Reference to RzCmdStateOutput |
fmt | String containing the numer and types of the columns (see RzTable for a reference of the possible types) |
... | Variable number of strings that specify the names of the columns. There should be enough string as characters in fmt . |
Definition at line 2589 of file cmd_api.c.
References RZ_OUTPUT_MODE_TABLE, rz_return_if_fail, and rz_table_set_vcolumnsf().
Referenced by entries_initfini_print(), flag_print(), open_maps_list(), rz_analysis_basic_block_list_handler(), rz_cmd_debug_list_bp_handler(), rz_cmd_info_demangle_list_handler(), rz_core_analysis_bb_info_print(), rz_core_analysis_bbs_info_print(), rz_core_bin_archs_print(), rz_core_bin_basefind_print(), rz_core_bin_class_fields_print(), rz_core_bin_class_methods_print(), rz_core_bin_classes_print(), rz_core_bin_fields_print(), rz_core_bin_imports_print(), rz_core_bin_libs_print(), rz_core_bin_main_print(), rz_core_bin_memory_print(), rz_core_bin_plugin_print(), rz_core_bin_relocs_print(), rz_core_bin_resources_print(), rz_core_bin_sections_mapping_print(), rz_core_bin_segments_print(), rz_core_binfiles_print(), rz_core_binxtr_plugin_print(), rz_core_file_info_print(), rz_core_io_plugins_print(), rz_open_list_handler(), rz_open_maps_list_cur_handler(), rz_open_show_current_handler(), sections_headers_setup(), strings_print(), and symbols_print().
RZ_API char* rz_cmd_unescape_arg | ( | const char * | arg, |
RzCmdEscape | esc | ||
) |
Returns an heap-allocated unescaped string. It is the opposite of rz_cmd_escape_arg
.
Definition at line 2536 of file cmd_api.c.
References RZ_CMD_ESCAPE_DOUBLE_QUOTED_ARG, RZ_CMD_ESCAPE_MULTI_ARG, RZ_CMD_ESCAPE_ONE_ARG, RZ_CMD_ESCAPE_PF_ARG, RZ_CMD_ESCAPE_SINGLE_QUOTED_ARG, rz_return_val_if_reached, SPECIAL_CHARS_DOUBLE_QUOTED, SPECIAL_CHARS_PF, SPECIAL_CHARS_REGULAR, SPECIAL_CHARS_REGULAR_SINGLE, SPECIAL_CHARS_SINGLE_QUOTED, strdup(), and unescape_special_chars().
Referenced by DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), do_handle_ts_unescape_arg(), and rz_core_cmd_subst_i().
RZ_LIB_VERSION | ( | rz_cmd | ) |
RZ_IPI int rz_output_mode_to_char | ( | RzOutputMode | mode | ) |
Definition at line 73 of file cmd_api.c.
References argv_modes, i, RZ_ARRAY_SIZE, and argv_modes_t::suffix.
Referenced by rz_cmd_debug_trace_graph_handler().
RZ_IPI const char* rz_output_mode_to_summary | ( | RzOutputMode | mode | ) |
Definition at line 83 of file cmd_api.c.
References argv_modes, i, RZ_ARRAY_SIZE, and argv_modes_t::summary_suffix.
Referenced by fill_usage_strbuf().
Definition at line 877 of file cmd_api.c.
References cd, has_cd_submodes(), and RZ_CMD_DESC_TYPE_OLDINPUT.
Referenced by calc_padding_len(), do_print_child_help(), and fill_usage_strbuf().
|
static |
Definition at line 244 of file cmd_api.c.
References cd, cd_sort(), rz_cmd_desc_t::children, rz_cmd_desc_t::help, rz_pvector_sort(), and rz_cmd_desc_help_t::sort_subcommands.
Referenced by rz_cmd_batch_end().
Definition at line 807 of file cmd_api.c.
References rz_strbuf_append(), s, and sb.
Referenced by do_print_child_help(), fill_children_chars(), and fill_usage_strbuf().
Definition at line 803 of file cmd_api.c.
References s.
Referenced by calc_padding_len(), and fill_details_do().
|
static |
Definition at line 269 of file cmd_api.c.
References argv_modes, i, argv_modes_t::mode, RZ_ARRAY_SIZE, and suffix.
Referenced by cd_suffix2mode(), and is_valid_argv_modes().
|
static |
Definition at line 1074 of file cmd_api.c.
References calc_padding_len(), cd, and val.
Referenced by fill_argv_modes_help_strbuf(), and group_get_help().
|
static |
Referenced by cmd_foreach_cmdname_modes(), fill_argv_modes_help_strbuf(), fill_modes_children_chars(), rz_output_mode_to_char(), rz_output_mode_to_summary(), and suffix2mode().
|
static |
Definition at line 45 of file cmd_api.c.
Referenced by create_cmd_desc().
|
static |
Definition at line 51 of file cmd_api.c.
Referenced by rz_cmd_new().
|
static |
Definition at line 42 of file cmd_api.c.
Referenced by rz_cmd_escape_arg(), and rz_cmd_unescape_arg().
|
static |
Definition at line 41 of file cmd_api.c.
Referenced by rz_cmd_escape_arg(), and rz_cmd_unescape_arg().
|
static |
Definition at line 39 of file cmd_api.c.
Referenced by rz_cmd_escape_arg(), and rz_cmd_unescape_arg().
|
static |
Definition at line 40 of file cmd_api.c.
Referenced by rz_cmd_escape_arg(), and rz_cmd_unescape_arg().
|
static |
Definition at line 43 of file cmd_api.c.
Referenced by rz_cmd_escape_arg(), and rz_cmd_unescape_arg().
|
static |
Definition at line 93 of file cmd_api.c.
Referenced by __asm_equ_new(), _aeli_iter(), _insert_into_disk(), _restore_memory_cb(), _write_asm(), _zip_win32_named_op_create_temp_output(), aarch64_ext_addr_regoff(), aarch64_ext_aimm(), aarch64_ext_cond(), aarch64_ext_ft(), aarch64_ext_hint(), aarch64_ext_ldst_reglist(), aarch64_ext_ldst_reglist_r(), aarch64_ext_limm(), aarch64_ext_pstatefield(), aarch64_ext_reg_extended(), aarch64_ext_reg_shifted(), aarch64_ext_reglane(), aarch64_ext_sysins_op(), aarch64_find_alias_opcode(), aarch64_find_next_alias_opcode(), aarch64_find_next_opcode(), aarch64_logical_immediate_p(), aarch64_print_operand(), aarch64_wide_constant_p(), addr_hint_foreach_cb(), analBars(), anop32(), arc_aux_reg_name(), arc_opcode_init_tables(), arc_opcode_lookup_suffix(), avr_il_assign_bool(), basefind_array_has(), basefind_create_pointer_map(), be16(), be24(), bfd_getm32(), bflt_load_relocs(), bin_elf_versioninfo_versym(), bin_pe_init_sections(), bs_option(), cabd_param(), calculate_luhn(), cb_dirtmp(), cb_log_config_colors(), cb_log_config_file(), cb_log_config_srcinfo(), check_rom_exists(), cmd_print_bars(), common_write_value_handler(), convert_movebitmask_to_mov(), convert_movewide_to_mov(), create_temp_file(), cs_option(), decode_asimd_fcvt(), decode_fcvt(), decode_limm(), decode_parameter(), decode_sizeq(), decode_sve_aimm(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), deflatePrime(), do_handle_substitution_cmd(), do_misc_decoding(), do_special_decoding(), dofwd(), dump_element(), emit_equ(), extract_all_fields(), extract_field_2(), extract_fields(), extract_ld_offset(), extract_reg(), extract_st_offset(), flirt_write_module(), foreach_reg_set_or_clear(), format_reg_value(), from_oct(), gdbr_write_reg(), gdbr_write_register(), gdbr_write_registers(), get_arm64_hwwp_values(), get_arm_hwbp_values(), get_cond_from_value(), get_enum_type(), get_greg_qualifier_from_value(), get_regname(), get_top_bit(), get_union_type(), get_versym_entry_sdb_from_verdef(), get_versym_entry_sdb_from_verneed(), getarg(), getvalue(), hash_cfg_config_compare(), hash_print_crypto(), hash_print_digest(), hash_string(), hppa_field_adjust(), hppa_rebuild_insn(), inflatePrime(), insert(), insert_addr_wb(), insert_base(), insert_cond(), insert_field(), insert_field_2(), insert_jumpflags(), insert_nullify(), insert_offset(), insert_reg(), insert_reladdr(), insert_s12(), insert_s15(), insert_u16(), insert_u8(), insert_ul16(), insert_update(), insert_uu16(), is_pc_inside_module(), is_pc_inside_windmodule(), isMask(), isShiftedMask(), java_constant_pool_stringify(), lang_byte_array_c_cpp(), lang_byte_array_java(), lang_byte_array_kotlin(), lookup_value(), LZ4_write16(), LZ4_write32(), LZ4_writeLE16(), macro_call(), main(), main_print_var(), make_int_16(), make_int_8(), map_enum(), memlimit_show(), oabd_param(), p_b_symbol(), parse_array_type(), parse_atomic_type(), parse_attr_value(), parse_byte(), parse_codeview_fld_attribute(), parse_codeview_func_attribute(), parse_codeview_modifier(), parse_codeview_pointer_attribute(), parse_codeview_property(), parse_enumerate(), parse_enumerator(), parse_memlimit(), parse_options(), parse_struct_member(), parse_typedef(), prompt_offset_and_seek(), prompt_offset_and_seek_file(), qnxr_write_reg(), qnxr_write_register(), rc_direct(), rd_factor(), rd_value(), read_imm_16(), read_imm_32(), read_imm_64(), read_imm_8(), read_n_bits(), rebase_bytes_v1(), references_handler(), reg_has_changed(), reg_offset_cmp(), replace_cmd_kv(), replace_cmd_kv_file(), replace_seq(), resource_value(), restore_memory_cb(), rotate_left_32(), rsp_op(), rz_analysis_switch_op_add_case(), rz_analysis_value_free(), rz_analysis_value_to_string(), rz_asm_code_set_equ(), rz_asm_pseudo_fill(), rz_atomic_bool_get(), rz_atomic_bool_set(), rz_bin_elf_add_addr(), rz_bin_elf_add_off(), rz_bin_elf_mul_addr(), rz_bin_elf_mul_off(), rz_buf_sleb128(), rz_buf_uleb128(), rz_buf_write8(), rz_buf_write8_at(), rz_bv_new_from_st64(), rz_bv_new_from_ut64(), rz_bv_set_from_st64(), rz_bv_set_from_ut64(), rz_cf_key_value_new(), rz_cf_value_array_add(), rz_cf_value_array_print(), rz_cf_value_bool_new(), rz_cf_value_dict_parse(), rz_cf_value_free(), rz_cf_value_print(), rz_cmd_macro_break(), rz_config_eval(), rz_config_node_new(), rz_config_set(), rz_config_set_b(), rz_config_set_cb(), rz_core_analysis_hasrefs(), rz_core_analysis_hasrefs_to_depth(), rz_core_analysis_il_vm_set(), rz_core_cmd_foreach3(), rz_core_cmd_subst_i(), rz_core_flirt_arch_from_id(), rz_core_print_string_c_cpp(), rz_core_search_value_in_range(), rz_core_write_value_at(), rz_core_write_value_inc_at(), rz_debruijn_offset(), rz_egg_config_handler(), rz_eval_getset_handler(), rz_fletcher64_update(), rz_il_event_mem_read_new(), rz_il_event_var_read_new(), rz_il_handler_store(), rz_il_handler_storew(), rz_il_mem_store(), rz_il_mem_storew(), rz_il_op_effect_free(), rz_il_op_new_bitv(), rz_il_op_new_bitv_from_st64(), rz_il_op_new_bitv_from_ut64(), rz_il_op_new_store(), rz_il_op_new_storew(), rz_il_vm_mem_load(), rz_il_vm_mem_loadw(), rz_il_vm_mem_store(), rz_il_vm_mem_storew(), rz_il_vm_status_handler(), rz_interval_node_all_in(), rz_interval_tree_all_in(), rz_is_valid_input_num_value(), rz_lang_define(), rz_mod255_update(), rz_num_get_input_value(), rz_num_is_valid_input(), rz_reg_set_double(), rz_reg_set_longdouble(), rz_reg_set_value(), rz_regs_show_valgroup(), rz_serialize_analysis_switch_op_load(), rz_sleb128(), rz_sys_setenv(), rz_type_enum_bitfield_handler(), rz_type_format_uleb(), rz_type_print_value_handler(), rz_write_debruijn_find_handler(), rz_write_versioned_vle(), rz_xor16_update(), rz_xor8_update(), rzil_print_register_bool(), sdb_concat(), sdb_dump_dupnext(), sdb_get_len(), sdb_ht_insert(), sdb_ht_internal_insert(), sdb_ht_update(), sdb_uncat(), set_bcj(), set_delta(), set_lzma(), shared_ht_up_insert(), sign_extend(), sign_extend2(), sort_loclists(), sparc_decode_asi(), sparc_decode_membar(), sparc_decode_prefetch(), sparc_decode_sparclet_cpreg(), str_to_uint64(), symbols(), symbols_contain(), system_apply_env_var(), TAG_CALLBACK(), types_enum_member_find(), types_enum_member_find_all(), uint64_to_nicestr(), uint64_to_str(), update(), update_key(), uv__custom_sem_init(), uv__sem_init(), uv__socket_sockopt(), uv_key_get(), uv_key_set(), uv_os_setenv(), uv_recv_buffer_size(), uv_sem_init(), uv_send_buffer_size(), uv_tty_write_bufs(), uv_udp_set_broadcast(), uv_uptime(), valPrint(), value_aligned_p(), value_fit_signed_field_p(), value_fit_unsigned_field_p(), value_in_range_p(), vtable_addr_in_text_section(), vtable_is_addr_vtable_start_itanium(), vtable_is_value_in_text_section(), w32_hwbp_arm_add(), w32_hwbp_arm_del(), write_n_bits(), DotZLib.GZipStream::WriteByte(), zip_random_uint32(), and zip_set_archive_flag().