Date: Wed, 8 Jun 1994 20:29:54 +0200
From: Anders Holst  <aho@sans.kth.se>
Message-Id: <199406081829.AA16250@thalamus.sans.kth.se>
To: gwm-talk@mirsa.inria.fr
Subject: gwmchat - an interactive shell to gwm

This is my contribution to the discussion about easier interaction
with gwm. It is a small program that is compiled separately from gwm.
When started it forks off a gwm-process, and then feeds text from
stdin to gwm. (It actually starts a third process also, that waits for
any of the other two to die, and which catches signals).

I saw (after already having written it) that Sven Wischnowsky
(oberon@cs.tu-berlin.de) actually had written a patch to gwm with much
the same effect (ie. making it read commands from stdin). That is
of course the right solution. However my program can be useful for
those which have no permission, or time, to change the version
installed on their machine.

Just compile gwmchat with one of the two commands below, and start it
with the same flags as you would have started gwm (eg. "gwmchat -f
mwm"). From your .xinitrc or .xsession or wherever gwm is started now,
you can say something like "xterm -e gwmchat -f mwm;".
NOTE: I have only tried it out on DEC-stations (with Ultrix), and on
Sun4:s. I have no idea if it works on other machines ! 
Also, it assumes that gwm is in your path.

There is one small problem though - I tried to make it use readline,
but I can't get it to work properly. Readline keeps mangling up the
prompt when walking around in the history list, or editing the
command. This is because the prompt is not written out through
readline, but through gwm, to make it sync with the result. Thus
readline knows of no prompt, and sometimes redraws the whole line. I
can't seem to get around this. 

Therefore there are two different ways to compile the program. Use:

  gcc -o gwmchat gwmchat.c -lreadline -liberty -ltermcap -lX11

if you want to try the readline interface. If you don't have readline,
or it behaves too strangely at your place, try this instead:

  gcc -o gwmchat gwmchat.c -DNORL -lX11

This will however give no commandline editing whatsoever, not even
going backwards or forwards with the arrows. So a recommendation, to
make it acceptable, is that gwmchat is started within an emacs
shell, and thus can rely on emacs editing, completion, and history
commands.

I'm sure you can find various strange behaviors from it. (For example I
sometimes get a strange message about "swap error" when gwm exits, and
I can't figure out what is wrong.) However I find it very useful
already now. 

Enough talk. Here follows the code. 

  Anders Holst  (aho@sans.kth.se)

