mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Add R2_PLUGINS, R2_EXTRAS, R2_BINDINGS macros (#9994)
This commit is contained in:
parent
571282dfc3
commit
5180e0220f
@ -575,6 +575,9 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (!(tmp = r_sys_getenv ("RABIN2_NOPLUGINS"))) {
|
||||
char *homeplugindir = r_str_home (R2_HOME_PLUGINS);
|
||||
char *plugindir = r_str_r2_prefix (R2_PLUGINS);
|
||||
char *extrasdir = r_str_r2_prefix (R2_EXTRAS);
|
||||
char *bindingsdir = r_str_r2_prefix (R2_BINDINGS);
|
||||
l = r_lib_new ("radare_plugin");
|
||||
r_lib_add_handler (l, R_LIB_TYPE_BIN, "bin plugins",
|
||||
&__lib_bin_cb, &__lib_bin_dt, NULL);
|
||||
@ -589,10 +592,13 @@ int main(int argc, char **argv) {
|
||||
r_lib_opendir (l, path);
|
||||
}
|
||||
r_lib_opendir (l, homeplugindir);
|
||||
r_lib_opendir (l, plugindir);
|
||||
r_lib_opendir (l, extrasdir);
|
||||
r_lib_opendir (l, bindingsdir);
|
||||
free (homeplugindir);
|
||||
r_lib_opendir (l, R2_LIBDIR "/radare2/" R2_VERSION);
|
||||
r_lib_opendir (l, R2_LIBDIR "/radare2-extras/" R2_VERSION);
|
||||
r_lib_opendir (l, R2_LIBDIR "/radare2-bindings/" R2_VERSION);
|
||||
free (plugindir);
|
||||
free (extrasdir);
|
||||
free (bindingsdir);
|
||||
}
|
||||
free (tmp);
|
||||
|
||||
|
@ -175,17 +175,17 @@ static int main_help(int line) {
|
||||
}
|
||||
if (line == 2) {
|
||||
char *homedir = r_str_home (R2_HOME_CONFIGDIR);
|
||||
char *dirPrefix = r_sys_prefix (NULL);
|
||||
printf (
|
||||
"Scripts:\n"
|
||||
" system ${R2_PREFIX}/share/radare2/radare2rc\n"
|
||||
" user ~/.radare2rc " R_JOIN_2_PATHS("~", R2_HOME_RC) " (and " R_JOIN_3_PATHS("~", R2_HOME_RC_DIR,"") ")\n"
|
||||
" user ~/.radare2rc " R_JOIN_2_PATHS ("~", R2_HOME_RC) " (and " R_JOIN_3_PATHS ("~", R2_HOME_RC_DIR,"") ")\n"
|
||||
" file ${filename}.r2\n"
|
||||
"Plugins:\n"
|
||||
" binrc " R_JOIN_4_PATHS("~", R2_HOME_BINRC, "bin-<format>", "") " (elf, elf64, mach0, ..)\n"
|
||||
" plugins "R2_PREFIX"/lib/radare2/last\n"
|
||||
" USER_PLUGINS " R_JOIN_2_PATHS("~", R2_HOME_PLUGINS)"\n"
|
||||
" LIBR_PLUGINS "R2_PREFIX"/lib/radare2/"R2_VERSION"\n"
|
||||
" USER_ZIGNS " R_JOIN_2_PATHS("~", R2_HOME_ZIGNS) "\n"
|
||||
" binrc " R_JOIN_4_PATHS ("~", R2_HOME_BINRC, "bin-<format>", "") " (elf, elf64, mach0, ..)\n"
|
||||
" USER_PLUGINS " R_JOIN_2_PATHS ("~", R2_HOME_PLUGINS) "\n"
|
||||
" LIBR_PLUGINS " R_JOIN_2_PATHS ("%s", R2_PLUGINS) "\n"
|
||||
" USER_ZIGNS " R_JOIN_2_PATHS ("~", R2_HOME_ZIGNS) "\n"
|
||||
"Environment:\n"
|
||||
" RHOMEDIR %s\n" // TODO: rename to RHOME R2HOME?
|
||||
" RCFILE ~/.radare2rc (user preferences, batch script)\n" // TOO GENERIC
|
||||
@ -198,7 +198,7 @@ static int main_help(int line) {
|
||||
" R2_INCDIR "R2_INCDIR"\n"
|
||||
" R2_LIBDIR "R2_LIBDIR"\n"
|
||||
" R2_LIBEXT "R_LIB_EXT"\n"
|
||||
, homedir);
|
||||
, dirPrefix, homedir);
|
||||
free (homedir);
|
||||
}
|
||||
return 0;
|
||||
@ -209,6 +209,7 @@ static int main_print_var(const char *var_name) {
|
||||
char *homedir = r_str_home (R2_HOME_CONFIGDIR);
|
||||
char *homeplugs = r_str_home (R2_HOME_PLUGINS);
|
||||
char *homezigns = r_str_home (R2_HOME_ZIGNS);
|
||||
char *plugins = r_str_r2_prefix (R2_PLUGINS);
|
||||
struct radare2_var_t {
|
||||
const char *name;
|
||||
const char *value;
|
||||
@ -220,7 +221,7 @@ static int main_print_var(const char *var_name) {
|
||||
{ "LIBDIR", R2_LIBDIR },
|
||||
{ "LIBEXT", R_LIB_EXT },
|
||||
{ "RHOMEDIR", homedir },
|
||||
{ "LIBR_PLUGINS", R2_PREFIX"/lib/radare2/"R2_VERSION },
|
||||
{ "LIBR_PLUGINS", plugins },
|
||||
{ "USER_PLUGINS", homeplugs },
|
||||
{ "USER_ZIGNS", homezigns },
|
||||
{ NULL, NULL }
|
||||
@ -242,6 +243,7 @@ static int main_print_var(const char *var_name) {
|
||||
free (homedir);
|
||||
free (homeplugs);
|
||||
free (homezigns);
|
||||
free (plugins);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -452,9 +452,15 @@ int main (int argc, char *argv[]) {
|
||||
free (homeplugindir);
|
||||
}
|
||||
if (1) { //where & R_CORE_LOADLIBS_SYSTEM) {
|
||||
r_lib_opendir (l, R2_LIBDIR "/radare2/" R2_VERSION);
|
||||
r_lib_opendir (l, R2_LIBDIR "/radare2-extras/" R2_VERSION);
|
||||
r_lib_opendir (l, R2_LIBDIR "/radare2-bindings/" R2_VERSION);
|
||||
char *plugindir = r_str_r2_prefix (R2_PLUGINS);
|
||||
char *extrasdir = r_str_r2_prefix (R2_EXTRAS);
|
||||
char *bindingsdir = r_str_r2_prefix (R2_BINDINGS);
|
||||
r_lib_opendir (l, plugindir);
|
||||
r_lib_opendir (l, extrasdir);
|
||||
r_lib_opendir (l, bindingsdir);
|
||||
free (plugindir);
|
||||
free (extrasdir);
|
||||
free (bindingsdir);
|
||||
}
|
||||
free (tmp);
|
||||
}
|
||||
|
@ -233,9 +233,9 @@ R_API bool r_anal_set_fcnsign(RAnal *anal, const char *name) {
|
||||
char *file = NULL;
|
||||
const char *arch = (anal->cur && anal->cur->arch) ? anal->cur->arch : R_SYS_ARCH;
|
||||
if (name && *name) {
|
||||
file = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "%s.sdb"), dirPrefix, name);
|
||||
file = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "%s.sdb"), dirPrefix, name);
|
||||
} else {
|
||||
file = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "%s-%s-%d.sdb"), dirPrefix,
|
||||
file = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "%s-%s-%d.sdb"), dirPrefix,
|
||||
anal->os, arch, anal->bits);
|
||||
}
|
||||
if (r_file_exists (file)) {
|
||||
|
@ -1180,7 +1180,7 @@ R_API char *r_sign_path(RAnal *a, const char *file) {
|
||||
free (abs);
|
||||
}
|
||||
|
||||
abs = r_str_newf (R_JOIN_3_PATHS("%s", R2_ZIGNS, "%s"), r_sys_prefix (NULL), file);
|
||||
abs = r_str_newf (R_JOIN_3_PATHS ("%s", R2_ZIGNS, "%s"), r_sys_prefix (NULL), file);
|
||||
if (r_file_is_regular (abs)) {
|
||||
return abs;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ R_API int r_asm_use(RAsm *a, const char *name) {
|
||||
if (!a->cur || (a->cur && strcmp (a->cur->arch, h->arch))) {
|
||||
//const char *dop = r_config_get (core->config, "dir.opcodes");
|
||||
// TODO: allow configurable path for sdb files
|
||||
snprintf (file, sizeof (file), R_JOIN_3_PATHS("%s", R2_SDB_OPCODES, "%s.sdb"),
|
||||
snprintf (file, sizeof (file), R_JOIN_3_PATHS ("%s", R2_SDB_OPCODES, "%s.sdb"),
|
||||
dirPrefix, h->arch);
|
||||
sdb_free (a->pair);
|
||||
r_asm_set_cpu (a, NULL);
|
||||
|
@ -434,7 +434,7 @@ static int bin_pe_parse_imports(struct PE_(r_bin_pe_obj_t)* bin,
|
||||
db = sdb_new (NULL, filename, 0);
|
||||
} else {
|
||||
const char *dirPrefix = r_sys_prefix (NULL);
|
||||
filename = sdb_fmt (R_JOIN_4_PATHS("%s", R2_SDB_FORMAT, "dll", "%s.sdb"),
|
||||
filename = sdb_fmt (R_JOIN_4_PATHS ("%s", R2_SDB_FORMAT, "dll", "%s.sdb"),
|
||||
dirPrefix, symdllname);
|
||||
if (r_file_exists (filename)) {
|
||||
db = sdb_new (NULL, filename, 0);
|
||||
|
@ -19,7 +19,7 @@ static char *get_filetype(RBinFile *bf) {
|
||||
if (ck && bf && bf->buf) {
|
||||
const char *tmp = NULL;
|
||||
// TODO: dir.magic not honored here
|
||||
char *pfx = r_str_newf (R_JOIN_2_PATHS("%s", R2_SDB_MAGIC), r_sys_prefix (NULL));
|
||||
char *pfx = r_str_newf (R_JOIN_2_PATHS ("%s", R2_SDB_MAGIC), r_sys_prefix (NULL));
|
||||
r_magic_load (ck, R2_SDB_MAGIC);
|
||||
r_buf_read_at (bf->buf, 0, buf, sizeof (buf));
|
||||
tmp = r_magic_buffer (ck, buf, sizeof (buf));
|
||||
|
@ -496,41 +496,41 @@ R_API void r_core_anal_type_init(RCore *core) {
|
||||
anal_arch = r_config_get (core->config, "anal.arch");
|
||||
os = r_config_get (core->config, "asm.os");
|
||||
// spaguetti ahead
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "types.sdb"), dir_prefix);
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "types.sdb"), dir_prefix);
|
||||
if (r_file_exists (dbpath)) {
|
||||
sdb_concat_by_path (types, dbpath);
|
||||
}
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "types-%s.sdb"),
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "types-%s.sdb"),
|
||||
dir_prefix, anal_arch);
|
||||
if (r_file_exists (dbpath)) {
|
||||
sdb_concat_by_path (types, dbpath);
|
||||
}
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "types-%s.sdb"),
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "types-%s.sdb"),
|
||||
dir_prefix, os);
|
||||
if (r_file_exists (dbpath)) {
|
||||
sdb_concat_by_path (types, dbpath);
|
||||
}
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "types-%d.sdb"),
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "types-%d.sdb"),
|
||||
dir_prefix, bits);
|
||||
if (r_file_exists (dbpath)) {
|
||||
sdb_concat_by_path (types, dbpath);
|
||||
}
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "types-%s-%d.sdb"),
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "types-%s-%d.sdb"),
|
||||
dir_prefix, os, bits);
|
||||
if (r_file_exists (dbpath)) {
|
||||
sdb_concat_by_path (types, dbpath);
|
||||
}
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "types-%s-%d.sdb"),
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "types-%s-%d.sdb"),
|
||||
dir_prefix, anal_arch, bits);
|
||||
if (r_file_exists (dbpath)) {
|
||||
sdb_concat_by_path (types, dbpath);
|
||||
}
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "types-%s-%s.sdb"),
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "types-%s-%s.sdb"),
|
||||
dir_prefix, anal_arch, os);
|
||||
if (r_file_exists (dbpath)) {
|
||||
sdb_concat_by_path (types, dbpath);
|
||||
}
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS("%s", R2_SDB_FCNSIGN, "types-%s-%s-%d.sdb"),
|
||||
dbpath = sdb_fmt (R_JOIN_3_PATHS ("%s", R2_SDB_FCNSIGN, "types-%s-%s-%d.sdb"),
|
||||
dir_prefix, anal_arch, os, bits);
|
||||
if (r_file_exists (dbpath)) {
|
||||
sdb_concat_by_path (types, dbpath);
|
||||
@ -1248,7 +1248,7 @@ static void set_bin_relocs(RCore *r, RBinReloc *reloc, ut64 addr, Sdb **db, char
|
||||
*db = sdb_new (NULL, filename, 0);
|
||||
} else {
|
||||
const char *dirPrefix = r_sys_prefix (NULL);
|
||||
filename = sdb_fmt (R_JOIN_4_PATHS("%s", R2_SDB_FORMAT, "dll", "%s.sdb"),
|
||||
filename = sdb_fmt (R_JOIN_4_PATHS ("%s", R2_SDB_FORMAT, "dll", "%s.sdb"),
|
||||
dirPrefix, module);
|
||||
if (r_file_exists (filename)) {
|
||||
*db = sdb_new (NULL, filename, 0);
|
||||
|
@ -2591,7 +2591,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETPREF ("zign.bytes", "true", "Use bytes patterns for matching");
|
||||
SETPREF ("zign.offset", "true", "Use original offset for matching");
|
||||
SETPREF ("zign.refs", "true", "Use references for matching");
|
||||
SETPREF ("zign.autoload", "false", "Autoload all zignatures located in " R_JOIN_2_PATHS("~", R2_HOME_ZIGNS));
|
||||
SETPREF ("zign.autoload", "false", "Autoload all zignatures located in " R_JOIN_2_PATHS ("~", R2_HOME_ZIGNS));
|
||||
|
||||
/* diff */
|
||||
SETCB ("diff.sort", "addr", &cb_diff_sort, "Specify function diff sorting column see (e diff.sort=?)");
|
||||
@ -2603,23 +2603,21 @@ R_API int r_core_config_init(RCore *core) {
|
||||
/* dir */
|
||||
SETCB ("dir.dbgsnap", ".", &cb_dbgsnap, "Path to session dump files");
|
||||
{
|
||||
char *path = r_str_newf (R_JOIN_2_PATHS("%s", R2_SDB_MAGIC), r_config_get (core->config, "dir.prefix"));
|
||||
char *path = r_str_newf (R_JOIN_2_PATHS ("%s", R2_SDB_MAGIC), r_config_get (core->config, "dir.prefix"));
|
||||
SETPREF ("dir.magic", path, "Path to r_magic files");
|
||||
free (path);
|
||||
path = r_str_newf (R_JOIN_2_PATHS ("%s", R2_PLUGINS), r_config_get (core->config, "dir.prefix"));
|
||||
SETPREF ("dir.plugins", path, "Path to plugin files to be loaded at startup");
|
||||
free (path);
|
||||
}
|
||||
#if __WINDOWS__
|
||||
SETPREF ("dir.plugins", "plugins", "Path to plugin files to be loaded at startup");
|
||||
#else
|
||||
SETPREF ("dir.plugins", R2_LIBDIR"/radare2/"R2_VERSION"/", "Path to plugin files to be loaded at startup");
|
||||
#endif
|
||||
SETCB ("dir.source", "", &cb_dirsrc, "Path to find source files");
|
||||
SETPREF ("dir.types", "/usr/include", "Default path to look for cparse type files");
|
||||
#if __ANDROID__
|
||||
SETPREF ("dir.projects", "/data/data/org.radare.radare2installer/radare2/projects", "Default path for projects");
|
||||
#else
|
||||
SETPREF ("dir.projects", R_JOIN_2_PATHS("~", R2_HOME_PROJECTS), "Default path for projects");
|
||||
SETPREF ("dir.projects", R_JOIN_2_PATHS ("~", R2_HOME_PROJECTS), "Default path for projects");
|
||||
#endif
|
||||
SETCB ("dir.zigns", R_JOIN_2_PATHS("~", R2_HOME_ZIGNS), &cb_dirzigns, "Default path for zignatures (see zo command)");
|
||||
SETCB ("dir.zigns", R_JOIN_2_PATHS ("~", R2_HOME_ZIGNS), &cb_dirzigns, "Default path for zignatures (see zo command)");
|
||||
SETPREF ("stack.bytes", "true", "Show bytes instead of words in stack");
|
||||
SETPREF ("stack.anotated", "false", "Show anotated hexdump in visual debug");
|
||||
SETI ("stack.size", 64, "Size in bytes of stack hexdump in visual debug");
|
||||
@ -2774,7 +2772,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
#endif
|
||||
SETI ("http.maxsize", 0, "Maximum file size for upload");
|
||||
SETPREF ("http.bind", "localhost", "Server address");
|
||||
SETPREF ("http.homeroot", R_JOIN_2_PATHS("~", R2_HOME_WWWROOT), "http home root directory");
|
||||
SETPREF ("http.homeroot", R_JOIN_2_PATHS ("~", R2_HOME_WWWROOT), "http home root directory");
|
||||
#if __ANDROID__
|
||||
SETPREF ("http.root", "/data/data/org.radare.radare2installer/www", "http root directory");
|
||||
#else
|
||||
|
@ -46,7 +46,7 @@ static const char *help_msg_ec[] = {
|
||||
"", " ", "",
|
||||
"colors:", "", "rgb:000, red, green, blue, #ff0000, ...",
|
||||
"e scr.color", "=0", "use more colors (0: no color 1: ansi 16, 2: 256, 3: 16M)",
|
||||
"$DATADIR/radare2/cons", "", R_JOIN_2_PATHS("~", R2_HOME_THEMES) " ./",
|
||||
"$DATADIR/radare2/cons", "", R_JOIN_2_PATHS ("~", R2_HOME_THEMES) " ./",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -310,11 +310,11 @@ static int cmd_eval(void *data, const char *input) {
|
||||
bool failed = false;
|
||||
char *home, *path, *tmp;
|
||||
|
||||
tmp = r_str_newf (R_JOIN_2_PATHS(R2_HOME_THEMES, "%s"), input + 3);
|
||||
tmp = r_str_newf (R_JOIN_2_PATHS (R2_HOME_THEMES, "%s"), input + 3);
|
||||
home = tmp ? r_str_home (tmp) : NULL;
|
||||
free (tmp);
|
||||
|
||||
tmp = r_str_newf (R_JOIN_2_PATHS(R2_THEMES, "%s"), input + 3);
|
||||
tmp = r_str_newf (R_JOIN_2_PATHS (R2_THEMES, "%s"), input + 3);
|
||||
path = tmp ? r_str_r2_prefix (tmp) : NULL;
|
||||
free (tmp);
|
||||
|
||||
@ -340,7 +340,7 @@ static int cmd_eval(void *data, const char *input) {
|
||||
}
|
||||
} else if (input[2] == '?') {
|
||||
eprintf ("Usage: eco [themename] ;load theme from "
|
||||
R_JOIN_3_PATHS("%s", R2_THEMES, "") " (see dir.prefix)\n",
|
||||
R_JOIN_3_PATHS ("%s", R2_THEMES, "") " (see dir.prefix)\n",
|
||||
r_sys_prefix (NULL));
|
||||
|
||||
} else {
|
||||
|
@ -880,15 +880,15 @@ static void cmd_print_format(RCore *core, const char *_input, const ut8* block,
|
||||
if (input[1] == 'o') { // "pfo"
|
||||
if (input[2] == '?') {
|
||||
eprintf ("|Usage: pfo [format-file]\n"
|
||||
" " R_JOIN_3_PATHS("~", R2_HOME_SDB_FORMAT, "") "\n"
|
||||
" " R_JOIN_3_PATHS("%s", R2_SDB_FORMAT, "") "\n",
|
||||
" " R_JOIN_3_PATHS ("~", R2_HOME_SDB_FORMAT, "") "\n"
|
||||
" " R_JOIN_3_PATHS ("%s", R2_SDB_FORMAT, "") "\n",
|
||||
r_sys_prefix (NULL));
|
||||
} else if (input[2] == ' ') {
|
||||
char *home, *path, tmp[512];
|
||||
snprintf (tmp, sizeof (tmp),
|
||||
R_JOIN_2_PATHS(R2_HOME_SDB_FORMAT, "%s"), input + 3);
|
||||
R_JOIN_2_PATHS (R2_HOME_SDB_FORMAT, "%s"), input + 3);
|
||||
home = r_str_home (tmp);
|
||||
snprintf (tmp, sizeof (tmp), R_JOIN_2_PATHS(R2_SDB_FORMAT, "%s"), input + 3);
|
||||
snprintf (tmp, sizeof (tmp), R_JOIN_2_PATHS (R2_SDB_FORMAT, "%s"), input + 3);
|
||||
path = r_str_r2_prefix (tmp);
|
||||
if (!r_core_cmd_file (core, home) && !r_core_cmd_file (core, path)) {
|
||||
if (!r_core_cmd_file (core, input + 3)) {
|
||||
|
@ -18,7 +18,7 @@ static const char *help_msg_P[] = {
|
||||
"PS", " [file]", "save script file",
|
||||
"P-", " [file]", "delete project (alias for Pd)",
|
||||
"NOTE:", "", "See 'e??prj.'",
|
||||
"NOTE:", "", "project are stored in " R_JOIN_2_PATHS("~", R2_HOME_PROJECTS),
|
||||
"NOTE:", "", "project are stored in " R_JOIN_2_PATHS ("~", R2_HOME_PROJECTS),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -502,7 +502,7 @@ static void load_scripts_for(RCore *core, const char *name) {
|
||||
// TODO:
|
||||
char *file;
|
||||
RListIter *iter;
|
||||
char *hdir = r_str_newf (R_JOIN_2_PATHS(R2_HOME_BINRC, "bin-%s"), name);
|
||||
char *hdir = r_str_newf (R_JOIN_2_PATHS (R2_HOME_BINRC, "bin-%s"), name);
|
||||
char *path = r_str_home (hdir);
|
||||
RList *files = r_sys_dir (path);
|
||||
if (!r_list_empty (files)) {
|
||||
|
@ -5,7 +5,7 @@ static const char *fortunes[] = {
|
||||
};
|
||||
|
||||
static char *getFortuneFile(RCore *core, const char *type) {
|
||||
return r_str_newf (R_JOIN_3_PATHS("%s", R2_FORTUNES, "fortunes.%s"),
|
||||
return r_str_newf (R_JOIN_3_PATHS ("%s", R2_FORTUNES, "fortunes.%s"),
|
||||
r_sys_prefix (NULL), type);
|
||||
}
|
||||
|
||||
|
@ -92,14 +92,15 @@ R_API int r_core_loadlibs(RCore *core, int where, const char *path) {
|
||||
free (homeplugindir);
|
||||
}
|
||||
if (where & R_CORE_LOADLIBS_SYSTEM) {
|
||||
#if __WINDOWS__
|
||||
r_lib_opendir (core->lib, "plugins");
|
||||
r_lib_opendir (core->lib, "share/radare2/"R2_VERSION "/plugins");
|
||||
#else
|
||||
r_lib_opendir (core->lib, R2_LIBDIR "/radare2/"R2_VERSION);
|
||||
r_lib_opendir (core->lib, R2_LIBDIR "/radare2-extras/"R2_VERSION);
|
||||
r_lib_opendir (core->lib, R2_LIBDIR "/radare2-bindings/"R2_VERSION);
|
||||
#endif
|
||||
char *plugindir = r_str_r2_prefix (R2_PLUGINS);
|
||||
char *extrasdir = r_str_r2_prefix (R2_EXTRAS);
|
||||
char *bindingsdir = r_str_r2_prefix (R2_BINDINGS);
|
||||
r_lib_opendir (core->lib, plugindir);
|
||||
r_lib_opendir (core->lib, extrasdir);
|
||||
r_lib_opendir (core->lib, bindingsdir);
|
||||
free (plugindir);
|
||||
free (extrasdir);
|
||||
free (bindingsdir);
|
||||
}
|
||||
#endif
|
||||
// load script plugins
|
||||
|
@ -198,7 +198,7 @@ static int zoom = 0;
|
||||
|
||||
R_API int r_core_visual_hud(RCore *core) {
|
||||
const char *c = r_config_get (core->config, "hud.path");
|
||||
char *f = r_str_newf (R_JOIN_3_PATHS("%s", R2_HUD, "main"),
|
||||
char *f = r_str_newf (R_JOIN_3_PATHS ("%s", R2_HUD, "main"),
|
||||
r_sys_prefix (NULL));
|
||||
int use_color = core->print->flags & R_PRINT_FLAGS_COLOR;
|
||||
char *homehud = r_str_home (R2_HOME_HUD);
|
||||
|
@ -12,44 +12,50 @@
|
||||
#define R2_INCDIR "include\\libr"
|
||||
#define R2_DATDIR "share"
|
||||
#define R2_WWWROOT "www"
|
||||
#define R2_PLUGINS "lib\\plugins"
|
||||
#define R2_EXTRAS "lib\\extras"
|
||||
#define R2_BINDINGS "lib\\bindings"
|
||||
#else
|
||||
#define R2_PREFIX "@PREFIX@"
|
||||
#define R2_LIBDIR "@LIBDIR@"
|
||||
#define R2_INCDIR "@INCLUDEDIR@/libr"
|
||||
#define R2_DATDIR "@DATADIR@"
|
||||
#define R2_WWWROOT R2_DATDIR "/radare2/" R2_VERSION "/www"
|
||||
#define R2_PLUGINS "lib/radare2/" R2_VERSION
|
||||
#define R2_EXTRAS "lib/radare2-extras/" R2_VERSION
|
||||
#define R2_BINDINGS "lib/radare2-bindings/" R2_VERSION
|
||||
#endif
|
||||
|
||||
#define R2_SDB R_JOIN_3_PATHS("share", "radare2", R2_VERSION)
|
||||
#define R2_ZIGNS R_JOIN_4_PATHS("share", "radare2", R2_VERSION, "zigns")
|
||||
#define R2_THEMES R_JOIN_4_PATHS("share", "radare2", R2_VERSION, "cons")
|
||||
#define R2_FORTUNES R_JOIN_3_PATHS("share", "doc", "radare2")
|
||||
#define R2_HUD R_JOIN_4_PATHS("share", "radare2", R2_VERSION, "hud")
|
||||
#define R2_SDB R_JOIN_3_PATHS ("share", "radare2", R2_VERSION)
|
||||
#define R2_ZIGNS R_JOIN_4_PATHS ("share", "radare2", R2_VERSION, "zigns")
|
||||
#define R2_THEMES R_JOIN_4_PATHS ("share", "radare2", R2_VERSION, "cons")
|
||||
#define R2_FORTUNES R_JOIN_3_PATHS ("share", "doc", "radare2")
|
||||
#define R2_HUD R_JOIN_4_PATHS ("share", "radare2", R2_VERSION, "hud")
|
||||
|
||||
#define R2_SDB_FCNSIGN R_JOIN_2_PATHS(R2_SDB, "fcnsign")
|
||||
#define R2_SDB_OPCODES R_JOIN_2_PATHS(R2_SDB, "opcodes")
|
||||
#define R2_SDB_MAGIC R_JOIN_2_PATHS(R2_SDB, "magic")
|
||||
#define R2_SDB_FORMAT R_JOIN_2_PATHS(R2_SDB, "format")
|
||||
#define R2_SDB_FCNSIGN R_JOIN_2_PATHS (R2_SDB, "fcnsign")
|
||||
#define R2_SDB_OPCODES R_JOIN_2_PATHS (R2_SDB, "opcodes")
|
||||
#define R2_SDB_MAGIC R_JOIN_2_PATHS (R2_SDB, "magic")
|
||||
#define R2_SDB_FORMAT R_JOIN_2_PATHS (R2_SDB, "format")
|
||||
|
||||
#define R2_HOME_CONFIGDIR R_JOIN_2_PATHS(".config", "radare2")
|
||||
#define R2_HOME_DATADIR R_JOIN_3_PATHS(".local", "share", "radare2")
|
||||
#define R2_HOME_CACHEDIR R_JOIN_2_PATHS(".cache", "radare2")
|
||||
#define R2_HOME_CONFIGDIR R_JOIN_2_PATHS (".config", "radare2")
|
||||
#define R2_HOME_DATADIR R_JOIN_3_PATHS (".local", "share", "radare2")
|
||||
#define R2_HOME_CACHEDIR R_JOIN_2_PATHS (".cache", "radare2")
|
||||
|
||||
#define R2_HOME_THEMES R_JOIN_2_PATHS(R2_HOME_DATADIR, "cons")
|
||||
#define R2_HOME_PLUGINS R_JOIN_2_PATHS(R2_HOME_DATADIR, "plugins")
|
||||
#define R2_HOME_ZIGNS R_JOIN_2_PATHS(R2_HOME_DATADIR, "zigns")
|
||||
#define R2_HOME_PDB R_JOIN_2_PATHS(R2_HOME_DATADIR, "pdb")
|
||||
#define R2_HOME_PROJECTS R_JOIN_2_PATHS(R2_HOME_DATADIR, "projects")
|
||||
#define R2_HOME_WWWROOT R_JOIN_2_PATHS(R2_HOME_DATADIR, "www")
|
||||
#define R2_HOME_SDB_FORMAT R_JOIN_2_PATHS(R2_HOME_DATADIR, "format")
|
||||
#define R2_HOME_HUD R_JOIN_2_PATHS(R2_HOME_DATADIR, "hud")
|
||||
#define R2_HOME_BINRC R_JOIN_2_PATHS(R2_HOME_DATADIR, "rc.d")
|
||||
#define R2_HOME_BIN R_JOIN_3_PATHS(R2_HOME_DATADIR, "prefix", "bin")
|
||||
#define R2_HOME_THEMES R_JOIN_2_PATHS (R2_HOME_DATADIR, "cons")
|
||||
#define R2_HOME_PLUGINS R_JOIN_2_PATHS (R2_HOME_DATADIR, "plugins")
|
||||
#define R2_HOME_ZIGNS R_JOIN_2_PATHS (R2_HOME_DATADIR, "zigns")
|
||||
#define R2_HOME_PDB R_JOIN_2_PATHS (R2_HOME_DATADIR, "pdb")
|
||||
#define R2_HOME_PROJECTS R_JOIN_2_PATHS (R2_HOME_DATADIR, "projects")
|
||||
#define R2_HOME_WWWROOT R_JOIN_2_PATHS (R2_HOME_DATADIR, "www")
|
||||
#define R2_HOME_SDB_FORMAT R_JOIN_2_PATHS (R2_HOME_DATADIR, "format")
|
||||
#define R2_HOME_HUD R_JOIN_2_PATHS (R2_HOME_DATADIR, "hud")
|
||||
#define R2_HOME_BINRC R_JOIN_2_PATHS (R2_HOME_DATADIR, "rc.d")
|
||||
#define R2_HOME_BIN R_JOIN_3_PATHS (R2_HOME_DATADIR, "prefix", "bin")
|
||||
|
||||
#define R2_HOME_RC R_JOIN_2_PATHS(R2_HOME_CONFIGDIR, "radare2rc")
|
||||
#define R2_HOME_RC_DIR R_JOIN_2_PATHS(R2_HOME_CONFIGDIR, "radare2rc.d")
|
||||
#define R2_HOME_RC R_JOIN_2_PATHS (R2_HOME_CONFIGDIR, "radare2rc")
|
||||
#define R2_HOME_RC_DIR R_JOIN_2_PATHS (R2_HOME_CONFIGDIR, "radare2rc.d")
|
||||
|
||||
#define R2_HOME_HISTORY R_JOIN_2_PATHS(R2_HOME_CACHEDIR, "history")
|
||||
#define R2_HOME_HISTORY R_JOIN_2_PATHS (R2_HOME_CACHEDIR, "history")
|
||||
|
||||
#define HAVE_LIB_MAGIC @HAVE_LIB_MAGIC@
|
||||
#define USE_LIB_MAGIC @USE_LIB_MAGIC@
|
||||
|
@ -12,36 +12,40 @@
|
||||
#define R2_DATDIR "@DATADIR@"
|
||||
#define R2_WWWROOT "@WWWROOT@"
|
||||
|
||||
#define R2_PLUGINS "@PLUGINS@"
|
||||
#define R2_EXTRAS "@EXTRAS@"
|
||||
#define R2_BINDINGS "@BINDINGS@"
|
||||
|
||||
#define R2_SDB "@SDB@"
|
||||
#define R2_ZIGNS "@ZIGNS@"
|
||||
#define R2_THEMES "@THEMES@"
|
||||
#define R2_FORTUNES "@FORTUNES@"
|
||||
#define R2_HUD "@HUD@"
|
||||
|
||||
#define R2_SDB_FCNSIGN R_JOIN_2_PATHS(R2_SDB, "fcnsign")
|
||||
#define R2_SDB_OPCODES R_JOIN_2_PATHS(R2_SDB, "opcodes")
|
||||
#define R2_SDB_MAGIC R_JOIN_2_PATHS(R2_SDB, "magic")
|
||||
#define R2_SDB_FORMAT R_JOIN_2_PATHS(R2_SDB, "format")
|
||||
#define R2_SDB_FCNSIGN R_JOIN_2_PATHS (R2_SDB, "fcnsign")
|
||||
#define R2_SDB_OPCODES R_JOIN_2_PATHS (R2_SDB, "opcodes")
|
||||
#define R2_SDB_MAGIC R_JOIN_2_PATHS (R2_SDB, "magic")
|
||||
#define R2_SDB_FORMAT R_JOIN_2_PATHS (R2_SDB, "format")
|
||||
|
||||
#define R2_HOME_CONFIGDIR R_JOIN_2_PATHS(".config", "radare2")
|
||||
#define R2_HOME_DATADIR R_JOIN_3_PATHS(".local", "share", "radare2")
|
||||
#define R2_HOME_CACHEDIR R_JOIN_2_PATHS(".cache", "radare2")
|
||||
#define R2_HOME_CONFIGDIR R_JOIN_2_PATHS (".config", "radare2")
|
||||
#define R2_HOME_DATADIR R_JOIN_3_PATHS (".local", "share", "radare2")
|
||||
#define R2_HOME_CACHEDIR R_JOIN_2_PATHS (".cache", "radare2")
|
||||
|
||||
#define R2_HOME_THEMES R_JOIN_2_PATHS(R2_HOME_DATADIR, "cons")
|
||||
#define R2_HOME_PLUGINS R_JOIN_2_PATHS(R2_HOME_DATADIR, "plugins")
|
||||
#define R2_HOME_ZIGNS R_JOIN_2_PATHS(R2_HOME_DATADIR, "zigns")
|
||||
#define R2_HOME_PDB R_JOIN_2_PATHS(R2_HOME_DATADIR, "pdb")
|
||||
#define R2_HOME_PROJECTS R_JOIN_2_PATHS(R2_HOME_DATADIR, "projects")
|
||||
#define R2_HOME_WWWROOT R_JOIN_2_PATHS(R2_HOME_DATADIR, "www")
|
||||
#define R2_HOME_SDB_FORMAT R_JOIN_2_PATHS(R2_HOME_DATADIR, "format")
|
||||
#define R2_HOME_HUD R_JOIN_2_PATHS(R2_HOME_DATADIR, "hud")
|
||||
#define R2_HOME_BINRC R_JOIN_2_PATHS(R2_HOME_DATADIR, "rc.d")
|
||||
#define R2_HOME_BIN R_JOIN_3_PATHS(R2_HOME_DATADIR, "prefix", "bin")
|
||||
#define R2_HOME_THEMES R_JOIN_2_PATHS (R2_HOME_DATADIR, "cons")
|
||||
#define R2_HOME_PLUGINS R_JOIN_2_PATHS (R2_HOME_DATADIR, "plugins")
|
||||
#define R2_HOME_ZIGNS R_JOIN_2_PATHS (R2_HOME_DATADIR, "zigns")
|
||||
#define R2_HOME_PDB R_JOIN_2_PATHS (R2_HOME_DATADIR, "pdb")
|
||||
#define R2_HOME_PROJECTS R_JOIN_2_PATHS (R2_HOME_DATADIR, "projects")
|
||||
#define R2_HOME_WWWROOT R_JOIN_2_PATHS (R2_HOME_DATADIR, "www")
|
||||
#define R2_HOME_SDB_FORMAT R_JOIN_2_PATHS (R2_HOME_DATADIR, "format")
|
||||
#define R2_HOME_HUD R_JOIN_2_PATHS (R2_HOME_DATADIR, "hud")
|
||||
#define R2_HOME_BINRC R_JOIN_2_PATHS (R2_HOME_DATADIR, "rc.d")
|
||||
#define R2_HOME_BIN R_JOIN_3_PATHS (R2_HOME_DATADIR, "prefix", "bin")
|
||||
|
||||
#define R2_HOME_RC R_JOIN_2_PATHS(R2_HOME_CONFIGDIR, "radare2rc")
|
||||
#define R2_HOME_RC_DIR R_JOIN_2_PATHS(R2_HOME_CONFIGDIR, "radare2rc.d")
|
||||
#define R2_HOME_RC R_JOIN_2_PATHS (R2_HOME_CONFIGDIR, "radare2rc")
|
||||
#define R2_HOME_RC_DIR R_JOIN_2_PATHS (R2_HOME_CONFIGDIR, "radare2rc.d")
|
||||
|
||||
#define R2_HOME_HISTORY R_JOIN_2_PATHS(R2_HOME_CACHEDIR, "history")
|
||||
#define R2_HOME_HISTORY R_JOIN_2_PATHS (R2_HOME_CACHEDIR, "history")
|
||||
|
||||
#define HAVE_LIB_MAGIC @HAVE_LIB_MAGIC@
|
||||
#define USE_LIB_MAGIC @USE_LIB_MAGIC@
|
||||
|
13
meson.build
13
meson.build
@ -115,7 +115,12 @@ if host_machine.system() == 'windows'
|
||||
endif
|
||||
endforeach
|
||||
|
||||
foreach opt : opts1 + opts2
|
||||
opts3 = ['r2_plugins', 'r2_extras', 'r2_bindings']
|
||||
r2_plugins = join_paths(r2_libdir, 'plugins')
|
||||
r2_extras = join_paths(r2_libdir, 'extras')
|
||||
r2_bindings = join_paths(r2_libdir, 'bindings')
|
||||
|
||||
foreach opt : opts1 + opts2 + opts3
|
||||
val = get_variable(opt)
|
||||
val = '\\\\'.join(val.split('/'))
|
||||
set_variable(opt, val)
|
||||
@ -131,6 +136,9 @@ else
|
||||
r2_themes = join_paths(get_option('datadir'), 'radare2', r2_version, 'cons')
|
||||
r2_fortunes = join_paths(get_option('datadir'), 'doc/radare2')
|
||||
r2_hud = join_paths(get_option('datadir'), 'radare2', r2_version, 'hud')
|
||||
r2_plugins = join_paths(get_option('libdir'), 'radare2', r2_version)
|
||||
r2_extras = join_paths(get_option('libdir'), 'radare2-extras', r2_version)
|
||||
r2_bindings = join_paths(get_option('libdir'), 'radare2-bindings', r2_version)
|
||||
endif
|
||||
|
||||
# load plugin configuration
|
||||
@ -167,6 +175,9 @@ userconf.set('ZIGNS', r2_zigns)
|
||||
userconf.set('THEMES', r2_themes)
|
||||
userconf.set('FORTUNES', r2_fortunes)
|
||||
userconf.set('HUD', r2_hud)
|
||||
userconf.set('PLUGINS', r2_plugins)
|
||||
userconf.set('EXTRAS', r2_extras)
|
||||
userconf.set('BINDINGS', r2_bindings)
|
||||
userconf.set('HAVE_LIB_MAGIC', 0)
|
||||
userconf.set('USE_LIB_MAGIC', 0)
|
||||
userconf.set('HAVE_OPENSSL', 0)
|
||||
|
Loading…
Reference in New Issue
Block a user