0. Contents

0. Contents
1. Introduction
2. Usage
3. Implementation
4. Bugs
5. Copying


1. Introduction

As there are still some CLI programs that do not provide a clean readline
interface, it seemed reasonable to write a frontend wrapper to feed those
braindead programs. The inspiration was the SQL interface from a major DB
vendor, bt it should work with any kind of program. There are some
weaknesses and bugs though, see below ...


2. Usage

readwrap $Revision ...$ (c) 2005 aoe <alexander@oelzant.priv.at>

./readwrap [options] program [progargs]
-d              debug
-e              buffer program standard error
-f              buffer program standard output
-h|-?           this help
-p prompt       set prompt
-u              set usleep time for buffer kludges (default 1000)

-e and -f options open pipes for standard output and error, however, this
can lead to ouptput only being delivered after the next input if it does
not arrive within DEFAULT_USLEEP microseconds.

The propmpt is set to the program name by default, since most programs
don't output a prompt if called from a pipe.

Examples:
$ readwrap -p asd cat
$ readwrap -- mysql -u username -p dbname
(mysql has a few issues, though - eg password input)


3. Implementation

pipes, usleep, fork, exec. non-blocking read (not all that portable yet ...)


4. Bugs

Does not show the default prompt since programs think they are not running
interactively (readwrap should probably allocate a tty ...)

In non-buffered mode: output usually overwrites the prompt

In buffered mode: output often is not complete, so user has to press enter
(thus giving the program an unwanted input line)

TODO:

write history (per program/prompt)


vim: textwidth=75
$Revision: 1.1 $

