mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-01 00:51:19 +00:00
Added 'mkdir' command in r2 shell
Add 'mkdir' to radare_argv
This commit is contained in:
parent
76497dee8f
commit
1f72e3fd04
@ -324,6 +324,11 @@ static int cmd_ls(void *data, const char *input) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_mkdir(void *data, const char *input) {
|
||||
r_core_syscmd_mkdir (input);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_stdin(void *data, const char *input) {
|
||||
RCore *core = (RCore *)data;
|
||||
if (input[0]=='?') {
|
||||
@ -1938,6 +1943,7 @@ R_API void r_core_cmd_init(RCore *core) {
|
||||
r_cmd_add (core->rcmd, "/", "search kw, pattern aes", &cmd_search);
|
||||
r_cmd_add (core->rcmd, "-", "open cfg.editor and run script", &cmd_stdin);
|
||||
r_cmd_add (core->rcmd, "ls", "list files and directories", &cmd_ls);
|
||||
r_cmd_add (core->rcmd, "mkdir", "make directory", &cmd_mkdir);
|
||||
r_cmd_add (core->rcmd, "(", "macro", &cmd_macro);
|
||||
r_cmd_add (core->rcmd, "quit", "exit program session", &cmd_quit);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ R_API RCore *r_core_new() {
|
||||
/*-----------------------------------*/
|
||||
#define CMDS (sizeof (radare_argv)/sizeof(const char*))
|
||||
static const char *radare_argv[] = {
|
||||
"?", "?v", "whereis", "which", "ls", "pwd", "cat", "less",
|
||||
"?", "?v", "whereis", "which", "ls", "mkdir", "pwd", "cat", "less",
|
||||
"dH", "ds", "dso", "dsl", "dc", "dd", "dm", "db ", "db-",
|
||||
"dp", "dr", "dcu", "dmd", "dmp", "dml",
|
||||
"ec","ecs",
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* radare - LGPL - Copyright 2013-2015 - pancake */
|
||||
|
||||
#include <r_core.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define FMT_RAW 1
|
||||
#define FMT_JSON 2
|
||||
@ -141,3 +142,16 @@ R_API void r_core_syscmd_cat(const char *file) {
|
||||
free (filename);
|
||||
} else eprintf ("Usage: cat [file]\n");
|
||||
}
|
||||
|
||||
R_API void r_core_syscmd_mkdir(const char *dir) {
|
||||
const char *p = strchr (dir, ' ');
|
||||
if (p) {
|
||||
char *dirname = strdup (p+1);
|
||||
dirname = r_str_chop (dirname);
|
||||
if (!r_sys_mkdir (dirname)) {
|
||||
if (r_sys_mkdir_failed ())
|
||||
eprintf ("Cannot create \"%s\"\n", dirname);
|
||||
}
|
||||
free (dirname);
|
||||
} else eprintf ("Usage: mkdir [directory]\n");
|
||||
}
|
||||
|
@ -467,6 +467,7 @@ R_API RCoreAnalStats* r_core_anal_get_stats (RCore *a, ut64 from, ut64 to, ut64
|
||||
R_API void r_core_anal_stats_free (RCoreAnalStats *s);
|
||||
R_API void r_core_syscmd_ls(const char *input);
|
||||
R_API void r_core_syscmd_cat(const char *file);
|
||||
R_API void r_core_syscmd_mkdir(const char *dir);
|
||||
|
||||
/* tasks */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user