Rizin
unix-like reverse engineering framework and cli tools
main.c File Reference
#include <stdio.h>
#include <string.h>
#include <rz_main.h>
#include <rz_util.h>

Go to the source code of this file.

Functions

 RZ_LIB_VERSION (rz_main)
 
RZ_API RzMainrz_main_new (const char *name)
 
RZ_API void rz_main_free (RzMain *m)
 
RZ_API int rz_main_run (RzMain *m, int argc, const char **argv)
 
RZ_API int rz_main_version_print (const char *progname)
 

Variables

static RzMain foo []
 

Function Documentation

◆ RZ_LIB_VERSION()

RZ_LIB_VERSION ( rz_main  )

◆ rz_main_free()

RZ_API void rz_main_free ( RzMain m)

Definition at line 40 of file main.c.

40  {
41  free(m);
42 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130

References free(), and regress::m.

Referenced by MAIN_NAME().

◆ rz_main_new()

RZ_API RzMain* rz_main_new ( const char *  name)

Definition at line 24 of file main.c.

24  {
25  int i = 0;
26  while (foo[i].name) {
27  if (!strcmp(name, foo[i].name)) {
28  RzMain *m = RZ_NEW0(RzMain);
29  if (m) {
30  m->name = strdup(foo[i].name);
31  m->main = foo[i].main;
32  }
33  return m;
34  }
35  i++;
36  }
37  return NULL;
38 }
lzma_index ** i
Definition: index.h:629
#define NULL
Definition: cris-opc.c:27
static RzMain foo[]
Definition: main.c:11
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define RZ_NEW0(x)
Definition: rz_types.h:284
Definition: z80asm.h:102
int(* main)(int argc, const char **argv)
Definition: rz_main.h:18

References foo, i, regress::m, rz_main_t::main, NULL, RZ_NEW0, and strdup().

Referenced by MAIN_NAME().

◆ rz_main_run()

RZ_API int rz_main_run ( RzMain m,
int  argc,
const char **  argv 
)

Definition at line 44 of file main.c.

44  {
45  rz_return_val_if_fail(m && m->main, -1);
46  return m->main(argc, argv);
47 }
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108

References argv, regress::m, and rz_return_val_if_fail.

Referenced by MAIN_NAME().

◆ rz_main_version_print()

RZ_API int rz_main_version_print ( const char *  progname)

Definition at line 49 of file main.c.

49  {
50  char *s = rz_str_version(progname);
51  printf("%s\n", s);
52  free(s);
53  return 0;
54 }
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
Definition: cs_driver.c:93
static Sdb * s
Definition: main.c:15
RZ_API char * rz_str_version(const char *program)
Definition: str.c:4051
#define progname

References free(), printf(), progname, rz_str_version(), and s.

Referenced by rax(), rz_main_rizin(), rz_main_rz_asm(), rz_main_rz_bin(), rz_main_rz_diff(), rz_main_rz_find(), rz_main_rz_gg(), rz_main_rz_hash(), rz_main_rz_run(), rz_main_rz_sign(), and showversion().

Variable Documentation

◆ foo

RzMain foo[]
static
Initial value:
= {
{ "rz", rz_main_rizin },
{ "rz-ax", rz_main_rz_ax },
{ "rz-diff", rz_main_rz_diff },
{ "rz-find", rz_main_rz_find },
{ "rz-run", rz_main_rz_run },
{ "rz-asm", rz_main_rz_asm },
{ "rz-gg", rz_main_rz_gg },
{ "rz-bin", rz_main_rz_bin },
{ "rizin", rz_main_rizin },
{ NULL, NULL }
}
RZ_API int rz_main_rizin(int argc, const char **argv)
Definition: rizin.c:370
RZ_API int rz_main_rz_find(int argc, const char **argv)
Definition: rz-find.c:474
RZ_API int rz_main_rz_diff(int argc, const char **argv)
Definition: rz-diff.c:2254
RZ_API int rz_main_rz_ax(int argc, const char **argv)
Definition: rz-ax.c:721
RZ_API int rz_main_rz_asm(int argc, const char **argv)
RZ_API int rz_main_rz_run(int argc, const char **argv)
Definition: rz-run.c:25
RZ_API int rz_main_rz_gg(int argc, const char **argv)
Definition: rz-gg.c:116
RZ_API int rz_main_rz_bin(int argc, const char **argv)
Definition: rz-bin.c:681

Definition at line 11 of file main.c.

Referenced by esil_peek_some(), esil_poke_some(), gb_get_gbtype(), init(), resolve(), resolveModuleOrdinal(), rz_bin_plugin_add(), rz_bin_xtr_add(), rz_cmd_help(), rz_debug_plugin_add(), rz_egg_add(), rz_egg_include(), rz_egg_mkvar(), rz_lang_add(), rz_main_new(), rz_parse_add(), rz_syscall_get_i(), and xnu_get_pid().