mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-23 14:28:07 +00:00
Initial implementation of 'prl'
This commit is contained in:
parent
be7cba651d
commit
9c536de095
@ -1350,7 +1350,16 @@ static int cmd_print(void *data, const char *input) {
|
||||
r_print_code (core->print, core->offset, core->block, len, input[1]);
|
||||
break;
|
||||
case 'r': //pr
|
||||
r_print_raw (core->print, core->block, len);
|
||||
switch (input[1]) {
|
||||
case '?':
|
||||
eprintf("Usage: prl: print raw with lines offsets\n");
|
||||
break;
|
||||
case 'l':
|
||||
r_print_raw (core->print, core->block, len, 1);
|
||||
break;
|
||||
default:
|
||||
r_print_raw (core->print, core->block, len, 0);
|
||||
}
|
||||
break;
|
||||
case 'x': //px
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ R_API void r_print_bytes(RPrint *p, const ut8* buf, int len, const char *fmt);
|
||||
R_API void r_print_fill(RPrint *p, const ut8 *arr, int size);
|
||||
R_API void r_print_byte(RPrint *p, const char *fmt, int idx, ut8 ch);
|
||||
R_API void r_print_c(RPrint *p, const ut8 *str, int len);
|
||||
R_API void r_print_raw(RPrint *p, const ut8* buf, int len);
|
||||
R_API void r_print_raw(RPrint *p, const ut8* buf, int len, int offlines);
|
||||
R_API void r_print_cursor(RPrint *p, int cur, int set);
|
||||
R_API void r_print_cursor_range(RPrint *p, int cur, int to, int set);
|
||||
R_API void r_print_set_cursor(RPrint *p, int curset, int ocursor, int cursor);
|
||||
|
@ -636,8 +636,25 @@ R_API void r_print_bytes(RPrint *p, const ut8* buf, int len, const char *fmt) {
|
||||
}
|
||||
}
|
||||
|
||||
R_API void r_print_raw(RPrint *p, const ut8* buf, int len) {
|
||||
p->write (buf, len);
|
||||
R_API void r_print_raw(RPrint *p, const ut8* buf, int len, int offlines) {
|
||||
if (offlines) {
|
||||
const ut8 *o, *q;
|
||||
int mustbreak = 0 ;
|
||||
o = q = buf;
|
||||
do {
|
||||
p->printf ("0x%08x ", (int)(size_t)(q-buf));
|
||||
for (;*q && *q != '\n'; q++);
|
||||
if (!*q) {
|
||||
mustbreak = 1;
|
||||
}
|
||||
p->write (o, (int)(size_t)(q-o));
|
||||
|
||||
p->printf ("\n");
|
||||
o = ++q;
|
||||
} while (!mustbreak);
|
||||
} else {
|
||||
p->write (buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
R_API void r_print_c(RPrint *p, const ut8 *str, int len) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user