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


C++ r_cons_printf函数代码示例

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


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

示例1: r_debug_wait

/* Returns  R_DEBUG_REASON_* */
R_API int r_debug_wait(RDebug *dbg) {
	int ret = 0;
	if (!dbg)
		return false;
	dbg->reason.type = R_DEBUG_REASON_UNKNOWN;
	if (r_debug_is_dead (dbg))
		return dbg->reason.type = R_DEBUG_REASON_DEAD;
	if (dbg->h && dbg->h->wait) {
		dbg->reason.type = R_DEBUG_REASON_UNKNOWN;
		ret = dbg->h->wait (dbg, dbg->pid);
		dbg->newstate = 1;
		if (ret == -1) {
			eprintf ("\n==> Process finished\n\n");
			r_debug_select (dbg, -1, -1);
		}
		if (dbg->trace->enabled)
			r_debug_trace_pc (dbg);
		dbg->reason.type = ret;
		if (ret == R_DEBUG_REASON_SIGNAL && dbg->reason.signum != -1) {
			/* handle signal on continuations here */
			int what = r_debug_signal_what (dbg, dbg->reason.signum);
			const char *name = r_debug_signal_resolve_i (dbg, dbg->reason.signum);
			if (name && strcmp ("SIGTRAP", name))
				r_cons_printf ("[+] signal %d aka %s received %d\n",
						dbg->reason.signum, name, what);
		}
	}
	return ret;
}
开发者ID:13572293130,项目名称:radare2,代码行数:30,代码来源:debug.c

示例2: flag_to_flag

static int flag_to_flag(RCore *core, const char *glob) {
	r_return_val_if_fail (glob, 0);
	glob = r_str_trim_ro (glob);
	struct flag_to_flag_t u = { .next = UT64_MAX, .offset = core->offset };
	r_flag_foreach_glob (core->flags, glob, flag_to_flag_foreach, &u);
	if (u.next != UT64_MAX && u.next > core->offset) {
		return u.next - core->offset;
	}
	return 0;
}

static void cmd_flag_tags (RCore *core, const char *input) {
	char mode = input[1];
	for (; *input && !IS_WHITESPACE (*input); input++) {}
	char *inp = strdup (input);
	char *arg = r_str_trim (inp);
	if (!*arg && !mode) {
		const char *tag;
		RListIter *iter;
		RList *list = r_flag_tags_list (core->flags);
		r_list_foreach (list, iter, tag) {
			r_cons_printf ("%s\n", tag);
		}
		r_list_free (list);
		free (inp);
		return;
	}
开发者ID:das-labor,项目名称:radare2,代码行数:27,代码来源:cmd_flag.c

示例3: r_core_visual_hud

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;
}
开发者ID:raulsiles,项目名称:radare2,代码行数:30,代码来源:visual.c

示例4: r_debug_wait

/* Returns PID */
R_API int r_debug_wait(RDebug *dbg) {
	int ret = 0;
	if (r_debug_is_dead (dbg))
		return R_FALSE;
	if (dbg && dbg->h && dbg->h->wait) {
		dbg->reason = R_DBG_REASON_UNKNOWN;
		ret = dbg->h->wait (dbg, dbg->pid);
		dbg->reason = ret;
		dbg->newstate = 1;
		if (ret == -1) {
			eprintf ("\n==> Process finished\n\n");
			r_debug_select (dbg, -1, -1);
		}
		//eprintf ("wait = %d\n", ret);
		if (dbg->trace->enabled)
			r_debug_trace_pc (dbg);
		if (ret == R_DBG_REASON_SIGNAL && dbg->signum != -1) {
			/* handle signal on continuations here */
			int what = r_debug_signal_what (dbg, dbg->signum);
			const char *name = r_debug_signal_resolve_i (dbg, dbg->signum);
			if (strcmp ("SIGTRAP", name))
				r_cons_printf ("[+] signal %d aka %s received\n",
					dbg->signum, name);
			if (what & R_DBG_SIGNAL_SKIP) {
				dbg->signum = 0;
				// TODO: use ptrace-setsiginfo to ignore signal
			}
			if (what & R_DBG_SIGNAL_CONT) {
				// XXX: support step, steptrace, continue_until_foo, etc..
				r_debug_continue (dbg);
			}
		}
	}
	return ret;
}
开发者ID:17twenty,项目名称:radare2,代码行数:36,代码来源:debug.c

