本文整理汇总了C++中r_cons_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ r_cons_printf函数的具体用法?C++ r_cons_printf怎么用?C++ r_cons_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了r_cons_printf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: handle_md5
static void handle_md5 (const ut8 *block, int len) {
int i = 0;
RHash *ctx = r_hash_new (true, R_HASH_MD5);
const ut8 *c = r_hash_do_md5 (ctx, block, len);
for (i=0; i<R_HASH_SIZE_MD5; i++) r_cons_printf ("%02x", c[i]);
r_cons_newline ();
r_hash_free (ctx);
}
开发者ID:EliaGeretto,项目名称:radare2,代码行数:8,代码来源:cmd_hash.c
示例17: algolist
static void algolist(int mode) {
const char *name;
ut64 bits;
int i;
for (i=0; ; i++) {
bits = 1<<i;
name = r_hash_name (bits);
if (!name||!*name) break;
if (mode) {
r_cons_printf ("%s\n", name);
} else {
r_cons_printf (" #%s", name);
if (!((i+1)%10)) r_cons_newline ();
}
}
if (!mode) r_cons_printf ("\n");
}
开发者ID:piaoapiao,项目名称:radare2,代码行数:17,代码来源:cmd_hash.c
示例18: r_core_rtr_cmd
R_API void r_core_rtr_cmd(RCore *core, const char *input) {
char bufw[1024], bufr[8];
const char *cmd = NULL, *cmd_output = NULL;
int i, cmd_len, fd = atoi (input);
if (*input==':' && !strchr (input+1, ':')) {
r_core_cmdf (core, "o rap://%s", input);
return;
}
if (fd != 0) {
if (rtr_host[rtr_n].fd)
for (rtr_n = 0; rtr_host[rtr_n].fd->fd != fd
&& rtr_n < RTR_MAX_HOSTS - 1; rtr_n++);
if (!(cmd = strchr (input, ' '))) {
eprintf ("Error\n");
return;
}
} else cmd = input;
if (!rtr_host[rtr_n].fd){
eprintf ("Error: Unknown host\n");
core->num->value = 1; // fail
return;
}
if (!rtr_host[rtr_n].proto == RTR_PROT_RAP){
eprintf ("Error: Not a rap:// host\n");
return;
}
core->num->value = 0; // that's fine
if (!strlen (cmd)) {
// just check if we can connect
r_socket_close (rtr_host[rtr_n].fd);
return;
}
/* send */
bufw[0] = RTR_RAP_CMD;
i = strlen (cmd) + 1;
r_mem_copyendian ((ut8*)bufw+1, (ut8*)&i, 4, endian);
memcpy (bufw+5, cmd, i);
r_socket_write (rtr_host[rtr_n].fd, bufw, 5+i);
/* read */
r_socket_read (rtr_host[rtr_n].fd, (ut8*)bufr, 5);
if (bufr[0] != (char)(RTR_RAP_CMD|RTR_RAP_REPLY)) {
eprintf ("Error: Wrong reply\n");
return;
}
r_mem_copyendian ((ut8*)&cmd_len, (ut8*)bufr+1, 4, endian);
cmd_output = malloc (cmd_len);
if (!cmd_output) {
eprintf ("Error: Allocating cmd output\n");
return;
}
r_socket_read (rtr_host[rtr_n].fd, (ut8*)cmd_output, cmd_len);
r_cons_printf ("%s\n", cmd_output);
free ((void *)cmd_output);
}
开发者ID:dialeth,项目名称:radare2,代码行数:58,代码来源:rtr.c
示例19: rtti_itanium_print_vmi_class_type_info_json
static void rtti_itanium_print_vmi_class_type_info_json (vmi_class_type_info *vmi_cti, ut64 addr) {
r_cons_printf ("{\"vmi_type_info\": {\"found_at\":%"PFMT32u",\"ref_to_type_class\":%"PFMT32u","
"\"ref_to_type_name\":%"PFMT32u",\"flags\":%"PFMT32d","
"\"count_of_base_classes\":%"PFMT32d",",
addr, vmi_cti->vtable_addr, vmi_cti->name_addr, vmi_cti->vmi_flags,
vmi_cti->vmi_base_count);
r_cons_printf ("\"base_classes\":[");
int i;
for (i = 0; i < vmi_cti->vmi_base_count; i++) {
r_cons_printf("{\"type_desc_addr\":%"PFMT32u",\"flags\":%"PFMT32d"}",
vmi_cti->vmi_bases[i].base_class_addr,
vmi_cti->vmi_bases[i].flags);
if (i < vmi_cti->vmi_base_count - 1) {
r_cons_printf(",");
}
}
r_cons_printf ("]}}");
}
开发者ID:jroimartin,项目名称:radare2,代码行数:18,代码来源:rtti_itanium.c
示例20: strdup
// Below this line are the r_io_zip plugin APIs
static RIODesc *r_io_zip_open(RIO *io, const char *file, int rw, int mode) {
RIODesc *result = NULL;
RIOZipFileObj *zipFileObj = NULL;
char *zip_uri = NULL, *zip_filename = NULL, *filename_in_zipfile = NULL;
if (!r_io_zip_plugin_open (io, file)) {
return result;
}
zip_uri = strdup(file);
// 1) Tokenize to the '//' and find the base file directory ('/')
zip_filename = strstr(zip_uri, "//");
if (zip_filename && zip_filename[2]) {
if (zip_filename[0] && zip_filename[0] == '/' &&
zip_filename[1] && zip_filename[1] == '/' ) {
*zip_filename++ = 0;
}
*zip_filename++ = 0;
filename_in_zipfile = strstr(zip_filename, "//");
if (filename_in_zipfile && filename_in_zipfile[2]) {
// null terminating uri to filename here.
*filename_in_zipfile++ = 0;
*filename_in_zipfile++ = 0;
}
}
if (!zip_filename) {// && !filename_in_zipfile) {
if (zip_uri)
free(zip_uri);
eprintf("usage: zip:///path/to/archive//filepath\n");
eprintf("Archive was not found.\n");
return result;
}
// Failed to find the file name the archive.
if (!filename_in_zipfile) {
RList *files = NULL;
RListIter *iter, *iter_tmp;
char *name;
//eprintf("usage: zip:///path/to/archive//filepath\n");
eprintf("\nFiles in archive\n\n");
files = r_io_zip_get_files(zip_filename, 0, mode, rw );
if (files) {
int i = 0;
r_list_foreach_safe(files, iter, iter_tmp, name) {
// XXX - io->printf does not flush
// io->printf("%s\n", name);
r_cons_printf("%s\n", name);
r_cons_flush ();
free (name);
r_list_delete (files, iter);
}
r_list_free (files);
}
开发者ID:jdukes,项目名称:radare2,代码行数:58,代码来源:io_zip.c
注:本文中的r_cons_printf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论