diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-04-24 18:29:35 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-04-24 18:29:35 +0000 |
commit | 4e8c85a7fa218fc538aaf3a4e08ffa9fd6017a3d (patch) | |
tree | c4b80e2b654ac6a89ac9abececae7ba701b15fac /main.c | |
parent | [w3m-dev 03181] KEYBIND_SRC was not passed to scripts/Makefile (diff) | |
download | w3m-4e8c85a7fa218fc538aaf3a4e08ffa9fd6017a3d.tar.gz w3m-4e8c85a7fa218fc538aaf3a4e08ffa9fd6017a3d.zip |
[w3m-dev-en 00730] Re: Patch for a more flexible dictionary lookup
* NEWS: rc: use_dictcommand, dictcommand
* main.c (execdict): use url_quote_conv() instead of cURLcode()
* proto.h (cURLcode): deleted
* doc-jp/README.dict: updated
From: Fumitoshi UKAI <ukai@debian.or.jp>
[w3m-dev-en 00729] Re: Patch for a more flexible dictionary lookup
* config.h.dist (DICT): define
* configure (use_dict): default y
* fm.h (DICTCMD): deleted
(UseDictCommand): added
(DictCommand): added
* main.c (execdict): rewrite to use DictCommand, loadGeneralFile()
* rc.c (CMT_USE_DICTCOMMAND): added
(CMT_DICTCOMMAND): added
(params1): use_dictcommand, dictcommand added
* doc/README.dict: updated
From: Tushar Samant <scribble@pobox.com>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 22 |
1 files changed, 8 insertions, 14 deletions
@@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.97 2002/04/17 02:42:27 ukai Exp $ */ +/* $Id: main.c,v 1.98 2002/04/24 18:29:35 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -4829,11 +4829,10 @@ GetWord(Buffer *buf) static void execdict(char *word) { - char *w; + char *w, *dictcmd; Buffer *buf; - MySignalHandler(*prevtrap) (); - if (word == NULL || *word == '\0') { + if (!UseDictCommand || word == NULL || *word == '\0') { displayBuffer(Currentbuf, B_NORMAL); return; } @@ -4842,22 +4841,17 @@ execdict(char *word) displayBuffer(Currentbuf, B_NORMAL); return; } - prevtrap = signal(SIGINT, intTrap); - crmode(); - buf = getshell(myExtCommand(DICTCMD, shell_quote(w), FALSE)->ptr); - signal(SIGINT, prevtrap); - term_raw(); + dictcmd = Sprintf("%s?%s", DictCommand, w)->ptr; + buf = loadGeneralFile(url_quote_conv(dictcmd, Currentbuf->document_code), + baseURL(Currentbuf), + parsedURL2Str(&Currentbuf->currentURL)->ptr, + 0, NULL); if (buf == NULL) { disp_message("Execution failed", FALSE); } - else if (buf->firstLine == NULL) { - /* if the dictionary doesn't describe the word. */ - disp_message(Sprintf("Word \"%s\" Not Found", word)->ptr, FALSE); - } else { buf->filename = w; buf->buffername = Sprintf("%s %s", DICTBUFFERNAME, word)->ptr; - buf->bufferprop |= (BP_INTERNAL | BP_NO_URL); if (buf->type == NULL) buf->type = "text/plain"; pushBuffer(buf); |