Rizin
unix-like reverse engineering framework and cli tools
rz_cmd.h
Go to the documentation of this file.
1 #ifndef RZ_CMD_H
2 #define RZ_CMD_H
3 
4 #include <rz_types.h>
5 #include <rz_util.h>
6 #include <rz_bind.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 typedef struct rz_core_t RzCore;
13 
14 // RZ_LIB_VERSION_HEADER (rz_cmd);
15 
16 #define MACRO_LIMIT 1024
17 #define MACRO_LABELS 20
18 #define RZ_CMD_MAXLEN 4096
19 
23 typedef enum rz_cmd_status_t {
31 
36 typedef enum rz_cmd_arg_type_t {
62 
67 #define RZ_CMD_ARG_FLAG_LAST (1 << 0)
72 #define RZ_CMD_ARG_FLAG_ARRAY (1 << 1)
76 #define RZ_CMD_ARG_FLAG_OPTION (1 << 2)
77 
78 typedef enum rz_cmd_escape_t {
85 
91 typedef struct rz_cmd_state_output_t {
101  union {
102  PJ *pj;
104  } d;
106 
107 typedef int (*RzCmdCb)(void *user, const char *input);
108 typedef RzCmdStatus (*RzCmdArgvCb)(RzCore *core, int argc, const char **argv);
109 typedef RzCmdStatus (*RzCmdArgvModesCb)(RzCore *core, int argc, const char **argv, RzOutputMode mode);
110 typedef RzCmdStatus (*RzCmdArgvStateCb)(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
111 typedef int (*RzCmdNullCb)(void *user);
112 
116 typedef struct rz_cmd_parsed_args_t {
117  int argc;
118  char **argv;
120  char *extra;
122 
123 typedef struct rz_cmd_macro_label_t {
124  char name[80];
125  char *ptr;
127 
128 typedef struct rz_cmd_macro_item_t {
129  char *name;
130  char *args;
131  char *code;
132  int codelen;
133  int nargs;
135 
136 typedef struct rz_cmd_macro_t {
137  int counter;
140  int brk;
141  // int (*cmd)(void *user, const char *cmd);
144  void *user;
146  int labels_n;
150 
151 typedef struct rz_cmd_item_t {
152  char cmd[64];
155 
156 typedef struct rz_cmd_alias_t {
157  int count;
158  char **keys;
159  char **values;
160  int *remote;
162 
176  const char *text;
180  const char *comment;
187  const char *arg_str;
189 
193 typedef struct rz_cmd_desc_detail_t {
197  const char *name;
203 
209 typedef RZ_OWN RzCmdDescDetail *(*RzCmdDescDetailCb)(RzCore *core, int argc, const char **argv);
210 
214 typedef RZ_OWN char **(*RzCmdArgChoiceCb)(RzCore *core);
215 
219 typedef struct rz_cmd_desc_arg_t {
223  const char *name;
244  bool optional;
249  bool no_space;
257  int flags;
262  const char *default_value;
266  union {
270  const char **choices;
276  };
278 
282 typedef struct rz_cmd_desc_help_t {
289  const char *summary;
298  const char *description;
304  const char *args_str;
311  const char *usage;
320  const char *options;
349 
350 typedef enum rz_cmd_desc_type_t {
405 
412 typedef struct rz_cmd_desc_t {
425  char *name;
445 
449  union {
450  struct {
453  struct {
455  int min_argc;
456  int max_argc;
458  struct {
461  struct {
463  int modes;
465  int min_argc;
466  int max_argc;
468  struct {
470  int modes;
472  int min_argc;
473  int max_argc;
475  } d;
477 
478 typedef struct rz_cmd_t {
479  void *data;
484  void *language; // used to store TSLanguage *
487  HtPP *ht_cmds;
493  bool has_cons;
500  bool batch;
502 
503 // TODO: remove this once transitioned to RzCmdDesc
504 typedef struct rz_cmd_descriptor_t {
505  const char *cmd;
506  const char **help_msg;
507  const char **help_detail;
508  const char **help_detail2;
509  struct rz_cmd_descriptor_t *sub[127];
511 
512 typedef bool (*RzCmdForeachNameCb)(RzCmd *cmd, const RzCmdDesc *desc, void *user);
513 
514 #ifdef RZ_API
515 RZ_API RzCmd *rz_cmd_new(bool has_cons);
517 RZ_API int rz_cmd_set_data(RzCmd *cmd, void *data);
520 RZ_API int rz_cmd_add(RzCmd *cmd, const char *command, RzCmdCb callback);
521 RZ_API int rz_cmd_call(RzCmd *cmd, const char *command);
524 RZ_API RzCmdDesc *rz_cmd_get_desc(RzCmd *cmd, const char *cmd_identifier);
525 RZ_API RzCmdDesc *rz_cmd_get_desc_best(RzCmd *cmd, const char *cmd_identifier);
526 RZ_API char *rz_cmd_get_help(RzCmd *cmd, RzCmdParsedArgs *args, bool use_color);
527 RZ_API bool rz_cmd_get_help_json(RzCmd *cmd, const RzCmdDesc *cd, PJ *j);
528 RZ_API bool rz_cmd_get_help_strbuf(RzCmd *cmd, const RzCmdDesc *cd, bool use_color, RzStrBuf *sb);
529 
530 static inline RzCmdStatus rz_cmd_int2status(int v) {
531  if (v == -2) {
532  return RZ_CMD_STATUS_EXIT;
533  } else if (v < 0) {
534  return RZ_CMD_STATUS_ERROR;
535  } else {
536  return RZ_CMD_STATUS_OK;
537  }
538 }
539 
540 static inline int rz_cmd_status2int(RzCmdStatus s) {
541  switch (s) {
542  case RZ_CMD_STATUS_OK:
543  return 0;
544  case RZ_CMD_STATUS_ERROR:
548  return -1;
549  case RZ_CMD_STATUS_EXIT:
550  default:
551  return -2;
552  }
553 }
554 
555 /* RzCmdDescriptor */
560 RZ_API RzCmdDesc *rz_cmd_desc_group_new(RzCmd *cmd, RzCmdDesc *parent, const char *name, RzCmdArgvCb cb, const RzCmdDescHelp *help, const RzCmdDescHelp *group_help);
561 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);
562 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);
571 RZ_API const RzCmdDescArg *rz_cmd_desc_get_arg(RzCmd *cmd, const RzCmdDesc *cd, size_t i);
572 
573 #define rz_cmd_desc_children_foreach(root, it_cd) rz_pvector_foreach (&root->children, it_cd)
574 
576 
577 /* RzCmdParsedArgs */
578 RZ_API RzCmdParsedArgs *rz_cmd_parsed_args_new(const char *cmd, int n_args, char **args);
582 RZ_API bool rz_cmd_parsed_args_setargs(RzCmdParsedArgs *arg, int n_args, char **args);
588 
589 RZ_API char *rz_cmd_escape_arg(const char *arg, RzCmdEscape escape);
590 RZ_API char *rz_cmd_unescape_arg(const char *arg, RzCmdEscape escape);
591 
599 
600 #define rz_cmd_parsed_args_foreach_arg(args, i, arg) for ((i) = 1; (i) < (args->argc) && ((arg) = (args)->argv[i]); (i)++)
601 
602 /* rz_cmd_macro */
606 RZ_API int rz_cmd_macro_add(RzCmdMacro *mac, const char *name);
607 RZ_API int rz_cmd_macro_rm(RzCmdMacro *mac, const char *_name);
610 RZ_API int rz_cmd_macro_call(RzCmdMacro *mac, const char *name);
611 RZ_API int rz_cmd_macro_call_multiple(RzCmdMacro *mac, const char *name);
612 RZ_API int rz_cmd_macro_break(RzCmdMacro *mac, const char *value);
613 
614 RZ_API bool rz_cmd_alias_del(RzCmd *cmd, const char *k);
615 RZ_API char **rz_cmd_alias_keys(RzCmd *cmd, int *sz);
616 RZ_API int rz_cmd_alias_set(RzCmd *cmd, const char *k, const char *v, int remote);
617 RZ_API char *rz_cmd_alias_get(RzCmd *cmd, const char *k, int remote);
620 
621 #ifdef __cplusplus
622 }
623 #endif
624 
625 #endif
626 #endif
lzma_index ** i
Definition: index.h:629
static csh cd
Definition: asm_mips_cs.c:10
static SblHeader sb
Definition: bin_mbn.c:26
const char * desc
Definition: bin_vsf.c:19
RZ_API void rz_cmd_macro_item_free(RzCmdMacroItem *item)
Definition: cmd_api.c:1530
RZ_API RzCmdParsedArgs * rz_cmd_parsed_args_newargs(int n_args, char **args)
Definition: cmd_api.c:2032
RZ_API void rz_cmd_desc_details_free(RzCmdDescDetail *details)
Free an array of RzCmdDescDetail sections.
Definition: cmd_api.c:2698
RZ_API bool rz_cmd_get_help_json(RzCmd *cmd, const RzCmdDesc *cd, PJ *j)
Generates a JSON output of the given help message description.
Definition: cmd_api.c:1439
RZ_API void rz_cmd_state_output_free(RZ_NONNULL RzCmdStateOutput *state)
Free the RzCmdStateOutput structure and its inner fields appropriately.
Definition: cmd_api.c:2624
RZ_API RzCmdDesc * rz_cmd_get_desc(RzCmd *cmd, const char *cmd_identifier)
Retrieve the command descriptor for the command named cmd_identifier.
Definition: cmd_api.c:372
RZ_API char * rz_cmd_parsed_args_argstr(RzCmdParsedArgs *a)
Definition: cmd_api.c:2115
RZ_API void rz_cmd_batch_end(RzCmd *cmd)
Mark the end of the batched changes to RzCmd.
Definition: cmd_api.c:264
RZ_API int rz_cmd_macro_call_multiple(RzCmdMacro *mac, const char *name)
Definition: cmd_api.c:1997
RZ_API char * rz_cmd_parsed_args_execstr(RzCmdParsedArgs *a)
Definition: cmd_api.c:2122
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.
Definition: cmd_api.c:384
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: cmd_api.c:2634
RZ_API RzCmdDesc * rz_cmd_desc_fake_new(RzCmd *cmd, RzCmdDesc *parent, const char *name, const RzCmdDescHelp *help)
Definition: cmd_api.c:2326
RZ_API RzCmdDesc * rz_cmd_desc_argv_new(RzCmd *cmd, RzCmdDesc *parent, const char *name, RzCmdArgvCb cb, const RzCmdDescHelp *help)
Definition: cmd_api.c:2153
RZ_API const char * rz_cmd_parsed_args_cmd(RzCmdParsedArgs *a)
Definition: cmd_api.c:2135
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.
Definition: cmd_api.c:2474
RZ_API void rz_cmd_alias_free(RzCmd *cmd)
Definition: cmd_api.c:419
RZ_API RzCmdDesc * rz_cmd_desc_oldinput_new(RzCmd *cmd, RzCmdDesc *parent, const char *name, RzCmdCb cb, const RzCmdDescHelp *help)
Definition: cmd_api.c:2316
RZ_API void rz_cmd_state_output_set_columnsf(RzCmdStateOutput *state, const char *fmt,...)
Specify the columns of the command output.
Definition: cmd_api.c:2589
RZ_API bool rz_cmd_alias_del(RzCmd *cmd, const char *k)
Definition: cmd_api.c:431
RZ_API bool rz_cmd_parsed_args_setcmd(RzCmdParsedArgs *a, const char *cmd)
Definition: cmd_api.c:2094
RZ_API int rz_cmd_add(RzCmd *c, const char *cmd, RzCmdCb cb)
Definition: cmd_api.c:528
RZ_API char * rz_cmd_unescape_arg(const char *arg, RzCmdEscape esc)
Definition: cmd_api.c:2536
RZ_API int rz_cmd_macro_add(RzCmdMacro *mac, const char *oname)
Definition: cmd_api.c:1558
RZ_API void rz_cmd_macro_init(RzCmdMacro *mac)
Definition: cmd_api.c:1540
RZ_API void rz_cmd_state_output_array_start(RzCmdStateOutput *state)
Mark the start of an array of elements in the output.
Definition: cmd_api.c:2558
RZ_API int rz_cmd_call(RzCmd *cmd, const char *input)
Definition: cmd_api.c:546
RZ_API bool rz_cmd_desc_has_handler(const RzCmdDesc *cd)
Definition: cmd_api.c:2336
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: cmd_api.c:2603
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)
Definition: cmd_api.c:1488
RZ_API RzCmdParsedArgs * rz_cmd_parsed_args_newcmd(const char *cmd)
Definition: cmd_api.c:2028
RZ_API bool rz_cmd_parsed_args_setargs(RzCmdParsedArgs *a, int n_args, char **args)
Definition: cmd_api.c:2057
RZ_API int rz_cmd_alias_set(RzCmd *cmd, const char *k, const char *v, int remote)
Definition: cmd_api.c:458
RZ_API char * rz_cmd_alias_get(RzCmd *cmd, const char *k, int remote)
Definition: cmd_api.c:501
RZ_API void rz_cmd_macro_fini(RzCmdMacro *mac)
Definition: cmd_api.c:1551
RZ_API bool rz_cmd_desc_remove(RzCmd *cmd, RzCmdDesc *cd)
Definition: cmd_api.c:2356
RZ_API RzCmdDesc * rz_cmd_get_root(RzCmd *cmd)
Get the root command descriptor.
Definition: cmd_api.c:230
RZ_API int rz_cmd_macro_call(RzCmdMacro *mac, const char *name)
Definition: cmd_api.c:1993
RZ_API RzCmd * rz_cmd_free(RzCmd *cmd)
Definition: cmd_api.c:208
RZ_API RzCmdDesc * rz_cmd_desc_inner_new(RzCmd *cmd, RzCmdDesc *parent, const char *name, const RzCmdDescHelp *help)
Definition: cmd_api.c:2217
RZ_API void rz_cmd_batch_start(RzCmd *cmd)
Mark the start of the batched changes to RzCmd.
Definition: cmd_api.c:240
RZ_API RzCmdStatus rz_cmd_call_parsed_args(RzCmd *cmd, RzCmdParsedArgs *args)
Definition: cmd_api.c:794
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 wi...
Definition: cmd_api.c:2268
RZ_API int rz_cmd_set_data(RzCmd *cmd, void *data)
Definition: cmd_api.c:523
RZ_API char * rz_cmd_get_help(RzCmd *cmd, RzCmdParsedArgs *args, bool use_color)
Definition: cmd_api.c:1494
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....
Definition: cmd_api.c:2195
RZ_API void rz_cmd_macro_meta(RzCmdMacro *mac)
Definition: cmd_api.c:1699
RZ_API RzCmd * rz_cmd_new(bool has_cons)
Definition: cmd_api.c:190
static int value
Definition: cmd_api.c:93
RZ_API int rz_cmd_macro_break(RzCmdMacro *mac, const char *value)
Definition: cmd_api.c:2001
RZ_API int rz_cmd_macro_rm(RzCmdMacro *mac, const char *_name)
Definition: cmd_api.c:1655
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 wi...
Definition: cmd_api.c:2299
RZ_API const RzCmdDescArg * rz_cmd_desc_get_arg(RzCmd *cmd, const RzCmdDesc *cd, size_t i)
Get a reference to the i-th argument of a command descriptor.
Definition: cmd_api.c:2375
RZ_API RzCmdMacroItem * rz_cmd_macro_item_new(void)
Definition: cmd_api.c:1526
RZ_API RzCmdDesc * rz_cmd_desc_parent(RzCmdDesc *cd)
Definition: cmd_api.c:2331
RZ_API RzCmdDesc * rz_cmd_get_desc_best(RzCmd *cmd, const char *cmd_identifier)
Retrieve the command descriptor that best matches the name cmd_identifier.
Definition: cmd_api.c:355
RZ_API void rz_cmd_parsed_args_free(RzCmdParsedArgs *a)
Definition: cmd_api.c:2036
RZ_API RzCmdDesc * rz_cmd_desc_get_exec(RzCmdDesc *cd)
Definition: cmd_api.c:291
RZ_API void rz_cmd_state_output_print(RZ_NONNULL RzCmdStateOutput *state)
Print the output accumulated in state to RzCons, if necessary.
Definition: cmd_api.c:2668
RZ_API char * rz_cmd_escape_arg(const char *arg, RzCmdEscape esc)
Definition: cmd_api.c:2516
RZ_API bool rz_cmd_parsed_args_addarg(RzCmdParsedArgs *a, const char *arg)
Definition: cmd_api.c:2081
RZ_API void rz_cmd_state_output_array_end(RzCmdStateOutput *state)
Mark the end of an array of elements in the output.
Definition: cmd_api.c:2572
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....
Definition: cmd_api.c:2212
RZ_API RzCmdParsedArgs * rz_cmd_parsed_args_new(const char *cmd, int n_args, char **args)
Definition: cmd_api.c:2013
RZ_API void rz_cmd_macro_list(RzCmdMacro *mac)
Definition: cmd_api.c:1680
RZ_API char ** rz_cmd_alias_keys(RzCmd *cmd, int *sz)
Definition: cmd_api.c:412
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 wi...
Definition: cmd_api.c:2233
#define RZ_API
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
Definition: sflib.h:79
const char * k
Definition: dsignal.c:11
const char * v
Definition: dsignal.c:12
const char int mode
Definition: ioapi.h:137
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
int args
Definition: mipsasm.c:18
static RzSocket * s
Definition: rtr.c:28
int(* RzCoreCmd)(void *core, const char *cmd)
Definition: rz_bind.h:11
struct rz_cmd_t RzCmd
bool(* RzCmdForeachNameCb)(RzCmd *cmd, const RzCmdDesc *desc, void *user)
Definition: rz_cmd.h:512
enum rz_cmd_arg_type_t RzCmdArgType
RzCmdStatus(* RzCmdArgvModesCb)(RzCore *core, int argc, const char **argv, RzOutputMode mode)
Definition: rz_cmd.h:109
rz_cmd_escape_t
Definition: rz_cmd.h:78
@ RZ_CMD_ESCAPE_MULTI_ARG
The string should be escaped so that it appears as one or multiple arguments.
Definition: rz_cmd.h:80
@ RZ_CMD_ESCAPE_SINGLE_QUOTED_ARG
The string should be escaped so that it can be wrapped in '....'.
Definition: rz_cmd.h:83
@ RZ_CMD_ESCAPE_PF_ARG
The string should be escaped so that it appears as one or multiple pf arguments.
Definition: rz_cmd.h:81
@ RZ_CMD_ESCAPE_ONE_ARG
The string should be escaped so that it appears as one single argument.
Definition: rz_cmd.h:79
@ RZ_CMD_ESCAPE_DOUBLE_QUOTED_ARG
The string should be escaped so that it can be wrapped in "....".
Definition: rz_cmd.h:82
#define MACRO_LABELS
Definition: rz_cmd.h:17
struct rz_cmd_descriptor_t RzCmdDescriptor
struct rz_cmd_desc_detail_t RzCmdDescDetail
struct rz_cmd_item_t RzCmdItem
int(* RzCmdCb)(void *user, const char *input)
Definition: rz_cmd.h:107
enum rz_cmd_desc_type_t RzCmdDescType
RZ_OWN RzCmdDescDetail *(* RzCmdDescDetailCb)(RzCore *core, int argc, const char **argv)
Definition: rz_cmd.h:209
struct rz_cmd_desc_help_t RzCmdDescHelp
rz_cmd_desc_type_t
Definition: rz_cmd.h:350
@ RZ_CMD_DESC_TYPE_ARGV_STATE
Definition: rz_cmd.h:403
@ RZ_CMD_DESC_TYPE_GROUP
Definition: rz_cmd.h:368
@ RZ_CMD_DESC_TYPE_ARGV
Definition: rz_cmd.h:361
@ RZ_CMD_DESC_TYPE_FAKE
Definition: rz_cmd.h:384
@ RZ_CMD_DESC_TYPE_ARGV_MODES
Definition: rz_cmd.h:391
@ RZ_CMD_DESC_TYPE_OLDINPUT
Definition: rz_cmd.h:355
@ RZ_CMD_DESC_TYPE_INNER
Definition: rz_cmd.h:376
struct rz_cmd_macro_t RzCmdMacro
int(* RzCmdNullCb)(void *user)
Definition: rz_cmd.h:111
enum rz_cmd_status_t RzCmdStatus
enum rz_cmd_escape_t RzCmdEscape
struct rz_cmd_parsed_args_t RzCmdParsedArgs
struct rz_cmd_desc_arg_t RzCmdDescArg
rz_cmd_arg_type_t
Definition: rz_cmd.h:36
@ RZ_CMD_ARG_TYPE_FCN
Argument can be the name of an existing function.
Definition: rz_cmd.h:43
@ RZ_CMD_ARG_TYPE_CLASS_TYPE
Argument is a C++/etc class name.
Definition: rz_cmd.h:56
@ RZ_CMD_ARG_TYPE_MACRO
Argument is the name of a pre-defined macro.
Definition: rz_cmd.h:47
@ RZ_CMD_ARG_TYPE_CMD
Argument is an rizin command.
Definition: rz_cmd.h:46
@ RZ_CMD_ARG_TYPE_STRING
Argument that can be an arbitrary string.
Definition: rz_cmd.h:40
@ RZ_CMD_ARG_TYPE_EVAL_KEY
Argument is the name of a evaluable variable (e.g. et command)
Definition: rz_cmd.h:48
@ RZ_CMD_ARG_TYPE_EVAL_FULL
Argument is the name+(optional)value of a evaluable variable (e.g. e command)
Definition: rz_cmd.h:49
@ RZ_CMD_ARG_TYPE_FCN_VAR
Argument is the name of a function variable/argument.
Definition: rz_cmd.h:50
@ RZ_CMD_ARG_TYPE_STRUCT_TYPE
Argument is a C struct type name.
Definition: rz_cmd.h:53
@ RZ_CMD_ARG_TYPE_ENUM_TYPE
Argument is a C enum type name.
Definition: rz_cmd.h:52
@ RZ_CMD_ARG_TYPE_OPTION
Argument is an option, prefixed with -. It is present or not. No argument.
Definition: rz_cmd.h:45
@ RZ_CMD_ARG_TYPE_CHOICES
Argument can be one of the provided choices.
Definition: rz_cmd.h:42
@ RZ_CMD_ARG_TYPE_NUM
Argument is a number.
Definition: rz_cmd.h:38
@ RZ_CMD_ARG_TYPE_RZNUM
Argument that can be interpreted by RzNum (numbers, flags, operations, etc.)
Definition: rz_cmd.h:39
@ RZ_CMD_ARG_TYPE_REG_TYPE
Argument is a register type/arena like "gpr".
Definition: rz_cmd.h:60
@ RZ_CMD_ARG_TYPE_ANY_TYPE
Argument is the any of the C or C++ type name.
Definition: rz_cmd.h:57
@ RZ_CMD_ARG_TYPE_FLAG
Argument is a rizin flag.
Definition: rz_cmd.h:51
@ RZ_CMD_ARG_TYPE_UNION_TYPE
Argument is a C union type name.
Definition: rz_cmd.h:54
@ RZ_CMD_ARG_TYPE_ALIAS_TYPE
Argument is a C typedef (alias) name.
Definition: rz_cmd.h:55
@ RZ_CMD_ARG_TYPE_REG_FILTER
Argument is a register name, size, type or "all".
Definition: rz_cmd.h:59
@ RZ_CMD_ARG_TYPE_FILE
Argument is a filename.
Definition: rz_cmd.h:44
@ RZ_CMD_ARG_TYPE_GLOBAL_VAR
Argument is a user defined global variable.
Definition: rz_cmd.h:58
@ RZ_CMD_ARG_TYPE_ENV
Argument can be the name of an existing rizin variable.
Definition: rz_cmd.h:41
@ RZ_CMD_ARG_TYPE_FAKE
This is not considered a real argument, just used to show something in the help. Name of arg is shown...
Definition: rz_cmd.h:37
struct rz_cmd_desc_t RzCmdDesc
struct rz_cmd_desc_detail_entry_t RzCmdDescDetailEntry
A detailed entry that can be used to show additional info about a command entry.
struct rz_cmd_macro_item_t RzCmdMacroItem
RzCmdStatus(* RzCmdArgvCb)(RzCore *core, int argc, const char **argv)
Definition: rz_cmd.h:108
RZ_OWN char **(* RzCmdArgChoiceCb)(RzCore *core)
Definition: rz_cmd.h:214
rz_cmd_status_t
Definition: rz_cmd.h:23
@ RZ_CMD_STATUS_OK
command handler exited in the right way
Definition: rz_cmd.h:24
@ RZ_CMD_STATUS_WRONG_ARGS
command handler could not handle the arguments passed to it
Definition: rz_cmd.h:25
@ RZ_CMD_STATUS_NONEXISTINGCMD
command does not exist
Definition: rz_cmd.h:28
@ RZ_CMD_STATUS_INVALID
command could not be executed (e.g. shell level error, bad expression, etc.)
Definition: rz_cmd.h:27
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26
@ RZ_CMD_STATUS_EXIT
command handler asks to exit the prompt loop
Definition: rz_cmd.h:29
struct rz_cmd_alias_t RzCmdAlias
RzCmdStatus(* RzCmdArgvStateCb)(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
Definition: rz_cmd.h:110
struct rz_cmd_state_output_t RzCmdStateOutput
Represent the output state of a command handler.
struct rz_cmd_macro_label_t RzCmdMacroLabel
#define RZ_OWN
Definition: rz_types.h:62
#define RZ_NONNULL
Definition: rz_types.h:64
int(* PrintfCallback)(const char *str,...) RZ_PRINTF_CHECK(1
Definition: rz_types.h:233
RzOutputMode
Enum to describe the way data are printed.
Definition: rz_types.h:38
#define UT8_MAX
static int
Definition: sfsocketcall.h:114
#define a(i)
Definition: sha256.c:41
Definition: z80asm.h:102
Definition: rz_pj.h:12
char ** values
Definition: rz_cmd.h:159
int * remote
Definition: rz_cmd.h:160
char ** keys
Definition: rz_cmd.h:158
RzCmdArgChoiceCb choices_cb
Definition: rz_cmd.h:275
RzCmdArgType type
Definition: rz_cmd.h:253
const char * default_value
Definition: rz_cmd.h:262
const char * name
Definition: rz_cmd.h:223
const char ** choices
Definition: rz_cmd.h:270
A detailed entry that can be used to show additional info about a command entry.
Definition: rz_cmd.h:172
const char * comment
Definition: rz_cmd.h:180
const char * text
Definition: rz_cmd.h:176
const char * arg_str
Definition: rz_cmd.h:187
const char * name
Definition: rz_cmd.h:197
const RzCmdDescDetailEntry * entries
Definition: rz_cmd.h:201
RzCmdDescDetailCb details_cb
Definition: rz_cmd.h:343
const RzCmdDescDetail * details
Definition: rz_cmd.h:334
const char * summary
Definition: rz_cmd.h:289
const char * usage
Definition: rz_cmd.h:311
const char * description
Definition: rz_cmd.h:298
const RzCmdDescArg * args
Definition: rz_cmd.h:347
const char * args_str
Definition: rz_cmd.h:304
const char * options
Definition: rz_cmd.h:320
bool sort_subcommands
Definition: rz_cmd.h:327
struct rz_cmd_desc_t * exec_cd
Definition: rz_cmd.h:459
struct rz_cmd_desc_t * parent
Definition: rz_cmd.h:432
int min_argc
Definition: rz_cmd.h:455
int max_argc
Definition: rz_cmd.h:456
int modes
A combination of RzOutputMode values.
Definition: rz_cmd.h:463
RzCmdArgvModesCb cb
Definition: rz_cmd.h:462
RzCmdArgvCb cb
Definition: rz_cmd.h:454
const RzCmdDescHelp * help
Definition: rz_cmd.h:444
RzCmdDescType type
Definition: rz_cmd.h:418
RzOutputMode default_mode
Make one of the modes the default one, used even when the special suffix is not specified.
Definition: rz_cmd.h:464
struct rz_cmd_desc_t::@262::@267 argv_state_data
union rz_cmd_desc_t::@262 d
RzPVector children
Definition: rz_cmd.h:440
RzCmdCb cb
Definition: rz_cmd.h:451
struct rz_cmd_desc_t::@262::@264 argv_data
int n_children
Definition: rz_cmd.h:436
char * name
Definition: rz_cmd.h:425
struct rz_cmd_desc_t::@262::@265 group_data
struct rz_cmd_desc_t::@262::@263 oldinput_data
RzCmdArgvStateCb cb
Definition: rz_cmd.h:469
struct rz_cmd_desc_t::@262::@266 argv_modes_data
const char ** help_detail2
Definition: rz_cmd.h:508
struct rz_cmd_descriptor_t * sub[127]
Definition: rz_cmd.h:509
const char ** help_detail
Definition: rz_cmd.h:507
const char * cmd
Definition: rz_cmd.h:505
const char ** help_msg
Definition: rz_cmd.h:506
RzCmdCb callback
Definition: rz_cmd.h:153
char cmd[64]
Definition: rz_cmd.h:152
ut64 _brk_value
Definition: rz_cmd.h:139
RzCoreCmd cmd
Definition: rz_cmd.h:142
PrintfCallback cb_printf
Definition: rz_cmd.h:143
RzCmdMacroLabel labels[MACRO_LABELS]
Definition: rz_cmd.h:147
ut64 * brk_value
Definition: rz_cmd.h:138
void * user
Definition: rz_cmd.h:144
RzNum * num
Definition: rz_cmd.h:145
RzList * macros
Definition: rz_cmd.h:148
int labels_n
Definition: rz_cmd.h:146
bool has_space_after_cmd
Definition: rz_cmd.h:119
char * extra
Extra data that is neither a command name nor an argument (e.g. command modifiers/specifiers,...
Definition: rz_cmd.h:120
Represent the output state of a command handler.
Definition: rz_cmd.h:91
RzOutputMode mode
Definition: rz_cmd.h:95
union rz_cmd_state_output_t::@259 d
void * data
Definition: rz_cmd.h:479
RzCmdAlias aliases
Definition: rz_cmd.h:483
RzCmdMacro macro
Definition: rz_cmd.h:482
RzCmdNullCb nullcallback
Definition: rz_cmd.h:480
HtUP * ts_symbols_ht
Definition: rz_cmd.h:485
RzCmdDesc * root_cmd_desc
Definition: rz_cmd.h:486
RzCmdItem * cmds[UT8_MAX]
Definition: rz_cmd.h:481
HtPP * ht_cmds
Definition: rz_cmd.h:487
void * language
Definition: rz_cmd.h:484
bool batch
Definition: rz_cmd.h:500
bool has_cons
Definition: rz_cmd.h:493
Definition: dis.h:43
const char * command
Definition: main.c:7
#define bool
Definition: sysdefs.h:146
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const char * cb[]
Definition: z80_tab.h:176
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)