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);