diff --git a/binr/rabin2/rabin2.c b/binr/rabin2/rabin2.c index bd848d192f..aa3cd0402d 100644 --- a/binr/rabin2/rabin2.c +++ b/binr/rabin2/rabin2.c @@ -1,7 +1,17 @@ -/* radare - LGPL - Copyright 2009-2022 - pancake */ +/* radare - LGPL - Copyright 2009-2023 - pancake */ #include int main(int argc, const char **argv) { + char *ea = r_sys_getenv ("RABIN2_ARGS"); + if (R_STR_ISNOTEMPTY (ea)) { + char **argv = r_str_argv (ea, &argc); + r_sys_setenv ("RABIN2_ARGS", NULL); + int res = r_main_rabin2 (argc, (const char **)argv); + free (ea); + free (argv); + return res; + } + free (ea); return r_main_rabin2 (argc, argv); } diff --git a/libr/main/rabin2.c b/libr/main/rabin2.c index bae3d92d0a..7b32f82f92 100644 --- a/libr/main/rabin2.c +++ b/libr/main/rabin2.c @@ -75,6 +75,7 @@ static int rabin_show_help(int v) { if (v) { printf ("Environment:\n" " R2_NOPLUGINS: 1|0| # do not load shared plugins (speedup loading)\n" + " RABIN2_ARGS: # ignore cli and use these program arguments\n" " RABIN2_CHARSET: e cfg.charset # set default value charset for -z strings\n" " RABIN2_DEBASE64: e bin.str.debase64 # try to debase64 all strings\n" " RABIN2_DEMANGLE=0:e bin.demangle # do not demangle symbols\n" diff --git a/libr/main/radare2.c b/libr/main/radare2.c index b831effbe0..085ecdf290 100644 --- a/libr/main/radare2.c +++ b/libr/main/radare2.c @@ -171,6 +171,7 @@ static int main_help(int line) { " R2_USER_ZIGNS ${XDG_DATA_DIR:=~/.local/share/radare2}/zigns\n" "Environment:\n" " R2_COLOR sets the initial value for 'scr.color'. set to 0 for no color\n" + " R2_ARGS ignore cli arguments and use these ones instead\n" " R2_DEBUG if defined, show error messages and crash signal.\n" " R2_DEBUG_NOPAPI do not load r2papi in the -j qjs shell\n" " R2_DEBUG_ASSERT set a breakpoint when hitting an assert.\n" diff --git a/libr/main/rarun2.c b/libr/main/rarun2.c index 17ebdf6864..078e7dda2d 100644 --- a/libr/main/rarun2.c +++ b/libr/main/rarun2.c @@ -1,4 +1,4 @@ -/* radare2 - Copyleft 2011-2022 - pancake */ +/* radare2 - Copyleft 2011-2023 - pancake */ #define R_LOG_ORIGIN "rarun2" diff --git a/man/rabin2.1 b/man/rabin2.1 index def5869331..b7c70c9318 100644 --- a/man/rabin2.1 +++ b/man/rabin2.1 @@ -139,6 +139,8 @@ Dump raw strings to stdout (for huge files) .El .Sh ENVIRONMENT .Pp +RABIN2_ARGS ignore cli and use these arguments instead +.Pp RABIN2_LANG same as r2 -e bin.lang for rabin2 .Pp RABIN2_DEMANGLE demangle symbols diff --git a/test/perf/mem.r2.js b/test/perf/mem.r2.js index b1707d1ed7..4a3794c371 100644 --- a/test/perf/mem.r2.js +++ b/test/perf/mem.r2.js @@ -1,4 +1,5 @@ -const lines = r2.cmd('cat mem.log').split(/\n/); +const logfile = 'a.txt'; +const lines = r2.cmd('cat '+logfile).split(/\n/); let total = 0; let leaked = 0; var track = {};