aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog21
-rw-r--r--acinclude.m436
-rw-r--r--aclocal.m437
-rw-r--r--anchor.c7
-rw-r--r--config.h.in17
-rwxr-xr-xconfigure175
-rw-r--r--configure.ac7
-rw-r--r--doc-jp/FAQ.html3
-rw-r--r--doc-jp/MANUAL.html1
-rw-r--r--doc-jp/menu.default2
-rw-r--r--doc-jp/menu.submenu2
-rw-r--r--doc/FAQ.html4
-rw-r--r--doc/menu.default2
-rw-r--r--doc/menu.submenu2
-rw-r--r--etc.c26
-rw-r--r--file.c51
-rw-r--r--fm.h5
-rw-r--r--ftp.c19
-rw-r--r--indep.c10
-rw-r--r--istream.c13
-rw-r--r--libwc/detect.c2
-rw-r--r--local.c12
-rw-r--r--main.c378
-rw-r--r--menu.c20
-rw-r--r--parsetagx.c6
-rw-r--r--proto.h7
-rw-r--r--rc.c11
-rw-r--r--scripts/w3mman/w3mman.1.in11
-rw-r--r--scripts/w3mman/w3mman.in5
-rw-r--r--scripts/w3mman/w3mman2html.cgi.in47
-rw-r--r--table.c15
-rw-r--r--terms.c121
-rw-r--r--url.c11
33 files changed, 1000 insertions, 86 deletions
diff --git a/ChangeLog b/ChangeLog
index 9418037..cd0b451 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2006-04-05 Dai Sato <satodai@w3m.jp>
+ * [w3m-dev-en 01060] Some patches
+ * fix many problems with w3m 0.5.1.
+ * http://www.sic.med.tohoku.ac.jp/~satodai/w3m-dev-en/200511.month/1060.html
+ * [w3m-dev 04150] vi_prec_num
+ * main.c: fixed the switching on/off of vi-like prefix.
+ * [w3m-dev 04151] Re: w3m -remote
+ * acinclude.m4, aclocal.m4, config.h.in, configure, configure.ac, main.c, proto.h, terms.c:
+ * added "-remote" option to receive commands from external processes.
+ * [w3m-dev 04152] [PATCH] Add more explanation for the usage of the option setting panel.
+ * doc/FAQ.html, doc-jp/FAQ.html, doc-jp/MANUAL.html: added some explanations.
+ * [w3m-dev 04153] NEXT_LINK error
+ * anchor.c, file.c, fm.h: fixed behavior of NEXT_LINK.
+ * [w3m-dev 04154] Unclosed textarea in table
+ * table.c: added handling </table> tag in textarea.
+ * [w3m-dev 04155] w3m mingw patch
+ * config.h, configure.ac, etc.c, file.c, ftp.c, indep.c, istream.c, local.c, main.c, rc.c, terms.c, url.c:
+ * to compile on MingW. can't handle basic certification.
+
2006-02-10 Dai Sato <satodai@w3m.jp>
* http://dog.w3m.jp/bbs/spool/until200602.html#20060210153135@keijiwan
@@ -8653,4 +8672,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.948 2006/02/10 12:52:23 inu Exp $
+$Id: ChangeLog,v 1.949 2006/04/05 14:18:53 inu Exp $
diff --git a/acinclude.m4 b/acinclude.m4
index e10b7ed..7795139 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -70,6 +70,18 @@ test x"$enable_mouse" = xyes && AC_DEFINE(USE_MOUSE)
AC_MSG_RESULT($enable_mouse)])
#
# ----------------------------------------------------------------
+# AC_W3M_REMOTE
+# ----------------------------------------------------------------
+AC_DEFUN([AC_W3M_REMOTE],
+[AC_SUBST(USE_MOUSE)
+AC_MSG_CHECKING(if remote operation enabled)
+AC_ARG_ENABLE(remote,
+ [ --disable-remote disable remote operation],,
+ [enable_remote="yes"])
+test x"$enable_remote" = xyes && AC_DEFINE(USE_REMOTE)
+AC_MSG_RESULT($enable_remote)])
+#
+# ----------------------------------------------------------------
# AC_W3M_COOKIE
# ----------------------------------------------------------------
AC_DEFUN([AC_W3M_COOKIE],
@@ -877,3 +889,27 @@ AC_DEFUN([AC_W3M_SIGNAL],
else
AC_DEFINE(SIGNAL_RETURN,return 0)
fi])
+#
+# ----------------------------------------------------------------
+# AC_W3M_SO_PEERCRED
+# ----------------------------------------------------------------
+AC_DEFUN([AC_W3M_SO_PEERCRED],
+[AC_SUBST(HAVE_SO_PEERCRED)
+AC_MSG_CHECKING(for SO_PEERCRED)
+AC_TRY_COMPILE(
+[#include <sys/socket.h>],
+[ int sopt = SO_PEERCRED;
+ exit(sopt);],
+[have_so_peercred="yes"; AC_DEFINE(HAVE_SO_PEERCRED)],
+[have_so_peercred="no"])
+AC_MSG_RESULT($have_so_peercred)])
+#
+# ----------------------------------------------------------------
+# AC_W3M_GETPEEREID
+# ----------------------------------------------------------------
+AC_DEFUN([AC_W3M_GETPEEREID],
+[AC_SUBST(HAVE_GETPEEREID)
+AC_MSG_CHECKING(for getpeereid)
+AC_CHECK_FUNC(getpeereid,
+[have_getpeereid="yes"; AC_DEFINE(HAVE_GETPEEREID)],
+[have_getpeereid="no"])])
diff --git a/aclocal.m4 b/aclocal.m4
index 957a741..0da2da9 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -82,6 +82,18 @@ test x"$enable_mouse" = xyes && AC_DEFINE(USE_MOUSE)
AC_MSG_RESULT($enable_mouse)])
#
# ----------------------------------------------------------------
+# AC_W3M_REMOTE
+# ----------------------------------------------------------------
+AC_DEFUN([AC_W3M_REMOTE],
+[AC_SUBST(USE_MOUSE)
+AC_MSG_CHECKING(if remote operation enabled)
+AC_ARG_ENABLE(remote,
+ [ --disable-remote disable remote operation],,
+ [enable_remote="yes"])
+test x"$enable_remote" = xyes && AC_DEFINE(USE_REMOTE)
+AC_MSG_RESULT($enable_remote)])
+#
+# ----------------------------------------------------------------
# AC_W3M_COOKIE
# ----------------------------------------------------------------
AC_DEFUN([AC_W3M_COOKIE],
@@ -890,6 +902,31 @@ AC_DEFUN([AC_W3M_SIGNAL],
AC_DEFINE(SIGNAL_RETURN,return 0)
fi])
+#
+# ----------------------------------------------------------------
+# AC_W3M_SO_PEERCRED
+# ----------------------------------------------------------------
+AC_DEFUN([AC_W3M_SO_PEERCRED],
+[AC_SUBST(HAVE_SO_PEERCRED)
+AC_MSG_CHECKING(for SO_PEERCRED)
+AC_TRY_COMPILE(
+[#include <sys/socket.h>],
+[ int sopt = SO_PEERCRED;
+ exit(sopt);],
+[have_so_peercred="yes"; AC_DEFINE(HAVE_SO_PEERCRED)],
+[have_so_peercred="no"])
+AC_MSG_RESULT($have_so_peercred)])
+#
+# ----------------------------------------------------------------
+# AC_W3M_GETPEEREID
+# ----------------------------------------------------------------
+AC_DEFUN([AC_W3M_GETPEEREID],
+[AC_SUBST(HAVE_GETPEEREID)
+AC_MSG_CHECKING(for getpeereid)
+AC_CHECK_FUNC(getpeereid,
+[have_getpeereid="yes"; AC_DEFINE(HAVE_GETPEEREID)],
+[have_getpeereid="no"])])
+
# lib-prefix.m4 serial 3 (gettext-0.13)
dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
diff --git a/anchor.c b/anchor.c
index 5211048..0aa21c1 100644
--- a/anchor.c
+++ b/anchor.c
@@ -1,4 +1,4 @@
-/* $Id: anchor.c,v 1.30 2003/09/26 17:59:51 ukai Exp $ */
+/* $Id: anchor.c,v 1.31 2006/04/05 14:18:53 inu Exp $ */
#include "fm.h"
#include "myctype.h"
#include "regex.h"
@@ -175,6 +175,8 @@ searchAnchor(AnchorList *al, char *str)
return NULL;
for (i = 0; i < al->nanchor; i++) {
a = &al->anchors[i];
+ if (a->hseq < 0)
+ continue;
if (!strcmp(a->url, str))
return a;
}
@@ -471,6 +473,7 @@ putHmarker(HmarkerList *ml, int line, int pos, int seq)
}
ml->marks[seq].line = line;
ml->marks[seq].pos = pos;
+ ml->marks[seq].invalid = 0;
return ml;
}
@@ -778,7 +781,7 @@ link_list_panel(Buffer *buf)
al = buf->href;
for (i = 0; i < al->nanchor; i++) {
a = &al->anchors[i];
- if (a->slave)
+ if (a->hseq < 0 || a->slave)
continue;
parseURL2(a->url, &pu, baseURL(buf));
p = parsedURL2Str(&pu)->ptr;
diff --git a/config.h.in b/config.h.in
index 09283fa..253af43 100644
--- a/config.h.in
+++ b/config.h.in
@@ -53,6 +53,7 @@
#undef USE_MIGEMO
#define USE_MARK
#undef USE_MOUSE
+#undef USE_REMOTE
#undef USE_GPM
#undef USE_SYSMOUSE
#undef USE_MENU
@@ -143,6 +144,8 @@ typedef long clen_t;
#undef HAVE_SETPGRP
#undef HAVE_SETLOCALE
#undef HAVE_LANGINFO_CODESET
+#undef HAVE_SO_PEERCRED
+#undef HAVE_GETPEEREID
#undef SETPGRP_VOID
#ifdef HAVE_SETPGRP
@@ -166,9 +169,15 @@ typedef RETSIGTYPE MySignalHandler;
#define SIGNAL_RETURN @SIGNAL_RETURN@
#ifdef HAVE_SIGSETJMP
+#ifdef __MINGW32_VERSION
+# define SETJMP(env) setjmp(env)
+# define LONGJMP(env,val) longjmp(env, val)
+# define JMP_BUF jmp_buf
+#else
# define SETJMP(env) sigsetjmp(env,1)
# define LONGJMP(env,val) siglongjmp(env,val)
# define JMP_BUF sigjmp_buf
+#endif /* __MINGW32_VERSION */
#else
# define SETJMP(env) setjmp(env)
# define LONGJMP(env,val) longjmp(env)
@@ -233,4 +242,12 @@ typedef RETSIGTYPE MySignalHandler;
#define BUNZIP2_NAME "bunzip2"
#define INFLATE_NAME "inflate"
+#ifdef __MINGW32_VERSION
+#define SIGKILL SIGTERM
+#define S_IXGRP 0
+#define S_IXOTH 0
+#define S_IRWXG 0
+#define S_IRWXO 0
+#endif /* __MINGW32_VERSION */
+
#endif /* CONFIG_H_SEEN */
diff --git a/configure b/configure
index 0607e3a..93b2ed6 100755
--- a/configure
+++ b/configure
@@ -310,7 +310,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION W3M W3M_LANG AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB PERL NKF MAN build build_cpu build_vendor build_os host host_cpu host_vendor host_os W3M_TARGET W3M_LIBS USE_M17N USE_UNICODE WCTARGET WCCFLAGS DISPLAY_CHARSET SYSTEM_CHARSET DOCUMENT_CHARSET POSUBST POLANG MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB INTLTARGET NLSTARGET USE_COLOR USE_ANSI_COLOR USE_BG_COLOR USE_IMAGE USE_W3MIMG_X11 USE_W3MIMG_FB W3MIMGDISPLAY_SETUID INSTALL_W3MIMGDISPLAY USE_GDKPIXBUF USE_GTK2 USE_IMLIB USE_IMLIB2 IMGTARGETS IMGOBJS IMGX11CFLAGS IMGX11LDFLAGS IMGFBCFLAGS IMGFBLDFLAGS USE_XFACE uncompface KEYMAP_FILE HELP_FILE KEYBIND USE_MENU USE_MOUSE USE_HISTORY USE_ALARM USE_COOKIE USE_DIGEST_AUTH USE_NNTP USE_GOPHER USE_DICT USE_HELP_CGI USE_EXTERNAL_URI_LOADER USE_W3MMAILER USE_MIGEMO DEF_MIGEMO_COMMAND DEF_EDITOR DEF_MAILER DEF_EXT_BROWSER INET6 HAVE_OLD_SS_FAMILY USE_SSL USE_SSL_VERIFY PKG_CONFIG SSL_CFLAGS SSL_LIBS USE_W3M USE_SYSMOUSE AUXBIN_TARGETS EGREP USE_BINMODE_STREAM HAVE_SYS_ERRLIST HAVE_SIGSETJMP RETSIGTYPE SIGNAL_RETURN HELP_DIR RC_DIR DOCDIRS CURRENT_VERSION LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION W3M W3M_LANG AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB PERL NKF MAN build build_cpu build_vendor build_os host host_cpu host_vendor host_os W3M_TARGET W3M_LIBS USE_M17N USE_UNICODE WCTARGET WCCFLAGS DISPLAY_CHARSET SYSTEM_CHARSET DOCUMENT_CHARSET POSUBST POLANG MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB INTLTARGET NLSTARGET USE_COLOR USE_ANSI_COLOR USE_BG_COLOR USE_IMAGE USE_W3MIMG_X11 USE_W3MIMG_FB W3MIMGDISPLAY_SETUID INSTALL_W3MIMGDISPLAY USE_GDKPIXBUF USE_GTK2 USE_IMLIB USE_IMLIB2 IMGTARGETS IMGOBJS IMGX11CFLAGS IMGX11LDFLAGS IMGFBCFLAGS IMGFBLDFLAGS USE_XFACE uncompface KEYMAP_FILE HELP_FILE KEYBIND USE_MENU USE_MOUSE USE_HISTORY USE_ALARM USE_COOKIE USE_DIGEST_AUTH USE_NNTP USE_GOPHER USE_DICT USE_HELP_CGI USE_EXTERNAL_URI_LOADER USE_W3MMAILER USE_MIGEMO DEF_MIGEMO_COMMAND DEF_EDITOR DEF_MAILER DEF_EXT_BROWSER INET6 HAVE_OLD_SS_FAMILY USE_SSL USE_SSL_VERIFY PKG_CONFIG SSL_CFLAGS SSL_LIBS USE_W3M USE_SYSMOUSE AUXBIN_TARGETS EGREP USE_BINMODE_STREAM HAVE_SYS_ERRLIST HAVE_SIGSETJMP RETSIGTYPE SIGNAL_RETURN HAVE_SO_PEERCRED HAVE_GETPEEREID HELP_DIR RC_DIR DOCDIRS CURRENT_VERSION LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -866,6 +866,7 @@ Optional Features:
--disable-mouse disable mouse operation
--disable-history disable URL history
--disable-alarm disable alarm
+ --disable-remote disable remote operation
--disable-cookie disable cookie
--disable-digest-auth disable digest auth
--disable-nntp disable NNTP
@@ -5502,6 +5503,22 @@ fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:$LINENO: checking if remote operation enabled" >&5
+echo $ECHO_N "checking if remote operation enabled... $ECHO_C" >&6
+# Check whether --enable-remote or --disable-remote was given.
+if test "${enable_remote+set}" = set; then
+ enableval="$enable_remote"
+
+else
+ enable_remote="yes"
+fi;
+test x"$enable_remote" = xyes && cat >>confdefs.h <<\_ACEOF
+#define USE_REMOTE 1
+_ACEOF
+
+echo "$as_me:$LINENO: result: $enable_remote" >&5
+echo "${ECHO_T}$enable_remote" >&6
+
echo "$as_me:$LINENO: checking if cookie is enabled" >&5
echo $ECHO_N "checking if cookie is enabled... $ECHO_C" >&6
@@ -10256,6 +10273,160 @@ _ACEOF
fi
+echo "$as_me:$LINENO: checking for SO_PEERCRED" >&5
+echo $ECHO_N "checking for SO_PEERCRED... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/socket.h>
+int
+main ()
+{
+ int sopt = SO_PEERCRED;
+ exit(sopt);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ have_so_peercred="yes"; cat >>confdefs.h <<\_ACEOF
+#define HAVE_SO_PEERCRED 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+have_so_peercred="no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $have_so_peercred" >&5
+echo "${ECHO_T}$have_so_peercred" >&6
+
+echo "$as_me:$LINENO: checking for getpeereid" >&5
+echo $ECHO_N "checking for getpeereid... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for getpeereid" >&5
+echo $ECHO_N "checking for getpeereid... $ECHO_C" >&6
+if test "${ac_cv_func_getpeereid+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define getpeereid to an innocuous variant, in case <limits.h> declares getpeereid.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define getpeereid innocuous_getpeereid
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getpeereid (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef getpeereid
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char getpeereid ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_getpeereid) || defined (__stub___getpeereid)
+choke me
+#else
+char (*f) () = getpeereid;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != getpeereid;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_getpeereid=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_getpeereid=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_getpeereid" >&5
+echo "${ECHO_T}$ac_cv_func_getpeereid" >&6
+if test $ac_cv_func_getpeereid = yes; then
+ have_getpeereid="yes"; cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETPEEREID 1
+_ACEOF
+
+else
+ have_getpeereid="no"
+fi
+
+
HELP_DIR="$datadir/$PACKAGE"
cat >>confdefs.h <<\_ACEOF
@@ -11042,6 +11213,8 @@ s,@HAVE_SYS_ERRLIST@,$HAVE_SYS_ERRLIST,;t t
s,@HAVE_SIGSETJMP@,$HAVE_SIGSETJMP,;t t
s,@RETSIGTYPE@,$RETSIGTYPE,;t t
s,@SIGNAL_RETURN@,$SIGNAL_RETURN,;t t
+s,@HAVE_SO_PEERCRED@,$HAVE_SO_PEERCRED,;t t
+s,@HAVE_GETPEEREID@,$HAVE_GETPEEREID,;t t
s,@HELP_DIR@,$HELP_DIR,;t t
s,@RC_DIR@,$RC_DIR,;t t
s,@DOCDIRS@,$DOCDIRS,;t t
diff --git a/configure.ac b/configure.ac
index 9277a94..c242d08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,7 @@ AC_W3M_MENU
AC_W3M_MOUSE
AC_W3M_HISTORY
AC_W3M_ALARM
+AC_W3M_REMOTE
AC_W3M_COOKIE
AC_W3M_DIGEST_AUTH
@@ -83,7 +84,7 @@ AC_W3M_MAILER
AC_W3M_EXT_BROWSER
dnl Checks for ext libs
-for lib in bsd BSD 44bsd socket nsl dld dl
+for lib in bsd BSD 44bsd socket dld
do
AC_W3M_EXTLIBS($lib)
done
@@ -110,7 +111,7 @@ AC_DEFINE(AUXBIN_TARGETS, "$AUXBIN_TARGETS")
AC_SUBST(USE_BINMODE_STREAM)
case "$host_os" in
- *cygwin*|*os2-emx*)
+ *cygwin*|*os2-emx*|*mingw*)
AC_DEFINE(USE_BINMODE_STREAM)
;;
esac
@@ -152,6 +153,8 @@ AM_LANGINFO_CODESET
AC_W3M_SYS_ERRLIST
AC_W3M_SIGSETJMP
AC_W3M_SIGNAL
+AC_W3M_SO_PEERCRED
+AC_W3M_GETPEEREID
AC_SUBST(HELP_DIR)
HELP_DIR="$datadir/$PACKAGE"
diff --git a/doc-jp/FAQ.html b/doc-jp/FAQ.html
index d74b35d..e16a986 100644
--- a/doc-jp/FAQ.html
+++ b/doc-jp/FAQ.html
@@ -222,6 +222,9 @@ application/x-dvi; xdvi %s
<dl>
<dt>設定ファイルはどこにあるの?
<dd>~/.w3m ディレクトリの下の config です.
+オプション設定パネルで変更できると記述されているオプションの値を
+このファイルで変更すると,w3m の挙動を調整できます.
+オプションの名前と値を空白で区切ったものを 1 行に 1 組ずつ書いて設定します.
<p>
<dt>~/.w3m の下に w3mXXXXXX のようなファイルがたくさんあるけど,何?
<dd>WWWサーバからファイルを読んでいるときに,それを一時的に保存する
diff --git a/doc-jp/MANUAL.html b/doc-jp/MANUAL.html
index 9dab5d9..0b24619 100644
--- a/doc-jp/MANUAL.html
+++ b/doc-jp/MANUAL.html
@@ -97,6 +97,7 @@ HTMLファイルのソースを表示する
<dd>折り返しサーチを使うかどうかを切りかえる.
<dt>-o option=value
<dd>オプションを指定する.
+オプションの名前や値は,~/.w3m/config で指定するものと同じ.
<dt>-no-proxy
<dd>プロキシを利用しない.
<dt>-pauth user:pass
diff --git a/doc-jp/menu.default b/doc-jp/menu.default
index 67f0361..fea90ec 100644
--- a/doc-jp/menu.default
+++ b/doc-jp/menu.default
@@ -1,7 +1,7 @@
# A sample of ~/.w3m/menu (default)
#
# menu MENU_ID
-# func LABEL FUNCTION KEYS
+# func LABEL FUNCTION KEYS FUNCTION_ARGUMENT
# popup LABEL MENU_ID KEYS
# nop LABEL
# end
diff --git a/doc-jp/menu.submenu b/doc-jp/menu.submenu
index 062fac1..f33ba1a 100644
--- a/doc-jp/menu.submenu
+++ b/doc-jp/menu.submenu
@@ -1,7 +1,7 @@
# A sample of ~/.w3m/menu (submenu type)
#
# menu MENU_ID
-# func LABEL FUNCTION KEYS
+# func LABEL FUNCTION KEYS FUNCTION_ARGUMENT
# popup LABEL MENU_ID KEYS
# nop LABEL
# end
diff --git a/doc/FAQ.html b/doc/FAQ.html
index a3e0cfc..50478e3 100644
--- a/doc/FAQ.html
+++ b/doc/FAQ.html
@@ -270,6 +270,10 @@ with Ctrl-u. What to do?</h3>
<dl>
<dt><h3>What is w3m's configuration file?</h3>
<dd>It is ~/.w3m/config.
+With this file, you can adjust w3m's behavior by changing values of options
+that are described to be varied with the option setting panel.
+Each line contains setting for one option, which is a pair of an option name
+and its value with a space as a separator.
<p>
<dt><h3>What are these w3mxxxx files in my ~/.w3m directory for?</h3>
<dd>These are temporary files used by w3m when reading documents from a
diff --git a/doc/menu.default b/doc/menu.default
index 43c8341..cbb157e 100644
--- a/doc/menu.default
+++ b/doc/menu.default
@@ -1,7 +1,7 @@
# A sample of ~/.w3m/menu (default)
#
# menu MENU_ID
-# func LABEL FUNCTION KEYS
+# func LABEL FUNCTION KEYS FUNCTION_ARGUMENT
# popup LABEL MENU_ID KEYS
# nop LABEL
# end
diff --git a/doc/menu.submenu b/doc/menu.submenu
index e55193d..fb960aa 100644
--- a/doc/menu.submenu
+++ b/doc/menu.submenu
@@ -1,7 +1,7 @@
# A sample of ~/.w3m/menu (submenu type)
#
# menu MENU_ID
-# func LABEL FUNCTION KEYS
+# func LABEL FUNCTION KEYS FUNCTION_ARGUMENT
# popup LABEL MENU_ID KEYS
# nop LABEL
# end
diff --git a/etc.c b/etc.c
index bed8292..5c9f35d 100644
--- a/etc.c
+++ b/etc.c
@@ -1,6 +1,8 @@
-/* $Id: etc.c,v 1.78 2004/04/16 18:47:19 ukai Exp $ */
+/* $Id: etc.c,v 1.79 2006/04/05 14:18:54 inu Exp $ */
#include "fm.h"
+#ifndef __MINGW32_VERSION
#include <pwd.h>
+#endif
#include "myctype.h"
#include "html.h"
#include "local.h"
@@ -1310,9 +1312,13 @@ romanAlphabet(int n)
static void
reset_signals(void)
{
+#ifdef SIGHUP
mySignal(SIGHUP, SIG_DFL); /* terminate process */
+#endif
mySignal(SIGINT, SIG_DFL); /* terminate process */
+#ifdef SIGQUIT
mySignal(SIGQUIT, SIG_DFL); /* terminate process */
+#endif
mySignal(SIGTERM, SIG_DFL); /* terminate process */
mySignal(SIGILL, SIG_DFL); /* create core image */
mySignal(SIGIOT, SIG_DFL); /* create core image */
@@ -1355,8 +1361,10 @@ setup_child(int child, int i, int f)
{
reset_signals();
mySignal(SIGINT, SIG_IGN);
+#ifndef __MINGW32_VERSION
if (!child)
SETPGRP();
+#endif /* __MINGW32_VERSION */
close_tty();
close_all_fds_except(i, f);
QuietMessage = TRUE;
@@ -1364,6 +1372,7 @@ setup_child(int child, int i, int f)
TrapSignal = FALSE;
}
+#ifndef __MINGW32_VERSION
pid_t
open_pipe_rw(FILE ** fr, FILE ** fw)
{
@@ -1421,6 +1430,7 @@ open_pipe_rw(FILE ** fr, FILE ** fw)
err0:
return (pid_t) - 1;
}
+#endif /* __MINGW32_VERSION */
void
myExec(char *command)
@@ -1433,6 +1443,7 @@ myExec(char *command)
void
mySystem(char *command, int background)
{
+#ifndef __MINGW32_VERSION
if (background) {
#ifndef __EMX__
flush_tty();
@@ -1447,6 +1458,7 @@ mySystem(char *command, int background)
#endif
}
else
+#endif /* __MINGW32_VERSION */
system(command);
}
@@ -1516,6 +1528,13 @@ myEditor(char *cmd, char *file, int line)
return tmp;
}
+#ifdef __MINGW32_VERSION
+char *
+expandName(char *name)
+{
+ return getenv("HOME");
+}
+#else
char *
expandName(char *name)
{
@@ -1559,6 +1578,7 @@ expandName(char *name)
rest:
return name;
}
+#endif
char *
file_to_url(char *file)
@@ -1898,7 +1918,11 @@ mymktime(char *timestr)
#ifdef INET6
#include <sys/socket.h>
#endif /* INET6 */
+#ifndef __MINGW32_VERSION
#include <netdb.h>
+#else
+#include <winsock.h>
+#endif
char *
FQDN(char *host)
{
diff --git a/file.c b/file.c
index 3318681..1492a49 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.238 2006/02/09 12:49:52 inu Exp $ */
+/* $Id: file.c,v 1.239 2006/04/05 14:18:54 inu Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -50,7 +50,7 @@ static struct table_mode table_mode[MAX_TABLE];
#ifdef USE_IMAGE
static ParsedURL *cur_baseURL = NULL;
#ifdef USE_M17N
-static char cur_document_charset;
+static wc_ces cur_document_charset;
#endif
#endif
@@ -836,13 +836,15 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
}
if (pu && name->length > 0) {
int err;
- if (flag & COO_SECURE)
- disp_message_nsec("Received a secured cookie", FALSE, 1,
+ if (show_cookie) {
+ if (flag & COO_SECURE)
+ disp_message_nsec("Received a secured cookie", FALSE, 1,
TRUE, FALSE);
- else
- disp_message_nsec(Sprintf("Received cookie: %s=%s",
+ else
+ disp_message_nsec(Sprintf("Received cookie: %s=%s",
name->ptr, value->ptr)->ptr,
FALSE, 1, TRUE, FALSE);
+ }
err =
add_cookie(pu, name, value, expires, domain, path, flag,
comment, version, port, commentURL);
@@ -874,10 +876,12 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
emsg =
"This cookie was rejected to prevent security violation.";
record_err_message(emsg);
- disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
+ if (show_cookie)
+ disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
}
else
- disp_message_nsec(Sprintf
+ if (show_cookie)
+ disp_message_nsec(Sprintf
("Accepting invalid cookie: %s=%s",
name->ptr, value->ptr)->ptr, FALSE,
1, TRUE, FALSE);
@@ -1599,9 +1603,17 @@ getAuthCookie(struct http_auth *hauth, char *auth_header,
getpassphrase(proxy ? "Proxy Password: " :
"Password: "));
#else
+#ifndef __MINGW32_VERSION
*pwd = Strnew_charp((char *)
getpass(proxy ? "Proxy Password: " :
"Password: "));
+#else
+ term_raw();
+ *pwd = Strnew_charp((char *)
+ inputLine(proxy ? "Proxy Password: " :
+ "Password: ", NULL, IN_PASSWORD));
+ term_cbreak();
+#endif /* __MINGW32_VERSION */
#endif
}
}
@@ -5281,6 +5293,17 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
buf->hmarklist =
putHmarker(buf->hmarklist, currentLn(buf),
pos, hseq - 1);
+ else if (hseq < 0) {
+ int h = -hseq - 1;
+ if (buf->hmarklist &&
+ h < buf->hmarklist->nmark &&
+ buf->hmarklist->marks[h].invalid) {
+ buf->hmarklist->marks[h].pos = pos;
+ buf->hmarklist->marks[h].line = currentLn(buf);
+ buf->hmarklist->marks[h].invalid = 0;
+ hseq = -hseq;
+ }
+ }
if (id && idFrame)
idFrame->body->nameList =
putAnchor(idFrame->body->nameList, id, NULL,
@@ -5300,8 +5323,12 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
a_href->end.line = currentLn(buf);
a_href->end.pos = pos;
if (a_href->start.line == a_href->end.line &&
- a_href->start.pos == a_href->end.pos)
+ a_href->start.pos == a_href->end.pos) {
+ if (buf->hmarklist &&
+ a_href->hseq < buf->hmarklist->nmark)
+ buf->hmarklist->marks[a_href->hseq].invalid = 1;
a_href->hseq = -1;
+ }
a_href = NULL;
}
break;
@@ -7670,6 +7697,7 @@ _MoveFile(char *path1, char *path2)
int
_doFileCopy(char *tmpf, char *defstr, int download)
{
+#ifndef __MINGW32_VERSION
Str msg;
Str filen;
char *p, *q = NULL;
@@ -7776,6 +7804,7 @@ _doFileCopy(char *tmpf, char *defstr, int download)
if (PreserveTimestamp && !is_pipe && !stat(tmpf, &st))
setModtime(p, st.st_mtime);
}
+#endif /* __MINGW32_VERSION */
return 0;
}
@@ -7790,6 +7819,7 @@ doFileMove(char *tmpf, char *defstr)
int
doFileSave(URLFile uf, char *defstr)
{
+#ifndef __MINGW32_VERSION
Str msg;
Str filen;
char *p, *q;
@@ -7875,6 +7905,7 @@ doFileSave(URLFile uf, char *defstr)
if (PreserveTimestamp && uf.modtime != -1)
setModtime(p, uf.modtime);
}
+#endif /* __MINGW32_VERSION */
return 0;
}
@@ -7945,6 +7976,7 @@ inputAnswer(char *prompt)
static void
uncompress_stream(URLFile *uf, char **src)
{
+#ifndef __MINGW32_VERSION
pid_t pid1;
FILE *f1;
char *expand_cmd = GUNZIP_CMDNAME;
@@ -8028,6 +8060,7 @@ uncompress_stream(URLFile *uf, char **src)
}
UFhalfclose(uf);
uf->stream = newFileStream(f1, (void (*)())fclose);
+#endif /* __MINGW32_VERSION */
}
static FILE *
diff --git a/fm.h b/fm.h
index 288426a..370dd3c 100644
--- a/fm.h
+++ b/fm.h
@@ -1,4 +1,4 @@
-/* $Id: fm.h,v 1.127 2004/07/15 16:44:37 ukai Exp $ */
+/* $Id: fm.h,v 1.128 2006/04/05 14:18:54 inu Exp $ */
/*
* w3m: WWW wo Miru utility
*
@@ -336,6 +336,7 @@ typedef struct _Line {
typedef struct {
int line;
int pos;
+ int invalid;
} BufferPoint;
#ifdef USE_IMAGE
@@ -867,7 +868,6 @@ global int TabCols init(10);
global DownloadList *FirstDL init(NULL);
global DownloadList *LastDL init(NULL);
global int CurrentKey;
-global char *CurrentKeyData;
global char *CurrentCmdData;
extern char *w3m_version;
@@ -1076,6 +1076,7 @@ global MouseAction mouse_action;
#ifdef USE_COOKIE
global int default_use_cookie init(TRUE);
global int use_cookie init(FALSE);
+global int show_cookie init(TRUE);
global int accept_cookie init(FALSE);
#define ACCEPT_BAD_COOKIE_DISCARD 0
#define ACCEPT_BAD_COOKIE_ACCEPT 1
diff --git a/ftp.c b/ftp.c
index e54dc3b..957ba6c 100644
--- a/ftp.c
+++ b/ftp.c
@@ -1,6 +1,8 @@
-/* $Id: ftp.c,v 1.35 2004/04/16 18:47:19 ukai Exp $ */
+/* $Id: ftp.c,v 1.36 2006/04/05 14:18:54 inu Exp $ */
#include <stdio.h>
+#ifndef __MINGW32_VERSION
#include <pwd.h>
+#endif /* __MINGW32_VERSION */
#include <Str.h>
#include <signal.h>
#include <setjmp.h>
@@ -14,10 +16,14 @@
#include <malloc.h>
#endif /* DEBUG */
+#ifndef __MINGW32_VERSION
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
+#else
+#include <winsock.h>
+#endif /* __MINGW32_VERSION */
typedef struct _FTP {
char *host;
@@ -371,7 +377,14 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
term_cbreak();
}
else {
+#ifndef __MINGW32_VERSION
pwd = Strnew_charp((char *)getpass("Password: "));
+#else
+ term_raw();
+ pwd = Strnew_charp(inputLine("Password: ", NULL, IN_PASSWORD));
+ pwd = Str_conv_to_system(pwd);
+ term_cbreak();
+#endif /* __MINGW32_VERSION */
}
add_auth_cookie_flag = TRUE;
}
@@ -380,8 +393,12 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
else if (ftppasswd != NULL && *ftppasswd != '\0')
pass = ftppasswd;
else {
+#ifndef __MINGW32_VERSION
struct passwd *mypw = getpwuid(getuid());
tmp = Strnew_charp(mypw ? mypw->pw_name : "anonymous");
+#else
+ tmp = Strnew_charp("anonymous");
+#endif __MINGW32_VERSION
Strcat_char(tmp, '@');
pass = tmp->ptr;
}
diff --git a/indep.c b/indep.c
index 6478271..dc864fc 100644
--- a/indep.c
+++ b/indep.c
@@ -1,7 +1,9 @@
-/* $Id: indep.c,v 1.35 2004/04/09 17:18:49 ukai Exp $ */
+/* $Id: indep.c,v 1.36 2006/04/05 14:18:54 inu Exp $ */
#include "fm.h"
#include <stdio.h>
+#ifndef __MINGW32_VERSION
#include <pwd.h>
+#endif /* __MINGW32_VERSION */
#include <sys/param.h>
#include <sys/types.h>
#include <stdlib.h>
@@ -225,6 +227,7 @@ expandPath(char *name)
p = name;
if (*p == '~') {
p++;
+#ifndef __MINGW32_VERSION
if (IS_ALPHA(*p)) {
char *q = strchr(p, '/');
if (q) { /* ~user/dir... */
@@ -238,8 +241,9 @@ expandPath(char *name)
if (!passent)
goto rest;
extpath = Strnew_charp(passent->pw_dir);
- }
- else if (*p == '/' || *p == '\0') { /* ~/dir... or ~ */
+ } else
+#endif /* __MINGW32_VERSION */
+ if (*p == '/' || *p == '\0') { /* ~/dir... or ~ */
extpath = Strnew_charp(getenv("HOME"));
}
else
diff --git a/istream.c b/istream.c
index fe5847b..3344ab3 100644
--- a/istream.c
+++ b/istream.c
@@ -1,4 +1,4 @@
-/* $Id: istream.c,v 1.23 2003/10/20 16:41:56 ukai Exp $ */
+/* $Id: istream.c,v 1.24 2006/04/05 14:18:54 inu Exp $ */
#include "fm.h"
#include "myctype.h"
#include "istream.h"
@@ -6,6 +6,9 @@
#ifdef USE_SSL
#include <openssl/x509v3.h>
#endif
+#ifdef __MINGW32_VERSION
+#include <winsock.h>
+#endif
#define uchar unsigned char
@@ -617,13 +620,21 @@ ssl_get_certificate(SSL * ssl, char *hostname)
static void
basic_close(int *handle)
{
+#ifdef __MINGW32_VERSION
+ closesocket(*(int *)handle);
+#else
close(*(int *)handle);
+#endif
}
static int
basic_read(int *handle, char *buf, int len)
{
+#ifdef __MINGW32_VERSION
+ return recv(*(int *)handle, buf, len, 0);
+#else
return read(*(int *)handle, buf, len);
+#endif
}
static void
diff --git a/libwc/detect.c b/libwc/detect.c
index eea2d5d..3fdf980 100644
--- a/libwc/detect.c
+++ b/libwc/detect.c
@@ -99,7 +99,7 @@ wc_auto_detect(char *is, size_t len, wc_ces hint)
for (; p < ep && ! WC_DETECT_MAP[*p]; p++)
;
if (p == ep)
- return WC_CES_US_ASCII;
+ return hint;
switch (hint) {
case WC_CES_ISO_2022_JP:
diff --git a/local.c b/local.c
index b1e388d..e3b9260 100644
--- a/local.c
+++ b/local.c
@@ -1,4 +1,4 @@
-/* $Id: local.c,v 1.31 2003/09/26 17:59:51 ukai Exp $ */
+/* $Id: local.c,v 1.32 2006/04/05 14:18:54 inu Exp $ */
#include "fm.h"
#include <string.h>
#include <stdio.h>
@@ -16,6 +16,10 @@
#include "local.h"
#include "hash.h"
+#ifdef __MINGW32_VERSION
+#include <winsock.h>
+#endif
+
#define CGIFN_NORMAL 0
#define CGIFN_LIBDIR 1
#define CGIFN_CGIBIN 2
@@ -193,8 +197,10 @@ check_local_cgi(char *file, int status)
return -1;
if (S_ISDIR(st.st_mode))
return -1;
+#ifndef __MINGW32_VERSION
if ((st.st_uid == geteuid() && (st.st_mode & S_IXUSR)) || (st.st_gid == getegid() && (st.st_mode & S_IXGRP)) || (st.st_mode & S_IXOTH)) /* executable */
return 0;
+#endif
return -1;
}
@@ -353,6 +359,9 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer)
pid_t pid;
char *file = uri, *name = uri, *path_info = NULL, *tmpf = NULL;
+#ifdef __MINGW32_VERSION
+ return NULL;
+#else
status = cgi_filename(uri, &file, &name, &path_info);
if (check_local_cgi(file, status) < 0)
return NULL;
@@ -412,4 +421,5 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer)
file, mybasename(file), strerror(errno));
exit(1);
return NULL;
+#endif
}
diff --git a/main.c b/main.c
index 24201a9..3e944fb 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.247 2005/02/26 17:06:44 ukai Exp $ */
+/* $Id: main.c,v 1.248 2006/04/05 14:18:54 inu Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -14,6 +14,13 @@
#include "terms.h"
#include "myctype.h"
#include "regex.h"
+
+#ifdef USE_REMOTE
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <dirent.h>
+#endif
+
#ifdef USE_MOUSE
#ifdef USE_GPM
#include <gpm.h>
@@ -24,6 +31,12 @@ extern int do_getch();
#endif /* defined(USE_GPM) || defined(USE_SYSMOUSE) */
#endif
+#ifdef __MINGW32_VERSION
+#include <winsock.h>
+
+WSADATA WSAData;
+#endif
+
#define DSTR_LEN 256
Hist *LoadHist;
@@ -65,7 +78,11 @@ static char *MarkString = NULL;
static char *SearchString = NULL;
int (*searchRoutine) (Buffer *, char *);
+#ifndef __MINGW32_VERSION
JMP_BUF IntReturn;
+#else
+_JBTYPE IntReturn[_JBLEN];
+#endif /* __MINGW32_VERSION */
static void delBuffer(Buffer *buf);
static void cmd_loadfile(char *path);
@@ -104,6 +121,19 @@ static int searchKeyNum(void);
#define help() fusage(stdout, 0)
#define usage() fusage(stderr, 1)
+#ifdef USE_REMOTE
+static int open_remote(int id);
+static void execute_remote(int sock, char *arg);
+static Str find_sock(int pid);
+static int init_serv(void);
+static int init_remote(char *prefix);
+static void parse_sock_data(void);
+static Str SockName;
+static int SockFd = -1, UseRemote = FALSE, ExecuteRemote = FALSE, RemoteId = -1;
+struct sockaddr_un SockAddr;
+socklen_t SockLength;
+#endif
+
static void
fversion(FILE * f)
{
@@ -134,6 +164,9 @@ fversion(FILE * f)
",sysmouse"
#endif
#endif
+#ifdef USE_REMOTE
+ ",remote"
+#endif
#ifdef USE_MENU
",menu"
#endif
@@ -229,6 +262,11 @@ fusage(FILE * f, int err)
#ifdef USE_MOUSE
fprintf(f, " -no-mouse don't use mouse\n");
#endif /* USE_MOUSE */
+#ifdef USE_REMOTE
+ fprintf(f, " -enable_remote accept remote operation\n");
+ fprintf(f, " -remote command execute command in an already running w3m process\n");
+ fprintf(f, " -remote_id pid select a w3m to control with -remote option\n");
+#endif /* USE_MOUSE */
#ifdef USE_COOKIE
fprintf(f,
" -cookie use cookie (-no-cookie: don't use cookie)\n");
@@ -727,6 +765,33 @@ main(int argc, char **argv, char **envp)
else if (!strcmp("-dummy", argv[i])) {
/* do nothing */
}
+#ifdef USE_REMOTE
+ else if (!strcmp("-enable_remote", argv[i])) {
+ UseRemote = TRUE;
+ }
+ else if (!strcmp("-remote_id", argv[i])) {
+ if (++i >= argc)
+ usage();
+ RemoteId = atoi(argv[i]);
+ }
+ else if (!strcmp("-remote", argv[i])) {
+ ExecuteRemote = TRUE;
+
+ SockFd = open_remote(RemoteId);
+ if (SockFd < 0) {
+ fprintf(stderr, "Can't find w3m process.\n");
+ exit(1);
+ }
+ while (++i < argc) {
+ if ((*argv[i] == '+') || (*argv[i] == '-')) {
+ i--;
+ break;
+ }
+ execute_remote(SockFd, argv[i]);
+ }
+ close(SockFd);
+ }
+#endif
else if (!strcmp("-debug", argv[i]))
w3m_debug = TRUE;
else {
@@ -741,13 +806,34 @@ main(int argc, char **argv, char **envp)
}
i++;
}
-
+#ifdef USE_REMOTE
+ if (ExecuteRemote) {
+ exit(0);
+ }
+#endif
#ifdef __WATT32__
if (w3m_debug)
dbug_init();
sock_init();
#endif
+#ifdef __MINGW32_VERSION
+ {
+ int err;
+ WORD wVerReq;
+
+ wVerReq = MAKEWORD(1, 1);
+
+ err = WSAStartup(wVerReq, &WSAData);
+ if (err != 0)
+ {
+ fprintf(stderr, "Can't find winsock\n");
+ return 1;
+ }
+ _fmode = _O_BINARY;
+ }
+#endif
+
FirstTab = NULL;
LastTab = NULL;
nTab = 0;
@@ -1028,6 +1114,13 @@ main(int argc, char **argv, char **envp)
if (line_str) {
_goLine(line_str);
}
+
+#ifdef USE_REMOTE
+ if (UseRemote) {
+ init_serv();
+ }
+#endif
+
for (;;) {
if (add_download_list) {
add_download_list = FALSE;
@@ -1044,7 +1137,6 @@ main(int argc, char **argv, char **envp)
/* event processing */
if (CurrentEvent) {
CurrentKey = -1;
- CurrentKeyData = NULL;
CurrentCmdData = (char *)CurrentEvent->data;
w3mFuncList[CurrentEvent->cmd].func();
CurrentCmdData = NULL;
@@ -1059,7 +1151,6 @@ main(int argc, char **argv, char **envp)
if (CurrentAlarm->sec == 0) { /* refresh (0sec) */
Currentbuf->event = NULL;
CurrentKey = -1;
- CurrentKeyData = NULL;
CurrentCmdData = (char *)CurrentAlarm->data;
w3mFuncList[CurrentAlarm->cmd].func();
CurrentCmdData = NULL;
@@ -1098,7 +1189,20 @@ main(int argc, char **argv, char **envp)
} while (sleep_till_anykey(1, 0) <= 0);
}
#endif
+#ifdef USE_REMOTE
+ if (UseRemote) {
+ int n;
+ c = getch_select(SockFd, &n);
+ if (n == 1) {
+ parse_sock_data();
+ continue;
+ }
+ } else {
+ c = getch();
+ }
+#else
c = getch();
+#endif
#ifdef SIGWINCH
mySignal(SIGWINCH, resize_hook);
#endif
@@ -1126,10 +1230,240 @@ main(int argc, char **argv, char **envp)
}
prev_key = CurrentKey;
CurrentKey = -1;
- CurrentKeyData = NULL;
}
}
+#ifdef USE_REMOTE
+#ifndef HAVE_GETPEEREID
+#ifdef HAVE_SO_PEERCRED
+int
+getpeereid(int s, uid_t *euid, gid_t *egid)
+{
+ struct ucred cr;
+ int cl = sizeof(cr), r;
+
+ r = getsockopt(s, SOL_SOCKET, SO_PEERCRED, &cr, &cl);
+ if (r)
+ return r;
+
+ *euid = cr.uid;
+ *egid = cr.gid;
+ return 0;
+}
+#endif /* HAVE_SO_PEERCRED */
+#endif /* ! HAVE_GETPEEREID */
+
+static int
+open_remote(int id)
+{
+#if defined(HAVE_SO_PEERCRED) || defined(HAVE_GETPEEREID)
+ uid_t euid;
+ gid_t egid;
+#endif
+ Str sock_name = find_sock(id);
+
+ if (! sock_name)
+ return -1;
+
+ if (sizeof(SockAddr.sun_path) <= sock_name->length)
+ return -1;
+
+ if (init_remote("w3mclis"))
+ return -1;
+
+ SockAddr.sun_family = AF_UNIX;
+ strcpy(SockAddr.sun_path, sock_name->ptr);
+ SockLength = sizeof(SockAddr.sun_family) + strlen(SockAddr.sun_path);
+
+ if (connect(SockFd, (struct sockaddr *) &SockAddr, SockLength)) {
+ close(SockFd);
+ unlink(SockName->ptr);
+ return -1;
+ }
+
+#if defined(HAVE_SO_PEERCRED) || defined(HAVE_GETPEEREID)
+ if (getpeereid(SockFd, &euid, &egid) != 0 || euid != getuid()) {
+ close(SockFd);
+ unlink(SockName->ptr);
+ return -1;
+ }
+#endif
+
+ return SockFd;
+}
+
+static void
+execute_remote(int sock, char *arg)
+{
+ write(sock, arg, strlen(arg));
+ write(sock, "\n", 1);
+}
+
+static Str
+find_sock(int pid)
+{
+ DIR *dot_w3m;
+ Str sock_name;
+ struct dirent *file = NULL;
+ struct stat sbuf;
+
+ if (pid > 0) {
+ sock_name = Sprintf("w3msock%d", pid);
+ } else {
+ sock_name = Strnew_charp("w3msock");
+ }
+
+ dot_w3m = opendir(rc_dir);
+ if (! dot_w3m)
+ return NULL;
+
+ while ((file = readdir(dot_w3m))) {
+ if ((pid > 0 && (Strcmp_charp(sock_name, file->d_name) == 0)) ||
+ (pid <= 0 && Strncmp_charp(sock_name, file->d_name, sock_name->length) == 0)) {
+ sock_name = Sprintf("%s/%s", rc_dir, file->d_name);
+ if ((stat(sock_name->ptr, &sbuf) == 0) &&
+ (sbuf.st_mode & S_IFSOCK) &&
+ !(sbuf.st_mode & (S_IRWXO | S_IRWXG)) &&
+ (sbuf.st_uid == getuid()))
+ goto SockFound;
+ }
+ }
+ closedir(dot_w3m);
+ return NULL;
+
+ SockFound:
+ closedir(dot_w3m);
+ return sock_name;
+}
+
+static int
+init_serv(void)
+{
+ if (init_remote("w3msock")) {
+ return 1;
+ }
+
+ if (listen(SockFd, 5)) {
+ unlink(SockName->ptr);
+ close(SockFd);
+ SockFd = -1;
+ UseRemote = FALSE;
+ return 1;
+ }
+
+ fcntl(SockFd, F_SETFL, O_NONBLOCK);
+ return 0;
+}
+
+
+static int
+init_remote(char *prefix)
+{
+ SockName = Sprintf("%s/%s%d", rc_dir, prefix, CurrentPid);
+ if (sizeof(SockAddr.sun_path) <= SockName->length)
+ goto SockErr;
+
+ SockAddr.sun_family = AF_UNIX;
+ strcpy(SockAddr.sun_path, SockName->ptr);
+ SockLength = sizeof(SockAddr.sun_family) + strlen(SockAddr.sun_path);
+
+ if ((SockFd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
+ goto SockErr;
+
+ unlink(SockName->ptr);
+ if (bind(SockFd, (struct sockaddr *) &SockAddr, SockLength))
+ goto SockErr;
+
+ chmod(SockName->ptr, S_IRUSR | S_IWUSR);
+ return 0;
+
+ SockErr:
+ unlink(SockName->ptr);
+ if (SockFd >= 0) {
+ close(SockFd);
+ }
+ SockFd = -1;
+ UseRemote = FALSE;
+ return 1;
+}
+
+static void
+parse_sock_data(void)
+{
+ Str data = NULL;
+ char buf[64];
+ char *p, *q, *s;
+ int l, f, conn;
+ struct sockaddr_un sock_addr = SockAddr;
+ socklen_t sock_length = SockLength;
+#if defined(HAVE_SO_PEERCRED) || defined(HAVE_GETPEEREID)
+ uid_t euid;
+ gid_t egid;
+#else
+ struct stat sbuf;
+ time_t staletime;
+#endif
+
+ if (!UseRemote || SockFd < 0) {
+ return;
+ }
+
+ if (!data)
+ data = Strnew();
+
+ conn = accept(SockFd, (struct sockaddr *) &sock_addr, &sock_length);
+
+ if (conn < 0)
+ return;
+
+
+ sock_length -= sizeof(sock_addr.sun_family);
+ sock_addr.sun_path[sock_length] = '\0';
+#if defined(HAVE_SO_PEERCRED) || defined(HAVE_GETPEEREID)
+ if (getpeereid(conn, &euid, &egid) != 0 || euid != getuid()) {
+#else
+#define STALE_LIMIT 60
+ staletime = time(NULL) - STALE_LIMIT;
+ if ((stat(sock_addr.sun_path, &sbuf) < 0) ||
+ !(sbuf.st_mode & S_IFSOCK) ||
+ (sbuf.st_mode & (S_IRWXO | S_IRWXG)) ||
+ (sbuf.st_uid != getuid()) ||
+ (sbuf.st_atime < staletime) ||
+ (sbuf.st_ctime < staletime) ||
+ (sbuf.st_mtime < staletime)) {
+#endif
+ close(conn);
+ return;
+ }
+ unlink(sock_addr.sun_path);
+ while ((l = read(conn, buf, sizeof(buf))) > 0) {
+ Strcat_charp_n(data, buf, l);
+ }
+ close(conn);
+
+ p = data->ptr;
+
+ while ((q = strchr(p, '\n'))) {
+ Str funcname = Strnew();
+ Str cmd = Strnew_charp_n(p, q - p);
+
+ s = cmd->ptr;
+ SKIP_BLANKS(s);
+ while (*s && !IS_SPACE(*s))
+ Strcat_char(funcname, *(s++));
+
+ SKIP_BLANKS(s);
+ f = getFuncList(funcname->ptr);
+ if (f >= 0) {
+ Str tmp = Strnew_charp(s);
+ Strchop(tmp);
+ pushEvent(f, tmp->ptr);
+ }
+ p = q + 1;
+ }
+}
+#endif /* USE_REMOTE */
+
static void
keyPressEventProc(int c)
{
@@ -1908,7 +2242,6 @@ DEFUN(setEnv, SETENV, "Set environment variable")
char *env;
char *var, *value;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
env = searchKeyData();
if (env == NULL || *env == '\0' || strchr(env, '=') == NULL) {
if (env != NULL && *env != '\0')
@@ -1933,7 +2266,6 @@ DEFUN(pipeBuf, PIPE_BUF, "Send rendered document to pipe")
char *cmd, *tmpf;
FILE *f;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
/* FIXME: gettextize? */
@@ -1978,7 +2310,6 @@ DEFUN(pipesh, PIPE_SHELL, "Execute shell command and browse")
Buffer *buf;
char *cmd;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
cmd = inputLineHist("(read shell[pipe])!", "", IN_COMMAND, ShellHist);
@@ -2010,7 +2341,6 @@ DEFUN(readsh, READ_SHELL, "Execute shell command and load")
MySignalHandler(*prevtrap) ();
char *cmd;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
cmd = inputLineHist("(read shell)!", "", IN_COMMAND, ShellHist);
@@ -2045,7 +2375,6 @@ DEFUN(execsh, EXEC_SHELL SHELL, "Execute shell command")
{
char *cmd;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
cmd = inputLineHist("(exec shell)!", "", IN_COMMAND, ShellHist);
@@ -4149,7 +4478,6 @@ DEFUN(setOpt, SET_OPTION, "Set option")
{
char *opt;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
opt = searchKeyData();
if (opt == NULL || *opt == '\0' || strchr(opt, '=') == NULL) {
if (opt != NULL && *opt != '\0') {
@@ -4335,7 +4663,6 @@ DEFUN(ldHist, HISTORY, "View history of URL")
/* download HREF link */
DEFUN(svA, SAVE_LINK, "Save link to file")
{
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
do_download = TRUE;
followA();
do_download = FALSE;
@@ -4344,7 +4671,6 @@ DEFUN(svA, SAVE_LINK, "Save link to file")
/* download IMG link */
DEFUN(svI, SAVE_IMAGE, "Save image to file")
{
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
do_download = TRUE;
followI();
do_download = FALSE;
@@ -4357,7 +4683,6 @@ DEFUN(svBuf, PRINT SAVE_SCREEN, "Save rendered document to file")
FILE *f;
int is_pipe;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
file = searchKeyData();
if (file == NULL || *file == '\0') {
/* FIXME: gettextize? */
@@ -4406,7 +4731,6 @@ DEFUN(svSrc, DOWNLOAD SAVE, "Save document source to file")
if (Currentbuf->sourcefile == NULL)
return;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
PermitSaveToPipe = TRUE;
if (Currentbuf->real_scheme == SCM_LOCAL)
file = conv_from_system(guess_save_name(NULL,
@@ -4943,7 +5267,6 @@ invoke_browser(char *url)
char *browser = NULL;
int bg = 0, len;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
browser = searchKeyData();
if (browser == NULL || *browser == '\0') {
switch (prec_num) {
@@ -5184,7 +5507,6 @@ do_mouse_action(int btn, int x, int y)
mouse_action.cursorX = x;
mouse_action.cursorY = y;
CurrentKey = -1;
- CurrentKeyData = NULL;
CurrentCmdData = map->data;
(*map->func) ();
CurrentCmdData = NULL;
@@ -5643,13 +5965,10 @@ searchKeyData(void)
{
char *data = NULL;
- if (CurrentKeyData != NULL && *CurrentKeyData != '\0')
- data = CurrentKeyData;
- else if (CurrentCmdData != NULL && *CurrentCmdData != '\0')
+ if (CurrentCmdData != NULL && *CurrentCmdData != '\0')
data = CurrentCmdData;
else if (CurrentKey >= 0)
data = getKeyData(CurrentKey);
- CurrentKeyData = NULL;
CurrentCmdData = NULL;
if (data == NULL || *data == '\0')
return NULL;
@@ -5714,6 +6033,14 @@ w3m_exit(int i)
#ifdef USE_NNTP
disconnectNews();
#endif
+#ifdef USE_REMOTE
+ if (UseRemote) {
+ unlink(SockName->ptr);
+ }
+#endif
+#ifdef __MINGW32_VERSION
+ WSACleanup();
+#endif
exit(i);
}
@@ -5722,7 +6049,6 @@ DEFUN(execCmd, COMMAND, "Execute w3m command(s)")
char *data, *p;
int cmd;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
data = searchKeyData();
if (data == NULL || *data == '\0') {
data = inputStrHist("command [; ...]: ", "", TextHist);
@@ -5744,7 +6070,6 @@ DEFUN(execCmd, COMMAND, "Execute w3m command(s)")
break;
p = getQWord(&data);
CurrentKey = -1;
- CurrentKeyData = NULL;
CurrentCmdData = *p ? p : NULL;
#ifdef USE_MOUSE
if (use_mouse)
@@ -5768,7 +6093,6 @@ SigAlarm(SIGNAL_ARG)
if (CurrentAlarm->sec > 0) {
CurrentKey = -1;
- CurrentKeyData = NULL;
CurrentCmdData = data = (char *)CurrentAlarm->data;
#ifdef USE_MOUSE
if (use_mouse)
@@ -5806,7 +6130,6 @@ DEFUN(setAlarm, ALARM, "Set alarm")
char *data;
int sec = 0, cmd = -1;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
data = searchKeyData();
if (data == NULL || *data == '\0') {
data = inputStrHist("(Alarm)sec command: ", "", TextHist);
@@ -5919,7 +6242,6 @@ DEFUN(defKey, DEFINE_KEY,
{
char *data;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
data = searchKeyData();
if (data == NULL || *data == '\0') {
data = inputStrHist("Key definition: ", "", TextHist);
@@ -6438,7 +6760,9 @@ download_action(struct parsed_tagarg *arg)
for (; arg; arg = arg->next) {
if (!strncmp(arg->arg, "stop", 4)) {
pid = (pid_t) atoi(&arg->arg[4]);
+#ifndef __MINGW32_VERSION
kill(pid, SIGKILL);
+#endif
}
else if (!strncmp(arg->arg, "ok", 2))
pid = (pid_t) atoi(&arg->arg[2]);
@@ -6472,7 +6796,9 @@ stopDownload(void)
for (d = FirstDL; d != NULL; d = d->next) {
if (d->ok)
continue;
+#ifndef __MINGW32_VERSION
kill(d->pid, SIGKILL);
+#endif
unlink(d->lock);
}
}
diff --git a/menu.c b/menu.c
index 1a156e0..50c49f1 100644
--- a/menu.c
+++ b/menu.c
@@ -1,4 +1,4 @@
-/* $Id: menu.c,v 1.43 2004/08/02 15:40:50 ukai Exp $ */
+/* $Id: menu.c,v 1.44 2006/04/05 14:18:54 inu Exp $ */
/*
* w3m menu.c
*/
@@ -590,7 +590,6 @@ action_menu(Menu *menu)
*item.variable = item.value;
if (item.type & MENU_FUNC) {
CurrentKey = -1;
- CurrentKeyData = NULL;
CurrentCmdData = item.data;
(*item.func) ();
CurrentCmdData = NULL;
@@ -1738,6 +1737,23 @@ initMenu(void)
}
}
+DEFUN(interpretAsMenu, INTERPRET_AS_MENU, "Interpret current document as menu-definition")
+{
+ FILE *mf;
+ MenuList *list;
+
+ if ((mf = fopen(Currentbuf->sourcefile, "r")) != NULL) {
+ interpret_menu(mf);
+ fclose(mf);
+
+ for (list = w3mMenuList; list->id != NULL; list++) {
+ if (list->item == NULL)
+ continue;
+ new_menu(list->menu, list->item);
+ }
+ }
+}
+
int
setMenuItem(MenuItem *item, char *type, char *line)
{
diff --git a/parsetagx.c b/parsetagx.c
index 6bcc787..5d8970e 100644
--- a/parsetagx.c
+++ b/parsetagx.c
@@ -1,4 +1,4 @@
-/* $Id: parsetagx.c,v 1.14 2003/02/05 16:44:00 ukai Exp $ */
+/* $Id: parsetagx.c,v 1.15 2006/04/05 14:18:54 inu Exp $ */
#include "fm.h"
#include "myctype.h"
#include "indep.h"
@@ -182,6 +182,8 @@ parse_tag(char **s, int internal)
while (*q && *q != '"') {
if (*q != '\n')
Strcat_char(value, *q);
+ else
+ Strcat_char(value, ' ');
if (!tag->need_reconstruct && is_html_quote(*q))
tag->need_reconstruct = TRUE;
q++;
@@ -194,6 +196,8 @@ parse_tag(char **s, int internal)
while (*q && *q != '\'') {
if (*q != '\n')
Strcat_char(value, *q);
+ else
+ Strcat_char(value, ' ');
if (!tag->need_reconstruct && is_html_quote(*q))
tag->need_reconstruct = TRUE;
q++;
diff --git a/proto.h b/proto.h
index c46d789..1be4fff 100644
--- a/proto.h
+++ b/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.99 2004/04/16 18:47:19 ukai Exp $ */
+/* $Id: proto.h,v 1.100 2006/04/05 14:18:54 inu Exp $ */
/*
* This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended.
@@ -137,6 +137,7 @@ extern void tabL(void);
extern void ldDL(void);
extern void linkLst(void);
#ifdef USE_MENU
+extern void interpretAsMenu(void);
extern void linkMn(void);
extern LinkList *link_menu(Buffer *buf);
extern void accessKey(void);
@@ -145,6 +146,7 @@ extern void listMn(void);
extern void movlistMn(void);
extern Anchor *list_menu(Buffer *buf);
#else
+#define interpretAsMenu nulcmd
#define linkMn nulcmd
#define accessKey nulcmd
#define listMn nulcmd
@@ -492,6 +494,9 @@ extern void term_title(char *s);
extern void flush_tty(void);
extern void toggle_stand(void);
extern char getch(void);
+#ifdef USE_REMOTE
+char getch_select(int fd, int *num);
+#endif
extern void bell(void);
extern int sleep_till_anykey(int sec, int purge);
#ifdef USE_IMAGE
diff --git a/rc.c b/rc.c
index 1b3e496..9a22337 100644
--- a/rc.c
+++ b/rc.c
@@ -1,4 +1,4 @@
-/* $Id: rc.c,v 1.99 2004/08/02 15:40:50 ukai Exp $ */
+/* $Id: rc.c,v 1.100 2006/04/05 14:18:54 inu Exp $ */
/*
* Initialization file etc.
*/
@@ -192,6 +192,7 @@ static int OptionEncode = FALSE;
#endif /* USE_SSL */
#ifdef USE_COOKIE
#define CMT_USECOOKIE N_("Enable cookie processing")
+#define CMT_SHOWCOOKIE N_("Print a message when receiving a cookie")
#define CMT_ACCEPTCOOKIE N_("Accept cookies")
#define CMT_ACCEPTBADCOOKIE N_("Action to be taken on invalid cookie")
#define CMT_COOKIE_REJECT_DOMAINS N_("Domains to reject cookies from")
@@ -301,9 +302,7 @@ static struct sel_c dnsorders[] = {
#ifdef USE_COOKIE
static struct sel_c badcookiestr[] = {
{N_S(ACCEPT_BAD_COOKIE_DISCARD), N_("discard")},
-#if 0
{N_S(ACCEPT_BAD_COOKIE_ACCEPT), N_("accept")},
-#endif
{N_S(ACCEPT_BAD_COOKIE_ASK), N_("ask")},
{0, NULL, NULL}
};
@@ -552,6 +551,8 @@ struct param_ptr params7[] = {
#ifdef USE_COOKIE
struct param_ptr params8[] = {
{"use_cookie", P_INT, PI_ONOFF, (void *)&use_cookie, CMT_USECOOKIE, NULL},
+ {"show_cookie", P_INT, PI_ONOFF, (void *)&show_cookie,
+ CMT_SHOWCOOKIE, NULL},
{"accept_cookie", P_INT, PI_ONOFF, (void *)&accept_cookie,
CMT_ACCEPTCOOKIE, NULL},
{"accept_bad_cookie", P_INT, PI_SEL_C, (void *)&accept_bad_cookie,
@@ -1111,7 +1112,11 @@ do_mkdir(const char *dir, long mode)
return mkdir(abs, mode);
}
#else /* not __EMX__ */
+#ifdef __MINGW32_VERSION
+#define do_mkdir(dir,mode) mkdir(dir)
+#else
#define do_mkdir(dir,mode) mkdir(dir,mode)
+#endif /* not __MINW32_VERSION */
#endif /* not __EMX__ */
void
diff --git a/scripts/w3mman/w3mman.1.in b/scripts/w3mman/w3mman.1.in
index eb30237..1c0361d 100644
--- a/scripts/w3mman/w3mman.1.in
+++ b/scripts/w3mman/w3mman.1.in
@@ -1,4 +1,4 @@
-.TH W3MMAN 1 "Mar 14, 2002"
+.TH W3MMAN 1 "Nov 5, 2005"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@@ -19,6 +19,9 @@ w3mman \- an interface to the on-line reference manuals by w3m(1)
.br
.B w3mman
.RI "[-M " path "] -k " keyword
+.br
+.B w3mman
+.RI -l " file
.SH DESCRIPTION
.B w3mman
is the system's manual pager by
@@ -31,9 +34,13 @@ Specify
.I path
as MANPATH.
.TP
-.B \-k " keyword"
+.BI \-k " keyword"
Specify
.I keyword.
+.TP
+.BI \-l " file"
+Specify a
+.I file.
.SH ENVIRONMENT
.TP
.B W3MMAN_W3M
diff --git a/scripts/w3mman/w3mman.in b/scripts/w3mman/w3mman.in
index 6c6f65d..6a27e70 100644
--- a/scripts/w3mman/w3mman.in
+++ b/scripts/w3mman/w3mman.in
@@ -8,6 +8,7 @@ sub usage {
($_ = $0) =~ s@.*/@@;
print STDERR "$_ [-M <path>] [[<section>] <command>]\n";
print STDERR "$_ [-M <path>] [-k <keyword>]\n";
+ print STDERR "$_ [-l <file>]\n";
exit 1;
}
@@ -20,6 +21,10 @@ while (@ARGV) {
} elsif (/^-k$/) {
@ARGV || &usage();
$query = "?keyword=" . &form_encode(shift @ARGV);
+ } elsif (/^-l$/) {
+ @ARGV || &usage();
+ $query = "?quit=ok&local=" . &form_encode(shift @ARGV);
+ $query .= "&pwd=" . &form_encode($ENV{'PWD'});
} elsif (/^-/) {
&usage();
} elsif (/^\d/ || $_ eq 'n') {
diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in
index f41d487..3cb105d 100644
--- a/scripts/w3mman/w3mman2html.cgi.in
+++ b/scripts/w3mman/w3mman2html.cgi.in
@@ -19,7 +19,7 @@ if ($QUERY =~ /\=/) {
$query{"man"} = &form_decode($QUERY);
}
-if (! $query{"man"}) {
+if ((! $query{"man"}) && (! $query{"local"})) {
if ($query{"keyword"}) {
$keyword = $query{"keyword"};
$k = &html_quote($keyword);
@@ -71,21 +71,29 @@ EOF
exit;
}
-$man = $query{"man"};
-if ($man =~ s/\((\w+)\)$//) {
- $section = $1;
- $man_section = "$man($1)";
-} elsif ($query{"section"}) {
- $section = $query{"section"};
- $man_section = "$man($section)";
+if ($query{"local"}) {
+ $file = $query{"local"};
+ if (! ($file =~ /^\//)) {
+ $file = $query{"pwd"} . '/' . $file;
+ }
+ open(F, "$MAN -l $file 2> /dev/null |");
} else {
- $section = "";
- $man_section = "$man";
-}
+ $man = $query{"man"};
+ if ($man =~ s/\((\w+)\)$//) {
+ $section = $1;
+ $man_section = "$man($1)";
+ } elsif ($query{"section"}) {
+ $section = $query{"section"};
+ $man_section = "$man($section)";
+ } else {
+ $section = "";
+ $man_section = "$man";
+ }
-$section =~ s:([^-\w\200-\377.,])::g;
-$man =~ s:([^-\w\200-\377.,])::g;
-open(F, "$MAN $section $man 2> /dev/null |");
+ $section =~ s:([^-\w\200-\377.,])::g;
+ $man =~ s:([^-\w\200-\377.,])::g;
+ open(F, "$MAN $section $man 2> /dev/null |");
+}
$ok = 0;
undef $header;
$blank = -1;
@@ -176,6 +184,11 @@ if ($prev) {
close(F);
if (! $ok) {
if ($query{'quit'}) {
+ if ($query{'local'}) {
+ print STDERR "File $file not found.\n";
+ } else {
+ print STDERR "No manual entry for $man_section.\n";
+ }
print STDERR "No manual entry for $man_section.\n";
print <<EOF;
w3m-control: EXIT
@@ -190,7 +203,11 @@ Content-Type: text/html
<body>
<pre>
EOF
- print "No manual entry for <B>$man_section</B>.\n";
+ if ($query{'local'}) {
+ print "File <B>$file</B> not found.\n";
+ } else {
+ print "No manual entry for <B>$man_section</B>.\n";
+ }
}
print <<EOF;
</pre>
diff --git a/table.c b/table.c
index 2b0ea63..45c0daa 100644
--- a/table.c
+++ b/table.c
@@ -1,4 +1,4 @@
-/* $Id: table.c,v 1.49 2004/01/09 15:46:49 ukai Exp $ */
+/* $Id: table.c,v 1.50 2006/04/05 14:18:54 inu Exp $ */
/*
* HTML table
*/
@@ -1984,7 +1984,7 @@ renderTable(struct table *t, int max_width, struct html_feed_environ *h_env)
break;
}
if (t->total_height == 0) {
- renderbuf = Strnew(" ");
+ renderbuf = Strnew_charp(" ");
t->total_height++;
t->total_width = 1;
push_render_image(renderbuf, 1, t->total_width, h_env);
@@ -2465,11 +2465,16 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode,
return TAG_ACTION_PLAIN;
}
if (mode->pre_mode & TBLM_INTXTA) {
- if (mode->end_tag == cmd) {
+ switch (cmd) {
+ CASE_TABLE_TAG:
+ case HTML_N_TEXTAREA:
table_close_textarea(tbl, mode, width);
- return TAG_ACTION_NONE;
+ if (cmd == HTML_N_TEXTAREA)
+ return TAG_ACTION_NONE;
+ break;
+ default:
+ return TAG_ACTION_FEED;
}
- return TAG_ACTION_FEED;
}
if (mode->pre_mode & TBLM_SCRIPT) {
if (mode->end_tag == cmd) {
diff --git a/terms.c b/terms.c
index ed9f425..748f6bd 100644
--- a/terms.c
+++ b/terms.c
@@ -1,4 +1,4 @@
-/* $Id: terms.c,v 1.53 2005/01/18 16:38:01 ukai Exp $ */
+/* $Id: terms.c,v 1.54 2006/04/05 14:18:54 inu Exp $ */
/*
* An original curses library for EUC-kanji by Akinori ITO, December 1989
* revised by Akinori ITO, January 1995
@@ -15,7 +15,11 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
+#ifndef __MINGW32_VERSION
#include <sys/ioctl.h>
+#else
+#include <winsock.h>
+#endif /* __MINGW32_VERSION */
#ifdef USE_MOUSE
#ifdef USE_GPM
#include <gpm.h>
@@ -287,6 +291,42 @@ typedef struct sgttyb TerminalMode;
#define MODEFLAG(d) ((d).sg_flags)
#endif /* HAVE_SGTTY_H */
+#ifdef __MINGW32_VERSION
+/* dummy struct */
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 32
+struct termios
+ {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+ speed_t c_ispeed; /* input speed */
+ speed_t c_ospeed; /* output speed */
+ };
+typedef struct termios TerminalMode;
+#define TerminalSet(fd,x) (0)
+#define TerminalGet(fd,x) (0)
+#define MODEFLAG(d) (0)
+
+/* dummy defines */
+#define SIGHUP (0)
+#define SIGQUIT (0)
+#define ECHO (0)
+#define ISIG (0)
+#define VEOF (0)
+#define ICANON (0)
+#define IXON (0)
+#define IXOFF (0)
+
+char *ttyname(int);
+#endif /* __MINGW32_VERSION */
+
#define MAX_LINE 200
#define MAX_COLUMN 400
@@ -511,6 +551,7 @@ set_tty(void)
void
ttymode_set(int mode, int imode)
{
+#ifndef __MINGW32_VERSION
TerminalMode ioval;
TerminalGet(tty, &ioval);
@@ -525,11 +566,13 @@ ttymode_set(int mode, int imode)
printf("Error occured while set %x: errno=%d\n", mode, errno);
reset_exit(SIGNAL_ARGLIST);
}
+#endif
}
void
ttymode_reset(int mode, int imode)
{
+#ifndef __MINGW32_VERSION
TerminalMode ioval;
TerminalGet(tty, &ioval);
@@ -544,6 +587,7 @@ ttymode_reset(int mode, int imode)
printf("Error occured while reset %x: errno=%d\n", mode, errno);
reset_exit(SIGNAL_ARGLIST);
}
+#endif /* __MINGW32_VERSION */
}
#ifndef HAVE_SGTTY_H
@@ -1830,6 +1874,44 @@ getch(void)
return c;
}
+#ifdef USE_REMOTE
+char
+getch_select(int fd, int *fdn)
+{
+ int maxfd = tty;
+ fd_set rset;
+
+ if (fd < 0 || fd == tty) {
+ *fdn = 0;
+ return getch();
+ }
+
+ if (maxfd < fd)
+ maxfd = fd;
+
+ maxfd++;
+
+ FD_ZERO(&rset);
+ FD_SET(tty, &rset);
+ FD_SET(fd, &rset);
+
+ while (select(maxfd, &rset, NULL, NULL, NULL) < 1) {
+ FD_ZERO(&rset);
+ FD_SET(tty, &rset);
+ FD_SET(fd, &rset);
+ }
+
+ if (FD_ISSET(tty, &rset)) {
+ *fdn = 0;
+ return getch();
+ } else if (FD_ISSET(fd, &rset)) {
+ *fdn = 1;
+ }
+ return 0;
+}
+#endif
+
+
#ifdef USE_MOUSE
#ifdef USE_GPM
char
@@ -2172,3 +2254,40 @@ touch_cursor()
#endif
}
#endif
+
+#ifdef __MINGW32_VERSION
+
+int tgetent(char *bp, char *name)
+{
+ return 0;
+}
+
+int tgetnum(char *id)
+{
+ return -1;
+}
+
+int tgetflag(char *id)
+{
+ return 0;
+}
+
+char *tgetstr(char *id, char **area)
+{
+ id = "";
+}
+
+char *tgoto(char *cap, int col, int row)
+{
+}
+
+int tputs(char *str, int affcnt, int (*putc)(char))
+{
+}
+
+char *ttyname(int tty)
+{
+ return "CON";
+}
+
+#endif /* __MINGW32_VERSION */
diff --git a/url.c b/url.c
index 8638613..7f2775e 100644
--- a/url.c
+++ b/url.c
@@ -1,10 +1,14 @@
-/* $Id: url.c,v 1.90 2006/02/10 12:52:23 inu Exp $ */
+/* $Id: url.c,v 1.91 2006/04/05 14:18:54 inu Exp $ */
#include "fm.h"
+#ifndef __MINGW32_VERSION
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#else
+#include <winsock.h>
+#endif /* __MINGW32_VERSION */
#include <signal.h>
#include <setjmp.h>
@@ -31,6 +35,11 @@
#define write(a,b,c) write_s(a,b,c)
#endif /* __WATT32__ */
+#ifdef __MINGW32_VERSION
+#define write(a,b,c) send(a,b,c, 0)
+#define close(fd) closesocket(fd)
+#endif
+
#ifdef INET6
/* see rc.c, "dns_order" and dnsorders[] */
int ai_family_order_table[7][3] = {