aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-01-17 15:05:43 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-01-17 15:05:43 +0000
commit7fe83699ea3a76fe00da4a5df83122564b767f0f (patch)
tree6a13fd55a3087c84266a71f0b2b7fd64d9f420d2
parent[w3m-dev 02867] mark URL for external URIs (diff)
downloadw3m-7fe83699ea3a76fe00da4a5df83122564b767f0f.tar.gz
w3m-7fe83699ea3a76fe00da4a5df83122564b767f0f.zip
[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 (limited to '')
-rw-r--r--ChangeLog18
-rw-r--r--main.c5
-rw-r--r--search.c28
3 files changed, 40 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 569d884..bb0da43 100644
--- 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
@@ -2105,4 +2121,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.239 2002/01/17 11:06:45 ukai Exp $
+$Id: ChangeLog,v 1.240 2002/01/17 15:05:43 ukai Exp $
diff --git a/main.c b/main.c
index 882d65f..d44750d 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.65 2002/01/17 11:06:45 ukai Exp $ */
+/* $Id: main.c,v 1.66 2002/01/17 15:05:43 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -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
index 1404828..09cedac 100644
--- a/search.c
+++ b/search.c
@@ -1,8 +1,9 @@
-/* $Id: search.c,v 1.14 2002/01/17 10:29:14 ukai Exp $ */
+/* $Id: search.c,v 1.15 2002/01/17 15:05:43 ukai Exp $ */
#include "fm.h"
#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);