Only scr.linesleep when in sandbox-free interactive

This commit is contained in:
pancake 2016-11-16 03:02:50 +01:00
parent 3e3f098413
commit 26e9c4feac
3 changed files with 33 additions and 29 deletions

View File

@ -539,25 +539,29 @@ R_API void r_cons_flush() {
if (I.is_html) {
r_cons_html_print (I.buffer);
} else {
if (I.linesleep > 0 && I.linesleep < 1000) {
int i = 0;
int pagesize = R_MAX (1, I.pagesize);
char *ptr = I.buffer;
char *nl = strchr (ptr, '\n');
int len = I.buffer_len;
I.buffer[I.buffer_len] = 0;
r_cons_break (NULL, NULL);
while (nl && !r_cons_is_breaked ()) {
r_cons_write (ptr, nl - ptr + 1);
if (!(i % pagesize)) {
r_sys_usleep (I.linesleep * 1000);
if (I.is_interactive && !r_sandbox_enable (false)) {
if (I.linesleep > 0 && I.linesleep < 1000) {
int i = 0;
int pagesize = R_MAX (1, I.pagesize);
char *ptr = I.buffer;
char *nl = strchr (ptr, '\n');
int len = I.buffer_len;
I.buffer[I.buffer_len] = 0;
r_cons_break (NULL, NULL);
while (nl && !r_cons_is_breaked ()) {
r_cons_write (ptr, nl - ptr + 1);
if (!(i % pagesize)) {
r_sys_usleep (I.linesleep * 1000);
}
ptr = nl + 1;
nl = strchr (ptr, '\n');
i++;
}
ptr = nl + 1;
nl = strchr (ptr, '\n');
i++;
r_cons_write (ptr, I.buffer + len - ptr);
r_cons_break_end ();
} else {
r_cons_write (I.buffer, I.buffer_len);
}
r_cons_write (ptr, I.buffer + len - ptr);
r_cons_break_end ();
} else {
r_cons_write (I.buffer, I.buffer_len);
}

View File

@ -3338,15 +3338,17 @@ static void cmd_anal_syscall(RCore *core, const char *input) {
else eprintf ("Unknown syscall number\n");
} else {
n = r_syscall_get_num (core->anal->syscall, input + 2);
if (n != -1)
if (n != -1) {
r_cons_printf ("%d\n", n);
else eprintf ("Unknown syscall name\n");
} else {
eprintf ("Unknown syscall name\n");
}
}
} else {
list = r_syscall_list (core->anal->syscall);
r_list_foreach (list, iter, si) {
r_cons_printf ("%s = 0x%02x.%d\n",
si->name, si->swi, si->num);
r_cons_printf ("%s = 0x%02x.%u\n",
si->name, (ut32)si->swi, (ut32)si->num);
}
r_list_free (list);
}
@ -3395,11 +3397,11 @@ static void anal_axg (RCore *core, const char *input, int level, Sdb *db) {
if (input && *input) {
addr = r_num_math (core->num, input);
}
int spaces = (level+1) * 2;
if (spaces > sizeof (pre)-4) {
spaces = sizeof(pre)-4;
int spaces = (level + 1) * 2;
if (spaces > sizeof (pre) - 4) {
spaces = sizeof (pre) - 4;
}
memset (pre, ' ', sizeof(pre));
memset (pre, ' ', sizeof (pre));
strcpy (pre+spaces, "- ");
xrefs = r_anal_xrefs_get (core->anal, addr);
@ -3408,7 +3410,7 @@ static void anal_axg (RCore *core, const char *input, int level, Sdb *db) {
if (fcn) {
//if (sdb_add (db, fcn->name, "1", 0)) {
r_cons_printf ("%s0x%08"PFMT64x" fcn 0x%08"PFMT64x" %s\n",
pre+2, addr, fcn->addr, fcn->name);
pre + 2, addr, fcn->addr, fcn->name);
//}
} else {
//snprintf (arg, sizeof (arg), "0x%08"PFMT64x, addr);

View File

@ -167,7 +167,6 @@ R_API int r_syscall_get_swi(RSyscall *s) {
R_API RSyscallItem *r_syscall_get(RSyscall *s, int num, int swi) {
const char *ret, *ret2, *key;
RSyscallItem *si;
if (!s || !s->db) {
eprintf ("Syscall database not loaded\n");
return NULL;
@ -186,8 +185,7 @@ R_API RSyscallItem *r_syscall_get(RSyscall *s, int num, int swi) {
if (!ret2) {
return NULL;
}
si = r_syscall_item_new_from_string (ret, ret2);
return si;
return r_syscall_item_new_from_string (ret, ret2);
}
R_API int r_syscall_get_num(RSyscall *s, const char *str) {