Add ?E clippy echo and use it in ????

This commit is contained in:
pancake 2016-03-30 12:44:56 +02:00
parent 41a280c3c6
commit 354b9efbf2
2 changed files with 21 additions and 2 deletions

View file

@ -48,6 +48,22 @@ static char *filter_flags(RCore *core, const char *msg) {
return buf;
}
static void clippy(const char *msg) {
int msglen = strlen (msg);
char *l = strdup (r_str_pad ('-', msglen));
char *s = strdup (r_str_pad (' ', msglen));
r_cons_printf (
" .--. .-%s-.\n"
" | _| | %s |\n"
" | O O < %s |\n"
" | | | | %s |\n"
" || | / `-%s-'\n"
" |`-'|\n"
" `---'\n", l, s, msg, s, l);
free (l);
free (s);
}
static int cmd_help(void *data, const char *input) {
RCore *core = (RCore *)data;
const char *k;
@ -427,6 +443,9 @@ static int cmd_help(void *data, const char *input) {
r_cons_newline ();
}
break;
case 'E': // clippy echo
clippy (r_str_chop_ro (input+1));
break;
case 'e': // echo
{
const char *msg = r_str_chop_ro (input+1);
@ -547,7 +566,7 @@ static int cmd_help(void *data, const char *input) {
case '?': // ???
if (input[1]=='?') {
if (input[2]=='?') {
r_cons_printf ("What are you doing?\n");
clippy ("What are you doing?");
return 0;
}
if (input[2]) {

View file

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2007-2015 - pancake */
/* radare - LGPL - Copyright 2007-2016 - pancake */
#include "r_types.h"
#include "r_util.h"