ec_editline - Man Page

Synopsis

#include <ecoli/editline.h>

struct ec_editline * ec_editline(
    /*
     * The name of the invoking program, used when reading the editrc(5) file
     * to determine which settings to use.
     */
    const char                  *prog,
    FILE                        *f_in,   /* The input stream to use. */
    FILE                        *f_out,  /* The output stream to use. */
    FILE                        *f_err,  /* The error stream to use. */
    /*
     * Flags to customize initialization. See ec_editline_init_flags.
     */
    enum ec_editline_init_flags  flags
);

Description

Create an editline instance with default behavior.

It allocates and initializes an ec_editline structure, calls editline's el_init(), and does the editline configuration according to given flags.

After that, the user must call ec_editline_set_node() to attach the grammar to the editline.

Structures

enum ec_editline_init_flags {


    /*
     * Ask the terminal to not send signals (STOP, SUSPEND, ...). The
     * ctrl-c, ctrl-z will be interpreted as standard characters. An action can
     * be associated with these characters with:
static int cb(EditLine
     * *editline, int c) {
{
 see editline documentation for details
}

if (el_set(el,
     * EL_ADDFN, "ed-foobar", "Help string about foobar", cb))
 handle_error;
if
     * (el_set(el, EL_BIND, "^C", "ed-break", NULL))
 handle_error;

The default
    * behavior (without this flag) is to let the signal pass: ctrl-c will stop program
    * and ctrl-z will suspend it.
    */
     EC_EDITLINE_DISABLE_SIGNALS;    /*
    * Disable history. The default behavior creates a history with
    * EC_EDITLINE_HISTORY_SIZE entries. To change this value, use ec_editline_set_history().
    */
     EC_EDITLINE_DISABLE_HISTORY;    /*
    * Disable completion. The default behavior is to complete when ? or
    * <tab> is hit. You can register your own callback with:

if (el_set(el,
     * EL_ADDFN, "ed-complete", "Complete buffer", callback))
 handle_error;
if
     * (el_set(el, EL_BIND, "^I", "ed-complete", NULL))
 handle_error;

The default
    * used callback is ec_editline_complete().
    */
     EC_EDITLINE_DISABLE_COMPLETION;    /*
    * Use editline own signal handler for the following signals when reading
    * command input: SIGCONT, SIGHUP, SIGINT, SIGQUIT, SIGSTOP, SIGTERM, SIGTSTP, and
    * SIGWINCH. Otherwise, the current signal handlers will be used.
    */
     EC_EDITLINE_DEFAULT_SIGHANDLER; };

Return Value

The allocated ec_editline structure, or NULL on error.

See Also

ec_editline_get_el(3), ec_editline_set_prompt(3), ec_editline_complete(3), ec_editline_set_prompt_esc(3), ec_editline_parse(3), ec_editline_free(3), ec_editline_term_size(3), ec_editline_gets(3), ec_editline_interact(3), ec_editline_set_node(3), ec_editline_set_history(3), ec_editline_get_node(3), ec_editline_curline(3)

Referenced By

ec_editline_complete(3), ec_editline_curline(3), ec_editline_free(3), ec_editline_get_el(3), ec_editline_get_node(3), ec_editline_gets(3), ec_editline_interact(3), ec_editline_parse(3), ec_editline_set_history(3), ec_editline_set_node(3), ec_editline_set_prompt(3), ec_editline_set_prompt_esc(3), ec_editline_term_size(3).

2026-05-21 Libecoli Programmer's Manual