29 #if defined (USE_READLINE)
35 #include <readline/history.h>
43 check_history_control (
const char *
line,
int history_control)
48 if (history_control == 0)
52 if ((history_control &
HC_IGNSPACE) && *line ==
' ')
59 temp = previous_history ();
61 r = (temp == 0 || strcmp (temp->line, line));
76 hc_erasedups (
const char *line)
82 while ((temp = previous_history ()))
84 if (! strcmp (temp->line, line))
99 if (check_history_control (line, history_control))
118 return where_history ();
124 return history_length;
130 return max_input_history;
148 return unstifle_history ();
154 return history_is_stifled ();
160 return history_set_pos (n);
166 return read_history (f);
178 return read_history_range (f, b, e);
184 return write_history (f);
190 return append_history (n, f);
196 return history_truncate_file (f, n);
202 HIST_ENTRY *discard = remove_history (n);
207 free (discard->line);
226 if (history_set_pos (n))
228 h = current_history ();
242 HIST_ENTRY *h = history_get (n);
253 static char **retval = 0;
255 HIST_ENTRY **hlist = 0;
269 hlist = history_list ();
280 beg = (limit < 0 || end < limit) ? 0 : (end - limit);
282 retval =
malloc ((end - beg + 1) *
sizeof (
char **));
285 for (i = beg; i < end; i++)
287 char *line = hlist[i]->line;
288 int len = line ? strlen (line) : 0;
289 char *tmp =
malloc (len + 64);
292 sprintf (tmp,
"%5d %s", i + history_base,
295 strcpy (tmp, line ? line :
"");
309 HIST_ENTRY *discard = replace_history_entry (which, line, 0);
314 free (discard->line);
void octave_replace_history_entry(int, const char *)
void octave_stifle_history(int)
char * octave_history_get(int n)
int octave_history_is_stifled(void)
int octave_add_history(const char *, int)
int octave_history_truncate_file(const char *, int)
int octave_max_input_history(void)
int octave_append_history(int, const char *)
void octave_remove_history(int)
char * octave_history_goto_mark(int n)
int octave_history_length(void)
F77_RET_T const double const double * f
int octave_history_base(void)
int octave_read_history(const char *)
int octave_where_history(void)
char ** octave_history_list(int, int)
void octave_using_history(void)
int octave_read_history_range(const char *, int, int)
int octave_history_set_pos(int)
int octave_write_history(const char *)
void octave_clear_history(void)
int octave_unstifle_history(void)