Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: editline doesn't allow ^C binding



In article <loom.20090702T093319-576%post.gmane.org@localhost>,
Dan Towner  <dant%picochip.com@localhost> wrote:
>Hi all,
>
>I am using editline in my application, compiled to run on Centos 5 using the
>distribution provided by Jess Thrysoee at thrysoee.dk and distributed as 
>version
>3.0. I want to be able to gracefully catch SIGINT, and start the command-line
>edit again, but I can't get ^C to do anything other than terminate the program.
>To try to determine the cause of the problem, I took a look at the
>examples/test.c program, but it appears that that doesn't gracefully handle ^C
>either. I notice that the program itself sets EL_SIGNAL to be true, and the
>documentation and surrounding comments seems to suggest that this will then
>enable ^C to be bound to something other than ed-tty-sigint, but if I try to
>change the binding (e.g., to ed-start-over), ^C still terminates the program.
>After I change the binding, listing the current bindings correctly shows that 
>^C
>has been bound to whatever I requested, but the action doesn't actually happen.
>Does editline only work under NetBSD, or am I doing something wrong in
>configuring editline?

EL_SIGNAL does not do what you think it does. It merely handles resetting
the state of the terminal to normal before passing control of the signal to
the regular handler.

You need to issue a setty command to unset Control-C from being the interrupt
character, otherwise the tty driver grabs it before libedit gets a chance to
see it:

        setty -d intr=^@

christos



Home | Main Index | Thread Index | Old Index