[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interrupt handling in mail (was: Re: Inconsistency in attribute.c)
From: |
Alain Magloire |
Subject: |
Re: Interrupt handling in mail (was: Re: Inconsistency in attribute.c) |
Date: |
Tue, 3 Jul 2001 10:27:30 -0400 (EDT) |
Bonjour,
> > Which seems to indicate readline-3.x, I do not think, in earlier then
> > 4.x the bits to handle user signal handlers were in, libreadline
> > would just take over. Unless you rl_clear_signals() and do in
>
> I have downgraded readline to version 2.0 (it is dated Aug-4-1994) :^)
> The code for interrupt handling is almost unchanged since this
> version, so it is also able to handle interrupts properly. The only
> problem with it is that readline(NULL) crashes miserably, as it is
> trying to do strlen(rl_prompt) without checking for NULL value.
> Actually, I am not sure whether we should go into the trouble of
> supporting it... What is your opinion?
I agree, it is not worth the trouble.
> The versions up from 2.1 seem to work quite well. What kind of
> problems are you experiencing on your box?
# ./mail
can't open `/usr/local/mailutils/etc/mail.rc': No such file or directory
mail (mailutils) 0.0.9, Copyright (C) 2001 Free Software Foundation, Inc.
mail comes with ABSOLUTELY NO WARRANTY; for details type
'warranty'. This is free software, and you are welcome to
redistribute it under certain conditions; type 'copying'
for details.
>O 1 Alain Magloire Sun Nov 14 03:00 56/1228 hello
O 2 Alexandre Oliva Sun Jul 6 22:46 73/3481 Re: grep-2.4.2 -v x -f /d
...
? f *
...
^C <---- hit ctrl-C to stop the flow of headers
#
In theory(I maybe wrong) but hitting ctrl-c i.e. raising SIGINT
will drop me back to the mainloop, not out of the program.
I do not think that the old mailx do this but in theory(again 8-)
we should also be able to break out any command, let say:
# MAIL=pop://address@hidden ./mail
can't open `/usr/local/mailutils/etc/mail.rc': No such file or directory
mail (mailutils) 0.0.9, Copyright (C) 2001 Free Software Foundation, Inc.
mail comes with ABSOLUTELY NO WARRANTY; for details type
'warranty'. This is free software, and you are welcome to
redistribute it under certain conditions; type 'copying'
for details.
Pop Passwd:
>O 1 Alain Magloire Sun Jul 3 10:33 25/1258 hello
O 2 Alexandre Oliva Sun Jul 3 10:33 58/3495 Re: grep-2.4.2 -v x -f /d
O 3 Bob Proulx Sun Jul 3 10:33 40/6402 grep-2.4.2 -v x -f /dev/n
O 4 Hubert Feyrer Sun Jul 3 10:33 42/2443 Bug Report: grep -v -A1 d
O 5 Paul Eggert Sun Jul 3 10:33 39/5210 Re: grep-2.4.2 -v x -f /d
O 6 Paul Eggert Sun Jul 3 10:33 41/2154 Re: Bug Report: grep -v -
...
? p 1-4
.....
^C <------ Raising SIGINT
#
The same goes for sending mail
#./mail alain
can't open `/usr/local/mailutils/etc/mail.rc': No such file or directory
mail (mailutils) 0.0.9, Copyright (C) 2001 Free Software Foundation, Inc.
mail comes with ABSOLUTELY NO WARRANTY; for details type
'warranty'. This is free software, and you are welcome to
redistribute it under certain conditions; type 'copying'
for details.
Cc:
Subject: le petit prince
^C
#
If you compare to /bin/mail
# /bin/mail alain
Subject: le petit prince
(Interrupt -- one more to kill letter)
> By the way, the only reliable method to discover the version of the
> library being used seems to be linking it against the program:
>
> #include <readline.h>
> int
> main()
> {
> printf("%s\n", rl_library_version);
> }
>
> If it compiles and runs, then it outputs the version. If it does not then
> it is 2.0 :^).
# cat l.c
#include <stdio.h>
#include <readline/readline.h>
int
main()
{
printf("%s\n", rl_library_version);
}
# gcc -o l l.c
/tmp/ccacKwzY.o: In function `main':
/tmp/ccacKwzY.o(.text+0xa): undefined reference to `rl_library_version'
collect2: ld returned 1 exit status
hum ... not good 8-).
>
> It seems mail_print now handles interrupts properly, it simply calls
> ml_got_interrupt() in its read-and-print loop. Use of longjmp would
> raise lots of problems as it can occur e.g. after malloc'ing some
> memory, in which case this chunk of memory would never be freed.
I will upgrade to readline-4.1. Maybe all those things I'm
seeing is due to readline-3.x that I'm using by default.
If that is the case we can use your code snippet above to make
readline 3.x and above a prerequisite and disable readline for
anything older.
BTW, did you try with readline disable?
--
alain