Return to README CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / readline / examples / rlfe |
1.1 ! misho 1: rlfe (ReadLine Front-End) is a "universal wrapper" around readline. ! 2: You specify an interactive program to run (typically a shell), and ! 3: readline is used to edit input lines. ! 4: ! 5: There are other such front-ends; what distinguishes this one is that ! 6: it monitors the state of the inferior pty, and if the inferior program ! 7: switches its terminal to raw mode, then rlfe passes your characters ! 8: through directly. This basically means you can run your entire ! 9: session (including bash and terminal-mode emacs) under rlfe. ! 10: ! 11: FEATURES ! 12: ! 13: * Can use all readline commands (and history) in commands that ! 14: read input lines in "canonical mode" - even 'cat'! ! 15: ! 16: * Automatically switches between "readline-editing mode" and "raw mode" ! 17: depending on the terminal mode. If the inferior program invokes ! 18: readline itself, it will do its own line editing. (The inferior ! 19: readline will not know about rlfe, and it will have its own history.) ! 20: You can even run programs like 'emavs -nw' and 'vi' under rlfe. ! 21: The goal is you could leave rlfe always on without even knowing ! 22: about it. (We're not quite there, but it works tolerably well.) ! 23: ! 24: * The input line (after any prompt) is changed to bold-face. ! 25: ! 26: INSTALL ! 27: ! 28: The usual: ./configure && make && make install ! 29: ! 30: Note so far rlfe has only been tested on GNU Linux (Fedora Core 2) ! 31: and Mac OS X (10.3). ! 32: ! 33: This assumes readline header files and libraries are in the default ! 34: places. If not, you can create a link named readline pointing to the ! 35: readline sources. To link with libreadline.a and libhistory.a ! 36: you can copy or link them, or add LDFLAGS='-/path/to/readline' to ! 37: the make command-line. ! 38: ! 39: USAGE ! 40: ! 41: Just run it. That by default runs bash. You can run some other ! 42: command by giving it as command-line arguments. ! 43: ! 44: There are a few tweaks: -h allows you to name the history file, ! 45: and -s allows you to specify its size. It default to "emacs" mode, ! 46: but if the the environment variable EDITOR is set to "vi" that ! 47: mode is chosen. ! 48: ! 49: ISSUES ! 50: ! 51: * The mode switching depends on the terminal mode set by the inferior ! 52: program. Thus ssh/telnet/screen-type programs will typically be in ! 53: raw mode, so rlfe won't be much use, even if remote programs run in ! 54: canonical mode. The work-around is to run rlfe on the remote end. ! 55: ! 56: * Echo supression and prompt recognition are somewhat fragile. ! 57: (A protocol so that the o/s tty code can reliably communicate its ! 58: state to rlfe could solve this problem, and the previous one.) ! 59: ! 60: * See the intro to rlfe.c for more notes. ! 61: ! 62: * Assumes a VT100-compatible terminal, though that could be generalized ! 63: if anybody cares. ! 64: ! 65: * Requires ncurses. ! 66: ! 67: * It would be useful to integrate rlfe's logic in a terminal emulator. ! 68: That would make it easier to reposition the edit position with a mouse, ! 69: integrate cut-and-paste with the system clipboard, and more robustly ! 70: handle escape sequence and multi-byte characters more robustly. ! 71: ! 72: AUTHOR ! 73: ! 74: Per Bothner <per@bothner.com> ! 75: ! 76: LICENSE ! 77: ! 78: GPL.