Handle RARUN2_ARGS env var in rarun2 ##tools

This commit is contained in:
pancake 2023-08-18 12:52:13 +02:00
parent 779698ead0
commit 8b550d2c5b
3 changed files with 15 additions and 3 deletions

View File

@ -1,7 +1,16 @@
/* radare2 - Copyleft 2011-2019 - pancake */
/* radare2 - Copyleft 2011-2023 - pancake */
#include <r_main.h>
int main(int argc, const char **argv) {
char *ea = r_sys_getenv ("RARUN2_ARGS");
if (ea) {
char **argv = r_str_argv (ea, &argc);
r_sys_setenv ("RARUN2_ARGS", NULL);
int res = r_main_rarun2 (argc, (const char **)argv);
free (ea);
free (argv);
return res;
}
return r_main_rarun2 (argc, argv);
}

View File

@ -1,4 +1,4 @@
.Dd Feb 3, 2017
.Dd Aug 18, 2023
.Dt RARUN2 1
.Sh NAME
.Nm rarun2
@ -160,6 +160,8 @@ You can also use the -- flag to specify program and arguments in a more natural
Run a library function
.Pp
$ rarun2 runlib=/lib/libc-2.25.so runlib.fcn=system arg1="ls /"
.Sh ENVIRONMENT
RARUN2_ARGS useful to just run "rarun2" but parse arguments from environment var
.Sh SEE ALSO
.Pp
.Xr radare2(1)

View File

@ -29,7 +29,6 @@ extern "C" {
#define SDB_HASH_FAST 0
#define SDB_INLINE_HASH 1
#define SDB_INLINE __attribute__((always_inline))
// ftp://ftp.gnu.org/old-gnu/Manuals/gperf-2.7/html_node/gperf_17.es.html
#define SDB_MAX_GPERF_KEYS 15000
@ -41,9 +40,11 @@ extern "C" {
#if defined(__GNUC__)
#define SDB_LIKELY(x) __builtin_expect((size_t)(x),1)
#define SDB_UNLIKELY(x) __builtin_expect((size_t)(x),0)
#define SDB_INLINE __attribute__((always_inline))
#else
#define SDB_LIKELY(x) (x)
#define SDB_UNLIKELY(x) (x)
#define SDB_INLINE
#endif
/* printf format check attributes */