w3m

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

commit 78038e6e1ba461b24056f54b0afc2a0795d46491
parent 9edb9076fce9d72e9860fe8dd2f7cb203ec73eca
Author: ukai <ukai>
Date:   Wed, 16 Jan 2002 19:02:12 +0000

[w3m-dev 02862] SIGPIPE for migemo support
* main.c (SigPipe): added
* main.c (MAIN): signal(SIGPIPE, )
* search.c: #include <errno.h>
* search.c (migemostr): check fflush() error
* search.c (migemostr): check result string (empty is err)
* search.c (migemostr): if error occured, disable use_migemo
From: Fumitoshi UKAI  <ukai@debian.or.jp>

Diffstat:
MChangeLog | 10++++++++++
Mmain.c | 19+++++++++++++++++++
Msearch.c | 16+++++++++++++++-
3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,15 @@ 2002-01-17 Fumitoshi UKAI <ukai@debian.or.jp> + * [w3m-dev 02862] SIGPIPE for migemo support + * main.c (SigPipe): added + * main.c (MAIN): signal(SIGPIPE, ) + * search.c: #include <errno.h> + * search.c (migemostr): check fflush() error + * search.c (migemostr): check result string (empty is err) + * search.c (migemostr): if error occured, disable use_migemo + +2002-01-17 Fumitoshi UKAI <ukai@debian.or.jp> + * [w3m-dev 02861] IPv6 configuration check * configure: force "#define INET6" if socket(AF_INET6, SOCK_STREAM, 0) failed but use_ipv6=y in config.param diff --git a/main.c b/main.c @@ -54,6 +54,10 @@ static MySignalHandler resize_handler(SIGNAL_ARG); static void resize_screen(void); #endif +#ifdef SIGPIPE +static MySignalHandler SigPipe(SIGNAL_ARG); +#endif + #ifdef USE_MARK static char *MarkString = NULL; #endif @@ -708,6 +712,9 @@ MAIN(int argc, char **argv, char **envp) #ifdef SIGCHLD signal(SIGCHLD, sig_chld); #endif +#ifdef SIGPIPE + signal(SIGPIPE, SigPipe); +#endif orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc); err_msg = Strnew(); @@ -1206,6 +1213,18 @@ resize_screen(void) } #endif /* SIGWINCH */ +#ifdef SIGPIPE +static MySignalHandler +SigPipe(SIGNAL_ARG) +{ +#ifdef USE_MIGEMO + init_migemo(); +#endif + signal(SIGPIPE, SigPipe); + SIGNAL_RETURN; +} +#endif + /* * Command functions: These functions are called with a keystroke. */ diff --git a/search.c b/search.c @@ -1,6 +1,7 @@ /* $Id$ */ #include "fm.h" #include "regex.h" +#include <errno.h> static void set_mark(Line *l, int pos, int epos) @@ -71,10 +72,23 @@ migemostr(char *str) if (open_migemo(migemo_command) == 0) return str; fprintf(migemow, "%s\n", str); - fflush(migemow); +again: + if (fflush(migemow) != 0) { + switch (errno) { + case EINTR: goto again; + default: goto err; + } + } tmp = Strfgets(migemor); Strchop(tmp); + if (tmp->length == 0) + goto err; return tmp->ptr; +err: + /* XXX: backend migemo is not working? */ + init_migemo(); + use_migemo = 0; + return str; } #endif /* USE_MIGEMO */