Many browserlike and editorlike programs under Unix obey this
pattern, even when the named resource they edit is something other
than a text file. Consider
gdb(1),
the GNU symbolic debugger, as an example.
Programs obeying the ed interface
design pattern are not quite so scriptable as would be the simpler
interface types resembling filters. You can feed them commands on
standard input, but it is trickier to generate sequences of commands
(and interpret any output they might ship back) than it is to just set
environment variables and command-line options. If the action of the
commands is not so predictable that they can be run blind (e.g., with a
here-document as input and ignoring output), driving
ed-like programs requires a protocol, and a
corresponding state machine in the calling process. This raises the
problems we noted in Chapter7 during the discussion of slave process
control.
Nevertheless, this is the simplest and most scriptable
pattern that supports fully interactive programs. Accordingly, it
is still quite useful as a component of the “separated engine and
interface” pattern we'll describe below.
[an error occurred while processing this directive]