]> git.pond.sub.org Git - empserver/commit
Fix client's command abort feature
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 2 Apr 2010 16:22:52 +0000 (18:22 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 2 Apr 2010 16:22:52 +0000 (18:22 +0200)
commit3cceb59bb1489de7fa1aa11a1f0a35a5490204f2
treef6b8b05cd02c0c0905e3e1430b8a4947f75041bd
parent6c639f1481d72c4e50c9582a0362573fe8ff7224
Fix client's command abort feature

The server aborts the current command when it receives a special line
of input for a prompt.  To make the client send it, you type the INTR
character (normally ^C).  This sends the client the SIGINT signal.
Unfortunately, it never quite worked.

Because we use a special line of input to signal interrupt, the client
can do that only after a complete line of input.

What if SIGINT arrives in the middle of a line?  We split the line in
two then and there, by inserting a newline.  Nasty, but it's simple,
and happens rarely.

However, we inserted the newline always, even after a complete line.
In that case, we inserted an empty line of input before the interrupt.
If you hit INTR at a server prompt, the server received an empty line
of input for that prompt, and the interrupt only for the *next*
prompt.  Which may well be too late to abort the command you wanted to
abort.

Fix by inserting the newline only when needed.
src/client/play.c