diff options
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | config.h.dist | 2 | ||||
-rwxr-xr-x | configure | 4 | ||||
-rw-r--r-- | doc-jp/README.dict | 45 | ||||
-rw-r--r-- | doc/README.dict | 57 | ||||
-rw-r--r-- | fm.h | 7 | ||||
-rw-r--r-- | main.c | 22 | ||||
-rw-r--r-- | proto.h | 7 | ||||
-rw-r--r-- | rc.c | 16 |
10 files changed, 135 insertions, 50 deletions
@@ -1,3 +1,25 @@ +2002-04-25 Fumitoshi UKAI <ukai@debian.or.jp> + + * [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 + +2002-04-25 Tushar Samant <scribble@pobox.com> + + * [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 + 2002-04-21 Kiyokazu SUTO <suto@ks-and-ks.ne.jp> * [w3m-dev 03181] KEYBIND_SRC was not passed to scripts/Makefile @@ -3364,4 +3386,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.373 2002/04/20 17:50:20 ukai Exp $ +$Id: ChangeLog,v 1.374 2002/04/24 18:29:35 ukai Exp $ @@ -1,5 +1,6 @@ w3m 0.4? +* rc: use_dictcommand, dictcommand * rc: mark_all_pages * configure: -mandir * func: COMMAND diff --git a/config.h.dist b/config.h.dist index 16d82c6..2d37c0c 100644 --- a/config.h.dist +++ b/config.h.dist @@ -12,7 +12,7 @@ If you define DICT, you can use dictionary look-up function in w3m. See README.dict for detail. */ -#undef DICT +#define DICT /* If you want to load and save URL history. @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: configure,v 1.67 2002/04/09 14:45:58 ukai Exp $ +# $Id: configure,v 1.68 2002/04/24 18:29:35 ukai Exp $ # Configuration. # @@ -775,7 +775,7 @@ else fi ### only use config.param -def_param use_dict n +def_param use_dict y def_param use_history y def_param use_bg_color y def_param format_nice n diff --git a/doc-jp/README.dict b/doc-jp/README.dict index 4f8c80d..55da29f 100644 --- a/doc-jp/README.dict +++ b/doc-jp/README.dict @@ -4,7 +4,8 @@ w3m�ѱ��¼�ŵ������ǽ�ˤĤ��� 'webster' ���ޥ�ɤʤɤΤ褦�˼�����������Υ��ޥ�ɤ����� ���ˤϡ�w3m ���椫�餽���Ȥ����Ȥ��Ǥ��ޤ������ε�ǽ�ϡ� -��Ӥ�������(rubikitch@ruby-lang.org)�ˤ���ΤǤ��� +��Ӥ�������(rubikitch@ruby-lang.org)�ˤ���Τ��Ȥ� +Tushar Samant (scribble at pobox.com)�������廊�ޤ����� 2. ���ȡ��� @@ -19,17 +20,41 @@ w3m�ѱ��¼�ŵ������ǽ�ˤĤ��� #define USE_DICT ���ѹ�����w3m ��ѥ��뤷�ʤ����Ƥ��������� -(dict.c �� keybind.c ��ѥ��뤷�ʤ������ɤ��Ϥ��Ǥ�) +w3m/0.3+cvs-1.358�ʹߤϡ�default��USE_DICT��define����ޤ��� -���줫�顤w3mdict �Ȥ������ޥ�ɤ��Ѱդ��ޤ�������ϡ���¸�� -����������ޥ�ɤؤΥ�Ǥ����㤨�С�webster �Ȥ������ޥ�� -������˻Ȥ��������ˤϡ����Τ褦�ˤ��Ƥ��������� +���줫�顤ʸ������ȤäƤ��η�̤���CGI�ץ������� +���ȡ��뤷�ޤ��� -% cd /usr/local/bin -% ln -s `which webster` w3mdict +�Ĥ��Τ褦����ˡ������ޤ� -���̤ˡ�ñ�������Ȥ��Ƽ�äơ�ɸ����Ϥ˲�������Ϥ��륳�ޥ�� -�Ǥ���С��ɤ�ʤ�ΤǤ� w3mdict �Ȥ��ƻȤ����Ȥ��Ǥ��ޤ��� + * �⤷ 'webster'�Ȥ������ޥ�ɤ�����Ф����Τ褦�����Ƥ�'w3mdict'�Ȥ��� + ������ץȤ�Ĥ���ޤ��� + + #!/bin/sh + + echo Content-type: text/plain + echo + webster $QUERY_STRING + + ����� lcoal CGI�Ȥ��ƥ��ȡ��뤷�ޤ� (w3m�ޥ˥奢��� local CGI + �Υ���������ߤƤ�������) ������ w3m�Υ��ץ����ڡ����� + ������������ꤷ�Ƥ��������� + + * �⤷ʸ�����Google�Ǹ������뵡ǽ���Ĥ���������硢 + �ʲ��Τ褦�� local CGI������ץȤ��Ĥ����ޤ��� + + #!/bin/sh + + google_q='http://google.com/search?btnG=Google&q' + + cat <<_END_ + Content-type: text/plain + W3m-control: GOTO $google_q=$QUERY_STRING + W3m-control: DELETE_PREVBUF + + _END_ + + ����Υѥ���������ޥ�ɤ�URL�Ȥ������ꤷ�Ƥ��������� 3. �Ȥ����� @@ -39,3 +64,5 @@ ESC w ñ������Ϥ��������ǰ�����ɽ�����ޤ��� ESC W �Хåե���θ��ߥ������뤬����ñ���ǰ�����ɽ�����ޤ��� +�����Υ������ѹ�����ˤϡ�~/.w3m/keymap��DICT_WORD�����DICT_WORD_AT +�ιԤ��ѹ����Ƥ��������� diff --git a/doc/README.dict b/doc/README.dict index ecb32be..ec4f44d 100644 --- a/doc/README.dict +++ b/doc/README.dict @@ -4,36 +4,65 @@ Dictionary look-up hack for w3m If you have dictionary look-up command (like 'webster'), you can look a word in a document using w3m. This dictionary-lookup code -was contributed by `Rubikitch' (rubikitch@ruby-lang.org). +was contributed by `Rubikitch' (rubikitch@ruby-lang.org), and +further modifed by Tushar Samant (scribble at pobox.com). -2. INSTALL +2. INSTALLATION -To make use of dictionary look-up, you have to change compile -option by hand. After running configure, edit config.h and -change +To make use of dictionary look-up, you currently must change a +compile option by hand. After running configure, edit config.h +and change #undef USE_DICT -into +to #define USE_DICT -and recompile w3m. (You have to recompile dict.c and keybind.c.) +and recompile w3me (i.e. type "make install"). +Note that w3m/0.3+cvs-1.358 or later, USE_DICT is defined by default. -Then prepare a command named 'w3mdict.' For example, if you want -to use 'webster' command, do the following: +Then find or install a CGI program which takes a word as a query +string and prints a response. -% cd /usr/local/bin -% ln -s `which webster` w3mdict +Some ways to do this would be: -In general, w3mdict can be any command that takes a word as an -argument and outputs something onto stdout. + * If you have the 'webster' command, put something like this + in a script called 'w3mdict': + + #!/bin/sh + + echo Content-type: text/plain + echo + webster $QUERY_STRING + + Then install w3mdict as a local CGI (see the local CGI section + of the w3m manual), and set your dictionary options from the + options page of w3m (usually invoked with "o"). + + * If you want this function to look a word up on Google instead, + write a local CGI script like this: + + #!/bin/sh + + google_q='http://google.com/search?btnG=Google&q' + + cat <<_END_ + Content-type: text/plain + W3m-control: GOTO $google_q=$QUERY_STRING + W3m-control: DELETE_PREVBUF + + _END_ + + and set its path as your dictionary-lookup URL option. 3. USAGE -You can use the following two commands. +You can use the following two commands: ESC w Input a word and look it up using w3mdict command. ESC W look up the current word in the buffer. +To change these keys, edit ~/.w3m/keymap and edit lines for the +functions DICT_WORD and DICT_WORD_AT respectively. @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.58 2002/03/29 16:39:37 ukai Exp $ */ +/* $Id: fm.h,v 1.59 2002/04/24 18:29:35 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -99,7 +99,6 @@ void bzero(void *, int); #define PIPEBUFFERNAME "*stream*" #define CPIPEBUFFERNAME "*stream(closed)*" #ifdef USE_DICT -#define DICTCMD "w3mdict" #define DICTBUFFERNAME "*dictionary*" #endif /* USE_DICT */ @@ -860,6 +859,10 @@ global char *pauth init(NULL); global Str proxy_auth_cookie init(NULL); global int UseExternalDirBuffer init(TRUE); global char *DirBufferCommand init("file:///$LIB/dirlist" CGI_EXTENSION); +#ifdef USE_DICT +global int UseDictCommand init(FALSE); +global char *DictCommand init("file:///$LIB/w3mdict" CGI_EXTENSION); +#endif /* USE_DICT */ global int ignore_null_img_alt init(TRUE); global int FoldTextarea init(FALSE); #define DEFAULT_URL_EMPTY 0 @@ -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); @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.40 2002/03/19 16:06:52 ukai Exp $ */ +/* $Id: proto.h,v 1.41 2002/04/24 18:29:35 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -559,11 +559,6 @@ extern void reMark(void); #define prevMk nulcmd #define reMark nulcmd #endif /* not USE_MARK */ -#ifdef JP_CHARSET -extern char *cURLcode(char *url, char code); -#else -#define cURLcode(url,buf) (url) -#endif #ifdef USE_MOUSE extern void mouse(void); @@ -1,4 +1,4 @@ -/* $Id: rc.c,v 1.41 2002/03/29 16:39:37 ukai Exp $ */ +/* $Id: rc.c,v 1.42 2002/04/24 18:29:35 ukai Exp $ */ /* * Initialization file etc. */ @@ -148,6 +148,10 @@ static char *config_file = NULL; #endif #define CMT_EXT_DIRLIST "�ǥ��쥯�ȥ�ꥹ�Ȥ˳������ޥ�ɤ�Ȥ�" #define CMT_DIRLIST_CMD "�ǥ��쥯�ȥ�ꥹ���ѥ��ޥ��" +#ifdef USE_DICT +#define CMT_USE_DICTCOMMAND "���������CGI��ͳ�Ǥ����ʤ�" +#define CMT_DICTCOMMAND "����������ޥ�ɤ�URL" +#endif /* USE_DICT */ #define CMT_IGNORE_NULL_IMG_ALT "����IMG ALT°���λ��˥��̾��ɽ������" #define CMT_IFILE "�ƥǥ��쥯�ȥ�Υ���ǥå����ե�����" #define CMT_RETRY_HTTP "URL�˼�ưŪ�� http:// ���䤦" @@ -283,6 +287,10 @@ static char *config_file = NULL; #endif #define CMT_EXT_DIRLIST "Use external program for directory listing" #define CMT_DIRLIST_CMD "Directory listing command" +#ifdef USE_DICT +#define CMT_USE_DICTCOMMAND "Enable dictionary lookup through CGI" +#define CMT_DICTCOMMAND "URL of dictionary lookup command" +#endif /* USE_DICT */ #define CMT_IGNORE_NULL_IMG_ALT "Ignore IMG ALT=\"\" (display link name)" #define CMT_IFILE "Index file for the directory" #define CMT_RETRY_HTTP "Prepend http:// to URL automatically" @@ -456,6 +464,12 @@ struct param_ptr params1[] = { CMT_EXT_DIRLIST, NULL}, {"dirlist_cmd", P_STRING, PI_TEXT, (void *)&DirBufferCommand, CMT_DIRLIST_CMD, NULL}, +#ifdef USE_DICT + {"use_dictcommand", P_INT, PI_ONOFF, (void *)&UseDictCommand, + CMT_USE_DICTCOMMAND, NULL}, + {"dictcommand", P_STRING, PI_TEXT, (void *)&DictCommand, + CMT_DICTCOMMAND, NULL}, +#endif /* USE_DICT */ {"multicol", P_INT, PI_ONOFF, (void *)&multicolList, CMT_MULTICOL, NULL}, {"alt_entity", P_CHARINT, PI_ONOFF, (void *)&UseAltEntity, CMT_ALT_ENTITY, NULL}, |