2015-06-02 03:54:26 +02:00
|
|
|
/* radare2 - Copyleft 2011-2015 - pancake */
|
2012-10-22 02:28:42 +02:00
|
|
|
|
2011-09-19 13:54:57 +02:00
|
|
|
#include <r_util.h>
|
2014-07-09 02:25:43 +02:00
|
|
|
#include <r_socket.h>
|
2011-06-05 01:33:28 +02:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2014-07-09 02:24:31 +02:00
|
|
|
char *file;
|
|
|
|
RRunProfile *p;
|
|
|
|
int i, ret;
|
2011-10-12 03:24:19 +02:00
|
|
|
if (argc==1 || !strcmp (argv[1], "-h")) {
|
2013-05-05 19:39:01 +02:00
|
|
|
eprintf ("Usage: rarun2 [-v] [script.rr2] [directive ..]\n");
|
2014-07-09 02:25:43 +02:00
|
|
|
printf ("%s", r_run_help ());
|
2011-06-05 01:33:28 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2012-10-22 02:28:42 +02:00
|
|
|
if (!strcmp (argv[1], "-v")) {
|
|
|
|
printf ("rarun2 "R2_VERSION"\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2011-06-05 01:33:28 +02:00
|
|
|
file = argv[1];
|
2012-10-22 02:28:42 +02:00
|
|
|
if (*file && !strchr (file, '=')) {
|
2014-09-11 04:18:23 +02:00
|
|
|
p = r_run_new (file);
|
2011-10-24 04:35:42 +02:00
|
|
|
} else {
|
2014-07-09 02:24:31 +02:00
|
|
|
p = r_run_new (NULL);
|
|
|
|
for (i = *file?1:2; i<argc; i++)
|
|
|
|
r_run_parseline (p, argv[i]);
|
2011-06-05 01:33:28 +02:00
|
|
|
}
|
2014-09-11 04:18:23 +02:00
|
|
|
if (!p)
|
|
|
|
return 1;
|
2014-07-09 02:24:31 +02:00
|
|
|
ret = r_run_start (p);
|
|
|
|
r_run_free (p);
|
|
|
|
return ret;
|
2011-06-05 01:33:28 +02:00
|
|
|
}
|