[w3m-dev 03136] Add COMMAND to execute multiple commands
* fm.h (CurrentMenuData): deleted (CurrentCmdData): added * func.c (getKey): check next char of ^ (getWord): get word until ';' (getQWord): rewrite using Str * funcname.tab (COMMAND): added * main.c (MAIN): delete CurrentMenuData initialize CurrentCmdData (searchKeyData): use CurrentCmdData (execCmd): added (SigAlarm): delete CurrentMenuData, use CurrentCmdData * menu.c (action_menu): delete CurrentMenuData, use CurrentCmdData * proto.h (execCmd): added * doc/README.func (ALARM): capitalize (COMMAND): added * doc-jp/README.func (COMMAND): added From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
@@ -1,3 +1,23 @@
|
|||||||
|
2002-03-20 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
|
||||||
|
|
||||||
|
* [w3m-dev 03136] Add COMMAND to execute multiple commands
|
||||||
|
* fm.h (CurrentMenuData): deleted
|
||||||
|
(CurrentCmdData): added
|
||||||
|
* func.c (getKey): check next char of ^
|
||||||
|
(getWord): get word until ';'
|
||||||
|
(getQWord): rewrite using Str
|
||||||
|
* funcname.tab (COMMAND): added
|
||||||
|
* main.c (MAIN): delete CurrentMenuData
|
||||||
|
initialize CurrentCmdData
|
||||||
|
(searchKeyData): use CurrentCmdData
|
||||||
|
(execCmd): added
|
||||||
|
(SigAlarm): delete CurrentMenuData, use CurrentCmdData
|
||||||
|
* menu.c (action_menu): delete CurrentMenuData, use CurrentCmdData
|
||||||
|
* proto.h (execCmd): added
|
||||||
|
* doc/README.func (ALARM): capitalize
|
||||||
|
(COMMAND): added
|
||||||
|
* doc-jp/README.func (COMMAND): added
|
||||||
|
|
||||||
2002-03-20 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
|
2002-03-20 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
|
||||||
|
|
||||||
* [w3m-dev 03135] commit of [w3m-dev 03006] is incomplete.
|
* [w3m-dev 03135] commit of [w3m-dev 03006] is incomplete.
|
||||||
@@ -3242,4 +3262,4 @@
|
|||||||
* release-0-2-1
|
* release-0-2-1
|
||||||
* import w3m-0.2.1
|
* import w3m-0.2.1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.356 2002/03/19 15:54:47 ukai Exp $
|
$Id: ChangeLog,v 1.357 2002/03/19 16:06:52 ukai Exp $
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ BEGIN ʸ
|
|||||||
BOOKMARK ブックマークを読み込みます
|
BOOKMARK ブックマークを読み込みます
|
||||||
CENTER_H カーソルのある位置を行の中央に移動します
|
CENTER_H カーソルのある位置を行の中央に移動します
|
||||||
CENTER_V カーソルのある行を画面の中央に移動します
|
CENTER_V カーソルのある行を画面の中央に移動します
|
||||||
|
COMMAND w3mのコマンドを実行します
|
||||||
COOKIE クッキー一覧を表示します
|
COOKIE クッキー一覧を表示します
|
||||||
DELETE_PREVBUF 前のバッファを消去します(主に local-CGI 用)
|
DELETE_PREVBUF 前のバッファを消去します(主に local-CGI 用)
|
||||||
DICT_WORD 入力した単語を辞書コマンドで調べます
|
DICT_WORD 入力した単語を辞書コマンドで調べます
|
||||||
|
|||||||
+2
-1
@@ -1,11 +1,12 @@
|
|||||||
ABORT Quit w3m without confirmation
|
ABORT Quit w3m without confirmation
|
||||||
ADD_BOOKMARK Add current page to bookmark
|
ADD_BOOKMARK Add current page to bookmark
|
||||||
ALARM set alarm
|
ALARM Set alarm
|
||||||
BACK Back to previous buffer
|
BACK Back to previous buffer
|
||||||
BEGIN Go to the first line
|
BEGIN Go to the first line
|
||||||
BOOKMARK Read bookmark
|
BOOKMARK Read bookmark
|
||||||
CENTER_H Move to the center line
|
CENTER_H Move to the center line
|
||||||
CENTER_V Move to the center column
|
CENTER_V Move to the center column
|
||||||
|
COMMAND Execute w3m command(s)
|
||||||
COOKIE View cookie list
|
COOKIE View cookie list
|
||||||
DELETE_PREVBUF Delete previous buffer (mainly for local-CGI)
|
DELETE_PREVBUF Delete previous buffer (mainly for local-CGI)
|
||||||
DICT_WORD Execute dictionary command (see README.dict)
|
DICT_WORD Execute dictionary command (see README.dict)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: fm.h,v 1.56 2002/03/15 18:33:32 ukai Exp $ */
|
/* $Id: fm.h,v 1.57 2002/03/19 16:06:52 ukai Exp $ */
|
||||||
/*
|
/*
|
||||||
* w3m: WWW wo Miru utility
|
* w3m: WWW wo Miru utility
|
||||||
*
|
*
|
||||||
@@ -765,9 +765,7 @@ global Buffer *Currentbuf;
|
|||||||
global Buffer *Firstbuf;
|
global Buffer *Firstbuf;
|
||||||
global int CurrentKey;
|
global int CurrentKey;
|
||||||
global char *CurrentKeyData;
|
global char *CurrentKeyData;
|
||||||
#ifdef USE_MENU
|
global char *CurrentCmdData;
|
||||||
global char *CurrentMenuData;
|
|
||||||
#endif
|
|
||||||
extern char *ullevel[];
|
extern char *ullevel[];
|
||||||
|
|
||||||
extern char *w3m_version;
|
extern char *w3m_version;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: func.c,v 1.7 2001/12/10 17:02:44 ukai Exp $ */
|
/* $Id: func.c,v 1.8 2002/03/19 16:06:52 ukai Exp $ */
|
||||||
/*
|
/*
|
||||||
* w3m func.c
|
* w3m func.c
|
||||||
*/
|
*/
|
||||||
@@ -139,7 +139,7 @@ getKey(char *s)
|
|||||||
s += 2;
|
s += 2;
|
||||||
ctrl = 1;
|
ctrl = 1;
|
||||||
}
|
}
|
||||||
else if (*s == '^') { /* ^, ^[^ */
|
else if (*s == '^' && *(s + 1)) { /* ^, ^[^ */
|
||||||
s++;
|
s++;
|
||||||
ctrl = 1;
|
ctrl = 1;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ getKey(char *s)
|
|||||||
s += 2;
|
s += 2;
|
||||||
ctrl = 1;
|
ctrl = 1;
|
||||||
}
|
}
|
||||||
else if (*s == '^') { /* ^[^, ^[[^ */
|
else if (*s == '^' && *(s + 1)) { /* ^[^, ^[[^ */
|
||||||
s++;
|
s++;
|
||||||
ctrl = 1;
|
ctrl = 1;
|
||||||
}
|
}
|
||||||
@@ -229,46 +229,36 @@ getWord(char **str)
|
|||||||
|
|
||||||
p = *str;
|
p = *str;
|
||||||
SKIP_BLANKS(p);
|
SKIP_BLANKS(p);
|
||||||
s = p;
|
for (s = p; *p && ! IS_SPACE(*p) && *p != ';'; p++) ;
|
||||||
while (*p != '\0') {
|
|
||||||
if (IS_SPACE(*p)) {
|
|
||||||
*p = '\0';
|
|
||||||
p++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
*str = p;
|
*str = p;
|
||||||
return s;
|
return Strnew_charp_n(s, p - s)->ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getQWord(char **str)
|
getQWord(char **str)
|
||||||
{
|
{
|
||||||
char *p, *s, *e;
|
Str tmp = Strnew();
|
||||||
|
char *p;
|
||||||
int in_q = 0, in_dq = 0, esc = 0;
|
int in_q = 0, in_dq = 0, esc = 0;
|
||||||
|
|
||||||
p = *str;
|
p = *str;
|
||||||
while (*p && IS_SPACE(*p))
|
SKIP_BLANKS(p);
|
||||||
p++;
|
for (; *p; p++) {
|
||||||
s = p;
|
|
||||||
e = p;
|
|
||||||
while (*p != '\0') {
|
|
||||||
if (esc) {
|
if (esc) {
|
||||||
if (in_q) {
|
if (in_q) {
|
||||||
if (*p != '\\' && *p != '\'') /* '..\\..', '..\'..' */
|
if (*p != '\\' && *p != '\'') /* '..\\..', '..\'..' */
|
||||||
*e++ = '\\';
|
Strcat_char(tmp, '\\');
|
||||||
}
|
}
|
||||||
else if (in_dq) {
|
else if (in_dq) {
|
||||||
if (*p != '\\' && *p != '"') /* "..\\..", "..\".." */
|
if (*p != '\\' && *p != '"') /* "..\\..", "..\".." */
|
||||||
*e++ = '\\';
|
Strcat_char(tmp, '\\');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (*p != '\\' && *p != '\'' && /* ..\\.., ..\'.. */
|
if (*p != '\\' && *p != '\'' && /* ..\\.., ..\'.. */
|
||||||
*p != '"' && !IS_SPACE(*p)) /* ..\".., ..\.. */
|
*p != '"' && !IS_SPACE(*p)) /* ..\".., ..\.. */
|
||||||
*e++ = '\\';
|
Strcat_char(tmp, '\\');
|
||||||
}
|
}
|
||||||
*e++ = *p;
|
Strcat_char(tmp, *p);
|
||||||
esc = 0;
|
esc = 0;
|
||||||
}
|
}
|
||||||
else if (*p == '\\') {
|
else if (*p == '\\') {
|
||||||
@@ -278,13 +268,13 @@ getQWord(char **str)
|
|||||||
if (*p == '\'')
|
if (*p == '\'')
|
||||||
in_q = 0;
|
in_q = 0;
|
||||||
else
|
else
|
||||||
*e++ = *p;
|
Strcat_char(tmp, *p);
|
||||||
}
|
}
|
||||||
else if (in_dq) {
|
else if (in_dq) {
|
||||||
if (*p == '"')
|
if (*p == '"')
|
||||||
in_dq = 0;
|
in_dq = 0;
|
||||||
else
|
else
|
||||||
*e++ = *p;
|
Strcat_char(tmp, *p);
|
||||||
}
|
}
|
||||||
else if (*p == '\'') {
|
else if (*p == '\'') {
|
||||||
in_q = 1;
|
in_q = 1;
|
||||||
@@ -292,16 +282,13 @@ getQWord(char **str)
|
|||||||
else if (*p == '"') {
|
else if (*p == '"') {
|
||||||
in_dq = 1;
|
in_dq = 1;
|
||||||
}
|
}
|
||||||
else if (IS_SPACE(*p)) {
|
else if (IS_SPACE(*p) || *p == ';') {
|
||||||
p++;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*e++ = *p;
|
Strcat_char(tmp, *p);
|
||||||
}
|
}
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
*e = '\0';
|
|
||||||
*str = p;
|
*str = p;
|
||||||
return s;
|
return tmp->ptr;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
# $Id: funcname.tab,v 1.7 2002/01/31 17:54:51 ukai Exp $
|
# $Id: funcname.tab,v 1.8 2002/03/19 16:06:52 ukai Exp $
|
||||||
# macro name function name
|
# macro name function name
|
||||||
#----------------------------
|
#----------------------------
|
||||||
@@@ nulcmd
|
@@@ nulcmd
|
||||||
@@ -10,6 +10,7 @@ BEGIN goLineF
|
|||||||
BOOKMARK ldBmark
|
BOOKMARK ldBmark
|
||||||
CENTER_H ctrCsrH
|
CENTER_H ctrCsrH
|
||||||
CENTER_V ctrCsrV
|
CENTER_V ctrCsrV
|
||||||
|
COMMAND execCmd
|
||||||
COOKIE cooLst
|
COOKIE cooLst
|
||||||
DELETE_PREVBUF deletePrevBuf
|
DELETE_PREVBUF deletePrevBuf
|
||||||
DICT_WORD dictword
|
DICT_WORD dictword
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: main.c,v 1.90 2002/03/15 19:02:40 ukai Exp $ */
|
/* $Id: main.c,v 1.91 2002/03/19 16:06:52 ukai Exp $ */
|
||||||
#define MAINPROGRAM
|
#define MAINPROGRAM
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -729,7 +729,6 @@ MAIN(int argc, char **argv, char **envp)
|
|||||||
initKeymap();
|
initKeymap();
|
||||||
#ifdef USE_MENU
|
#ifdef USE_MENU
|
||||||
initMenu();
|
initMenu();
|
||||||
CurrentMenuData = NULL;
|
|
||||||
#endif /* MENU */
|
#endif /* MENU */
|
||||||
fmInit();
|
fmInit();
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
@@ -953,9 +952,7 @@ MAIN(int argc, char **argv, char **envp)
|
|||||||
for (i = 0; i < n_event_queue; i++) {
|
for (i = 0; i < n_event_queue; i++) {
|
||||||
CurrentKey = -1;
|
CurrentKey = -1;
|
||||||
CurrentKeyData = eventQueue[i].user_data;
|
CurrentKeyData = eventQueue[i].user_data;
|
||||||
#ifdef USE_MENU
|
CurrentCmdData = NULL;
|
||||||
CurrentMenuData = NULL;
|
|
||||||
#endif
|
|
||||||
w3mFuncList[eventQueue[i].cmd].func();
|
w3mFuncList[eventQueue[i].cmd].func();
|
||||||
}
|
}
|
||||||
n_event_queue = 0;
|
n_event_queue = 0;
|
||||||
@@ -4929,17 +4926,14 @@ set_buffer_environ(Buffer *buf)
|
|||||||
char *
|
char *
|
||||||
searchKeyData(void)
|
searchKeyData(void)
|
||||||
{
|
{
|
||||||
char *data;
|
char *data = NULL;
|
||||||
|
|
||||||
if (CurrentKeyData != NULL && *CurrentKeyData != '\0')
|
if (CurrentKeyData != NULL && *CurrentKeyData != '\0')
|
||||||
return allocStr(CurrentKeyData, -1);
|
data = CurrentKeyData;
|
||||||
#ifdef USE_MENU
|
else if (CurrentCmdData != NULL && *CurrentCmdData != '\0')
|
||||||
if (CurrentMenuData != NULL && *CurrentMenuData != '\0')
|
data = CurrentCmdData;
|
||||||
return allocStr(CurrentMenuData, -1);
|
else if (CurrentKey >= 0)
|
||||||
#endif
|
data = getKeyData(CurrentKey);
|
||||||
if (CurrentKey < 0)
|
|
||||||
return NULL;
|
|
||||||
data = getKeyData(CurrentKey);
|
|
||||||
if (data == NULL || *data == '\0')
|
if (data == NULL || *data == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
return allocStr(data, -1);
|
return allocStr(data, -1);
|
||||||
@@ -4984,26 +4978,72 @@ w3m_exit(int i)
|
|||||||
exit(i);
|
exit(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
execCmd(void)
|
||||||
|
{
|
||||||
|
char *data, *p;
|
||||||
|
int cmd;
|
||||||
|
|
||||||
|
CurrentKeyData = NULL; /* not allowed in w3m-control: */
|
||||||
|
data = searchKeyData();
|
||||||
|
if (data == NULL || *data == '\0') {
|
||||||
|
data = inputStrHist("command [; ...]: ", "", TextHist);
|
||||||
|
if (data == NULL) {
|
||||||
|
displayBuffer(Currentbuf, B_NORMAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* data: FUNC [DATA] [; FUNC [DATA] ...] */
|
||||||
|
while (*data) {
|
||||||
|
SKIP_BLANKS(data);
|
||||||
|
if (*data == ';') {
|
||||||
|
data++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
p = getWord(&data);
|
||||||
|
cmd = getFuncList(p);
|
||||||
|
if (cmd < 0)
|
||||||
|
break;
|
||||||
|
p = getQWord(&data);
|
||||||
|
CurrentKey = -1;
|
||||||
|
CurrentKeyData = NULL;
|
||||||
|
CurrentCmdData = *p ? p : NULL;
|
||||||
|
#ifdef USE_MOUSE
|
||||||
|
if (use_mouse)
|
||||||
|
mouse_inactive();
|
||||||
|
#endif
|
||||||
|
w3mFuncList[cmd].func();
|
||||||
|
#ifdef USE_MOUSE
|
||||||
|
if (use_mouse)
|
||||||
|
mouse_active();
|
||||||
|
#endif
|
||||||
|
CurrentCmdData = NULL;
|
||||||
|
}
|
||||||
|
displayBuffer(Currentbuf, B_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_ALARM
|
#ifdef USE_ALARM
|
||||||
static MySignalHandler
|
static MySignalHandler
|
||||||
SigAlarm(SIGNAL_ARG)
|
SigAlarm(SIGNAL_ARG)
|
||||||
{
|
{
|
||||||
if (alarm_sec > 0) {
|
if (alarm_sec > 0) {
|
||||||
CurrentKey = -1;
|
CurrentKey = -1;
|
||||||
CurrentKeyData = (char *)alarm_event.user_data;
|
CurrentKeyData = NULL;
|
||||||
#ifdef USE_MENU
|
CurrentCmdData = (char *)alarm_event.user_data;
|
||||||
CurrentMenuData = NULL;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_MOUSE
|
#ifdef USE_MOUSE
|
||||||
if (use_mouse)
|
if (use_mouse)
|
||||||
mouse_inactive();
|
mouse_inactive();
|
||||||
#endif
|
#endif
|
||||||
w3mFuncList[alarm_event.cmd].func();
|
w3mFuncList[alarm_event.cmd].func();
|
||||||
onA();
|
|
||||||
#ifdef USE_MOUSE
|
#ifdef USE_MOUSE
|
||||||
if (use_mouse)
|
if (use_mouse)
|
||||||
mouse_active();
|
mouse_active();
|
||||||
#endif
|
#endif
|
||||||
|
CurrentCmdData = NULL;
|
||||||
|
onA();
|
||||||
|
disp_message_nsec(Sprintf("%s %s", w3mFuncList[alarm_event.cmd].id,
|
||||||
|
CurrentCmdData ? CurrentCmdData : "")->ptr,
|
||||||
|
FALSE, alarm_sec - 1, FALSE, TRUE);
|
||||||
if (alarm_status == AL_IMPLICIT) {
|
if (alarm_status == AL_IMPLICIT) {
|
||||||
alarm_buffer = Currentbuf;
|
alarm_buffer = Currentbuf;
|
||||||
alarm_status = AL_IMPLICIT_DONE;
|
alarm_status = AL_IMPLICIT_DONE;
|
||||||
@@ -5041,7 +5081,10 @@ setAlarm(void)
|
|||||||
cmd = getFuncList(getWord(&data));
|
cmd = getFuncList(getWord(&data));
|
||||||
}
|
}
|
||||||
if (cmd >= 0) {
|
if (cmd >= 0) {
|
||||||
setAlarmEvent(sec, AL_EXPLICIT, cmd, getQWord(&data));
|
data = getQWord(&data);
|
||||||
|
setAlarmEvent(sec, AL_EXPLICIT, cmd, data);
|
||||||
|
disp_message_nsec(Sprintf("%s %s", w3mFuncList[cmd].id, data)->ptr,
|
||||||
|
FALSE, sec - 1, FALSE, TRUE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setAlarmEvent(0, AL_UNSET, FUNCNAME_nulcmd, NULL);
|
setAlarmEvent(0, AL_UNSET, FUNCNAME_nulcmd, NULL);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: menu.c,v 1.14 2002/01/31 17:54:52 ukai Exp $ */
|
/* $Id: menu.c,v 1.15 2002/03/19 16:06:52 ukai Exp $ */
|
||||||
/*
|
/*
|
||||||
* w3m menu.c
|
* w3m menu.c
|
||||||
*/
|
*/
|
||||||
@@ -641,9 +641,9 @@ action_menu(Menu *menu)
|
|||||||
if (item.type & MENU_FUNC) {
|
if (item.type & MENU_FUNC) {
|
||||||
CurrentKey = -1;
|
CurrentKey = -1;
|
||||||
CurrentKeyData = NULL;
|
CurrentKeyData = NULL;
|
||||||
CurrentMenuData = item.data;
|
CurrentCmdData = item.data;
|
||||||
(*item.func) ();
|
(*item.func) ();
|
||||||
CurrentMenuData = NULL;
|
CurrentCmdData = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mselect == MENU_CLOSE) {
|
else if (mselect == MENU_CLOSE) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: proto.h,v 1.39 2002/03/15 18:33:32 ukai Exp $ */
|
/* $Id: proto.h,v 1.40 2002/03/19 16:06:52 ukai Exp $ */
|
||||||
/*
|
/*
|
||||||
* This file was automatically generated by version 1.7 of cextract.
|
* This file was automatically generated by version 1.7 of cextract.
|
||||||
* Manual editing not recommended.
|
* Manual editing not recommended.
|
||||||
@@ -102,6 +102,7 @@ extern void rFrame(void);
|
|||||||
extern void extbrz(void);
|
extern void extbrz(void);
|
||||||
extern void linkbrz(void);
|
extern void linkbrz(void);
|
||||||
extern void curlno(void);
|
extern void curlno(void);
|
||||||
|
extern void execCmd(void);
|
||||||
#ifdef USE_IMAGE
|
#ifdef USE_IMAGE
|
||||||
extern void dispI(void);
|
extern void dispI(void);
|
||||||
extern void stopI(void);
|
extern void stopI(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user