w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 638a2df0d44a76a4c19d21ab32f92924db1a7a40
parent fee6beb502b6093d7dc7e8ba52811c4b4fe26a8d
Author: ukai <ukai>
Date:   Thu, 17 Jan 2002 15:05:43 +0000

[w3m-dev 02870] don't kill migemo by SIGINT
* main.c (w3m_exit): init_migemo() to kill migemo
* search.c: #include <unistd.h>
* search.c (migemo_active): added
* search.c (migemo_pid): added
* search.c (init_migemo): migemo_active = use_migemo
* search.c (init_migemo): kill migemo_pid
* search.c (open_migemo): s/pid/migemo_pid/
* search.c (open_migemo): setpgrp()
* search.c (open_migemo): s/use_migemo/migemo_active/
* search.c (migemostr): ditto
* search.c (forwardSearch): ditto
* search.c (backwardSearch): ditto
From: Fumitoshi UKAI  <ukai@debian.or.jp>

Diffstat:
MChangeLog | 16++++++++++++++++
Mmain.c | 3+++
Msearch.c | 26++++++++++++++++++--------
3 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,19 @@ +2002-01-18 Fumitoshi UKAI <ukai@debian.or.jp> + + * [w3m-dev 02870] don't kill migemo by SIGINT + * main.c (w3m_exit): init_migemo() to kill migemo + * search.c: #include <unistd.h> + * search.c (migemo_active): added + * search.c (migemo_pid): added + * search.c (init_migemo): migemo_active = use_migemo + * search.c (init_migemo): kill migemo_pid + * search.c (open_migemo): s/pid/migemo_pid/ + * search.c (open_migemo): setpgrp() + * search.c (open_migemo): s/use_migemo/migemo_active/ + * search.c (migemostr): ditto + * search.c (forwardSearch): ditto + * search.c (backwardSearch): ditto + 2002-01-17 Fumitoshi UKAI <ukai@debian.or.jp> * [w3m-dev 02867] mark URL for external URIs diff --git a/main.c b/main.c @@ -4779,6 +4779,9 @@ deleteFiles() void w3m_exit(int i) { +#ifdef USE_MIGEMO + init_migemo(); /* close pipe to migemo */ +#endif deleteFiles(); #ifdef USE_SSL free_ssl_ctx(); diff --git a/search.c b/search.c @@ -3,6 +3,7 @@ #include "regex.h" #include <signal.h> #include <errno.h> +#include <unistd.h> static void set_mark(Line *l, int pos, int epos) @@ -14,15 +15,21 @@ set_mark(Line *l, int pos, int epos) #ifdef USE_MIGEMO /* Migemo: romaji --> kana+kanji in regexp */ static FILE *migemor, *migemow; +static int migemo_active; +static int migemo_pid; void init_migemo() { + migemo_active = use_migemo; if (migemor != NULL) fclose(migemor); if (migemow != NULL) fclose(migemow); migemor = migemow = NULL; + if (migemo_pid) + kill(migemo_pid, SIGTERM); + migemo_pid = 0; } static int @@ -30,7 +37,7 @@ open_migemo(char *migemo_command) { int fdr[2]; int fdw[2]; - int pid; + if (pipe(fdr) < 0) goto err0; if (pipe(fdw) < 0) @@ -38,12 +45,15 @@ open_migemo(char *migemo_command) flush_tty(); /* migemow:fdw[1] -|-> fdw[0]=0 {migemo} fdr[1]=1 -|-> fdr[0]:migemor */ - pid = fork(); - if (pid < 0) + migemo_pid = fork(); + if (migemo_pid < 0) goto err2; - if (pid == 0) { + if (migemo_pid == 0) { /* child */ signal(SIGINT, SIG_IGN); +#ifdef HAVE_SETPGRP + setpgrp(); +#endif close_tty(); close(fdr[0]); close(fdw[1]); @@ -65,7 +75,7 @@ open_migemo(char *migemo_command) close(fdr[0]); close(fdr[1]); err0: - use_migemo = 0; + migemo_active = 0; return 0; } @@ -94,7 +104,7 @@ migemostr(char *str) err: /* XXX: backend migemo is not working? */ init_migemo(); - use_migemo = 0; + migemo_active = 0; return str; } #endif /* USE_MIGEMO */ @@ -108,7 +118,7 @@ forwardSearch(Buffer *buf, char *str) int pos; #ifdef USE_MIGEMO - if (use_migemo) { + if (migemo_active) { if (((p = regexCompile(migemostr(str), IgnoreCase)) != NULL) && ((p = regexCompile(str, IgnoreCase)) != NULL)) { message(p, 0, 0); @@ -186,7 +196,7 @@ backwardSearch(Buffer *buf, char *str) int pos; #ifdef USE_MIGEMO - if (use_migemo) { + if (migemo_active) { if (((p = regexCompile(migemostr(str), IgnoreCase)) != NULL) && ((p = regexCompile(str, IgnoreCase)) != NULL)) { message(p, 0, 0);