当前位置: 首页>>代码示例>>C++>>正文


C++ r_core_seek函数代码示例

本文整理汇总了C++中r_core_seek函数的典型用法代码示例。如果您正苦于以下问题:C++ r_core_seek函数的具体用法?C++ r_core_seek怎么用?C++ r_core_seek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了r_core_seek函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: r_core_yank_string

/* Copy a zero terminated string to the clipboard. Clamp to maxlen or blocksize. */
R_API int r_core_yank_string(RCore *core, ut64 addr, int maxlen) {
	ut64 curseek = core->offset;
	ut8 *buf = NULL;
	if (maxlen < 0) {
		eprintf ("r_core_yank_string: cannot yank negative bytes\n");
		return false;
	}
	if (addr != core->offset) {
		r_core_seek (core, addr, 1);
	}
	/* Ensure space and safe termination for largest possible string allowed */
	buf = calloc (1, core->blocksize + 1);
	if (!buf) {
		return false;
	}
	buf[core->blocksize] = 0;
	r_io_read_at (core->io, addr, buf, core->blocksize);
	if (maxlen == 0) {
		// Don't use strnlen, see: http://sourceforge.net/p/mingw/bugs/1912/
		maxlen = r_str_nlen ((const char *) buf, core->blocksize);
	} else if (maxlen > core->blocksize) {
		maxlen = core->blocksize;
	}
	r_core_yank_set (core, addr, buf, maxlen);
	if (curseek != addr) {
		r_core_seek (core, curseek, 1);
	}
	free (buf);
	return true;
}
开发者ID:csarn,项目名称:radare2,代码行数:31,代码来源:yank.c

示例2: r_core_yank_string

/* Copy a zero terminated string to the clipboard. Clamp to maxlen or blocksize. */
R_API int r_core_yank_string(RCore *core, ut64 addr, int maxlen) {
	ut64 curseek = core->offset;
	ut8 *buf = NULL;
	if (maxlen<0) {
		eprintf ("r_core_yank_string: cannot yank negative bytes\n");
		return R_FALSE;
	}
	if (addr != core->offset)
		r_core_seek (core, addr, 1);
	/* Ensure space and safe termination for largest possible string allowed */
	buf = malloc (core->blocksize + 1);
	if (!buf)
		return R_FALSE;
	buf[core->blocksize] = 0;
	r_core_read_at (core, addr, buf, core->blocksize);
	if (maxlen == 0) {
		maxlen = strnlen ((const char*)buf, core->blocksize);
	} else if (maxlen > core->blocksize) {
		maxlen = core->blocksize;
	}
	r_core_yank_set (core, addr, buf, maxlen);
	if (curseek != addr)
		r_core_seek (core, curseek, 1);
	free (buf);
	return R_TRUE;
}
开发者ID:t35t12345,项目名称:radare2,代码行数:27,代码来源:yank.c

示例3: r_core_yank

R_API int r_core_yank(struct r_core_t *core, ut64 addr, int len) {
	ut64 curseek = core->offset;
	ut8 *buf = NULL;
	if (len < 0) {
		eprintf ("r_core_yank: cannot yank negative bytes\n");
		return false;
	}
	if (len == 0) {
		len = core->blocksize;
	}
	buf = malloc (len);
	if (!buf) {
		return false;
	}
	if (addr != core->offset) {
		r_core_seek (core, addr, 1);
	}
	r_io_read_at (core->io, addr, buf, len);
	r_core_yank_set (core, addr, buf, len);
	if (curseek != addr) {
		r_core_seek (core, curseek, 1);
	}
	free (buf);
	return true;
}
开发者ID:csarn,项目名称:radare2,代码行数:25,代码来源:yank.c

示例4: r_core_visual_prompt_input

