Add readline support to any programme

I discovered this little piece of magic today, which automatically adds in the readline library to any Unix socket. To whet your appetite, anyone who has done CompSci at Cambridge will immediately warm to this little command, which turns the SML/NJ command line into a fully functional one, with the same ability as bash to scroll back over previously entered lines and edit them. Try it out to get a taste:

# aptitude install socat
$ socat READLINE EXEC:'sml Bases.sml'

Magic! Socat is So-Cat, a socketing version of standard cat that makes a two-way link between any two sockets, which could be networking devices, files, raw neworking sockets, sockets over TCP, and most pertinently readline, which is the standard Unix utility library for managing terminal input. Here we use socat as the two-way buffer between us and sml to make the interactive session work as expected like bash.