MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / rl_initialize

Function rl_initialize

extern/editline/src/readline.c:291–414  ·  view source on GitHub ↗

* initialize rl compat stuff */

Source from the content-addressed store, hash-verified

289 * initialize rl compat stuff
290 */
291int
292rl_initialize(void)
293{
294 HistEvent ev;
295 int editmode = 1;
296 struct termios t;
297
298 if (e != NULL)
299 el_end(e);
300 if (h != NULL)
301 history_end(h);
302
303 if (!rl_instream)
304 rl_instream = stdin;
305 if (!rl_outstream)
306 rl_outstream = stdout;
307
308 /*
309 * See if we don't really want to run the editor
310 */
311 if (tcgetattr(fileno(rl_instream), &t) != -1 && (t.c_lflag & ECHO) == 0)
312 editmode = 0;
313
314 e = el_init(rl_readline_name, rl_instream, rl_outstream, stderr);
315
316 if (!editmode)
317 el_set(e, EL_EDITMODE, 0);
318
319 h = history_init();
320 if (!e || !h)
321 return -1;
322
323 history(h, &ev, H_SETSIZE, INT_MAX); /* unlimited */
324 history_length = 0;
325 max_input_history = INT_MAX;
326 el_set(e, EL_HIST, history, h);
327
328 /* Setup resize function */
329 el_set(e, EL_RESIZE, _resize_fun, &rl_line_buffer);
330
331 /* setup getc function if valid */
332 if (rl_getc_function)
333 el_set(e, EL_GETCFN, _getc_function);
334
335 /* for proper prompt printing in readline() */
336 if (rl_set_prompt("") == -1) {
337 history_end(h);
338 el_end(e);
339 return -1;
340 }
341 el_set(e, EL_PROMPT, _get_prompt, RL_PROMPT_START_IGNORE);
342 el_set(e, EL_SIGNAL, rl_catch_signals);
343
344 /* set default mode to "emacs"-style and read setting afterwards */
345 /* so this can be overridden */
346 el_set(e, EL_EDITOR, "emacs");
347 if (rl_terminal_name != NULL)
348 el_set(e, EL_TERMINAL, rl_terminal_name);

Callers 15

readlineFunction · 0.85
using_historyFunction · 0.85
history_expandFunction · 0.85
stifle_historyFunction · 0.85
read_historyFunction · 0.85
write_historyFunction · 0.85
history_getFunction · 0.85
add_historyFunction · 0.85
remove_historyFunction · 0.85
replace_history_entryFunction · 0.85
clear_historyFunction · 0.85
rl_completeFunction · 0.85

Calls 10

el_endFunction · 0.85
filenoFunction · 0.85
el_initFunction · 0.85
el_setFunction · 0.85
historyClass · 0.85
rl_set_promptFunction · 0.85
el_getFunction · 0.85
el_sourceFunction · 0.85
_resize_funFunction · 0.85
_rl_update_posFunction · 0.85

Tested by

no test coverage detected