1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Merge with #elinks-0.12

This commit is contained in:
Kalle Olavi Niemitalo 2007-07-16 00:18:17 +03:00 committed by Kalle Olavi Niemitalo
commit 8097929290
29 changed files with 199 additions and 165 deletions

6
NEWS
View File

@ -17,7 +17,7 @@ To be released as ELinks 0.12.0.
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
This list now contains all the important changes from ELinks 0.11.0 to This list now contains all the important changes from ELinks 0.11.0 to
ELinks 0.12.GIT (0cf15ca9d9dbc00c10f23440674fcdb832dffd75) and related ELinks 0.12.GIT (98260f7970bcd940f2d2146ac7b5a980a7586082) and related
bug numbers. Each section is sorted by severity and grouped by topic. bug numbers. Each section is sorted by severity and grouped by topic.
The list no doubt includes several changes that are not really The list no doubt includes several changes that are not really
@ -71,6 +71,7 @@ Miscellaneous:
* gzip_read: always call gzclearerr * gzip_read: always call gzclearerr
* bug 816: convert entity references in input/@value only once * bug 816: convert entity references in input/@value only once
* bug 916: if a mailcap entry has no %s, provide the file as stdin * bug 916: if a mailcap entry has no %s, provide the file as stdin
* bug 766: speed up CSS
* bug 355: add documents displayed via ``What to do'' dialog to the * bug 355: add documents displayed via ``What to do'' dialog to the
global history global history
* encode and decode filenames in FSP URLs * encode and decode filenames in FSP URLs
@ -281,6 +282,8 @@ To be released as 0.11.4.
* critical bug 755: fix crashes due to dangling pointers to struct * critical bug 755: fix crashes due to dangling pointers to struct
form_state form_state
* critical bugs 613, 714, 961: ``assertion list_empty(form_controls)
failed''
* critical bug 945: don't crash if a Lua script calls e.g. error(nil) * critical bug 945: don't crash if a Lua script calls e.g. error(nil)
* major bug 956: don't reuse pointers to SpiderMonkey objects that may * major bug 956: don't reuse pointers to SpiderMonkey objects that may
have been collected as garbage. This fix causes bug 954. have been collected as garbage. This fix causes bug 954.
@ -306,6 +309,7 @@ To be released as 0.11.4.
on SunOS on SunOS
* build bug 936: fix errors about undefined off_t (autoheader * build bug 936: fix errors about undefined off_t (autoheader
incompatibility) incompatibility)
* build bug 959: test in configure whether -lX11 works
* build: update SpiderMonkey configure check Debian compatibility * build: update SpiderMonkey configure check Debian compatibility
* build: use $(CPPFLAGS) rather than $(AM_CFLAGS) * build: use $(CPPFLAGS) rather than $(AM_CFLAGS)
* minor build bug 960: fix errors in loadmsgcat.c if mmap() exists but * minor build bug 960: fix errors in loadmsgcat.c if mmap() exists but

View File

@ -5,10 +5,7 @@ dnl From Bruno Haible.
AC_DEFUN([AM_LANGINFO_CODESET], AC_DEFUN([AM_LANGINFO_CODESET],
[ [
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
[AC_TRY_LINK([#include <langinfo.h>], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[char* cs = nl_langinfo(CODESET);]])],[am_cv_langinfo_codeset=yes],[am_cv_langinfo_codeset=no])
[char* cs = nl_langinfo(CODESET);],
am_cv_langinfo_codeset=yes,
am_cv_langinfo_codeset=no)
]) ])
if test $am_cv_langinfo_codeset = yes; then if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE(HAVE_LANGINFO_CODESET, 1, AC_DEFINE(HAVE_LANGINFO_CODESET, 1,

View File

@ -125,7 +125,7 @@ AC_DEFUN([EL_CHECK_CODE],
[ [
$2=yes; $2=yes;
AC_MSG_CHECKING([for $1]) AC_MSG_CHECKING([for $1])
AC_TRY_COMPILE([$3], [$4], [EL_DEFINE($2, [$1])], $2=no) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]], [[$4]])],[EL_DEFINE($2, [$1])],[$2=no])
AC_MSG_RESULT([$]$2) AC_MSG_RESULT([$]$2)
]) ])
@ -134,10 +134,9 @@ AC_DEFUN([EL_CHECK_TYPE],
[ [
EL_CHECK_TYPE_LOCAL=yes; EL_CHECK_TYPE_LOCAL=yes;
AC_MSG_CHECKING([for $1]) AC_MSG_CHECKING([for $1])
AC_TRY_COMPILE([ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h> #include <sys/types.h>
], [int a = sizeof($1);], ]], [[int a = sizeof($1);]])],[EL_CHECK_TYPE_LOCAL=yes],[EL_CHECK_TYPE_LOCAL=no])
[EL_CHECK_TYPE_LOCAL=yes], [EL_CHECK_TYPE_LOCAL=no])
AC_MSG_RESULT([$]EL_CHECK_TYPE_LOCAL) AC_MSG_RESULT([$]EL_CHECK_TYPE_LOCAL)
if test "x[$]EL_CHECK_TYPE_LOCAL" != "xyes"; then if test "x[$]EL_CHECK_TYPE_LOCAL" != "xyes"; then
AC_DEFINE($1, $2, [Define to $2 if <sys/types.h> doesn't define.]) AC_DEFINE($1, $2, [Define to $2 if <sys/types.h> doesn't define.])

View File

