This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: readline messing with SA_RESTART for SIGWINCH
- To: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>
- Subject: Re: readline messing with SA_RESTART for SIGWINCH
- From: "Dale P. Smith" <dpsm at en dot com>
- Date: Thu, 15 Jun 2000 16:42:38 -0400
- CC: bug-guile <bug-guile at gnu dot org>, guile <guile at sourceware dot cygnus dot com>,djurfeldt at nada dot kth dot se
- Organization: Altus Technologies Corporation.
- References: <39492994.33100449@en.com> <xy7em5ywv6q.fsf@mdj.nada.kth.se>
Mikael Djurfeldt wrote:
> If anyone provides the code for rl_pre_input_hook and a test for
> configure (code is sufficient), then I'll include it in the 1.4
> release.
>
> However, we're *really* close to release now, so I'd better have it
> tonight to be able to include it.
Here is a patch for the rl_pre_input_hook. Pick a better name than "fix_winch"!
I'll try to come up with some test code.
-Dale
Index: readline.c
===================================================================
RCS file: /cvs/guile/guile/guile-core/guile-readline/readline.c,v
retrieving revision 1.25
diff -c -r1.25 readline.c
*** readline.c 2000/06/14 15:03:01 1.25
--- readline.c 2000/06/15 20:44:02
***************
*** 36,41 ****
--- 36,42 ----
#include <readline/readline.h>
#include <readline/history.h>
#include <sys/time.h>
+ #include <signal.h>
#include "libguile/validate.h"
#include "guile-readline/readline.h"
***************
*** 504,509 ****
--- 505,528 ----
#endif /* HAVE_RL_GETC_FUNCTION */
+
+ /* Readline disables SA_RESTART on SIGWINCH for some reason.
+ * This turns it back on. */
+ static int
+ fix_winch(void)
+ {
+ #ifdef HAVE_SIGINTERRUPT
+ siginterrupt (SIGWINCH, 0);
+ #elif defined(SA_RESTART)
+ struct sigaction action;
+
+ sigaction (SIGWINCH, NULL, &action);
+ action.sa_flags |= SA_RESTART;
+ sigaction (SIGWINCH, &action, NULL);
+ #endif
+ return 0;
+ }
+
void
scm_init_readline ()
{
***************
*** 516,521 ****
--- 535,541 ----
rl_completion_entry_function = (Function*) completion_function;
rl_basic_word_break_characters = "\t\n\"'`;()";
rl_readline_name = "Guile";
+ rl_pre_input_hook = fix_winch;
#ifdef USE_THREADS
scm_mutex_init (&reentry_barrier_mutex);
--
Dale P. Smith
Altus Technologies Corp.
dsmith@altustech.com
400-746-9000 x309