From a095ad7a42faff6d2e9826201242d36467c2cac2 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 22 Sep 2014 16:35:23 +0200 Subject: [PATCH] Fix #1356 - rax2 =10 0x89984 or rax2 =16 ... --- binr/rax2/rax2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/binr/rax2/rax2.c b/binr/rax2/rax2.c index 80ca57e0ee..b247243d50 100644 --- a/binr/rax2/rax2.c +++ b/binr/rax2/rax2.c @@ -10,6 +10,7 @@ static RNum *num; static int help (); static ut64 flags = 0; static int use_stdin (); +static int force_mode = '0'; static int rax (char *str, int len, int last); static int format_output (char mode, const char *s) { @@ -17,6 +18,9 @@ static int format_output (char mode, const char *s) { const char *str = (char*) &n; char strbits[65]; + if (force_mode) + mode = force_mode; + if (flags & 2) { /* swap endian */ ut32 n2 = (n>>32)? 8:4; @@ -40,6 +44,9 @@ static int format_output (char mode, const char *s) { printf ("%st\n", strbits); } else printf ("0t\n"); break; + default: + eprintf ("Unknown output mode %d\n", mode); + break; } return R_TRUE; } @@ -89,6 +96,17 @@ static int rax (char *str, int len, int last) { len = strlen (str); if ((flags & 4)) goto dotherax; + if (*str=='=') { + switch (atoi (str+1)) { + case 2: force_mode = 'B'; break; + case 3: force_mode = 'T'; break; + case 8: force_mode = 'O'; break; + case 10: force_mode = 'I'; break; + case 16: force_mode = '0'; break; + case 0: force_mode = str[1]; break; + } + return R_TRUE; + } if (*str=='-') { while (str[1] && str[1]!=' ') { switch (str[1]) {