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]) {