-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsample.c
37 lines (30 loc) · 1.06 KB
/
sample.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* sample radare2 plugin - LGPL - Copyright 2011 [email protected]
with portions derived from radare - LGPL - Copyright 2010 pancake<@nopcode.org> */
#include <r_types.h>
#include <r_lib.h>
#include <r_cmd.h>
#include <r_core.h>
#define _GNU_SOURCE
#include <stdio.h>
/* invoked by r_cmd whenever a command is submitted with the contents of the command;
return R_TRUE if radare2 should not proceed to the next command plugin */
static int call(void *user, const char *cmd) {
RCore* core = (RCore*)user;
if(user == NULL) return R_FALSE; /* WTF? */
if (strcmp (cmd, "sample")) return R_FALSE;
printf("sample command invoked\n");
return R_TRUE;
}
struct r_cmd_plugin_t r_cmd_plugin_sample = {
/** the following is the "name" of the command in the plugin list */
.name = "sample",
/** the following is the "description" of the command in the plugin list */
.desc = "a sample command",
.call = call,
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_CMD,
.data = &r_cmd_plugin_sample
};
#endif