On Sat Apr 24 06:16:22 2010, ghewson wrote:
Show quoted text> In many interactive applications, I'm used to entering ^D to mark the
> end of my input at the terminal. This is the default POSIX EOF
> character, and is presented to the application as a zero-length string
> (as distinct from a string containing \n).
>
> I would like to be able to do this in CLIF applications. I expect I
> could override is_quit_signal(), but should CLIF recognise EOF by default?
Making ^D act as a "quit signal" is a good idea. Overriding
is_quit_signal() won't work, since CTRL-D is not a character (it's a
condition that the terminal detects based on entry of the EOT character).
I've added this with a one-line patch to read_cmd(), which I'm planning
to release in v0.05. The effect will be that, by default, CTRL-D will
exit the app in the same way as the other default quit signals.
The only point to note about the way I've implemented it is that if you
set your app to have no quit signals (by overriding quit_signals to
return a value that translates to an empty array in list context),
CTRL-D will not exit. I think this is the desired behavior -- if you've
asked for no quit signals, then you won't get any (of course, CTRL-C
[SIGINT] still works).