GNU Info

Info Node: (readline.info)Alternate Interface

(readline.info)Alternate Interface


Next: A Readline Example Prev: Miscellaneous Functions Up: Readline Convenience Functions
Enter node , (file) or (file)node

Alternate Interface
-------------------

   An alternate interface is available to plain `readline()'.  Some
applications need to interleave keyboard I/O with file, device, or
window system I/O, typically by using a main loop to `select()' on
various file descriptors.  To accomodate this need, readline can also
be invoked as a `callback' function from an event loop.  There are
functions available to make this easy.

 - Function: void rl_callback_handler_install (const char *prompt,
          rl_vcpfunc_t *lhandler)
     Set up the terminal for readline I/O and display the initial
     expanded value of PROMPT.  Save the value of LHANDLER to use as a
     function to call when a complete line of input has been entered.
     The function takes the text of the line as an argument.

 - Function: void rl_callback_read_char (void)
     Whenever an application determines that keyboard input is
     available, it should call `rl_callback_read_char()', which will
     read the next character from the current input source.  If that
     character completes the line, `rl_callback_read_char' will invoke
     the LHANDLER function saved by `rl_callback_handler_install' to
     process the line.  `EOF' is  indicated by calling LHANDLER with a
     `NULL' line.

 - Function: void rl_callback_handler_remove (void)
     Restore the terminal to its initial state and remove the line
     handler.  This may be called from within a callback as well as
     independently.


automatically generated by info2www version 1.2.2.9