本文整理汇总了C++中r_cons_strcat函数的典型用法代码示例。如果您正苦于以下问题:C++ r_cons_strcat函数的具体用法?C++ r_cons_strcat怎么用?C++ r_cons_strcat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了r_cons_strcat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r_debug_signal_list
R_API void r_debug_signal_list(RDebug *dbg, int mode) {
dbg->_mode = mode;
switch (mode) {
case 0:
case 1:
sdb_foreach (DB, siglistcb, dbg);
break;
case 2:
r_cons_strcat ("[");
sdb_foreach (DB, siglistjsoncb, dbg);
r_cons_strcat ("]");
r_cons_newline();
break;
}
dbg->_mode = 0;
}
示例2: r_cons_printf_list
R_API void r_cons_printf_list(const char *format, va_list ap) {
size_t size, written;
va_list ap2;
va_copy (ap2, ap);
if (I.null || !format) {
va_end (ap2);
return;
}
if (strchr (format, '%')) {
palloc (MOAR + strlen (format) * 20);
club:
size = I.buffer_sz - I.buffer_len - 1; /* remaining space in I.buffer */
written = vsnprintf (I.buffer + I.buffer_len, size, format, ap);
if (written >= size) { /* not all bytes were written */
palloc (written);
va_copy (ap, ap2);
va_copy (ap2, ap);
written = vsnprintf (I.buffer + I.buffer_len, written, format, ap2);
if (written >= size) {
palloc (written);
goto club;
}
va_end (ap2);
}
I.buffer_len += written;
} else {
r_cons_strcat (format);
}
va_end (ap2);
}
示例3: r_cons_canvas_print
R_API void r_cons_canvas_print(RConsCanvas *c) {
char *o = r_cons_canvas_to_string (c);
if (o) {
r_cons_strcat (o);
free (o);
}
}
示例4: r_cons_rgb
R_API void r_cons_rgb (ut8 r, ut8 g, ut8 b, int is_bg) {
#if __WINDOWS__
#warning r_cons_rgb not yet supported on windows
#else
char outstr[64];
r_cons_strcat (r_cons_rgb_str (outstr, r, g, b, is_bg));
#endif
}
示例5: r_cons_newline
R_API void r_cons_newline() {
if (!I.null) {
r_cons_strcat ("\n");
}
#if __WINDOWS__
r_cons_reset_colors();
#endif
//if (I.is_html) r_cons_strcat ("<br />\n");
}
示例6: cmd_meta
static int cmd_meta(void *data, const char *input) {
RCore *core = (RCore*)data;
int i;
char *t = 0;
RAnalFunction *f;
switch (*input) {
case 'j':
case '*':
r_meta_list (core->anal, R_META_TYPE_ANY, *input);
break;
case 'L':
cmd_meta_lineinfo (core, input + 1);
break;
case 'C':
cmd_meta_comment (core, input);
break;
case 'h': /* comment */
case 's': /* string */
case 'd': /* data */
case 'm': /* magic */
case 'f': /* formatted */
cmd_meta_hsdmf (core, input);
break;
case '-':
if (input[1]!='*') {
i = r_num_math (core->num, input+((input[1]==' ')?2:1));
r_meta_del (core->anal, R_META_TYPE_ANY, core->offset, i, "");
} else r_meta_cleanup (core->anal, 0LL, UT64_MAX);
break;
case '\0':
case '?':
r_cons_strcat (
"|Usage: C[-LCvsdfm?] [...]\n"
"| C* List meta info in r2 commands\n"
"| C- [len] [@][ addr] delete metadata at given address range\n"
"| CL[-][*] [file:line] [addr] show or add 'code line' information (bininfo)\n"
"| CC[-] [comment-text] add/remove comment. Use CC! to edit with $EDITOR\n"
"| CCa[-at]|[at] [text] add/remove comment at given address\n"
"| Cs[-] [size] [[addr]] add string\n"
"| Ch[-] [size] [@addr] hide data\n"
"| Cd[-] [size] hexdump data\n"
"| Cf[-] [sz] [fmt..] format memory (see pf?)\n"
"| Cm[-] [sz] [fmt..] magic parse (see pm?)\n");
break;
case 'F':
f = r_anal_fcn_find (core->anal, core->offset,
R_ANAL_FCN_TYPE_FCN|R_ANAL_FCN_TYPE_SYM);
if (f) r_anal_str_to_fcn (core->anal, f, input+2);
else eprintf ("Cannot find function here\n");
break;
}
if (t)
free (t);
return R_TRUE;
}
示例7: r_cons_any_key
R_API int r_cons_any_key(const char *msg) {
if (msg && *msg) {
r_cons_printf ("\n-- %s --\n", msg);
} else {
r_cons_strcat ("\n--press any key--\n");
}
r_cons_flush ();
return r_cons_readchar ();
//r_cons_strcat ("\x1b[2J\x1b[0;0H"); // wtf?
}
示例8: r_cons_fill_line
R_API void r_cons_fill_line() {
char *p, white[1024];
int cols = I.columns-1;
if (cols<1) return;
p = (cols>=sizeof (white))?
malloc (cols+1): white;
memset (p, ' ', cols);
p[cols] = 0;
r_cons_strcat (p);
if (white != p) free (p);
}
示例9: r_cons_canvas_print_region
R_API void r_cons_canvas_print_region(RConsCanvas *c) {
char *o = r_cons_canvas_to_string (c);
if (o) {
char *p = r_str_trim_tail (o);
if (p) {
r_cons_strcat (p);
free (p);
} else {
free (o);
}
}
}
示例10: siglistcb
static int siglistcb (void *p, const char *k, const char *v) {
static char key[32] = "cfg.";
RDebug *dbg = (RDebug *)p;
int mode = dbg->_mode;
int opt;
if (atoi (k)>0) {
strcpy (key+4, k);
opt = sdb_num_get (DB, key, 0);
if (opt) {
r_cons_printf ("%s %s", k, v);
if (opt & R_DBG_SIGNAL_CONT)
r_cons_strcat (" cont");
if (opt & R_DBG_SIGNAL_SKIP)
r_cons_strcat (" skip");
r_cons_newline ();
} else {
if (mode == 0)
r_cons_printf ("%s %s\n", k, v);
}
}
return 1;
}
示例11: siglistjsoncb
static int siglistjsoncb (void *p, const char *k, const char *v) {
static char key[32] = "cfg.";
RDebug *dbg = (RDebug *)p;
int opt;
if (atoi (k)>0) {
strcpy (key+4, k);
opt = (int)sdb_num_get (DB, key, 0);
if (dbg->_mode == 2) {
dbg->_mode = 0;
} else r_cons_strcat (",");
r_cons_printf ("{\"signum\":\"%s\",\"name\":\"%s\","
"\"option\":", k, v);
if (opt & R_DBG_SIGNAL_CONT) {
r_cons_strcat ("\"cont\"");
} else if (opt & R_DBG_SIGNAL_SKIP) {
r_cons_strcat ("\"skip\"");
} else {
r_cons_strcat ("null");
}
r_cons_strcat ("}");
}
return true;
}
示例12: r_cons_printf
R_API void r_cons_printf(const char *format, ...) {
size_t size, written;
va_list ap;
if (I.null) return;
if (strchr (format, '%')) {
palloc (MOAR + strlen (format)*20);
size = I.buffer_sz-I.buffer_len-1; /* remaining space in I.buffer */
va_start (ap, format);
written = vsnprintf (I.buffer+I.buffer_len, size, format, ap);
va_end (ap);
if (written>=size) { /* not all bytes were written */
palloc (written);
va_start (ap, format);
written = vsnprintf (I.buffer+I.buffer_len, written, format, ap);
va_end (ap);
}
I.buffer_len += written;
} else r_cons_strcat (format);
}
示例13: cmd_type
static int cmd_type(void *data, const char *input) {
RCore *core = (RCore*)data;
switch (input[0]) {
// t [typename] - show given type in C syntax
case 's':
{
char *q, *p, *o, *e;
p = o = strdup (input+1);
for (;;) {
q = strchr (p, ' ');
if (q) *q = 0;
if (!*p) {
p++;
continue;
}
e = strchr (p, '=');
if (e) {
*e = 0;
r_anal_type_set (core->anal, core->offset,
p, r_num_math (core->num, e+1));
} else eprintf ("TODO: implement get\n");
if (!q) break;
p = q+1;
}
free (o);
}
break;
case ' ':
{
char *fmt = r_anal_type_format (core->anal, input +1);
if (fmt) {
r_cons_printf ("pf %s\n", fmt);
free (fmt);
} else eprintf ("Cannot find '%s' type\n", input+1);
}
break;
#if 0
// t* - list all types in 'pf' syntax
case '*':
r_anal_type_list (core->anal, R_ANAL_TYPE_ANY, 1);
break;
#endif
case 0:
// TODO: use r_cons here
//sdb_list (core->anal->sdb_types);
sdb_foreach (core->anal->sdb_types, sdbforcb, core);
break;
case 'o':
if (input[1] == ' ') {
const char *filename = input + 2;
if (!strcmp (filename, "-")) {
char *out, *tmp;
tmp = r_core_editor (core, "");
if (tmp) {
out = r_parse_c_string (tmp);
if (out) {
r_cons_strcat (out);
sdb_query_lines (core->anal->sdb_types, out);
free (out);
}
free (tmp);
}
} else {
char *out = r_parse_c_file (filename);
if (out) {
r_cons_strcat (out);
sdb_query_lines (core->anal->sdb_types, out);
free (out);
}
//r_anal_type_loadfile (core->anal, filename);
}
}
break;
// td - parse string with cparse engine and load types from it
case 'd':
if (input[1] == '?') {
const char * help_message[] = {
"Usage:", "td[...]", "",
"td", "[string]", "Load types from string",
NULL
};
r_core_cmd_help(core, help_message);
} else
if (input[1] == '-') {
const char *arg = strchr (input+1, ' ');
if (arg) arg++; else arg = input+2;
r_anal_type_del (core->anal, arg);
} else
if (input[1] == ' ') {
char tmp[256];
snprintf (tmp, sizeof (tmp), "%s;", input+2);
//const char *string = input + 2;
//r_anal_str_to_type (core->anal, string);
char *out = r_parse_c_string (tmp);
if (out) {
r_cons_strcat (out);
sdb_query_lines (core->anal->sdb_types, out);
free (out);
//.........这里部分代码省略.........
示例14: cmd_eval
static int cmd_eval(void *data, const char *input) {
char *p;
RCore *core = (RCore *)data;
switch (input[0]) {
case 't': // env
if (input[1]==' ' && input[2]) {
RConfigNode *node = r_config_node_get (core->config, input+2);
if (node) {
const char *type = r_config_node_type (node);
if (type && *type) {
r_cons_printf ("%s\n", type);
}
}
} else {
eprintf ("Usage: et [varname] ; show type of eval var\n");
}
break;
case 'n': // env
if (!strchr (input, '=')) {
char *var, *p;
var = strchr (input, ' ');
if (var) while (*var==' ') var++;
p = r_sys_getenv (var);
if (p) {
r_cons_printf ("%s\n", p);
free (p);
} else {
char **e = r_sys_get_environ ();
while (e && *e) {
r_cons_printf ("%s\n", *e);
e++;
}
}
} else if (strlen (input)>3) {
char *v, *k = strdup (input+3);
if (!k) break;
v = strchr (k, '=');
if (v) {
*v++ = 0;
r_sys_setenv (k, v);
}
free (k);
}
return true;
case 'x': // exit
return cmd_quit (data, "");
case 'j':
r_config_list (core->config, NULL, 'j');
break;
case '\0':
r_config_list (core->config, NULL, 0);
break;
case 'c':
switch (input[1]) {
case 'h': // echo
if (( p = strchr (input, ' ') )) {
r_cons_strcat (p+1);
r_cons_newline ();
}
break;
case 'd':
r_cons_pal_init (NULL);
break;
case '?': {
const char *helpmsg[] = {
"Usage ec[s?] [key][[=| ]fg] [bg]","","",
"ec","","list all color keys",
"ec*","","same as above, but using r2 commands",
"ecd","","set default palette",
"ecr","","set random palette",
"ecs","","show a colorful palette",
"ecj","","show palette in JSON",
"ecc","","show palette in CSS",
"eco"," dark|white","load white color scheme template",
"ecn","","load next color theme",
"ec"," prompt red","change color of prompt",
"ec"," prompt red blue","change color and background of prompt",
""," ","",
"colors:","","rgb:000, red, green, blue, ...",
"e scr.rgbcolor","=1|0","for 256 color cube (boolean)",
"e scr.truecolor","=1|0","for 256*256*256 colors (boolean)",
"$DATADIR/radare2/cons","","~/.config/radare2/cons ./",
NULL};
r_core_cmd_help (core, helpmsg);
}
break;
case 'o': // "eco"
if (input[2] == ' ') {
bool failed = false;
char *home, path[512];
snprintf (path, sizeof (path), ".config/radare2/cons/%s", input+3);
home = r_str_home (path);
snprintf (path, sizeof (path), R2_DATDIR"/radare2/"
R2_VERSION"/cons/%s", input+3);
if (!r_core_cmd_file (core, home)) {
if (r_core_cmd_file (core, path)) {
//curtheme = r_str_dup (curtheme, path);
curtheme = r_str_dup (curtheme, input + 3);
} else {
if (r_core_cmd_file (core, input+3)) {
//.........这里部分代码省略.........
示例15: r_cons_invert
R_API void r_cons_invert(int set, int color) {
r_cons_strcat (R_CONS_INVERT (set, color));
}