static void wrapper_for_write_history() { #if 1 /* Alternative code, saves one disk access */ if (history_is_stifled()) unstifle_history(); if (gnuplot_history_size >= 0) stifle_history (gnuplot_history_size); /* returns 0 on success */ if (write_history(expanded_history_filename)) fprintf (stderr, "Warning: Could not write history file!!!\n"); unstifle_history(); #else /* if writing was successful, truncate history * to gnuplot_history_size lines */ if (write_history(expanded_history_filename)) { if (gnuplot_history_size >= 0) history_truncate_file(expanded_history_filename, gnuplot_history_size); } #endif }
static void wrapper_for_write_history() { if (!expanded_history_filename) return; if (history_is_stifled()) unstifle_history(); if (gnuplot_history_size >= 0) stifle_history (gnuplot_history_size); /* returns 0 on success */ if (write_history(expanded_history_filename)) fprintf (stderr, "Warning: Could not write history file!!!\n"); unstifle_history(); }
//------------------------------------------------------------------------------ void load_history() { char buffer[512]; get_history_file_name(buffer, sizeof(buffer)); // Clear existing history. stifle_history(0); unstifle_history(); g_new_history_count = 0; // Read from disk. read_history(buffer); using_history(); }