void get_and_execute_command(const char line[], size_t line_pos, CmdInputType type) { char *const cmd = get_ext_command(line, line_pos, type); if(cmd == NULL) { save_extcmd(line, type); } else { save_extcmd(cmd, type); execute_extcmd(cmd, type); free(cmd); } }
/* Queries prompt input using external editor. */ static void extedit_prompt(const char input[], int cursor_col) { char *const ext_cmd = get_ext_command(input, cursor_col, GET_PROMPT_INPUT); if(ext_cmd != NULL) { finish_prompt_submode(ext_cmd); } else { save_prompt_history(input); status_bar_error("Error querying data from external source."); curr_stats.save_msg = 1; } free(ext_cmd); }