R_API void r_core_visual_prompt_input (RCore *core) {
	int ret;
	ut64 addr = core->offset;
	ut64 bsze = core->blocksize;

	r_cons_reset_colors();
	r_cons_printf("\nPress <enter> to return to Visual mode.\n");

	r_cons_show_cursor (true);
	core->vmode = false;
	ut64 newaddr = addr;
	if (curset) {
		if (ocursor != -1) {
			newaddr = core->offset + ocursor;
			r_core_block_size (core, cursor-ocursor);
		} else newaddr = core->offset + cursor;
		r_core_seek (core, newaddr, 1);
	}
	do {
		ret = r_core_visual_prompt (core);
		if (core->offset != newaddr) {
			// do not restore seek anymore
			newaddr = addr;
		}
	} while (ret);
	if (curset) {
		if (addr != newaddr) {
			r_core_seek (core, addr, 1);
			r_core_block_size (core, bsze);
		}
	}
	r_cons_show_cursor (false);
	core->vmode = true;
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:34,代码来源:visual.c

示例5: r_core_visual_seek_animation

R_API void r_core_visual_seek_animation (RCore *core, ut64 addr) {
	if (r_config_get_i (core->config, "scr.feedback")<1)
		return;
#if 0
	int i, ns = 90000;
	const char *scmd = (addr > core->offset)? "so": "s-4";
	for (i=0;i<5;i++) {
		r_core_cmd0 (core, scmd);
		r_core_visual_refresh (core);
		r_cons_flush();
		r_sys_usleep (ns);
		ns -= 1000;
	}
	r_core_seek (core, addr, 1);
#else
	if (core->offset == addr)
		return;
	r_cons_gotoxy (1, 2);
	if (addr>core->offset) {
		r_cons_printf (".----.\n");
		r_cons_printf ("| \\/ |\n");
		r_cons_printf ("'----'\n");
	} else {
		r_cons_printf (".----.\n");
		r_cons_printf ("| /\\ |\n");
		r_cons_printf ("'----'\n");
	}
	r_cons_flush();
	r_sys_usleep (90000);
#endif
	r_core_seek (core, addr, 1);
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:32,代码来源:visual.c

示例6: on_fcn_delete

static int on_fcn_delete (void *_anal, void* _user, RAnalFunction *fcn) {
	RCore *core = (RCore*)_user;
	const char *cmd = r_config_get (core->config, "cmd.fcn.delete");
	if (cmd && *cmd) {
		ut64 oaddr = core->offset;
		ut64 addr = fcn->addr;
		r_core_seek (core, addr, 1);
		r_core_cmd0 (core, cmd);
		r_core_seek (core, oaddr, 1);
	}
	return 0;
}
开发者ID:0x2F,项目名称:radare2,代码行数:12,代码来源:core.c

示例7: on_fcn_rename

static int on_fcn_rename(void *_anal, void* _user, RAnalFunction *fcn, const char *oname) {
	RCore *core = (RCore*)_user;
	const char *cmd = r_config_get (core->config, "cmd.fcn.rename");
	if (cmd && *cmd) {
// XXX: wat do with old name here?
		ut64 oaddr = core->offset;
		ut64 addr = fcn->addr;
		r_core_seek (core, addr, 1);
		r_core_cmd0 (core, cmd);
		r_core_seek (core, oaddr, 1);
	}
	return 0;
}
开发者ID:0x2F,项目名称:radare2,代码行数:13,代码来源:core.c

示例8: __seek_line_absolute

static void __seek_line_absolute(RCore *core, int numline) {
	if (numline < 1 || numline > core->print->lines_cache_sz - 1) {
		eprintf ("ERROR: Line must be between 1 and %d\n", core->print->lines_cache_sz - 1);
	} else {
		r_core_seek (core, core->print->lines_cache[numline - 1], 1);
	}
}
开发者ID:P4N74,项目名称:radare2,代码行数:7,代码来源:cmd_seek.c

示例9: r_core_visual_prompt

R_API int r_core_visual_prompt (RCore *core) {
    char buf[1024];
    int ret;
    ut64 oseek = core->offset;
#if __UNIX__
    r_line_set_prompt (Color_RESET":> ");
#else
    r_line_set_prompt (":> ");
#endif
    showcursor (core, R_TRUE);
    r_cons_fgets (buf, sizeof (buf), 0, NULL);
    if (*buf) {
        r_line_hist_add (buf);
        r_core_cmd (core, buf, 0);
        r_cons_flush ();
        ret = R_TRUE;
    } else {
        ret = R_FALSE;
        //r_cons_any_key ();
        r_cons_clear00 ();
        showcursor (core, R_FALSE);
    }
    if (curset) r_core_seek (core, oseek, 1);
    return ret;
}
开发者ID:revskills,项目名称:radare2,代码行数:25,代码来源:visual.c

示例10: r_core_magic

static void r_core_magic(RCore *core, const char *file, int v) {
	ut64 addr = core->offset;
	magicdepth = r_config_get_i (core->config, "magic.depth"); // TODO: do not use global var here
	r_core_magic_at (core, file, addr, magicdepth, v);
	if (addr != core->offset)
		r_core_seek (core, addr, R_TRUE);
}
开发者ID:commiebstrd,项目名称:radare2,代码行数:7,代码来源:cmd_magic.c

示例11: r_core_seek_delta

R_API int r_core_seek_delta(RCore *core, st64 addr) {
	ut64 tmp = core->offset;
	int ret;
	if (addr == 0) {
		return true;
	}
	if (addr > 0LL) {
		/* TODO: check end of file */
		addr += tmp;
	} else {
		/* check < 0 */
		if (-addr > tmp) {
			addr = 0;
		} else {
			addr += tmp;
		}
	}
	core->offset = addr;
	ret = r_core_seek (core, addr, 1);
	//ret = r_core_block_read (core);
	//if (ret == -1)
	//	memset (core->block, 0xff, core->blocksize);
	//	core->offset = tmp;
	return ret;
}
开发者ID:f0829,项目名称:radare2,代码行数:25,代码来源:cio.c

示例12: seek_to_register

static void seek_to_register(RCore *core, const char *input, bool is_silent) {
	ut64 off;
	if (core->io->debug) {
		off = r_debug_reg_get (core->dbg, input);
		if (!is_silent) {
			r_io_sundo_push (core->io, core->offset, r_print_get_cursor (core->print));
		}
		r_core_seek (core, off, 1);
	} else {
		RReg *orig = core->dbg->reg;
		core->dbg->reg = core->anal->reg;
		off = r_debug_reg_get (core->dbg, input);
		core->dbg->reg = orig;
		if (!is_silent) {
			r_io_sundo_push (core->io, core->offset, r_print_get_cursor (core->print));
		}
		r_core_seek (core, off, 1);
	}
}
开发者ID:P4N74,项目名称:radare2,代码行数:19,代码来源:cmd_seek.c

示例13: __seek_line_relative

static void __seek_line_relative(RCore *core, int numlines) {
	int curr = r_util_lines_getline (core->print->lines_cache, core->print->lines_cache_sz, core->offset);
	if (numlines > 0 && curr + numlines >= core->print->lines_cache_sz - 1) {
		eprintf ("ERROR: Line must be < %d\n", core->print->lines_cache_sz - 1);
	} else if (numlines < 0 && curr + numlines < 1) {
		eprintf ("ERROR: Line must be > 1\n");
	} else {
		r_core_seek (core, core->print->lines_cache[curr + numlines - 1], 1);
	}
}
开发者ID:P4N74,项目名称:radare2,代码行数:10,代码来源:cmd_seek.c

示例14: r_core_visual_mark_seek

static void r_core_visual_mark_seek(RCore *core, ut8 ch) {
	if (!marks_init) {
		int i;
		for (i=0;i<UT8_MAX;i++)
			marks[i] = 0;
		marks_init = 1;
	}
	if (marks[ch])
		r_core_seek (core, marks[ch], 1);
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:10,代码来源:visual.c

示例15: r_core_visual_prompt_input

R_API void r_core_visual_prompt_input (RCore *core) {
	int ret;
	eprintf ("Press <enter> to return to Visual mode.\n");
	do {
		ut64 addr = core->offset;
		ut64 bsze = core->blocksize;
		if (curset) {
			if (ocursor != -1) {
				r_core_block_size (core, cursor-ocursor);
				r_core_seek (core, core->offset + ocursor, 1);
			} else r_core_seek (core, core->offset + cursor, 1);
		}
		ret = r_core_visual_prompt (core);
		if (curset) {
			r_core_seek (core, addr, 1);
			r_core_block_size (core, bsze);
		}
	} while (ret);
}
开发者ID:dialeth,项目名称:radare2,代码行数:19,代码来源:visual.c


注:本文中的r_core_seek函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。