示例5: 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:raulsiles,项目名称:radare2,代码行数:34,代码来源:visual.c

示例6: r_core_visual_hud

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;

	r_cons_show_cursor (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);
	}
	r_cons_show_cursor (R_FALSE);
	r_cons_flush ();
	return (int)(size_t)p;
}
开发者ID:DJHartley,项目名称:radare2,代码行数:27,代码来源:visual.c

示例7: r_cons_pal_show_rgb

static void r_cons_pal_show_rgb () {
	const int inc = 3;
	int i, j, k, n = 0;

	r_cons_print ("\n\nRGB:\n");
	for (i = n = 0; i <= 0xf; i += inc) {
		for (k = 0; k <= 0xf; k += inc) {
			for (j = 0; j <= 0xf; j += inc) {
				char fg[32], bg[32];
				int r = i * 16;
				int g = j * 16;
				int b = k * 16;
				if ((i < 6) && (j <5)) strcpy (fg, Color_WHITE);
				else strcpy (fg, Color_BLACK);
				r_cons_rgb_str (bg, r, g, b, 1);
				r_cons_printf ("%s%s rgb:%02x%02x%02x "
					Color_RESET, fg, bg, r, g, b);
				//if (n++==7) {
				if (n ++== 5) {
					n = 0;
					r_cons_newline ();
				}
			}
		}
	}
}
开发者ID:Kodoque1,项目名称:radare2,代码行数:26,代码来源:pal.c

示例8: nextpal_item

static bool nextpal_item(RCore *core, int mode, const char *file, int ctr) {
	const char *fn = r_str_lchr (file, '/');
	if (!fn) fn = file;
	switch (mode) {
	case 'j': // json
		r_cons_printf ("%s\"%s\"", ctr?",":"", fn);
		break;
	case 'l': // list
		r_cons_println (fn);
		break;
	case 'p': // previous
		// TODO: move logic here
		break;
	case 'n': // next
		if (getNext) {
			curtheme = r_str_dup (curtheme, fn);
			getNext = false;
			return false;
		} else if (curtheme) {
			if (!strcmp (curtheme, fn)) {
				getNext = true;
			}
		} else {
			curtheme = r_str_dup (curtheme, fn);
			return false;
		}
		break;
	}
	return true;
}
开发者ID:xarkes,项目名称:radare2,代码行数:30,代码来源:cmd_eval.c

示例9: r_cons_gotoxy

R_API void r_cons_gotoxy(int x, int y) {
#if 0
#if __WINDOWS__
        static HANDLE hStdout = NULL;
        COORD coord;
        coord.X = x;
        coord.Y = y;
        if (!hStdout)
                hStdout = GetStdHandle (STD_OUTPUT_HANDLE);
        SetConsoleCursorPosition (hStdout, coord);
#else
	r_cons_printf ("\x1b[%d;%dH", y, x);
#endif
#endif
	r_cons_printf ("\x1b[%d;%dH", y, x);
}
开发者ID:Lukas-Dresel,项目名称:radare2,代码行数:16,代码来源:cons.c

示例10: r_cons_pal_show

