commit d9b79b79ffc33e712157aecd6f02b7b44b18bf84
parent 239c5c1197092cdcb645b75c23a1b0e037556cd6
Author: ukai <ukai>
Date: Sun, 6 Apr 2003 16:27:53 +0000
[w3m-dev 03843] cleanup macros
* config.h.dist config.h.in etc.c file.c fm.h ftp.c linein.c
main.c rc.c:
delete EMACS_LIKE_LINEEDIT, VI_PREC_NUM, LABEL_TOPLINE,
NEXTPAGE_TOPLINE, FTPPASS_HOSTNAMEGEN
use_mark default FALSE
emacs_like_lineedit default FALSE
vi_prec_num default FALSE
add UseHistory, use_history
* NEWS: rc: use_history
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat:
11 files changed, 25 insertions(+), 90 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,16 @@
+2003-04-07 Fumitoshi UKAI <ukai@debian.or.jp>
+
+ * [w3m-dev 03843] cleanup macros
+ * config.h.dist config.h.in etc.c file.c fm.h ftp.c linein.c
+ main.c rc.c:
+ delete EMACS_LIKE_LINEEDIT, VI_PREC_NUM, LABEL_TOPLINE,
+ NEXTPAGE_TOPLINE, FTPPASS_HOSTNAMEGEN
+ use_mark default FALSE
+ emacs_like_lineedit default FALSE
+ vi_prec_num default FALSE
+ add UseHistory, use_history
+ * NEWS: rc: use_history
+
2003-04-05 ABE Yuji <cbo46560@pop12.odn.ne.jp>
* [w3m-dev 03838] W3M_LIBS splitted from LIBS
diff --git a/NEWS b/NEWS
@@ -1,6 +1,7 @@
w3m 0.5 or 1.0?
* autoconfiscate
+* rc: use_history
w3m 0.4.1 - 2003-03-07
diff --git a/config.h.dist b/config.h.dist
@@ -119,11 +119,7 @@ INSTALL_W3MIMGDISPLAY=$(INSTALL_PROGRAM)
#define USE_COLOR
#undef USE_ANSI_COLOR
#undef USE_MIGEMO
-#undef EMACS_LIKE_LINEEDIT
-#undef VI_PREC_NUM
#undef USE_MARK
-#undef LABEL_TOPLINE
-#undef NEXTPAGE_TOPLINE
#define USE_MOUSE
#define USE_GPM
#undef USE_SYSMOUSE
@@ -132,7 +128,6 @@ INSTALL_W3MIMGDISPLAY=$(INSTALL_PROGRAM)
#define USE_DIGEST_AUTH
#define USE_SSL
#undef USE_SSL_VERIFY
-#undef FTPPASS_HOSTNAMEGEN
#undef USE_NNTP
#undef USE_GOPHER
#define USE_EXTERNAL_URI_LOADER
diff --git a/config.h.in b/config.h.in
@@ -42,11 +42,7 @@
#undef USE_ANSI_COLOR
#undef USE_BG_COLOR
#undef USE_MIGEMO
-#define EMACS_LIKE_LINEEDIT
-#define VI_PREC_NUM
#define USE_MARK
-#define LABEL_TOPLINE
-#define NEXTPAGE_TOPLINE
#undef USE_MOUSE
#undef USE_GPM
#undef USE_SYSMOUSE
@@ -55,7 +51,6 @@
#undef USE_DIGEST_AUTH
#undef USE_SSL
#undef USE_SSL_VERIFY
-#define FTPPASS_HOSTNAMEGEN
#undef USE_HELP_CGI
#undef USE_EXTERNAL_URI_LOADER
#undef USE_W3MMAILER
@@ -70,10 +65,8 @@
#undef USE_GDKPIXBUF
#undef USE_IMLIB2
#undef USE_XFACE
-#define SHOW_PARAMS
#undef USE_DICT
#undef USE_HISTORY
-#define VIEW_UNSEENOBJECTS
#undef FORMAT_NICE
#define ID_EXT
#undef CLEAR_BUF
diff --git a/etc.c b/etc.c
@@ -84,9 +84,7 @@ lineSkip(Buffer *buf, Line *line, int offset, int last)
Line *l;
l = currentLineSkip(buf, line, offset, last);
-#ifdef NEXTPAGE_TOPLINE
if (!nextpage_topline)
-#endif
for (i = buf->LINES - 1 - (buf->lastLine->linenumber - l->linenumber);
i > 0 && l->prev != NULL; i--, l = l->prev) ;
return l;
diff --git a/file.c b/file.c
@@ -2079,12 +2079,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
#endif /* not JP_CHARSET */
if (a != NULL) {
gotoLine(b, a->start.line);
-#ifdef LABEL_TOPLINE
if (label_topline)
b->topLine = lineSkip(b, b->topLine,
b->currentLine->linenumber
- b->topLine->linenumber, FALSE);
-#endif
b->pos = a->start.pos;
arrangeCursor(b);
}
diff --git a/fm.h b/fm.h
@@ -898,20 +898,12 @@ global int visited_color init(5); /* magenta */
#endif /* USE_COLOR */
global int confirm_on_quit init(TRUE);
#ifdef USE_MARK
-global int use_mark init(TRUE);
+global int use_mark init(FALSE);
#endif
-#ifdef EMACS_LIKE_LINEEDIT
-global int emacs_like_lineedit init(TRUE);
-#endif
-#ifdef VI_PREC_NUM
-global int vi_prec_num init(TRUE);
-#endif
-#ifdef LABEL_TOPLINE
+global int emacs_like_lineedit init(FALSE);
+global int vi_prec_num init(FALSE);
global int label_topline init(FALSE);
-#endif
-#ifdef NEXTPAGE_TOPLINE
global int nextpage_topline init(FALSE);
-#endif
global char *displayTitleTerm init(NULL);
global int displayLink init(FALSE);
global int displayLineInfo init(FALSE);
@@ -944,9 +936,7 @@ global int disable_secret_security_check init(FALSE);
global char *passwd_file init(PASSWD_FILE);
global char *pre_form_file init(PRE_FORM_FILE);
global char *ftppasswd init(NULL);
-#ifdef FTPPASS_HOSTNAMEGEN
global int ftppass_hostnamegen init(TRUE);
-#endif
global int do_download init(FALSE);
#ifdef USE_IMAGE
global char *image_source init(NULL);
@@ -1005,6 +995,7 @@ extern Hist *URLHist;
extern Hist *ShellHist;
extern Hist *TextHist;
#ifdef USE_HISTORY
+global int UseHistory init(TRUE);
global int URLHistSize init(100);
global int SaveURLHist init(TRUE);
#endif /* USE_HISTORY */
diff --git a/ftp.c b/ftp.c
@@ -15,7 +15,7 @@
#endif /* DEBUG */
#include <sys/socket.h>
-#if defined(FTPPASS_HOSTNAMEGEN) || defined(INET6)
+#if defined(INET6)
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
@@ -119,7 +119,6 @@ ftp_login(FTP ftp)
sock = openSocket(ftp->host, "ftp", 21);
if (sock < 0)
goto open_err;
-#ifdef FTPPASS_HOSTNAMEGEN
if (ftppass_hostnamegen && !strcmp(ftp->user, "anonymous")) {
size_t n = strlen(ftp->pass);
@@ -143,7 +142,6 @@ ftp_login(FTP ftp)
}
}
}
-#endif
ftp->rf = newInputStream(sock);
ftp->wf = fdopen(dup(sock), "wb");
if (!ftp->rf || !ftp->wf)
diff --git a/linein.c b/linein.c
@@ -201,29 +201,21 @@ inputLineHistSearch(char *prompt, char *def_str, int flag, Hist *hist,
if (!i_quote &&
(((cm_mode & CPL_ALWAYS) && (c == CTRL_I || c == ' ')) ||
((cm_mode & CPL_ON) && (c == CTRL_I)))) {
-#ifdef EMACS_LIKE_LINEEDIT
if (emacs_like_lineedit && cm_next) {
_dcompl();
need_redraw = TRUE;
}
else {
-#endif
_compl();
cm_disp_next = -1;
-#ifdef EMACS_LIKE_LINEEDIT
}
-#endif
}
else if (!i_quote && CLen == CPos &&
(cm_mode & CPL_ALWAYS || cm_mode & CPL_ON) && c == CTRL_D) {
-#ifdef EMACS_LIKE_LINEEDIT
if (!emacs_like_lineedit) {
-#endif
_dcompl();
need_redraw = TRUE;
-#ifdef EMACS_LIKE_LINEEDIT
}
-#endif
}
else if (!i_quote && c == DEL_CODE) {
_bs();
@@ -456,24 +448,19 @@ _esc(void)
break;
case CTRL_I:
case ' ':
-#ifdef EMACS_LIKE_LINEEDIT
if (emacs_like_lineedit) {
_rdcompl();
cm_clear = FALSE;
need_redraw = TRUE;
}
else
-#endif
_rcompl();
break;
case CTRL_D:
-#ifdef EMACS_LIKE_LINEEDIT
if (!emacs_like_lineedit)
-#endif
_rdcompl();
need_redraw = TRUE;
break;
-#ifdef EMACS_LIKE_LINEEDIT
case 'f':
if (emacs_like_lineedit)
_mvRw();
@@ -486,7 +473,6 @@ _esc(void)
if (emacs_like_lineedit)
_bsw();
break;
-#endif
#ifdef JP_CHARSET
case '$':
/* ISO-2022-jp characters */
@@ -865,11 +851,9 @@ next_dcompl(int next)
move(y, 0);
clrtoeolx();
bold();
-#ifdef EMACS_LIKE_LINEEDIT
if (emacs_like_lineedit)
addstr("----- Press TAB to continue -----");
else
-#endif
addstr("----- Press CTRL-D to continue -----");
boldend();
}
diff --git a/main.c b/main.c
@@ -410,7 +410,8 @@ main(int argc, char **argv, char **envp)
TextHist = newHist();
URLHist = newHist();
#ifdef USE_HISTORY
- loadHistory(URLHist);
+ if (UseHistory)
+ loadHistory(URLHist);
#endif /* not USE_HISTORY */
if (!non_null(HTTP_proxy) &&
@@ -1420,11 +1421,9 @@ nscroll(int n, int mode)
else {
tlnum = buf->topLine->linenumber;
llnum = buf->topLine->linenumber + buf->LINES - 1;
-#ifdef NEXTPAGE_TOPLINE
if (nextpage_topline)
diff_n = 0;
else
-#endif
diff_n = n - (tlnum - top->linenumber);
if (lnum < tlnum)
lnum = tlnum + diff_n;
@@ -1462,11 +1461,9 @@ nscroll(int n, int mode)
void
pgFore(void)
{
-#ifdef VI_PREC_NUM
if (vi_prec_num)
nscroll(searchKeyNum() * (Currentbuf->LINES - 1), B_NORMAL);
else
-#endif
nscroll(prec_num ? searchKeyNum() : searchKeyNum()
* (Currentbuf->LINES - 1), prec_num ? B_SCROLL : B_NORMAL);
}
@@ -1475,11 +1472,9 @@ pgFore(void)
void
pgBack(void)
{
-#ifdef VI_PREC_NUM
if (vi_prec_num)
nscroll(-searchKeyNum() * (Currentbuf->LINES - 1), B_NORMAL);
else
-#endif
nscroll(-(prec_num ? searchKeyNum() : searchKeyNum()
* (Currentbuf->LINES - 1)), prec_num ? B_SCROLL : B_NORMAL);
}
@@ -2346,7 +2341,7 @@ _quitfm(int confirm)
save_cookies();
#endif /* USE_COOKIE */
#ifdef USE_HISTORY
- if (SaveURLHist)
+ if (UseHistory && SaveURLHist)
saveHistory(URLHist, URLHistSize);
#endif /* USE_HISTORY */
w3m_exit(0);
@@ -2795,14 +2790,12 @@ loadLink(char *url, char *target, char *referer, FormList *request)
}
if (al) {
gotoLine(Currentbuf, al->start.line);
-#ifdef LABEL_TOPLINE
if (label_topline)
Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
Currentbuf->currentLine->
linenumber -
Currentbuf->topLine->linenumber,
FALSE);
-#endif
Currentbuf->pos = al->start.pos;
arrangeCursor(Currentbuf);
}
@@ -2832,13 +2825,11 @@ gotoLabel(char *label)
(*buf->clone)++;
pushBuffer(buf);
gotoLine(Currentbuf, al->start.line);
-#ifdef LABEL_TOPLINE
if (label_topline)
Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
Currentbuf->currentLine->linenumber
- Currentbuf->topLine->linenumber,
FALSE);
-#endif
Currentbuf->pos = al->start.pos;
arrangeCursor(Currentbuf);
displayBuffer(Currentbuf, B_FORCE_REDRAW);
diff --git a/rc.c b/rc.c
@@ -57,6 +57,7 @@ static int RC_table_size;
#define CMT_PIXEL_PER_CHAR "文字幅 (4.0...32.0)"
#define CMT_PIXEL_PER_LINE "一行の高さ (4.0...64.0)"
#define CMT_PAGERLINE "ページャとして利用した時に保存される行数"
+#define CMT_HISTORY "履歴を使う"
#define CMT_HISTSIZE "保持するURL履歴の数"
#define CMT_SAVEHIST "URL履歴の保存"
#define CMT_KANJICODE "表示用漢字コード"
@@ -119,18 +120,10 @@ static int RC_table_size;
#ifdef USE_MARK
#define CMT_USE_MARK "マーク機能を有効にする"
#endif
-#ifdef EMACS_LIKE_LINEEDIT
#define CMT_EMACS_LIKE_LINEEDIT "Emacs風の行編集にする"
-#endif
-#ifdef VI_PREC_NUM
#define CMT_VI_PREC_NUM "vi風の数値プレフィクス"
-#endif
-#ifdef LABEL_TOPLINE
#define CMT_LABEL_TOPLINE "ラベルに移動する時にカーソルがトップになるようにする"
-#endif
-#ifdef NEXTPAGE_TOPLINE
#define CMT_NEXTPAGE_TOPLINE "次のページに移動する時にカーソルがトップになるようにする"
-#endif
#define CMT_FOLD_LINE "plain text ファイルの行を折り返す"
#define CMT_SHOW_NUM "行番号を表示する"
#define CMT_SHOW_SRCH_STR "検索文字列を表示する"
@@ -146,9 +139,7 @@ static int RC_table_size;
#define CMT_PASSWDFILE "パスワードファイル"
#define CMT_PRE_FORM_FILE "文書読込時のフォーム設定用ファイル"
#define CMT_FTPPASS "FTPのパスワード(普通は自分のmail addressを使う)"
-#ifdef FTPPASS_HOSTNAMEGEN
#define CMT_FTPPASS_HOSTNAMEGEN "FTPのパスワードのドメイン名を自動生成する"
-#endif
#define CMT_USERAGENT "User-Agent"
#define CMT_ACCEPTENCODING "圧縮方法(Accept-Encoding:)"
#define CMT_ACCEPTMEDIA "受けつけるメディアタイプ(Accept:)"
@@ -222,6 +213,7 @@ static int RC_table_size;
#define CMT_PIXEL_PER_CHAR "Number of pixels per character (4.0...32.0)"
#define CMT_PIXEL_PER_LINE "Number of pixels per line (4.0...64.0)"
#define CMT_PAGERLINE "Number of remembered lines when used as a pager"
+#define CMT_HISTORY "Use URL history"
#define CMT_HISTSIZE "Number of remembered URL"
#define CMT_SAVEHIST "Save URL history"
/* #define CMT_KANJICODE "Display Kanji Code" */
@@ -284,18 +276,10 @@ static int RC_table_size;
#ifdef USE_MARK
#define CMT_USE_MARK "Enable mark operations"
#endif
-#ifdef EMACS_LIKE_LINEEDIT
#define CMT_EMACS_LIKE_LINEEDIT "Enable Emacs-style line editing"
-#endif
-#ifdef VI_PREC_NUM
#define CMT_VI_PREC_NUM "Enable vi-like numeric prefix"
-#endif
-#ifdef LABEL_TOPLINE
#define CMT_LABEL_TOPLINE "Move cursor to top line when going to label"
-#endif
-#ifdef NEXTPAGE_TOPLINE
#define CMT_NEXTPAGE_TOPLINE "Move cursor to top line when moving to next page"
-#endif
#define CMT_FOLD_LINE "Fold lines of plain text file"
#define CMT_SHOW_NUM "Show line numbers"
#define CMT_SHOW_SRCH_STR "Show search string"
@@ -311,9 +295,7 @@ static int RC_table_size;
#define CMT_PASSWDFILE "Password file"
#define CMT_PRE_FORM_FILE "File for setting form on loading"
#define CMT_FTPPASS "Password for anonymous FTP (your mail address)"
-#ifdef FTPPASS_HOSTNAMEGEN
#define CMT_FTPPASS_HOSTNAMEGEN "Generate domain part of password for FTP"
-#endif
#define CMT_USERAGENT "User-Agent identification string"
#define CMT_ACCEPTENCODING "Accept-Encoding header"
#define CMT_ACCEPTMEDIA "Accept header"
@@ -575,14 +557,10 @@ struct param_ptr params1[] = {
{"show_lnum", P_INT, PI_ONOFF, (void *)&showLineNum, CMT_SHOW_NUM, NULL},
{"show_srch_str", P_INT, PI_ONOFF, (void *)&show_srch_str,
CMT_SHOW_SRCH_STR, NULL},
-#ifdef LABEL_TOPLINE
{"label_topline", P_INT, PI_ONOFF, (void *)&label_topline,
CMT_LABEL_TOPLINE, NULL},
-#endif
-#ifdef NEXTPAGE_TOPLINE
{"nextpage_topline", P_INT, PI_ONOFF, (void *)&nextpage_topline,
CMT_NEXTPAGE_TOPLINE, NULL},
-#endif
{NULL, 0, 0, NULL, NULL, NULL},
};
@@ -618,6 +596,7 @@ struct param_ptr params2[] = {
struct param_ptr params3[] = {
{"pagerline", P_NZINT, PI_TEXT, (void *)&PagerMax, CMT_PAGERLINE, NULL},
#ifdef USE_HISTORY
+ {"use_history", P_INT, PI_ONOFF, (void *)&UseHistory, CMT_HISTORY, NULL},
{"history", P_INT, PI_TEXT, (void *)&URLHistSize, CMT_HISTSIZE, NULL},
{"save_hist", P_INT, PI_ONOFF, (void *)&SaveURLHist, CMT_SAVEHIST, NULL},
#endif /* USE_HISTORY */
@@ -628,14 +607,10 @@ struct param_ptr params3[] = {
#ifdef USE_MARK
{"mark", P_INT, PI_ONOFF, (void *)&use_mark, CMT_USE_MARK, NULL},
#endif
-#ifdef EMACS_LIKE_LINEEDIT
{"emacs_like_lineedit", P_INT, PI_ONOFF, (void *)&emacs_like_lineedit,
CMT_EMACS_LIKE_LINEEDIT, NULL},
-#endif
-#ifdef VI_PREC_NUM
{"vi_prec_num", P_INT, PI_ONOFF, (void *)&vi_prec_num, CMT_VI_PREC_NUM,
NULL},
-#endif
{"mark_all_pages", P_INT, PI_ONOFF, (void *)&MarkAllPages,
CMT_MARK_ALL_PAGES, NULL},
{"wrap_search", P_INT, PI_ONOFF, (void *)&WrapDefault, CMT_WRAP, NULL},
@@ -766,10 +741,8 @@ struct param_ptr params9[] = {
(void *)&disable_secret_security_check, CMT_DISABLE_SECRET_SECURITY_CHECK,
NULL},
{"ftppasswd", P_STRING, PI_TEXT, (void *)&ftppasswd, CMT_FTPPASS, NULL},
-#ifdef FTPPASS_HOSTNAMEGEN
{"ftppass_hostnamegen", P_INT, PI_ONOFF, (void *)&ftppass_hostnamegen,
CMT_FTPPASS_HOSTNAMEGEN, NULL},
-#endif
{"pre_form_file", P_STRING, PI_TEXT, (void *)&pre_form_file,
CMT_PRE_FORM_FILE, NULL},
{"user_agent", P_STRING, PI_TEXT, (void *)&UserAgent, CMT_USERAGENT, NULL},