@ -20,22 +20,18 @@ AC_DEFUN([AM_ICONV],
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no am_cv_lib_iconv=no
AC_TRY_LINK([#include <stdlib.h> AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <iconv.h>], #include <iconv.h>]], [[iconv_t cd = iconv_open("","");
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL); iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);], iconv_close(cd);]])],[am_cv_func_iconv=yes],[])
am_cv_func_iconv=yes)
if test "$am_cv_func_iconv" != yes; then if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS" am_save_LIBS="$LIBS"
LIBS="$LIBS -liconv" LIBS="$LIBS -liconv"
AC_TRY_LINK([#include <stdlib.h> AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <iconv.h>], #include <iconv.h>]], [[iconv_t cd = iconv_open("","");
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL); iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);], iconv_close(cd);]])],[am_cv_lib_iconv=yes
am_cv_lib_iconv=yes am_cv_func_iconv=yes],[])
am_cv_func_iconv=yes)
LIBS="$am_save_LIBS" LIBS="$am_save_LIBS"
fi fi
]) ])
@ -43,7 +39,7 @@ AC_DEFUN([AM_ICONV],
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
AC_MSG_CHECKING([for iconv declaration]) AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL(am_cv_proto_iconv, [ AC_CACHE_VAL(am_cv_proto_iconv, [
AC_TRY_COMPILE([ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h> #include <stdlib.h>
#include <iconv.h> #include <iconv.h>
extern extern
@ -55,7 +51,7 @@ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, si
#else #else
size_t iconv(); size_t iconv();
#endif #endif
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") ]], [[]])],[am_cv_proto_iconv_arg1=""],[am_cv_proto_iconv_arg1="const"])
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([$]{ac_t:- AC_MSG_RESULT([$]{ac_t:-

View File

@ -4,8 +4,8 @@
# because gettext's gettext.m4 (distributed in the automake package) # because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader # still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics: # give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX # configure.in:556: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX # configure.in:556: AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[]) was called before AC_ISC_POSIX
undefine([AC_ISC_POSIX]) undefine([AC_ISC_POSIX])

View File

@ -13,8 +13,7 @@
AC_DEFUN([AM_LC_MESSAGES], AC_DEFUN([AM_LC_MESSAGES],
[if test $ac_cv_header_locale_h = yes; then [if test $ac_cv_header_locale_h = yes; then
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <locale.h>]], [[return LC_MESSAGES]])],[am_cv_val_LC_MESSAGES=yes],[am_cv_val_LC_MESSAGES=no])])
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
if test $am_cv_val_LC_MESSAGES = yes; then if test $am_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES, 1, AC_DEFINE(HAVE_LC_MESSAGES, 1,
[Define if your <locale.h> file defines LC_MESSAGES.]) [Define if your <locale.h> file defines LC_MESSAGES.])

View File

@ -6,8 +6,7 @@ AC_DEFUN([EL_CONFIG_OS_OS2],
EL_SAVE_FLAGS EL_SAVE_FLAGS
CFLAGS="$CFLAGS -Zmt" CFLAGS="$CFLAGS -Zmt"
AC_TRY_LINK([#include <stdlib.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], [[_beginthread(NULL, NULL, 0, NULL)]])],[cf_result=yes],[cf_result=no])
[_beginthread(NULL, NULL, 0, NULL)], cf_result=yes, cf_result=no)
AC_MSG_RESULT($cf_result) AC_MSG_RESULT($cf_result)
if test "$cf_result" = yes; then if test "$cf_result" = yes; then
@ -28,14 +27,10 @@ AC_DEFUN([EL_CONFIG_OS_OS2],
if test -n "$X11ROOT"; then if test -n "$X11ROOT"; then
CFLAGS="$CFLAGS_X -I$X11ROOT/XFree86/include" CFLAGS="$CFLAGS_X -I$X11ROOT/XFree86/include"
LIBS="$LIBS_X -L$X11ROOT/XFree86/lib -lxf86_gcc" LIBS="$LIBS_X -L$X11ROOT/XFree86/lib -lxf86_gcc"
AC_TRY_LINK([#include <pty.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pty.h>]], [[struct winsize win;ptioctl(1, TIOCGWINSZ, &win)]])],[cf_result=yes],[cf_result=no])
[struct winsize win;ptioctl(1, TIOCGWINSZ, &win)],
cf_result=yes, cf_result=no)
if test "$cf_result" = no; then if test "$cf_result" = no; then
LIBS="$LIBS_X -L$X11ROOT/XFree86/lib -lxf86" LIBS="$LIBS_X -L$X11ROOT/XFree86/lib -lxf86"
AC_TRY_LINK([#include <pty.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pty.h>]], [[struct winsize win;ptioctl(1, TIOCGWINSZ, &win)]])],[cf_result=yes],[cf_result=no])
[struct winsize win;ptioctl(1, TIOCGWINSZ, &win)],
cf_result=yes, cf_result=no)
fi fi
fi fi

View File

@ -78,9 +78,7 @@ if test "$CONFIG_SCRIPTING_RUBY" = "yes"; then
CFLAGS="$RUBY_CFLAGS $CFLAGS" CFLAGS="$RUBY_CFLAGS $CFLAGS"
CPPFLAGS="$CPPFLAGS $RUBY_CFLAGS" CPPFLAGS="$CPPFLAGS $RUBY_CFLAGS"
AC_TRY_LINK([#include <ruby.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ruby.h>]], [[ruby_init();]])],[CONFIG_SCRIPTING_RUBY=yes],[CONFIG_SCRIPTING_RUBY=no])
[ruby_init();],
CONFIG_SCRIPTING_RUBY=yes, CONFIG_SCRIPTING_RUBY=no)
else else
AC_MSG_RESULT([Ruby header files not found]) AC_MSG_RESULT([Ruby header files not found])
fi fi

View File

@ -5,8 +5,7 @@ AC_DEFUN([EL_CONFIG_OS_WIN32],
EL_SAVE_FLAGS EL_SAVE_FLAGS
AC_TRY_LINK([#include <stdlib.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], [[_beginthread(NULL, NULL, 0, NULL)]])],[cf_result=yes],[cf_result=no])
[_beginthread(NULL, NULL, 0, NULL)], cf_result=yes, cf_result=no)
AC_MSG_RESULT($cf_result) AC_MSG_RESULT($cf_result)
if test "$cf_result" = yes; then if test "$cf_result" = yes; then

View File

@ -1,10 +1,11 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936. dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936.
dnl Autoconf 2.59 is installed in the computer that generates our daily dnl Autoconf 2.59 is installed in the computer that generates our nightly
dnl snapshots, so we need to be compatible with that. dnl snapshots, so we need to be compatible with that.
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_INIT(src/main/main.c) AC_INIT
AC_CONFIG_SRCDIR([src/main/main.c])
AC_CONFIG_AUX_DIR(config) AC_CONFIG_AUX_DIR(config)
PACKAGE=elinks PACKAGE=elinks
@ -107,7 +108,7 @@ EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manu
EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats]) EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
dnl gcc specific options (to be continued at the bottom of configure) dnl gcc specific options (to be continued at the bottom of configure)
if test "x$ac_cv_prog_gcc" = "xyes"; then if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
dnl We want to see all warnings and live with none. dnl We want to see all warnings and live with none.
dnl We can't set up -Werror here as there may be some warnings in test dnl We can't set up -Werror here as there may be some warnings in test
dnl suite of configure, and we don't want to fail them. dnl suite of configure, and we don't want to fail them.
@ -124,9 +125,9 @@ AC_DEFUN([EL_CHECK_COMPILER_MACROS],
AC_MSG_CHECKING([for $2]) AC_MSG_CHECKING([for $2])
for flag in $3; do for flag in $3; do
AC_TRY_COMPILE(, [#ifndef $flag AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef $flag
kill me! kill me!
#endif ], $1=yes, $1=no) #endif ]])],[$1=yes],[$1=no])
if test "[$]$1" = yes; then if test "[$]$1" = yes; then
EL_CONFIG([$1], [$2]) EL_CONFIG([$1], [$2])
break break
@ -262,7 +263,7 @@ dnl happily ignoring it and stderr not being checked for error messages.
AC_MSG_CHECKING([for -rdynamic]) AC_MSG_CHECKING([for -rdynamic])
LDFLAGS_X="$LDFLAGS" LDFLAGS_X="$LDFLAGS"
LDFLAGS="$LDFLAGS -rdynamic" LDFLAGS="$LDFLAGS -rdynamic"
AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X" test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
AC_MSG_RESULT($have_rdynamic) AC_MSG_RESULT($have_rdynamic)
@ -289,7 +290,7 @@ AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction) AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
AC_CHECK_FUNCS(gettimeofday clock_gettime) AC_CHECK_FUNCS(gettimeofday clock_gettime)
AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path) AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes) AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes) AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
@ -305,28 +306,26 @@ AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
if test x"$HAVE_RAISE" = x; then if test x"$HAVE_RAISE" = x; then
if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
AC_ERROR([Unable to emulate raise()]) AC_MSG_ERROR([Unable to emulate raise()])
fi fi
fi fi
AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[ AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
AC_TRY_LINK([#include <stdarg.h> AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
va_list ap1,ap2;], [__va_copy(ap1,ap2);], va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],[el_cv_HAVE_VA_COPY=yes],[el_cv_HAVE_VA_COPY=no])])
el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
EL_DEFINE(HAVE_VA_COPY, __va_copy) EL_DEFINE(HAVE_VA_COPY, __va_copy)
fi fi
AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[ AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
AC_TRY_LINK([#include <unistd.h> AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
], [int page_size = sysconf(_SC_PAGE_SIZE);], ]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE) EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
fi fi
AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[ AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
@ -358,8 +357,7 @@ void foo(const char *format, ...) {
exit(0); exit(0);
} }
main() { foo("hello\n"); } main() { foo("hello\n"); }
], ]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()]) EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
fi fi
@ -592,10 +590,10 @@ if test "$enable_see" = "yes"; then
SEE_CFLAGS="`$SEE_CONFIG --cppflags`" SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
CPPFLAGS="$SEE_CFLAGS $CPPFLAGS" CPPFLAGS="$SEE_CFLAGS $CPPFLAGS"
LIBS="$SEE_LIBS $LIBS_X" LIBS="$SEE_LIBS $LIBS_X"
AC_TRY_LINK([#include <see/see.h>],[#if SEE_VERSION_API_MAJOR < 2 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <see/see.h>]], [[#if SEE_VERSION_API_MAJOR < 2
#error SEE too old #error SEE too old
#endif #endif
], cf_result=yes, cf_result=no) ]])],[cf_result=yes],[cf_result=no])
EL_RESTORE_FLAGS EL_RESTORE_FLAGS
if test "$cf_result" = yes; then if test "$cf_result" = yes; then
LIBS="$SEE_LIBS $LIBS" LIBS="$SEE_LIBS $LIBS"
@ -630,22 +628,17 @@ if test -z "$disable_spidermonkey"; then
for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
for spidermonkeylib in js smjs mozjs; do for spidermonkeylib in js smjs mozjs; do
if test "$cf_result" = no; then if test "$cf_result" = no &&
SPIDERMONKEY_LIBS="-l$spidermonkeylib" test -f "$spidermonkeydir$spidermonkeyinclude/jsapi.h"; then
SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib -l$spidermonkeylib"
if test ! -z "$spidermonkeydir"; then
SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude" SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
fi
LIBS="$SPIDERMONKEY_LIBS $LIBS_X" LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS" CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS" CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
AC_TRY_LINK([#define XP_UNIX AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
#include <jsapi.h>], #include <jsapi.h>]], [[JS_GetReservedSlot(NULL, NULL, 0, NULL)]])],[cf_result=yes],[cf_result=no])
[JS_GetReservedSlot(NULL, NULL, 0, NULL)],
cf_result=yes, cf_result=no)
fi fi
done done
done done
@ -776,29 +769,24 @@ if test "$enable_perl" = "yes"; then
LIBS="$PERL_LIBS $LIBS" LIBS="$PERL_LIBS $LIBS"
CFLAGS="$PERL_CFLAGS $CFLAGS" CFLAGS="$PERL_CFLAGS $CFLAGS"
CPPFLAGS="$CPPFLAGS $PERL_CFLAGS" CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
AC_TRY_LINK([ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include <perlapi.h> #include <perlapi.h>
], ]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
[PerlInterpreter *my_perl = perl_alloc();],
cf_result=yes, cf_result=no)
fi fi
if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
AC_MSG_CHECKING([whether POPpx works without an n_a variable]) AC_MSG_CHECKING([whether POPpx works without an n_a variable])
AC_TRY_COMPILE([ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
extern PerlInterpreter *my_perl; extern PerlInterpreter *my_perl;
], ]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
[dSP; (void) POPpx;],
[AC_MSG_RESULT([yes])
AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1], AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
[Define if using Perl 5.8.8 or later, where the "POPpx" macro [Define if using Perl 5.8.8 or later, where the "POPpx" macro
no longer needs an "n_a" variable like it did in 5.8.7])], no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
[AC_MSG_RESULT([no])])
if test "$cf_result" != "yes"; then if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS EL_RESTORE_FLAGS
@ -842,9 +830,7 @@ if test "$enable_python" = "yes"; then
PYTHON_LIBS="`$PYTHON -c 'from distutils import sysconfig; var = sysconfig.get_config_var; print "%s %s %s -L%s -lpython%s" % (var("LINKFORSHARED"), var("LIBS"), var("SYSLIBS"), var("LIBPL"), var("VERSION"))'`" PYTHON_LIBS="`$PYTHON -c 'from distutils import sysconfig; var = sysconfig.get_config_var; print "%s %s %s -L%s -lpython%s" % (var("LINKFORSHARED"), var("LIBS"), var("SYSLIBS"), var("LIBPL"), var("VERSION"))'`"
LIBS="$PYTHON_LIBS $LIBS" LIBS="$PYTHON_LIBS $LIBS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS" CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
AC_TRY_LINK([#include <Python.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
[Py_Initialize();],
cf_result=yes, cf_result=no)
if test "$cf_result" != "yes"; then if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS EL_RESTORE_FLAGS
@ -894,30 +880,25 @@ if test -z "$disable_lua"; then
fi fi
for luadir in "$withval" "" /usr /usr/local; do for luadir in "$withval" "" /usr /usr/local; do
for suffix in "" 50 51; do for suffix in "" 50 51; do
if test "$cf_result" = no; then if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
LUA_LIBS="-llua$suffix -llualib$suffix -lm" test -f "$luadir/include/lua$suffix/lua.h" ) ; then
LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm"
if test ! -z "$luadir"; then
LUA_LIBS="-L$luadir/lib $LUA_LIBS"
LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix" LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
fi
LIBS="$LUA_LIBS $LIBS_X" LIBS="$LUA_LIBS $LIBS_X"
CFLAGS="$CFLAGS_X $LUA_CFLAGS" CFLAGS="$CFLAGS_X $LUA_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS" CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
# Check that it is a compatible Lua version # Check that it is a compatible Lua version
AC_TRY_LINK([ #include <lua.h> AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lua.h>
#include <lualib.h>], #include <lualib.h>]], [[ lua_State *L = lua_open();
[ lua_State *L = lua_open();
luaopen_base(L); luaopen_base(L);
luaopen_table(L); luaopen_table(L);
luaopen_io(L); luaopen_io(L);
luaopen_string(L); luaopen_string(L);
luaopen_math(L); luaopen_math(L);
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
lua_close(L);], lua_close(L);]])],[cf_result=yes],[cf_result=no])
cf_result=yes, cf_result=no)
fi fi
done done
done done
@ -1015,13 +996,9 @@ else
else else
LIBS="-lssl -lcrypto $LIBS_X" LIBS="-lssl -lcrypto $LIBS_X"
fi fi
AC_TRY_LINK([#include <openssl/ssl.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
[OpenSSL_add_all_algorithms()],
cf_result=yes, cf_result=no)
if test "$cf_result" != yes; then if test "$cf_result" != yes; then
AC_TRY_LINK([#include <openssl/ssl.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
[SSLeay_add_ssl_algorithms()],
cf_result=yes, cf_result=no)
fi fi
fi fi
done done
@ -1079,10 +1056,8 @@ else
# Verify if it's really usable. gnutls_session was # Verify if it's really usable. gnutls_session was
# renamed to gnutls_session_t before GNU TLS 1.2.0 # renamed to gnutls_session_t before GNU TLS 1.2.0
# (on 2004-06-13); ELinks now requires this. # (on 2004-06-13); ELinks now requires this.
AC_TRY_LINK([#include <gnutls/gnutls.h>], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]], [[gnutls_session_t dummy;
[gnutls_session_t dummy; gnutls_check_version(NULL)]])],[cf_result=yes],[cf_result=no])
gnutls_check_version(NULL)],
cf_result=yes, cf_result=no)
fi fi
if test "$cf_result" = yes; then if test "$cf_result" = yes; then
@ -1144,15 +1119,26 @@ dnl ===================================================================
AC_PATH_X AC_PATH_X
if test x"$no_x" != xyes; then if test x"$no_x" != xyes; then
EL_SAVE_FLAGS
if test -n "$x_includes"; then if test -n "$x_includes"; then
X_CFLAGS="-I$x_includes" X_CFLAGS="-I$x_includes"
CPPFLAGS="$CPPLAGS $X_CFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
fi fi
if test -n "$x_libraries"; then
LDFLAGS="$LDFLAGS -L$x_libraries"
fi
LIBS="-lX11 $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
EL_RESTORE_FLAGS
if test "$cf_result" = yes; then
if test -n "$x_libraries"; then if test -n "$x_libraries"; then
LDFLAGS="$LDFLAGS -L$x_libraries" LDFLAGS="$LDFLAGS -L$x_libraries"
fi fi
LIBS="-lX11 $LIBS" LIBS="-lX11 $LIBS"
EL_DEFINE(HAVE_X11, [X11 for restoring window titles]) EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
AC_SUBST(X_CFLAGS) AC_SUBST(X_CFLAGS)
fi
fi fi
@ -1401,7 +1387,7 @@ dnl ===================================================================
dnl A little fine tuning of gcc specific options (continued) dnl A little fine tuning of gcc specific options (continued)
dnl =================================================================== dnl ===================================================================
if test "x$ac_cv_prog_gcc" = "xyes"; then if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
if test "$CONFIG_DEBUG" = "yes"; then if test "$CONFIG_DEBUG" = "yes"; then
dnl We want to see all warnings and live with none (in debug mode). dnl We want to see all warnings and live with none (in debug mode).
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Werror"
@ -1438,9 +1424,7 @@ if test "x$ac_cv_prog_gcc" = "xyes"; then
AC_MSG_CHECKING([whether $CC accepts -Wno-always-true]) AC_MSG_CHECKING([whether $CC accepts -Wno-always-true])
EL_SAVE_FLAGS EL_SAVE_FLAGS
CFLAGS="$CFLAGS -Wno-always-true" CFLAGS="$CFLAGS -Wno-always-true"
AC_TRY_COMPILE([], [], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[AC_MSG_RESULT([yes])],[EL_RESTORE_FLAGS
[AC_MSG_RESULT([yes])],
[EL_RESTORE_FLAGS
AC_MSG_RESULT([no])]) AC_MSG_RESULT([no])])
fi fi
@ -1462,7 +1446,7 @@ dnl ===================================================================
dnl Generated files dnl Generated files
dnl =================================================================== dnl ===================================================================
AC_OUTPUT([ \ AC_CONFIG_FILES([ \
Makefile.config \ Makefile.config \
contrib/elinks.spec \ contrib/elinks.spec \
contrib/lua/hooks.lua \ contrib/lua/hooks.lua \
@ -1471,6 +1455,7 @@ AC_OUTPUT([ \
src/intl/gettext/ref-add.sed \ src/intl/gettext/ref-add.sed \
src/intl/gettext/ref-del.sed src/intl/gettext/ref-del.sed
]) ])
AC_OUTPUT
abs_srcdir="$(cd "$srcdir" && pwd)" abs_srcdir="$(cd "$srcdir" && pwd)"
# builddir is always absolute! # builddir is always absolute!

View File

@ -759,7 +759,7 @@ do_pass_uri_to_command(struct terminal *term, void *command_, void *xxx)
{ {
unsigned char *command = command_; unsigned char *command = command_;
exec_on_terminal(term, command, "", 0); exec_on_terminal(term, command, "", TERM_EXEC_BG);
mem_free(command); mem_free(command);
} }

View File

@ -27,8 +27,6 @@
/* XXX: Some strange dependency makes it necessary to this include last. */ /* XXX: Some strange dependency makes it necessary to this include last. */
#include "document/html/internal.h" #include "document/html/internal.h"
/* #define DEBUG_CSS */
/* TODO: A way to disable CSS completely, PLUS a way to stop various property /* TODO: A way to disable CSS completely, PLUS a way to stop various property
* groups from taking effect. (Ie. way to turn out effect of 'display: none' * groups from taking effect. (Ie. way to turn out effect of 'display: none'
@ -122,12 +120,18 @@ examine_element(struct html_context *html_context, struct css_selector *base,
struct list_head *selectors, struct html_element *element) struct list_head *selectors, struct html_element *element)
{ {
struct css_selector *selector; struct css_selector *selector;
unsigned char *code;
#ifdef DEBUG_CSS #ifdef DEBUG_CSS
/* Cannot use list_empty() inside the arglist of DBG() because
* GCC 4.1 "warning: operation on `errfile' may be undefined"
* breaks the build with -Werror. */
int dbg_has_leaves, dbg_has_properties;
DBG("examine_element(%p, %s, %d, %d, %p, %.*s);", html_context, base->name, seltype, rel, selectors, element->namelen, element->name); DBG("examine_element(%p, %s, %d, %d, %p, %.*s);", html_context, base->name, seltype, rel, selectors, element->namelen, element->name);
#define dbginfo(sel, type_, base) \ #define dbginfo(sel, type_, base) \
DBG("Matched selector %s (rel %d type %d [m%d])! Children %p !!%d, props !!%d", sel->name, sel->relation, sel->type, sel->type == type_, &sel->leaves, !list_empty(sel->leaves), !list_empty(sel->properties)) dbg_has_leaves = !list_empty(sel->leaves), \
dbg_has_properties = !list_empty(sel->properties), \
DBG("Matched selector %s (rel %d type %d [m%d])! Children %p !!%d, props !!%d", sel->name, sel->relation, sel->type, sel->type == type_, &sel->leaves, dbg_has_leaves, dbg_has_properties)
#else #else
#define dbginfo(sel, type, base) #define dbginfo(sel, type, base)
#endif #endif
@ -186,29 +190,27 @@ examine_element(struct html_context *html_context, struct css_selector *base,
process_found_selector(selector, CST_PSEUDO, base); process_found_selector(selector, CST_PSEUDO, base);
} }
code = get_attr_val(element->options, "class", html_context->doc_cp); if (element->attr.class && seltype <= CST_CLASS) {
if (code && seltype <= CST_CLASS) { const unsigned char *class = element->attr.class;
unsigned char *class = code;
while (class) { for (;;) {
unsigned char *end = strchr(class, ' '); const unsigned char *begin;
if (end) while (*class == ' ') ++class;
*end++ = 0; if (*class == '\0') break;
begin = class;
while (*class != ' ' && *class != '\0') ++class;
selector = find_css_selector(selectors, CST_CLASS, rel, class, -1); selector = find_css_selector(selectors, CST_CLASS, rel,
begin, class - begin);
process_found_selector(selector, CST_CLASS, base); process_found_selector(selector, CST_CLASS, base);
class = end;
} }
} }
mem_free_if(code);
code = get_attr_val(element->options, "id", html_context->doc_cp); if (element->attr.id && seltype <= CST_ID) {
if (code && seltype <= CST_ID) { selector = find_css_selector(selectors, CST_ID, rel, element->attr.id, -1);
selector = find_css_selector(selectors, CST_ID, rel, code, -1);
process_found_selector(selector, CST_ID, base); process_found_selector(selector, CST_ID, base);
} }
if (code) mem_free(code);
#undef process_found_selector #undef process_found_selector
#undef dbginfo #undef dbginfo

View File

@ -21,8 +21,6 @@
#include "util/memory.h" #include "util/memory.h"
#include "util/string.h" #include "util/string.h"
/* #define DEBUG_CSS */
void void
css_parse_properties(struct list_head *props, struct scanner *scanner) css_parse_properties(struct list_head *props, struct scanner *scanner)
@ -172,7 +170,20 @@ struct selector_pkg {
struct css_selector *selector; struct css_selector *selector;
}; };
struct css_selector * /** Move a CSS selector and its leaves into a new list. If a similar
* selector already exists in the list, merge them.
*
* \param sels
* The list to which \a selector should be moved. Must not be NULL.
* \param selector
* The selector that should be moved. Must not be NULL. If it is
* already in some list, this function removes it from there.
* \param watch
* This function updates \a *watch if it merges that selector into
* another one. \a watch must not be NULL but \a *watch may be.
*
* \return \a selector or the one into which it was merged. */
static struct css_selector *
reparent_selector(struct list_head *sels, struct css_selector *selector, reparent_selector(struct list_head *sels, struct css_selector *selector,
struct css_selector **watch) struct css_selector **watch)
{ {
@ -481,11 +492,17 @@ css_parse_ruleset(struct css_stylesheet *css, struct scanner *scanner)
/* Mirror the properties to all the selectors. */ /* Mirror the properties to all the selectors. */
foreach (pkg, selectors) { foreach (pkg, selectors) {
#ifdef DEBUG_CSS #ifdef DEBUG_CSS
/* Cannot use list_empty() inside the arglist of DBG()
* because GCC 4.1 "warning: operation on `errfile'
* may be undefined" breaks the build with -Werror. */
int dbg_has_properties = !list_empty(properties);
int dbg_has_leaves = !list_empty(pkg->selector->leaves);
DBG("Binding properties (!!%d) to selector %s (type %d, relation %d, children %d)", DBG("Binding properties (!!%d) to selector %s (type %d, relation %d, children %d)",
!list_empty(properties), dbg_has_properties,
pkg->selector->name, pkg->selector->type, pkg->selector->name, pkg->selector->type,
pkg->selector->relation, pkg->selector->relation,
!list_empty(pkg->selector->leaves)); dbg_has_leaves);
#endif #endif
add_selector_properties(pkg->selector, &properties); add_selector_properties(pkg->selector, &properties);
} }

View File

@ -27,7 +27,7 @@
struct css_selector * struct css_selector *
find_css_selector(struct list_head *sels, enum css_selector_type type, find_css_selector(struct list_head *sels, enum css_selector_type type,
enum css_selector_relation rel, enum css_selector_relation rel,
unsigned char *name, int namelen) const unsigned char *name, int namelen)
{ {
struct css_selector *selector; struct css_selector *selector;

View File

@ -4,6 +4,8 @@
#include "util/lists.h" #include "util/lists.h"
/* #define DEBUG_CSS */
/* TODO: We need a memory efficient and fast way to define how properties /* TODO: We need a memory efficient and fast way to define how properties
* cascade. What we are interested in is making it fast and easy to find * cascade. What we are interested in is making it fast and easy to find
* all properties we need. * all properties we need.
@ -118,7 +120,7 @@ struct css_selector *get_css_selector(struct list_head *selector_list,
struct css_selector *find_css_selector(struct list_head *selector_list, struct css_selector *find_css_selector(struct list_head *selector_list,
enum css_selector_type type, enum css_selector_type type,
enum css_selector_relation rel, enum css_selector_relation rel,
unsigned char *name, int namelen); const unsigned char *name, int namelen);
#define find_css_base_selector(stylesheet, type, rel, name, namelen) \ #define find_css_base_selector(stylesheet, type, rel, name, namelen) \
find_css_selector(&stylesheet->selectors, rel, type, name, namelen) find_css_selector(&stylesheet->selectors, rel, type, name, namelen)

View File

@ -52,6 +52,16 @@ struct text_attrib {
#endif #endif
color_T image_link; color_T image_link;
#ifdef CONFIG_CSS
/* Bug 766: CSS speedup. 56% of CPU time was going to
* get_attr_value(). Of those calls, 97% were asking for "id"
* or "class". So cache the results. start_element() sets up
* these pointers if html_context->options->css_enable;
* otherwise they remain NULL. */
unsigned char *id;
unsigned char *class;
#endif
unsigned char *select; unsigned char *select;
int select_disabled; int select_disabled;
unsigned int tabindex; unsigned int tabindex;

View File

@ -905,6 +905,10 @@ start_element(struct element_info *ei,
* usually have type != ET_NESTABLE when we either (1) * usually have type != ET_NESTABLE when we either (1)
* rescan on your own from somewhere else (2) html_stack_dup() * rescan on your own from somewhere else (2) html_stack_dup()
* in our own way. --pasky */ * in our own way. --pasky */
mem_free_set(&html_top->attr.id,
get_attr_val(attr, "id", html_context->doc_cp));
mem_free_set(&html_top->attr.class,
get_attr_val(attr, "class", html_context->doc_cp));
/* Call it now to gain some of the stuff which might affect /* Call it now to gain some of the stuff which might affect
* formatting of some elements. */ * formatting of some elements. */
/* FIXME: The caching of the CSS selector is broken, since t can /* FIXME: The caching of the CSS selector is broken, since t can

View File

@ -107,6 +107,11 @@ kill_html_stack_item(struct html_context *html_context, struct html_element *e)
mem_free_if(e->attr.title); mem_free_if(e->attr.title);
mem_free_if(e->attr.select); mem_free_if(e->attr.select);
#ifdef CONFIG_CSS
mem_free_if(e->attr.id);
mem_free_if(e->attr.class);
#endif
mem_free_if(e->attr.onclick); mem_free_if(e->attr.onclick);
mem_free_if(e->attr.ondblclick); mem_free_if(e->attr.ondblclick);
mem_free_if(e->attr.onmouseover); mem_free_if(e->attr.onmouseover);
@ -146,6 +151,8 @@ html_stack_dup(struct html_context *html_context, enum html_element_mortality_ty
if (ep->attr.title) e->attr.title = stracpy(ep->attr.title); if (ep->attr.title) e->attr.title = stracpy(ep->attr.title);
if (ep->attr.select) e->attr.select = stracpy(ep->attr.select); if (ep->attr.select) e->attr.select = stracpy(ep->attr.select);
e->attr.id = e->attr.class = NULL;
/* We don't want to propagate these. */ /* We don't want to propagate these. */
/* XXX: For sure? --pasky */ /* XXX: For sure? --pasky */
e->attr.onclick = e->attr.ondblclick = e->attr.onmouseover = e->attr.onhover e->attr.onclick = e->attr.ondblclick = e->attr.onmouseover = e->attr.onhover

View File

@ -1858,8 +1858,8 @@ check_html_form_hierarchy(struct part *part)
foreachsafe (fc, next, form_controls) { foreachsafe (fc, next, form_controls) {
foreach (form, document->forms) { foreach (form, document->forms) {
if (fc->position < form->form_num if (form->form_num <= fc->position
|| form->form_end < fc->position) && fc->position <= form->form_end)
continue; continue;
fc->form = form; fc->form = form;

View File

@ -90,6 +90,6 @@ open_new_window(struct terminal *term, unsigned char *exe_name,
(unsigned char *) NULL); (unsigned char *) NULL);
if (!command) return; if (!command) return;
exec_on_terminal(term, command, "", 2); exec_on_terminal(term, command, "", TERM_EXEC_NEWWIN);
mem_free(command); mem_free(command);
} }

View File

@ -193,7 +193,7 @@ static struct option_info http_options[] = {
"is sent to HTTP server when a document is requested. The 'textmode'\n" "is sent to HTTP server when a document is requested. The 'textmode'\n"
"token in the first field is our silent attempt to establish this as\n" "token in the first field is our silent attempt to establish this as\n"
"a standard for new textmode user agents, so that the webmasters can\n" "a standard for new textmode user agents, so that the webmasters can\n"
"have just a single uniform test for these if they are ie. pushing\n" "have just a single uniform test for these if they are e.g. pushing\n"
"some lite version to them automagically.\n" "some lite version to them automagically.\n"
"%v in the string means ELinks version\n" "%v in the string means ELinks version\n"
"%s in the string means system identification\n" "%s in the string means system identification\n"

View File

@ -300,7 +300,7 @@ user_protocol_handler(struct session *ses, struct uri *uri)
if (prog) { if (prog) {
unsigned char *delete = empty_string_or_(filename); unsigned char *delete = empty_string_or_(filename);
exec_on_terminal(ses->tab->term, prog, delete, 1); exec_on_terminal(ses->tab->term, prog, delete, TERM_EXEC_FG);
mem_free(prog); mem_free(prog);
} else if (filename) { } else if (filename) {

View File

@ -231,7 +231,8 @@ static int
l_execute(LS) l_execute(LS)
{ {
if (lua_isstring(S, 1)) { if (lua_isstring(S, 1)) {
exec_on_terminal(lua_ses->tab->term, (unsigned char *) lua_tostring(S, 1), "", 0); exec_on_terminal(lua_ses->tab->term, (unsigned char *) lua_tostring(S, 1), "",
TERM_EXEC_BG);
lua_pushnumber(S, 0); lua_pushnumber(S, 0);
return 1; return 1;
} }
@ -795,7 +796,7 @@ handle_ret_run(struct session *ses)
unsigned char *cmd = (unsigned char *) lua_tostring(L, -1); unsigned char *cmd = (unsigned char *) lua_tostring(L, -1);
if (cmd) { if (cmd) {
exec_on_terminal(ses->tab->term, cmd, "", 1); exec_on_terminal(ses->tab->term, cmd, "", TERM_EXEC_FG);
return; return;
} }

View File

@ -103,7 +103,7 @@ elinks_execute(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
if (!*string) if (!*string)
return JS_TRUE; return JS_TRUE;
exec_on_terminal(smjs_ses->tab->term, string, "", 0); exec_on_terminal(smjs_ses->tab->term, string, "", TERM_EXEC_BG);
undef_to_jsval(ctx, rval); undef_to_jsval(ctx, rval);
return JS_TRUE; return JS_TRUE;

View File

@ -376,7 +376,7 @@ download_data_store(struct download *download, struct file_download *file_downlo
} else { } else {
exec_on_terminal(term, file_download->external_handler, exec_on_terminal(term, file_download->external_handler,
file_download->file, file_download->file,
!!file_download->block); file_download->block ? TERM_EXEC_FG : TERM_EXEC_BG);
file_download->delete = 0; file_download->delete = 0;
abort_download_and_beep(file_download, term); abort_download_and_beep(file_download, term);
} }
@ -1100,7 +1100,8 @@ tp_open(struct type_query *type_query)
read_from_popen(type_query->ses, handler, NULL); read_from_popen(type_query->ses, handler, NULL);
else else
exec_on_terminal(type_query->ses->tab->term, exec_on_terminal(type_query->ses->tab->term,
handler, "", !!type_query->block); handler, "",
type_query->block ? TERM_EXEC_FG : TERM_EXEC_BG);
mem_free(handler); mem_free(handler);
} }

View File

@ -510,7 +510,7 @@ in_sock(struct itrm *itrm)
struct string path; struct string path;
struct string delete; struct string delete;
char ch; char ch;
int fg; int fg; /* enum term_exec */
ssize_t bytes_read, i, p; ssize_t bytes_read, i, p;
unsigned char buf[ITRM_OUT_QUEUE_SIZE]; unsigned char buf[ITRM_OUT_QUEUE_SIZE];
@ -575,7 +575,7 @@ has_nul_byte:
unsigned char *param; unsigned char *param;
int path_len, del_len, param_len; int path_len, del_len, param_len;
if (is_blocked() && fg) { if (is_blocked() && fg != TERM_EXEC_BG) {
if (*delete.source) unlink(delete.source); if (*delete.source) unlink(delete.source);
goto nasty_thing; goto nasty_thing;
} }
@ -591,20 +591,20 @@ has_nul_byte:
memcpy(param + 1, path.source, path_len + 1); memcpy(param + 1, path.source, path_len + 1);
memcpy(param + 1 + path_len + 1, delete.source, del_len + 1); memcpy(param + 1 + path_len + 1, delete.source, del_len + 1);
if (fg == 1) block_itrm(); if (fg == TERM_EXEC_FG) block_itrm();
blockh = start_thread((void (*)(void *, int)) exec_thread, blockh = start_thread((void (*)(void *, int)) exec_thread,
param, param_len); param, param_len);
mem_free(param); mem_free(param);
if (blockh == -1) { if (blockh == -1) {
if (fg == 1) if (fg == TERM_EXEC_FG)
unblock_itrm(); unblock_itrm();
goto nasty_thing; goto nasty_thing;
} }
if (fg == 1) { if (fg == TERM_EXEC_FG) {
set_handlers(blockh, (select_handler_T) unblock_itrm_x, set_handlers(blockh, (select_handler_T) unblock_itrm_x,
NULL, (select_handler_T) unblock_itrm_x, NULL, (select_handler_T) unblock_itrm_x,
(void *) (long) blockh); (void *) (long) blockh);

View File

@ -179,7 +179,7 @@ exec_thread(unsigned char *path, int p)
int plen = strlen(path + 1) + 2; int plen = strlen(path + 1) + 2;
#if defined(HAVE_SETPGID) && !defined(CONFIG_OS_BEOS) && !defined(HAVE_BEGINTHREAD) #if defined(HAVE_SETPGID) && !defined(CONFIG_OS_BEOS) && !defined(HAVE_BEGINTHREAD)
if (path[0] == 2) setpgid(0, 0); if (path[0] == TERM_EXEC_NEWWIN) setpgid(0, 0);
#endif #endif
exe(path + 1); exe(path + 1);
if (path[plen]) unlink(path + plen); if (path[plen]) unlink(path + plen);
@ -210,7 +210,7 @@ static void
exec_on_master_terminal(struct terminal *term, exec_on_master_terminal(struct terminal *term,
unsigned char *path, int plen, unsigned char *path, int plen,
unsigned char *delete, int dlen, unsigned char *delete, int dlen,
int fg) enum term_exec fg)
{ {
int blockh; int blockh;
int param_size = plen + dlen + 2 /* 2 null char */ + 1 /* fg */; int param_size = plen + dlen + 2 /* 2 null char */ + 1 /* fg */;
@ -222,17 +222,17 @@ exec_on_master_terminal(struct terminal *term,
memcpy(param + 1, path, plen + 1); memcpy(param + 1, path, plen + 1);
memcpy(param + 1 + plen + 1, delete, dlen + 1); memcpy(param + 1 + plen + 1, delete, dlen + 1);
if (fg == 1) block_itrm(); if (fg == TERM_EXEC_FG) block_itrm();
blockh = start_thread((void (*)(void *, int)) exec_thread, blockh = start_thread((void (*)(void *, int)) exec_thread,
param, param_size); param, param_size);
fmem_free(param); fmem_free(param);
if (blockh == -1) { if (blockh == -1) {
if (fg == 1) unblock_itrm(); if (fg == TERM_EXEC_FG) unblock_itrm();
return; return;
} }
if (fg == 1) { if (fg == TERM_EXEC_FG) {
term->blocked = blockh; term->blocked = blockh;
set_handlers(blockh, set_handlers(blockh,
(select_handler_T) unblock_terminal, (select_handler_T) unblock_terminal,
@ -253,7 +253,7 @@ static void
exec_on_slave_terminal( struct terminal *term, exec_on_slave_terminal( struct terminal *term,
unsigned char *path, int plen, unsigned char *path, int plen,
unsigned char *delete, int dlen, unsigned char *delete, int dlen,
int fg) enum term_exec fg)
{ {
int data_size = plen + dlen + 1 /* 0 */ + 1 /* fg */ + 2 /* 2 null char */; int data_size = plen + dlen + 1 /* 0 */ + 1 /* fg */ + 2 /* 2 null char */;
unsigned char *data = fmem_alloc(data_size); unsigned char *data = fmem_alloc(data_size);
@ -270,7 +270,7 @@ exec_on_slave_terminal( struct terminal *term,
void void
exec_on_terminal(struct terminal *term, unsigned char *path, exec_on_terminal(struct terminal *term, unsigned char *path,
unsigned char *delete, int fg) unsigned char *delete, enum term_exec fg)
{ {
if (path) { if (path) {
if (!*path) return; if (!*path) return;
@ -279,7 +279,7 @@ exec_on_terminal(struct terminal *term, unsigned char *path,
} }
#ifdef NO_FG_EXEC #ifdef NO_FG_EXEC
fg = 0; fg = TERM_EXEC_BG;
#endif #endif
if (term->master) { if (term->master) {
@ -288,7 +288,7 @@ exec_on_terminal(struct terminal *term, unsigned char *path,
return; return;
} }
if (fg && is_blocked()) { if (fg != TERM_EXEC_BG && is_blocked()) {
unlink(delete); unlink(delete);
return; return;
} }
@ -314,7 +314,7 @@ exec_shell(struct terminal *term)
sh = get_shell(); sh = get_shell();
if (sh && *sh) if (sh && *sh)
exec_on_terminal(term, sh, "", 1); exec_on_terminal(term, sh, "", TERM_EXEC_FG);
} }
@ -328,7 +328,7 @@ do_terminal_function(struct terminal *term, unsigned char code,
if (!x_data) return; if (!x_data) return;
x_data[0] = code; x_data[0] = code;
memcpy(x_data + 1, data, data_len + 1); memcpy(x_data + 1, data, data_len + 1);
exec_on_terminal(term, NULL, x_data, 0); exec_on_terminal(term, NULL, x_data, TERM_EXEC_BG);
fmem_free(x_data); fmem_free(x_data);
} }

View File

@ -175,10 +175,28 @@ void destroy_all_terminals(void);
void exec_thread(unsigned char *, int); void exec_thread(unsigned char *, int);
void close_handle(void *); void close_handle(void *);
/* Operations that can be requested with do_terminal_function().
* The interlink protocol passes these values as one byte in a
* null-terminated string, so zero cannot be used. */
#define TERM_FN_TITLE 1 #define TERM_FN_TITLE 1
#define TERM_FN_RESIZE 2 #define TERM_FN_RESIZE 2
void exec_on_terminal(struct terminal *, unsigned char *, unsigned char *, int); /* How to execute a program in a terminal. These values are used in
* the interlink protocol and must fit in one byte. */
enum term_exec {
/* Execute in the background. ELinks keeps using the terminal
* and the program should not use it. */
TERM_EXEC_BG = 0,
/* Execute in the foreground. The program may use the terminal.
* ELinks will redraw when the program exits. */
TERM_EXEC_FG = 1,
/* Execute in the background and in a new process group. */
TERM_EXEC_NEWWIN = 2
};
void exec_on_terminal(struct terminal *, unsigned char *, unsigned char *, enum term_exec);
void exec_shell(struct terminal *term); void exec_shell(struct terminal *term);
void set_terminal_title(struct terminal *, unsigned char *); void set_terminal_title(struct terminal *, unsigned char *);

View File

@ -625,7 +625,7 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_,
} }
if (term_) term = term_; if (term_) term = term_;
exec_on_terminal(term, ex, "", 1); exec_on_terminal(term, ex, "", TERM_EXEC_FG);
mem_free(ex); mem_free(ex);
textarea_editor = 1; textarea_editor = 1;