mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-09 03:43:28 +00:00
Implement Pc command to show contents of a project script
This commit is contained in:
parent
7cb4334712
commit
99d99aca14
@ -119,7 +119,7 @@ static int main_help(int line) {
|
||||
" -n, -nn do not load RBin info (-nn only load bin structures)\n"
|
||||
" -N do not load user settings and scripts\n"
|
||||
" -q quiet mode (no prompt) and quit after -i\n"
|
||||
" -p [prj] set project file\n"
|
||||
" -p [prj] use project, list if no arg, load if no file\n"
|
||||
" -P [file] apply rapatch file and quit\n"
|
||||
" -s [addr] initial seek\n"
|
||||
" -S start r2 in sandbox mode\n"
|
||||
|
@ -7,6 +7,13 @@ static int cmd_project(void *data, const char *input) {
|
||||
if (*arg==' ') arg++;
|
||||
file = input[1]?arg:str;
|
||||
switch (input[0]) {
|
||||
case 'c':
|
||||
if (!input[1]) {
|
||||
eprintf ("TODO: Show project saving script to console\n");
|
||||
} else if (input[1]==' ') {
|
||||
r_core_project_cat (core, input+2);
|
||||
} else eprintf ("Usage: Pc [prjname]\n");
|
||||
break;
|
||||
case 'o':
|
||||
// if (r_file_is_regular (file))
|
||||
if (input[1]) {
|
||||
@ -39,6 +46,8 @@ static int cmd_project(void *data, const char *input) {
|
||||
"Ps", " [file]", "save project",
|
||||
"Pd", " [file]", "delete project",
|
||||
"Pi", " [file]", "show project information",
|
||||
"Pc", " [file]", "show project script to console",
|
||||
"Pc", "", "show what will be saved in the project script",
|
||||
"Pl", "", "list all projects",
|
||||
"NOTE:", "", "See 'e file.project'",
|
||||
"NOTE:", "", "project files are stored in ~/.config/radare2/projects",
|
||||
|
@ -63,6 +63,19 @@ static int r_core_is_project(RCore *core, const char *name) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
R_API int r_core_project_cat(RCore *core, const char *name) {
|
||||
char *path = r_core_project_file (core, name);
|
||||
if (path) {
|
||||
char *data = r_file_slurp (path, NULL);
|
||||
if (data) {
|
||||
r_cons_printf ("%s\n", data);
|
||||
free (data);
|
||||
}
|
||||
}
|
||||
free (path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
R_API int r_core_project_list(RCore *core, int mode) {
|
||||
RListIter *iter;
|
||||
RList *list;
|
||||
|
@ -349,6 +349,7 @@ R_API int r_core_gdiff(RCore *core1, RCore *core2, int anal_all);
|
||||
R_API int r_core_gdiff_fcn(RCore *c, ut64 addr, ut64 addr2);
|
||||
|
||||
R_API int r_core_project_open(RCore *core, const char *file);
|
||||
R_API int r_core_project_cat(RCore *core, const char *name);
|
||||
R_API int r_core_project_delete(RCore *core, const char *prjfile);
|
||||
R_API int r_core_project_list(RCore *core, int mode);
|
||||
R_API int r_core_project_save(RCore *core, const char *file);
|
||||
|
Loading…
Reference in New Issue
Block a user