Ejemplo n.º 1
0
R_API int r_core_visual_hud(RCore *core) {
	const char *c = r_config_get (core->config, "hud.path");
	const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main";
	char *homehud = r_str_home (R2_HOMEDIR"/hud");
	char *res = NULL;
	char *p = 0;

	showcursor (core, true);
	if (c && *c && r_file_exists (c))
		res = r_cons_hud_file (c);
	if (!res && homehud)
		res = r_cons_hud_file (homehud);
	if (!res && r_file_exists (f))
		res = r_cons_hud_file (f);
	if (!res)
		r_cons_message ("Cannot find hud file");

	r_cons_clear ();
	if (res) {
		p = strchr (res, '\t');
		r_cons_printf ("%s\n", res);
		r_cons_flush ();
		if (p) r_core_cmd0 (core, p+1);
		free (res);
	}
	showcursor (core, false);
	r_cons_flush ();
	free (homehud);
	return (int)(size_t)p;
}
Ejemplo n.º 2
0
static int r_core_visual_hud(RCore *core) {
    const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main";
    char *homehud = r_str_home (R2_HOMEDIR"/hud");
    char *res = NULL;
    char *p = 0;

    showcursor (core, R_TRUE);
    if (homehud)
        res = r_cons_hud_file (homehud);
    if (!res) {
        if (r_file_exists (f))
            res = r_cons_hud_file (f);
        else r_cons_message ("Cannot find hud file");
    }
    r_cons_clear ();
    if (res) {
        p = strchr (res, '\t');
        core->printidx = 1;
        r_cons_printf ("%s\n", res);
        r_cons_flush ();
        if (p) r_core_cmd0 (core, p+1);
        free (res);
    }
    showcursor (core, R_FALSE);
    r_cons_flush ();
    free (homehud);
    return (int)(size_t)p;
}
Ejemplo n.º 3
0
R_API int r_core_yank_hud_file (RCore *core, const char *input) {
	char *buf = NULL;
	ut32 len = 0;
	int res = R_FALSE;

	for (input++; *input==' '; input++) ;

	buf = r_cons_hud_file (input);
	len = buf ? strlen ((const char*)buf) + 1 : 0;
	res = r_core_yank_set_str (core, R_CORE_FOREIGN_ADDR, buf, len);
	return res;
}
Ejemplo n.º 4
0
R_API int r_core_yank_hud_file (RCore *core, const char *input) {
	char *buf = NULL;
	bool res = false;
	ut32 len = 0;
	if (!input || !*input) return false;
	for (input++; *input==' '; input++) ;
	buf = r_cons_hud_file (input);
	len = buf ? strlen ((const char*)buf) + 1 : 0;
	res = r_core_yank_set_str (core, R_CORE_FOREIGN_ADDR, buf, len);
	free (buf);
	return res;
}