Rizin
unix-like reverse engineering framework and cli tools
main.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012-2021 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_main.h>
5 #include <rz_util.h>
6 
7 int MAIN_NAME(int argc, const ARGV_TYPE **argv) {
8  char **utf8_argv = ARGV_TYPE_TO_UTF8(argc, argv);
9  int rc = 1;
10  const char *prog_name = rz_file_basename(utf8_argv[0]);
11  RzMain *m = rz_main_new(prog_name);
12  if (m) {
13  rc = rz_main_run(m, argc, (const char **)utf8_argv);
14  rz_main_free(m);
15  }
16  FREE_UTF8_ARGV(argc, utf8_argv);
17  return rc;
18 }
int MAIN_NAME(int argc, const ARGV_TYPE **argv)
Definition: main.c:7
RZ_API void rz_main_free(RzMain *m)
Definition: main.c:40
RZ_API int rz_main_run(RzMain *m, int argc, const char **argv)
Definition: main.c:44
RZ_API RzMain * rz_main_new(const char *name)
Definition: main.c:24
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
RZ_API const char * rz_file_basename(const char *path)
Definition: file.c:83
#define ARGV_TYPE_TO_UTF8(argc, argv)
Definition: rz_main.h:30
#define FREE_UTF8_ARGV(argc, utf8_argv)
Definition: rz_main.h:31
#define ARGV_TYPE
Definition: rz_main.h:29