Query the user before running the .r2 companion file

This commit is contained in:
pancake 2017-12-02 21:43:15 +01:00
parent 0d95b7f469
commit e811e2647b

View File

@ -1223,10 +1223,11 @@ int main(int argc, char **argv, char **envp) {
char f[128];
snprintf (f, sizeof (f), "%s.r2", pfile);
if (r_file_exists (f)) {
if (!quiet) {
eprintf ("NOTE: Loading '%s' script.\n", f);
// TODO: should 'q' unset the interactive bit?
bool isInteractive = r_config_get_i (r.config, "scr.interactive");
if (isInteractive && r_cons_yesno ('n', "Do you want to run the '%s' script? (y/N) ", f)) {
r_core_cmd_file (&r, f);
}
r_core_cmd_file (&r, f);
}
}
}