diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c index 448203b543..17a0b40888 100644 --- a/libr/core/cconfig.c +++ b/libr/core/cconfig.c @@ -4364,6 +4364,7 @@ R_API int r_core_config_init(RCore *core) { SETPREF ("scr.prompt.tabhelp", "true", "show command help when pressing the TAB key"); SETCB ("scr.prompt.mode", "false", &cb_scr_prompt_mode, "set prompt color based on vi mode"); SETBPREF ("scr.prompt.file", "false", "show user prompt file (used by r2 -q)"); + SETBPREF ("scr.prompt.prj", "false", "show currently used project in prompt"); SETBPREF ("scr.prompt.flag", "false", "show flag name in the prompt"); SETBPREF ("scr.prompt.sect", "false", "show section name in the prompt"); SETBPREF ("scr.tts", "false", "use tts if available by a command (see ic)"); diff --git a/libr/core/cmd_project.inc.c b/libr/core/cmd_project.inc.c index 07664acbf9..f24f0eeca5 100644 --- a/libr/core/cmd_project.inc.c +++ b/libr/core/cmd_project.inc.c @@ -84,7 +84,7 @@ static void r_core_project_zip_export(RCore *core, const char *prjname, const ch char *zipfile = r_str_newf ("%s/%s.zrp", cwd, prj_name); r_file_rm (zipfile); // XXX use the ZIP api instead! - r_sys_cmdf ("zip -r %s %s", outzip? outzip: zipfile, prj_name); + r_sys_cmdf ("zip -r %s/%s %s", cwd, outzip? outzip: zipfile, prj_name); free (zipfile); } else { R_LOG_WARN ("Command injection attempt?"); @@ -102,10 +102,10 @@ static void cmd_Pz(RCore *core, const char *cmd) { arg++; } switch (*cmd) { - case 'i': + case 'i': // "Pzi" r_core_project_zip_import (core, arg); break; - case 'e': + case 'e': // "Pze" case ' ': r_core_project_zip_export (core, NULL, arg); break; @@ -194,7 +194,7 @@ static int cmd_project(void *data, const char *input) { } break; case 'z': // "Pz" - cmd_Pz (core, input + 1); + cmd_Pz (core, r_str_trim_head_ro (input + 1)); break; case '+': // "P+" // xxx diff --git a/libr/core/core.c b/libr/core/core.c index f112f04596..131e8fad1a 100644 --- a/libr/core/core.c +++ b/libr/core/core.c @@ -3574,10 +3574,14 @@ static void set_prompt(RCore *r) { r_core_cmd (r, cmdprompt, 0); } - if (r_config_get_b (r->config, "scr.prompt.file")) { + if (r_config_get_b (r->config, "scr.prompt.prj")) { + free (filename); + const char *pn = r_config_get (r->config, "prj.name"); + filename = r_str_newf ("<%s>", pn); + } else if (r_config_get_b (r->config, "scr.prompt.file")) { free (filename); const char *fn = r->io->desc ? r_file_basename (r->io->desc->name) : ""; - filename = r_str_newf ("\"%s\"", fn); + filename = r_str_newf ("<%s>", fn); } if (r->cmdremote) { char *s = r_core_cmd_str (r, "s");