R_API void r_cons_pal_show () {
	const int inc = 3;
	int i, j, k, n = 0;
	for (i=0; colors[i].name; i++) {
		r_cons_printf ("%s%s__"Color_RESET" %s\n",
			colors[i].code,
			colors[i].bgcode,
			colors[i].name);
	}
	r_cons_printf ("\nGreyscale:\n");
	for (i=n=0; i<=0xf; i+=1) {
		char fg[32], bg[32];
		int r = i*16;
		if (i<5) strcpy (fg, Color_WHITE);
		else r_cons_rgb_str (fg, 0, 0, 0, 0);
		r_cons_rgb_str (bg, r, r, r, 1);
		r_cons_printf ("%s%s  rgb:%x%x%x  "
			Color_RESET, fg, bg, i, i, i);
		if (n++==5) {
			n = 0;
			r_cons_newline();
		}
	}
	r_cons_printf ("\n\nRGB:\n");
	for (i=n=0; i<=0xf; i+=inc) {
		for (k=0; k<=0xf; k+=inc) {
			for (j=0; j<=0xf; j+=inc) {
				char fg[32], bg[32];
				int r = i*16;
				int g = j*16;
				int b = k*16;
				if ((i<6) && (j<5) ) 
					strcpy (fg, Color_WHITE);
				//if (i<2 && j<6 && k<13) 
				else r_cons_rgb_str (fg, 0, 0, 0, 0);
				r_cons_rgb_str (bg, r, g, b, 1);
				r_cons_printf ("%s%s  rgb:%x%x%x  "Color_RESET,
					fg, bg, i, j, k);
				//if (n++==7) {
				if (n++==5) {
					n = 0;
					r_cons_newline();
				}
			}
		}
	}
}
开发者ID:l3acon,项目名称:radare2,代码行数:47,代码来源:pal.c

示例11: config_scrfkey_callback

static int config_scrfkey_callback(void *user, void *data) {
	RConfigNode *node = (RConfigNode*) data;
	if (!strcmp (node->value, "help") || *node->value == '?') {
		r_cons_printf ("scr.fkey = fun, hit, flag\n");
		return R_FALSE;
	}
	return R_TRUE;
}
开发者ID:moon2l,项目名称:radare2,代码行数:8,代码来源:config.c

示例12: handle_sha512

static void handle_sha512 (const ut8 *block, int len) {
	int i = 0;
	RHash *ctx = r_hash_new (R_TRUE, R_HASH_SHA512);
	const ut8 *c = r_hash_do_sha512 (ctx, block, len);
	for (i=0; i<R_HASH_SIZE_SHA512; i++) r_cons_printf ("%02x", c[i]);
	r_cons_newline ();
	r_hash_free (ctx);
}
开发者ID:8500616886,项目名称:radare2,代码行数:8,代码来源:cmd_hash.c

示例13: r_core_yank_dump

R_API int r_core_yank_dump (RCore *core, ut64 pos) {
	int res = R_FALSE, i = 0;
	int ybl = core->yank_buf->length;
	if (ybl>0) {
		if (pos<ybl) {
			r_cons_printf ("0x%08"PFMT64x " %d ",
				core->yank_buf->base+pos,
				core->yank_buf->length-pos);
			for (i = pos; i < core->yank_buf->length; i++)
				r_cons_printf ("%02x",
					core->yank_buf->buf[i]);
			r_cons_newline ();
			res = R_TRUE;
		} else eprintf ("Position exceeds buffer length.\n");
	} else eprintf ("No buffer yanked already\n");
	return res;
}
开发者ID:t35t12345,项目名称:radare2,代码行数:17,代码来源:yank.c

示例14: rtti_itanium_print_class_type_info

static void rtti_itanium_print_class_type_info (class_type_info *cti, ut64 addr, const char *prefix) {
	r_cons_printf ("%sType Info at 0x%08"PFMT64x ":\n"
			"%s  Reference to RTTI's type class: 0x%08"PFMT32x "\n"
			"%s  Reference to type's name: 0x%08"PFMT32x "\n",
			prefix, addr,
			prefix, cti->vtable_addr,
			prefix, cti->name_addr);
}
开发者ID:jroimartin,项目名称:radare2,代码行数:8,代码来源:rtti_itanium.c

示例15: pair

static void pair(const char *a, const char *b, int mode, bool last) {
	if (!b || !(*b)) return;

	if (IS_MODE_JSON (mode)) {
		const char *lst = last ? "" : ",";
		r_cons_printf ("\"%s\":%s%s", a, b, lst);
	} else {
		char ws[16];
		int al = strlen (a);

		al = PAIR_WIDTH - al;
		if (al < 0) al = 0;
		memset (ws, ' ', al);
		ws[al] = 0;
		r_cons_printf ("%s%s%s\n", a, ws, b);
	}
}
开发者ID:hidd3ncod3s,项目名称:radare2,代码行数:17,代码来源:bin.c


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