Репозитории ALT
S: | 0.15.1-alt2 |
5.1: | 0.12-alt0.9 |
4.1: | 0.12-alt0.1 |
4.0: | 0.11.4-alt1.M40.1 |
3.0: | 0.10.5-alt1 |
Группа :: Сети/WWW
Пакет: elinks
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: elinks-0.11.4-alt1.M40.1.patch
Скачать
Скачать
.gear/rules | 2 +
.../tags/76d5dc47b055cdf412dab5f65138189fa68d4f25 | 119 +++++++++
.gear/tags/list | 1 +
configure.in | 11 +-
elinks.conf | 15 +
elinks.spec | 272 ++++++++++++++++++++
src/bfu/listbox.c | 2 +-
src/config/options.inc | 5 +-
src/intl/charsets.c | 5 +-
src/main/main.c | 8 +-
src/osdep/osdep.c | 7 +-
src/protocol/http/http.c | 4 +-
src/protocol/smb/smb.c | 12 +-
src/protocol/user.c | 39 ++-
src/scripting/lua/core.c | 13 +-
src/scripting/lua/hooks.c | 2 +-
src/session/download.c | 46 ++--
src/setup.h | 8 +-
src/terminal/terminal.c | 1 +
src/util/error.c | 7 +-
src/util/file.c | 6 +-
src/viewer/text/search.c | 5 +-
src/viewer/text/textarea.c | 37 ++-
23 files changed, 540 insertions(+), 87 deletions(-)
diff --git a/.gear/rules b/.gear/rules
new file mode 100644
index 0000000..460bf56
--- /dev/null
+++ b/.gear/rules
@@ -0,0 +1,2 @@
+tar: elinks-@version@:.
+diff: elinks-@version@:. .
diff --git a/.gear/tags/76d5dc47b055cdf412dab5f65138189fa68d4f25 b/.gear/tags/76d5dc47b055cdf412dab5f65138189fa68d4f25
new file mode 100644
index 0000000..f1dbd45
--- /dev/null
+++ b/.gear/tags/76d5dc47b055cdf412dab5f65138189fa68d4f25
@@ -0,0 +1,119 @@
+object 8015269e363a6fadf9cf5e2f0c7f1bb3b7d9c7bf
+type commit
+tag elinks-0.11.4
+tagger Jonas Fonseca <fonseca@diku.dk> 1213992924 +0200
+
+ELinks 0.11.4
+
+Here goes the final 0.11.4 release containing mostly bug fixes and
+translation updates. Hopefully this will be one of the last releases of
+the long lived 0.11 branch that came to life back in 2006-01-01, since
+all the goodies in the 0.12 branch brings considerable improvements in
+terms of UTF-8 support etc.
+
+Below is the complete shortlog of changes since 0.11.4rc1 and the NEWS
+entry for this release with information about bug fixes.
+
+Adam Golebiowski (1):
+ pl.po: Shortcut key for File/resize terminal changed from 't' to 'r'.
+
+Jonas Fonseca (5):
+ elinks-0.11.4rc1.GIT
+ Update Danish translation
+ Update po files
+ Update manpages for 0.11.4
+ elinks-0.11.4
+
+Kalle Olavi Niemitalo (10):
+ keys2doc: Change \"foo\" to "foo".
+ update-man: Install manpages to srcdir, not builddir.
+ elinks.conf.5: quoting corrections
+ Bug 939: Documented the fix.
+ Bug 1012: Compile with -fno-strict-overflow or -fwrapv.
+ Bug 1014: Fix incompatible pointer type in init_perl.
+ NEWS: mention bug 1014
+ Bug 1016: Avoid JSFunctionSpec.
+ NEWS: Critical bug 674 is a duplicate of 956.
+ NEWS: Remove the "should be removed" section.
+
+Miciah Dashiel Butler Masters (2):
+ elinks.conf.5: Correct description of 'unset' directive
+ save_textarea_file: don't return a dangling pointer if open fails
+
+Paul B. Mahol (1):
+ Recognize Insert key on cons25 (FreeBSD console)
+
+Witold Filipczyk (7):
+ Polish translation was updated.
+ Mark option changed in "File extensions -> Add".
+ bittorrent: Overflow occuring when a piece was rejected.
+ fsp: Fixed a serious bug.
+ Test whether CIA works.
+ Test commit.
+ pl.po: Question marks.
+
+The complete list of bug fixes since 0.11.3 (from NEWS):
+
+* critical bug 755: fix crashes due to dangling pointers to struct
+ 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 1003: don't crash if a smart URI rewrite template gets
+ too few parameters
+* critical bug 1016: avoid JSFunctionSpec for better compatibility
+ across versions of SpiderMonkey
+* critical bugs 674, 956: don't reuse pointers to SpiderMonkey objects
+ that may have been collected as garbage. This fix causes bug 954.
+* CVE-2007-2027: check if the program path contains "src/" before
+ using ../po files
+* important Debian bug 380347: prevent a buffer overflow in entity_cache
+ and a possible subsequent crash
+* major bug 788: don't read STRLEN n_a, which isn't initialized by
+ POPpx of Perl v5.8.8 and later
+* fix query parsing in file: URIs for local CGI (was broken in 0.11.3)
+* bug 451: fix incompatible pointer type in PERL_SYS_INIT3 call
+* bug 691: don't look up bogus IPv4 addresses based on characters of a
+ hostname
+* bug 712: GnuTLS works on https://www-s.uiuc.edu/[]
+* fix active and passive FTP over IPv6
+* bug 938: elinks -remote no longer needs a controlling tty
+* bug 939: fix FSP directory listing (some compiler options left it empty)
+* bug 978: Python's webbrowser.open_new_tab(URL) works since now
+* bug 1012: compile with -fno-strict-overflow or -fwrapv if available
+* bug 1014: fix incompatible pointer type in Perl_sys_init3 call
+* minor bug 54, Debian bug 338402: don't force the terminal to 8 bits
+ with no parity, and don't disable XON/XOFF flow control either
+* minor bug 951 in user SMJS: garbage-collect SMJS objects on 'File ->
+ Flush all caches' to work around their holding cache entries busy
+* minor bug 396: never show empty filename in the what-to-do dialog
+* minor bug 461: ensure contrast in blank areas, to keep the cursor visible
+* minor bug 928: properly display no-break spaces in a UTF-8 document
+ if the terminal uses some other charset
+* minor bug 987: English spelling and grammar corrections
+* minor bug 1000: preserve any query and fragment when converting a
+ file name to a file:// URL
+* minor: don't assume sizeof(int)==4 in bittorrent
+* trivial bug 947: document.html.wrap_nbsp also affects text in tables
+* trivial bug 997: fix unlikely stack corruption in active FTP
+* build bug 1002: fix ``comparison is always true due to limited range
+ of data type'' warning on PowerPC and s390
+* build bug 950: fix ``config/install-sh: No such file or directory''
+ on SunOS
+* build bug 936: fix errors about undefined off_t (autoheader
+ incompatibility)
+* build bug 959: test in configure whether -lX11 works
+* build: update SpiderMonkey configure check Debian compatibility
+* build: use $(CPPFLAGS) rather than $(AM_CFLAGS)
+* build: disable GCC 4.2 warning about builtin_modules
+* build: move debian/ to contrib/debian/
+* minor build bug 989: AsciiDoc 8.2.2 compatibility
+* minor build bug 960: fix errors in loadmsgcat.c if mmap() exists but
+ munmap() doesn't
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQBIXA/jJfQykjqsXHcRAiSWAJ9BknlbJWiU/lNwDDBMOAiYhk9uEACeJs6I
+H7lJtazQxk4zl8714yn8c9M=
+=5YhM
+-----END PGP SIGNATURE-----
diff --git a/.gear/tags/list b/.gear/tags/list
new file mode 100644
index 0000000..87ab8f3
--- /dev/null
+++ b/.gear/tags/list
@@ -0,0 +1 @@
+76d5dc47b055cdf412dab5f65138189fa68d4f25 elinks-0.11.4
diff --git a/configure.in b/configure.in
index 85e6615..753a5be 100644
--- a/configure.in
+++ b/configure.in
@@ -236,7 +236,7 @@ AC_MSG_CHECKING([for -rdynamic])
LDFLAGS_X="$LDFLAGS"
LDFLAGS="$LDFLAGS -rdynamic"
AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
-test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
+LDFLAGS="$LDFLAGS_X"
AC_MSG_RESULT($have_rdynamic)
dnl ===================================================================
@@ -759,11 +759,7 @@ if test -z "$disable_lua"; then
AC_TRY_LINK([ #include <lua.h>
#include <lualib.h>],
[ lua_State *L = lua_open();
- luaopen_base(L);
- luaopen_table(L);
- luaopen_io(L);
- luaopen_string(L);
- luaopen_math(L);
+ luaL_openlibs(L);
lua_pushboolean(L, 1);
lua_close(L);],
cf_result=yes, cf_result=no)
@@ -1190,6 +1186,9 @@ EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
[ --disable-backtrace disable backtrace support])
+if test "$CONFIG_BACKTRACE" = yes && test "$have_rdynamic" = yes; then
+ LDFLAGS="$LDFLAGS -rdynamic"
+fi
EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
[ --enable-no-root enable prevention of usage by root])
diff --git a/elinks.conf b/elinks.conf
new file mode 100644
index 0000000..6f9f8b4
--- /dev/null
+++ b/elinks.conf
@@ -0,0 +1,15 @@
+# ALT defaults for ELinks.
+# See elinks.conf(5) for details.
+# Use Options manager for customization.
+
+# Assume VT100 colored terminal.
+set terminal._template_.colors = 1
+set terminal._template_.type = 1
+
+# Vi-style scrolling.
+bind "main" "k" = "scroll-up"
+bind "main" "j" = "scroll-down"
+
+# Smart prefixes for ALT bugzilla.
+set protocol.rewrite.smart.altbug = "https://bugzilla.altlinux.org/buglist.cgi?component=%0&component_type=substring&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"
+set protocol.rewrite.smart.altbugno = "https://bugzilla.altlinux.org/show_bug.cgi?id=%0"
diff --git a/elinks.spec b/elinks.spec
new file mode 100644
index 0000000..f51624a
--- /dev/null
+++ b/elinks.spec
@@ -0,0 +1,272 @@
+Name: elinks
+Version: 0.11.4
+Release: alt1.M40.1
+
+Summary: Lynx-like text WWW browser with many features
+License: GPL
+Group: Networking/WWW
+
+URL: http://elinks.cz
+Source: elinks-%version.tar
+Patch: elinks-%version-%release.patch
+
+#Patch6: elinks-0.10.1-alt-owl-man.patch
+#Patch10: elinks-0.5-alt-pld-lua-scripts-fixes.patch
+#Patch11: elinks-0.5-alt-hooks.patch
+#Patch12: elinks-0.5-alt-default-lang-charset.patch
+
+# alternatives
+%set_compress_method gzip
+%define weight 30
+PreReq: alternatives >= 0.2.0
+BuildPreReq: alternatives >= 0.2.0
+
+Provides: webclient, links
+Provides: %_bindir/links
+Obsoletes: links
+
+# Automatically added by buildreq on Mon Apr 16 2007
+BuildRequires: asciidoc bzlib-devel docbook-utils libexpat-devel libgpm-devel liblua5-devel libssl-devel python-modules-encodings termutils unzip xmlto zlib-devel
+
+%description
+ELinks is advanced text-mode web browser with wide scale of additional
+features and extensibility by possibility to plug in own scripts in Lua
+language. This project aims to provide feature-rich version of Links,
+with more open patches/features inclusion policy.
+
+%prep
+%setup -q
+%patch -p1
+unzip -d icons contrib/LinksOS2Icon.zip
+
+%build
+cat config/m4/*.m4 >acinclude.m4
+autoreconf -fisv
+export ac_cv_prog_HAVE_SMBCLIENT=no
+%configure --without-x --sysconfdir=/etc/elinks %{subst_enable debug} \
+ --enable-cgi --enable-finger --enable-gopher --enable-nntp --disable-smb \
+ --enable-256-colors --disable-leds --without-spidermonkey --without-idn
+make -C src V=1 CFLAGS="%optflags -fno-strict-aliasing -Wno-pointer-sign -Werror"
+make -C doc V=1 features.txt manual.html
+
+%install
+%makeinstall V=1
+
+mkdir -p %buildroot%_menudir
+cat <<__EOF__ >%buildroot%_menudir/elinks
+?package(elinks): \
+ command="%_bindir/elinks" \
+ needs="text" \
+ icon="elinks.png" \
+ section="%group" \
+ title="ELinks" \
+ longtitle="%summary"
+__EOF__
+
+mkdir -p %buildroot%_altdir
+cat <<__EOF__ >%buildroot%_altdir/elinks
+%_bindir/links %_bindir/elinks %weight
+%_man1dir/links.1.gz %_man1dir/elinks.1.gz %_bindir/elinks
+__EOF__
+
+install -pD -m644 icons/LinksIconSmallColor.png %buildroot%_miconsdir/elinks.png
+install -pD -m644 icons/LinksIcon32x32VGA.png %buildroot%_niconsdir/elinks.png
+install -pD -m644 icons/LinksIconXGA16.png %buildroot%_liconsdir/elinks.png
+
+install -pD -m644 elinks.conf %buildroot/etc/elinks/elinks.conf
+
+%find_lang elinks
+
+%post
+%register_alternatives elinks
+%update_menus
+
+%preun
+%unregister_alternatives elinks
+
+%postun
+%clean_menus
+
+%files -f elinks.lang
+%_bindir/elinks
+%dir /etc/elinks
+%config(noreplace) /etc/elinks/elinks.conf
+%_man1dir/elinks.*
+%_man5dir/elinks*
+%_menudir/elinks
+%_altdir/elinks
+%_miconsdir/elinks.png
+%_niconsdir/elinks.png
+%_liconsdir/elinks.png
+%doc AUTHORS NEWS README THANKS
+%doc doc/manual.html
+
+%changelog
+* Mon Aug 04 2008 Alexey Tourbin <at@altlinux.ru> 0.11.4-alt1.M40.1
+- 0.11.3 -> 0.11.4
+
+* Wed Apr 18 2007 Alexey Tourbin <at@altlinux.ru> 0.11.3-alt1.1
+- uncompressed tarball, added release to tarball name
+
+* Mon Apr 16 2007 Alexey Tourbin <at@altlinux.ru> 0.11.3-alt1
+- 0.11.2 -> 0.11.3
+
+* Tue Nov 21 2006 Alexey Tourbin <at@altlinux.ru> 0.11.2-alt1
+- 0.11.1 -> 0.11.2 (SMB protocol disabled, CVE-2006-5925)
+
+* Sun Oct 15 2006 Alexey Tourbin <at@altlinux.ru> 0.11.1-alt3
+- fixed more gcc warnings (check asprintf return value)
+- restored -rdynamic for use with backtrace
+
+* Sat Oct 14 2006 Alexey Tourbin <at@altlinux.ru> 0.11.1-alt2
+- cloned git tree from elinks.cz, applied my changes and built with gear
+- fixed a handful of warnings emitted by new gcc compiler
+- fixed lua alert message on startup (when hooks.lua fails)
+- removed -rdynamic from LDFLAGS
+- changed doc packaging; only asciidoc-generated manual.html is now
+ packaged, which really has most of the stuff inside it
+
+* Wed May 17 2006 Alexey Tourbin <at@altlinux.ru> 0.11.1-alt1
+- 0.10.6 -> 0.11.1
+- patched for lua-5.1
+
+* Thu Sep 15 2005 Alexey Tourbin <at@altlinux.ru> 0.10.6-alt1
+- 0.10.5 -> 0.10.6
+
+* Thu May 05 2005 Alexey Tourbin <at@altlinux.ru> 0.10.5-alt1
+- 0.10.4 -> 0.10.5
+
+* Wed Apr 06 2005 Alexey Tourbin <at@altlinux.ru> 0.10.4-alt1
+- 0.10.3 -> 0.10.4
+
+* Thu Mar 03 2005 Alexey Tourbin <at@altlinux.ru> 0.10.3-alt1
+- 0.10.2 -> 0.10.3
+
+* Thu Feb 03 2005 Alexey Tourbin <at@altlinux.ru> 0.10.2-alt1
+- 0.10.1 -> 0.10.2
+- added smart prefixes (altbug and altbugno) for ALT bugzilla to elinks.conf
+
+* Thu Jan 06 2005 Alexey Tourbin <at@altlinux.ru> 0.10.1-alt1
+- 0.10pre3 -> 0.10.1
+- build without JavaScript by default
+- build without libidn
+- %_docdir/elinks-%version/contrib not packaged
+
+* Mon Nov 08 2004 Alexey Tourbin <at@altlinux.ru> 0.10-alt0.2
+- 0.10pre2 -> 0.10pre3
+
+* Thu Oct 07 2004 Alexey Tourbin <at@altlinux.ru> 0.10-alt0.1
+- 0.9.1 -> 0.10pre2
+- enabled JavaScript, Finger, Gopher, NNTP, international domain names
+- updated patches
+- upgraded to new alternatives format
+- rebuilt with lua5:
+ + /etc/elinks/hooks.lua not packaged
+ + smart prefixes available under `Options Manager/Protocol/URI Rewrite'
+ + old hooks.lua for lua4 available in %_docdir/elinks-%version/contrib/lua
+
+* Mon May 10 2004 ALT QA Team Robot <qa-robot@altlinux.org> 0.9.1-alt4.1
+- Rebuilt with openssl-0.9.7d.
+
+* Fri Mar 19 2004 Alexey Tourbin <at@altlinux.ru> 0.9.1-alt4
+- cvs-listbox-segfault.patch: fixes elinks bug #391 (oh my)
+- cvs-menu-segfault.patch: fixes elinks bug #394
+
+* Sat Feb 07 2004 Alexey Tourbin <at@altlinux.ru> 0.9.1-alt3
+- Owl patches updated:
+ * Fri Feb 06 2004 Michail Litvak <mci@owl.openwall.com> 0.9.1-owl4
+ - Fix yet another bug in -owl-tmp patch (Thanks to Maxim Timofeyev).
+
+* Mon Feb 02 2004 Alexey Tourbin <at@altlinux.ru> 0.9.1-alt2
+- Owl patches updated:
+ * Sun Feb 01 2004 Solar Designer <solar@owl.openwall.com> 0.9.1-owl3
+ - Don't leak kernel version information (uname -srm) via User-Agent by
+ default.
+ * Sun Feb 01 2004 Michail Litvak <mci@owl.openwall.com> 0.9.1-owl2
+ - Fix bug in -owl-tmp patch (Thanks to Alexey Tourbin for report).
+
+* Fri Jan 30 2004 Alexey Tourbin <at@altlinux.ru> 0.9.1-alt1
+- 0.9.1, many new features compared to 0.4.3, see NEWS
+- features revision:
+ + enabled: 256 colors, SMB protocol, local CGI support
+ + built-in URI rewriting kept enabled (hooks.lua prefixes still work)
+- Owl patches merged in:
+ * Sun Jan 25 2004 Solar Designer <solar@owl.openwall.com> 0.9.0-owl2
+ - Use vitmp in textarea_edit().
+ - Minor corrections to the temporary file handling patch.
+ - Do not set xterm window title (it wasn't getting reset when Elinks is
+ exited, the URL wasn't sanitized before being used as a part of a terminal
+ escape sequence, and some xterm's and window managers are known to have
+ vulnerabilities exploitable via the window title string).
+ - Don't define external programs for tn3270, gopher, news, and irc URLs by
+ default.
+ - When invoking external programs, treat '-' as an unsafe character unless
+ it is preceded by a safe non-whitespace one.
+ - man page corrections and updates of the "see also" lists for Owl.
+ * Wed Jan 21 2004 Michail Litvak <mci@owl.openwall.com> 0.9.0-owl1
+ - Switch from Links to ELinks.
+- install icons from contrib
+- more docs packaged; ChangeLog not packaged (NEWS is enough)
+- alt-default-lang-charset.patch disabled: system language detection
+ re-implemented upstream, system charset is in progress
+
+* Thu Nov 27 2003 Alexey Tourbin <at@altlinux.ru> 0.4.3-alt7
+- 0.4.3 finally released
+
+* Tue Sep 16 2003 Alexey Tourbin <at@altlinux.ru> 0.4.3-alt6rc2
+- alt-owl-tmp.patch disabled again since it breaks things down
+
+* Wed Sep 10 2003 Alexey Tourbin <at@altlinux.ru> 0.4.3-alt4rc2
+- alt-owl-tmp.patch resurrected (the use of tempnam(3) eliminated)
+- gcc -Werror enabled
+
+* Thu Sep 04 2003 Alexey Tourbin <at@altlinux.ru> 0.4.3-alt3rc2
+- 0.4.3rc2
+- cpan (=search.cpan.org) added to hooks.lua
+
+* Fri Jun 20 2003 Alexey Tourbin <at@altlinux.ru> 0.4.3-alt2rc1
+- rebuild to fit to new lua4-devel package
+
+* Tue Jun 10 2003 Alexey Tourbin <at@altlinux.ru> 0.4.3-alt1rc1
+- 0.4.3rc1
+
+* Wed May 27 2003 Alexey Tourbin <at@altlinux.ru> 0.4.2-alt8
+- cvs fixes (20030526); patches reordered
+- increase height for big dialogs (alt-dialog-height.patch)
+- use colors and frames for all terminals by default
+
+* Thu May 08 2003 Alexey Tourbin <at@altlinux.ru> 0.4.2-alt7
+- cvs fixes (REL_0_4 20030507)
+- added alt (=search.altlinux.ru) and atmsk (=atmks.ru) hooks
+
+* Wed Apr 09 2003 Stanislav Ievlev <inger@altlinux.ru> 0.4.2-alt6
+- new alternatives config format
+
+* Fri Mar 14 2003 Stanislav Ievlev <inger@altlinux.ru> 0.4.2-alt5
+- PreReq fixes
+
+* Wed Mar 12 2003 Stanislav Ievlev <inger@altlinux.ru> 0.4.2-alt4
+- update buildreqs
+
+* Tue Mar 11 2003 Stanislav Ievlev <inger@altlinux.ru> 0.4.2-alt3
+- move to new alternatives scheme
+ warning to mantainter: alternatives removing must be in preun
+- added packager tag
+
+* Fri Mar 07 2003 Alexey Tourbin <at@altlinux.ru> 0.4.2-alt2
+- alt-default-lang-charset (according to locale settings) patch
+
+* Sun Jan 26 2003 Alexey Tourbin <at@altlinux.ru> 0.4.2-alt1
+- 0.4.2 (a few fixes)
+- alt-owl-tmp patch disabled; this requires extra study
+
+* Tue Jan 21 2003 Alexey Tourbin <at@altlinux.ru> 0.4.1-alt1cvs
+- 0.4.1 (bugfix release) + current-stable fixes (cvs-20030120 patch;
+ my env-http_proxy patch accepted)
+- fixed %%postun code
+- lua-scripts-fixes patch integrated (PLD Team)
+- yandex search added to hooks.lua (alt-hooks patch)
+- COPYING points to /usr/share/license/GPL-2
+
+* Tue Dec 24 2002 Alexey Tourbin <at@altlinux.ru> 0.4.0-alt1
+- initial build (based on links1-0.98-alt3)
diff --git a/src/bfu/listbox.c b/src/bfu/listbox.c
index fb0930f..d69018f 100644
--- a/src/bfu/listbox.c
+++ b/src/bfu/listbox.c
@@ -52,7 +52,7 @@ dlg_format_listbox(struct terminal *term, struct widget_data *widget_data,
/* Height bussiness follows: */
/* This is only weird heuristic, it could scale well I hope. */
- optimal_h = max_height * 7 / 10 - VERTICAL_LISTBOX_MARGIN;
+ optimal_h = max_height * 5 / 6 - VERTICAL_LISTBOX_MARGIN;
min = get_opt_int("ui.dialogs.listbox_min_height");
if (max_height - VERTICAL_LISTBOX_MARGIN < min) {
diff --git a/src/config/options.inc b/src/config/options.inc
index 4ed472d..db0606c 100644
--- a/src/config/options.inc
+++ b/src/config/options.inc
@@ -1234,10 +1234,11 @@ static struct option_info config_options_info[] = {
#endif
INIT_OPT_BOOL("ui", N_("Set window title"),
- "window_title", 0, 1,
+ "window_title", 0, 0,
N_("Set the window title when running in a windowing environment\n"
"in an xterm-like terminal. This way the document's title is\n"
- "shown on the window titlebar.")),
+ "shown on the window titlebar. This functionality is disabled\n"
+ "at compile time and may be re-enabled in the future.")),
diff --git a/src/intl/charsets.c b/src/intl/charsets.c
index b9f69bd..1afa514 100644
--- a/src/intl/charsets.c
+++ b/src/intl/charsets.c
@@ -270,9 +270,10 @@ get_translation_table_to_utf_8(int from)
if (from == -1) return NULL;
from &= ~SYSTEM_CHARSET_FLAG;
if (from == lfr) return utf_table;
- if (utf_table_init)
- memset(utf_table, 0, sizeof(utf_table)),
+ if (utf_table_init) {
+ memset(utf_table, 0, sizeof(utf_table));
utf_table_init = 0;
+ }
else
free_utf_table();
diff --git a/src/main/main.c b/src/main/main.c
index a78e0b2..773c010 100644
--- a/src/main/main.c
+++ b/src/main/main.c
@@ -93,11 +93,9 @@ check_cwd(void)
{
unsigned char *cwd = get_cwd();
- if (!cwd || !file_is_dir(cwd)) {
- unsigned char *home = getenv("HOME");
-
- if (home && file_is_dir(home))
- chdir(home);
+ if (!cwd) {
+ perror("getcwd");
+ exit(2);
}
mem_free_if(cwd);
diff --git a/src/osdep/osdep.c b/src/osdep/osdep.c
index bf5ec18..e1412d8 100644
--- a/src/osdep/osdep.c
+++ b/src/osdep/osdep.c
@@ -377,6 +377,7 @@ set_clipboard_text(unsigned char *data)
void
set_window_title(unsigned char *title)
{
+#if 0
unsigned char *s;
int xsize, ysize;
int j = 0;
@@ -442,6 +443,7 @@ set_window_title(unsigned char *title)
fflush(stdout);
mem_free(s);
+#endif
}
#ifdef HAVE_X11
@@ -629,6 +631,7 @@ start_thread(void (*fn)(void *, int), void *ptr, int l)
pid = fork();
if (!pid) {
struct terminal *term;
+ int rv;
/* Close input in this thread; otherwise, if it will live
* longer than its parent, it'll block the terminal until it'll
@@ -643,12 +646,12 @@ start_thread(void (*fn)(void *, int), void *ptr, int l)
close(p[0]);
fn(ptr, p[1]);
- write(p[1], "x", 1);
+ rv = write(p[1], "x", 1);
close(p[1]);
/* We use _exit() here instead of exit(), see
* http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC6 for
* reasons. Fixed by Sven Neumann <sven@convergence.de>. */
- _exit(0);
+ _exit(rv == 1 ? 0 : 1);
}
if (pid == -1) {
close(p[0]);
diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c
index 1264f6f..942fe91 100644
--- a/src/protocol/http/http.c
+++ b/src/protocol/http/http.c
@@ -185,7 +185,7 @@ static struct option_info http_options[] = {
/* OSNews.com is supposed to be relying on the textmode token, at least. */
INIT_OPT_STRING("protocol.http", N_("User-agent identification"),
- "user_agent", 0, "ELinks/%v (textmode; %s; %t-%b)",
+ "user_agent", 0, "ELinks/%v (textmode; Linux; %t)",
N_("Change the User Agent ID. That means identification string, which\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"
@@ -194,7 +194,7 @@ static struct option_info http_options[] = {
"some lite version to them automagically.\n"
"Use \" \" if you don't want any User-Agent header to be sent at all.\n"
"%v in the string means ELinks version,\n"
- "%s in the string means system identification,\n"
+ "%s in the string means system identification (uname -srm),\n"
"%t in the string means size of the terminal,\n"
"%b in the string means number of bars displayed by ELinks.")),
diff --git a/src/protocol/smb/smb.c b/src/protocol/smb/smb.c
index 145a36e..77fe438 100644
--- a/src/protocol/smb/smb.c
+++ b/src/protocol/smb/smb.c
@@ -630,8 +630,12 @@ smb_protocol_handler(struct connection *conn)
if (*share) {
/* Construct service path. */
- asprintf((char **) &v[n++], "//%.*s/%s",
+ int rv = asprintf((char **) &v[n++], "//%.*s/%s",
uri->hostlen, uri->host, share);
+ if (rv < 1) {
+ perror("asprintf");
+ _exit(1);
+ }
/* Add password if any. */
if (uri->passwordlen && !uri->userlen) {
@@ -661,9 +665,13 @@ smb_protocol_handler(struct connection *conn)
v[n++] = memacpy(uri->user, uri->userlen);
} else {
/* With password. */
- asprintf((char **) &v[n++], "%.*s%%%.*s",
+ int rv = asprintf((char **) &v[n++], "%.*s%%%.*s",
uri->userlen, uri->user,
uri->passwordlen, uri->password);
+ if (rv < 1) {
+ perror("asprintf");
+ _exit(1);
+ }
}
}
diff --git a/src/protocol/user.c b/src/protocol/user.c
index e00cf72..fe45968 100644
--- a/src/protocol/user.c
+++ b/src/protocol/user.c
@@ -217,32 +217,43 @@ static unsigned char *
save_form_data_to_file(struct uri *uri)
{
unsigned char *filename = get_tempdir_filename("elinks-XXXXXX");
- int formfd;
- FILE *formfile;
+ int fd;
+ FILE *fp;
+ unsigned char *formdata;
+ size_t len, nmemb;
if (!filename) return NULL;
- formfd = safe_mkstemp(filename);
- if (formfd < 0) {
+ fd = safe_mkstemp(filename);
+ if (fd < 0) {
mem_free(filename);
return NULL;
}
- formfile = fdopen(formfd, "w");
- if (!formfile) {
+ if (!uri->post) return filename;
+
+ /* Jump the content type */
+ formdata = strchr(uri->post, '\n');
+ formdata = formdata ? formdata + 1 : uri->post;
+ len = strlen(formdata);
+ if (len == 0) return filename;
+
+ fp = fdopen(fd, "w");
+ if (!fp) {
+error: unlink(filename);
mem_free(filename);
- close(formfd);
+ close(fd);
return NULL;
}
- if (uri->post) {
- /* Jump the content type */
- unsigned char *formdata = strchr(uri->post, '\n');
-
- formdata = formdata ? formdata + 1 : uri->post;
- fwrite(formdata, strlen(formdata), 1, formfile);
+ nmemb = fwrite(formdata, len, 1, fp);
+ if (nmemb != 1) {
+ fclose(fp);
+ goto error;
}
- fclose(formfile);
+
+ if (fclose(fp) != 0)
+ goto error;
return filename;
}
diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c
index d720738..7e6fef1 100644
--- a/src/scripting/lua/core.c
+++ b/src/scripting/lua/core.c
@@ -641,8 +641,8 @@ do_hooks_file(LS, unsigned char *prefix, unsigned char *filename)
if (file_can_read(file)) {
int oldtop = lua_gettop(S);
- if (lua_dofile(S, file) != 0)
- sleep(3); /* Let some time to see error messages. */
+ if (luaL_dofile(S, file) != 0)
+ l_alert(S);
lua_settop(S, oldtop);
}
@@ -653,12 +653,7 @@ void
init_lua(struct module *module)
{
L = lua_open();
-
- luaopen_base(L);
- luaopen_table(L);
- luaopen_io(L);
- luaopen_string(L);
- luaopen_math(L);
+ luaL_openlibs(L);
lua_register(L, LUA_ALERT, l_alert);
lua_register(L, "current_url", l_current_url);
@@ -763,7 +758,7 @@ handle_ret_eval(struct session *ses)
int oldtop = lua_gettop(L);
if (prepare_lua(ses) == 0) {
- lua_dostring(L, expr);
+ (void)luaL_dostring(L, expr);
lua_settop(L, oldtop);
finish_lua();
}
diff --git a/src/scripting/lua/hooks.c b/src/scripting/lua/hooks.c
index d79ad80..47c0091 100644
--- a/src/scripting/lua/hooks.c
+++ b/src/scripting/lua/hooks.c
@@ -200,7 +200,7 @@ static enum evhook_status
script_hook_quit(va_list ap, void *data)
{
if (!prepare_lua(NULL)) {
- lua_dostring(lua_state, "if quit_hook then quit_hook() end");
+ (void)luaL_dostring(lua_state, "if quit_hook then quit_hook() end");
finish_lua();
}
diff --git a/src/session/download.c b/src/session/download.c
index a34a6f8..af58d8e 100644
--- a/src/session/download.c
+++ b/src/session/download.c
@@ -561,23 +561,22 @@ create_download_file_do(struct terminal *term, unsigned char *file, void *data,
unsigned char *wd;
int h = -1;
int saved_errno;
-#ifdef NO_FILE_SECURITY
- int sf = 0;
-#else
- int sf = cdf_hop->safe;
-#endif
if (!file) goto finish;
wd = get_cwd();
set_cwd(term->cwd);
- /* O_APPEND means repositioning at the end of file before each write(),
- * thus ignoring seek()s and that can hide mysterious bugs. IMHO.
- * --pasky */
- h = open(file, O_CREAT | O_WRONLY | (resume ? 0 : O_TRUNC)
- | (sf && !resume ? O_EXCL : 0),
- sf ? 0600 : 0666);
+ if (cdf_hop->safe) {
+ h = mkstemp(file);
+ } else {
+ /* O_APPEND means repositioning at the end of file before each
+ * write(), thus ignoring seek()s and that can hide mysterious
+ * bugs. IMHO.
+ * --pasky */
+ h = open(file,
+ O_WRONLY | (resume ? 0 : (O_CREAT | O_TRUNC)), 0666);
+ }
saved_errno = errno; /* Saved in case of ... --Zas */
if (wd) {
@@ -654,6 +653,7 @@ create_download_file(struct terminal *term, unsigned char *fi,
}
+#if 0
static unsigned char *
get_temp_name(struct uri *uri)
{
@@ -683,6 +683,7 @@ get_temp_name(struct uri *uri)
return name.source;
}
+#endif
static unsigned char *
@@ -783,7 +784,6 @@ resume_download(void *ses, unsigned char *file)
struct codw_hop {
struct type_query *type_query;
unsigned char *real_file;
- unsigned char *file;
};
static void
@@ -807,9 +807,8 @@ continue_download_do(struct terminal *term, int fd, void *data, int resume)
if (type_query->external_handler) {
file_download->external_handler = subst_file(type_query->external_handler,
- codw_hop->file);
+ codw_hop->real_file);
file_download->delete = 1;
- mem_free(codw_hop->file);
mem_free_set(&type_query->external_handler, NULL);
}
@@ -826,7 +825,6 @@ continue_download_do(struct terminal *term, int fd, void *data, int resume)
return;
cancel:
- if (type_query->external_handler) mem_free_if(codw_hop->file);
tp_cancel(type_query);
mem_free(codw_hop);
}
@@ -836,15 +834,22 @@ continue_download(void *data, unsigned char *file)
{
struct type_query *type_query = data;
struct codw_hop *codw_hop = mem_calloc(1, sizeof(*codw_hop));
+ unsigned char *prog = type_query->external_handler;
if (!codw_hop) {
tp_cancel(type_query);
return;
}
- if (type_query->external_handler) {
- /* FIXME: get_temp_name() calls tempnam(). --Zas */
- file = get_temp_name(type_query->uri);
+ if (prog) {
+ unsigned char *tmpdir;
+
+ tmpdir = getenv("TMPDIR");
+ if (!tmpdir || !*tmpdir) tmpdir = "/tmp";
+
+ file = straconcat(tmpdir,
+ "/" ELINKS_TEMPNAME_PREFIX "-XXXXXX", NULL);
+
if (!file) {
mem_free(codw_hop);
tp_cancel(type_query);
@@ -853,14 +858,15 @@ continue_download(void *data, unsigned char *file)
}
codw_hop->type_query = type_query;
- codw_hop->file = file;
kill_downloads_to_file(file);
create_download_file(type_query->ses->tab->term, file,
&codw_hop->real_file,
- !!type_query->external_handler, 0,
+ !!prog, 0,
continue_download_do, codw_hop);
+
+ if (file && prog) mem_free(file);
}
diff --git a/src/setup.h b/src/setup.h
index 7ac026b..c2c5d38 100644
--- a/src/setup.h
+++ b/src/setup.h
@@ -96,10 +96,10 @@
/* Default external programs for protocol.user.* autocreated options */
#define DEFAULT_AC_OPT_MAILTO "mutt %h -s \"%s\" -i \"%f\""
#define DEFAULT_AC_OPT_TELNET "telnet %h %p"
-#define DEFAULT_AC_OPT_TN3270 "tn3270 %h %p"
-#define DEFAULT_AC_OPT_GOPHER "lynx %u"
-#define DEFAULT_AC_OPT_NEWS "lynx %u"
-#define DEFAULT_AC_OPT_IRC "irc %u"
+#define DEFAULT_AC_OPT_TN3270 ""
+#define DEFAULT_AC_OPT_GOPHER ""
+#define DEFAULT_AC_OPT_NEWS ""
+#define DEFAULT_AC_OPT_IRC ""
/* Default terminal size. Used for -dump and for normal runs if detection
* through ioctl() and environment variables fails. */
diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c
index 895e898..0e9a40b 100644
--- a/src/terminal/terminal.c
+++ b/src/terminal/terminal.c
@@ -173,6 +173,7 @@ exec_thread(unsigned char *path, int p)
#if defined(HAVE_SETPGID) && !defined(CONFIG_BEOS) && !defined(HAVE_BEGINTHREAD)
if (path[0] == 2) setpgid(0, 0);
#endif
+ /* XXX: This interface should be re-arranged to use execvp(3). */
exe(path + 1);
if (path[plen]) unlink(path + plen);
}
diff --git a/src/util/error.c b/src/util/error.c
index 0c2d1cd..8164f82 100644
--- a/src/util/error.c
+++ b/src/util/error.c
@@ -145,13 +145,18 @@ void
elinks_assertm(int x, unsigned char *fmt, ...)
{
unsigned char *buf = NULL;
+ int rv;
va_list params;
if (assert_failed) return;
if (!(assert_failed = !x)) return;
va_start(params, fmt);
- vasprintf((char **) &buf, fmt, params);
+ rv = vasprintf((char **) &buf, fmt, params);
+ if (rv < 0) {
+ perror("vasprintf");
+ return;
+ }
va_end(params);
elinks_internal("assertion failed: %s", buf);
if (buf) free(buf);
diff --git a/src/util/file.c b/src/util/file.c
index 21aecd9..fa3c532 100644
--- a/src/util/file.c
+++ b/src/util/file.c
@@ -181,12 +181,8 @@ get_tempdir_filename(unsigned char *name)
{
unsigned char *tmpdir = getenv("TMPDIR");
- if (!tmpdir || !*tmpdir) tmpdir = getenv("TMP");
- if (!tmpdir || !*tmpdir) tmpdir = getenv("TEMPDIR");
- if (!tmpdir || !*tmpdir) tmpdir = getenv("TEMP");
if (!tmpdir || !*tmpdir) tmpdir = "/tmp";
-
- return straconcat(tmpdir, "/", name, NULL);
+ return straconcat(tmpdir, "/" ELINKS_TEMPNAME_PREFIX "area-XXXXXX", NULL);
}
unsigned char *
diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c
index 5371688..1f3143e 100644
--- a/src/viewer/text/search.c
+++ b/src/viewer/text/search.c
@@ -825,7 +825,10 @@ point_intersect(struct point *p1, int l1, struct point *p2, int l2)
assert(p2);
if_assert_failed return 0;
- if (first_time) memset(hash, 0, HASH_SIZE), first_time = 0;
+ if (first_time) {
+ memset(hash, 0, HASH_SIZE);
+ first_time = 0;
+ }
for (i = 0; i < l1; i++) hash[HASH(p1[i])] = 1;
diff --git a/src/viewer/text/textarea.c b/src/viewer/text/textarea.c
index 25c6732..b8b39e4 100644
--- a/src/viewer/text/textarea.c
+++ b/src/viewer/text/textarea.c
@@ -292,22 +292,39 @@ static unsigned char *
save_textarea_file(unsigned char *value)
{
unsigned char *filename;
- FILE *file = NULL;
- int h;
+ FILE *fp;
+ int fd;
+ size_t len, nmemb;
filename = get_tempdir_filename("elinks-area-XXXXXX");
if (!filename) return NULL;
- h = safe_mkstemp(filename);
- if (h >= 0) file = fdopen(h, "w");
+ fd = safe_mkstemp(filename);
+ if (fd < 0) {
+ mem_free(filename);
+ return NULL;
+ }
- if (file) {
- fwrite(value, strlen(value), 1, file);
- fclose(file);
- } else {
- mem_free_set(&filename, NULL);
+ len = strlen(value);
+ if (len == 0) return filename;
+
+ fp = fdopen(fd, "w");
+ if (!fp) {
+error: unlink(filename);
+ mem_free(filename);
+ close(fd);
+ return NULL;
+ }
+
+ nmemb = fwrite(value, len, 1, fp);
+ if (nmemb != 1) {
+ fclose(fp);
+ goto error;
}
+ if (fclose(fp) != 0)
+ goto error;
+
return filename;
}
@@ -349,7 +366,7 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_,
if (!ed || !*ed) {
ed = getenv("EDITOR");
- if (!ed || !*ed) ed = "vi";
+ if (!ed || !*ed) ed = "vitmp";
}
ex = straconcat(ed, " ", fn, NULL);