static int op_remove(ops_t *ops, void *data, const char *src, const char *dst) { if(cfg_confirm_delete(0) && !curr_stats.confirmed && (ops == NULL || !ops->bg)) { curr_stats.confirmed = prompt_msg("Permanent deletion", "Are you sure? If you're undoing a command and want to see file " "names, use :undolist! command."); if(!curr_stats.confirmed) return SKIP_UNDO_REDO_OPERATION; } return op_removesl(ops, data, src, dst); }
int confirm_deletion(int nfiles, int use_trash) { curr_stats.confirmed = 0; if(cfg_confirm_delete(use_trash)) { const char *const title = use_trash ? "Deletion" : "Permanent deletion"; char *const msg = format_str("Are you sure you want to delete %d file%s?", nfiles, (nfiles == 1) ? "" : "s"); const int proceed = prompt_msg(title, msg); free(msg); if(!proceed) { return 0; } curr_stats.confirmed = 1; } return 1; }