EC_EDITLINE_INTERACT(3)

NAME
ec_editline_interact - Interact with the user until exit.

SYNOPSIS
#include <ecoli/editline.h>

int ec_editline_interact(
    struct ec_editline          *editline,       /* The pointer to the ec_editline structure. */
    /*
     * Optional function pointer executed before each loop iteration to check
     * if loop should be exited (when the function return true).
     */
    ec_editline_check_exit_cb_t  check_exit_cb,
    void                        *opaque          /* User pointer, passed as-is to check_exit_cb(). */
);

DESCRIPTION

Run the command line, parsing and completing commands on demand. When a command is parsed successfully, invoke the callback attached to the grammar node as a EC_INTERACT_CB_ATTR attribute. The callback type must be ec_interact_command_cb_t.

On EOF, or if check_exit() function returns true, exit from the interactive loop.

RETURN VALUE

0 if interactive loop exited gracefully, or -1 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_set_node(3), ec_editline_set_history(3), ec_editline(3), ec_editline_get_node(3), ec_editline_curline(3)

COPYRIGHT

Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.