mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-23 14:28:07 +00:00
Add pkgname in RLibStruct for r2pm on outdated plugins ##core (#15813)
This commit is contained in:
parent
f64f2211fb
commit
31e71d340f
@ -101,6 +101,19 @@ R_API void r_core_loadlibs_init(RCore *core) {
|
||||
core->times->loadlibs_init_time = r_sys_now () - prev;
|
||||
}
|
||||
|
||||
static bool __isScriptFilename(const char *name) {
|
||||
const char *ext = r_str_lchr (name, '.');
|
||||
if (ext) {
|
||||
ext++;
|
||||
if (!strcmp (ext, "py")
|
||||
|| !strcmp (ext, "js")
|
||||
|| !strcmp (ext, "lua")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
R_API int r_core_loadlibs(RCore *core, int where, const char *path) {
|
||||
ut64 prev = r_sys_now ();
|
||||
__loadSystemPlugins (core, where, path);
|
||||
@ -115,7 +128,7 @@ R_API int r_core_loadlibs(RCore *core, int where, const char *path) {
|
||||
RListIter *iter;
|
||||
char *file;
|
||||
r_list_foreach (files, iter, file) {
|
||||
bool isScript = r_str_endswith (file, ".py") || r_str_endswith (file, ".js") || r_str_endswith (file, ".lua");
|
||||
bool isScript = __isScriptFilename (file);
|
||||
if (isScript) {
|
||||
r_core_cmdf (core, ". %s/%s", homeplugindir, file);
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ typedef struct r_cmd_descriptor_t {
|
||||
struct r_cmd_descriptor_t *sub[127];
|
||||
} RCmdDescriptor;
|
||||
|
||||
// TODO: move into r_core.h
|
||||
typedef struct r_core_plugin_t {
|
||||
const char *name;
|
||||
const char *desc;
|
||||
|
@ -59,6 +59,7 @@ typedef struct r_lib_struct_t {
|
||||
void *data; /* pointer to data handled by plugin handler */
|
||||
const char *version; /* r2 version */
|
||||
void (*free)(void *data);
|
||||
const char *pkgname; /* pkgname associated to this plugin */
|
||||
} RLibStruct;
|
||||
|
||||
typedef RLibStruct* (*RLibStructFunc) (void);
|
||||
|
@ -303,6 +303,9 @@ R_API int r_lib_open_ptr(RLib *lib, const char *file, void *handler, RLibStruct
|
||||
if (strcmp (stru->version, R2_VERSION)) {
|
||||
eprintf ("Module version mismatch %s (%s) vs (%s)\n",
|
||||
file, stru->version, R2_VERSION);
|
||||
if (stru->pkgname) {
|
||||
printf ("r2pm -ci %s\n", stru->pkgname);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user