mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Merge commit 'origin/elinks-0.12'
Conflicts: po/fr.po src/document/dom/renderer.c src/document/html/parser.c src/document/options.c src/document/refresh.c
This commit is contained in:
commit
13523248ed
2
NEWS
2
NEWS
@ -84,6 +84,8 @@ Miscellaneous:
|
||||
reloaded. See elinks-users mail from 28 Oct 2005.
|
||||
* several accesskey fixes
|
||||
* in Lua: don't write to the string returned by lua_tostring
|
||||
* minor bug 972: preserve the background color and underlining in
|
||||
spaces when justifying
|
||||
* minor bug 284: render closing bracket for HTML element SUB in the
|
||||
same line; don't let it fall to the next
|
||||
* minor: show quote characters for HTML element Q, rather than italics
|
||||
|
28
configure.in
28
configure.in
@ -1423,18 +1423,24 @@ if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
|
||||
;;
|
||||
esac
|
||||
|
||||
# GCC 4.2 snapshots warn that comparisons like &object != NULL
|
||||
# always return true. Some macros in ELinks check whether pointer
|
||||
# arguments are NULL, and giving them addresses of named objects
|
||||
# triggers the warning. These warnings have not revealed any real
|
||||
# bugs, so shut them up instead of complicating the code. GCC 4.1
|
||||
# does not recognize -Wno-always-true and exits with code 1 if it is
|
||||
# given.
|
||||
AC_MSG_CHECKING([whether $CC accepts -Wno-always-true])
|
||||
# GCC 4.2.1 warns if we use the address of an object in Boolean context:
|
||||
# warning: the address of `builtin_modules' will always evaluate as `true'
|
||||
# This hits the object_lock and foreach_module macros in particular.
|
||||
# It would be okay to put something in the macros to avoid the warning,
|
||||
# but currently this seems to require defining parallel macros that skip
|
||||
# the NULL check, and that's too ugly. So we instead disable the warning.
|
||||
# GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
|
||||
# GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
|
||||
for warning_flag in -Wno-address -Wno-always-true; do
|
||||
AC_MSG_CHECKING([whether $CC accepts $warning_flag])
|
||||
EL_SAVE_FLAGS
|
||||
CFLAGS="$CFLAGS -Wno-always-true"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[AC_MSG_RESULT([yes])],[EL_RESTORE_FLAGS
|
||||
AC_MSG_RESULT([no])])
|
||||
CFLAGS="$CFLAGS $warning_flag"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
break],
|
||||
[AC_MSG_RESULT([no])])
|
||||
EL_RESTORE_FLAGS
|
||||
done
|
||||
fi
|
||||
|
||||
EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
|
||||
|
2886
po/pt_BR.po
2886
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
@ -142,16 +142,14 @@ menu_copying(struct terminal *term, void *xxx, void *xxxx)
|
||||
N_("Copying"), ALIGN_CENTER,
|
||||
msg_text(term, N_("ELinks %s\n"
|
||||
"\n"
|
||||
"(C) 1999 - 2002 Mikulas Patocka\n"
|
||||
"(C) 2001 - 2004 Petr Baudis\n"
|
||||
"(C) 2002 - 2006 Jonas Fonseca\n"
|
||||
"and others\n"
|
||||
"%s"
|
||||
"et al.\n"
|
||||
"\n"
|
||||
"This program is free software; you can redistribute it "
|
||||
"and/or modify it under the terms of the GNU General Public "
|
||||
"License as published by the Free Software Foundation, "
|
||||
"specifically version 2 of the License."),
|
||||
VERSION_STRING));
|
||||
VERSION_STRING, COPYRIGHT_STRING));
|
||||
}
|
||||
|
||||
|
||||
|
@ -436,7 +436,7 @@ static struct menu_item view_menu[] = {
|
||||
|
||||
static struct menu_item help_menu[] = {
|
||||
/* [gettext_accelerator_context(.help_menu)] */
|
||||
INIT_MENU_ITEM(N_("~ELinks homepage"), NULL, ACT_MAIN_NONE, menu_url_shortcut, ELINKS_HOMEPAGE, 0),
|
||||
INIT_MENU_ITEM(N_("~ELinks homepage"), NULL, ACT_MAIN_NONE, menu_url_shortcut, ELINKS_WEBSITE_URL, 0),
|
||||
INIT_MENU_ITEM(N_("~Documentation"), NULL, ACT_MAIN_NONE, menu_url_shortcut, ELINKS_DOC_URL, 0),
|
||||
INIT_MENU_ITEM(N_("~Keys"), NULL, ACT_MAIN_NONE, menu_keys, NULL, 0),
|
||||
#ifdef CONFIG_LEDS
|
||||
@ -449,6 +449,7 @@ static struct menu_item help_menu[] = {
|
||||
#endif
|
||||
BAR_MENU_ITEM,
|
||||
INIT_MENU_ITEM(N_("~Copying"), NULL, ACT_MAIN_NONE, menu_copying, NULL, 0),
|
||||
INIT_MENU_ITEM(N_("Autho~rs"), NULL, ACT_MAIN_NONE, menu_url_shortcut, ELINKS_AUTHORS_URL, 0),
|
||||
INIT_MENU_ITEM(N_("~About"), NULL, ACT_MAIN_NONE, menu_about, NULL, 0),
|
||||
NULL_MENU_ITEM
|
||||
};
|
||||
|
@ -152,3 +152,17 @@ start_document_refreshes(struct session *ses)
|
||||
|
||||
start_document_refresh(ses->doc_view->document->refresh, ses->doc_view);
|
||||
}
|
||||
|
||||
void
|
||||
start_document_refreshes(struct session *ses)
|
||||
{
|
||||
assert(ses);
|
||||
|
||||
if (!ses->doc_view
|
||||
|| !ses->doc_view->document
|
||||
|| !ses->doc_view->document->refresh
|
||||
|| !get_opt_bool("document.browse.refresh"))
|
||||
return;
|
||||
|
||||
start_document_refresh(ses->doc_view->document->refresh, ses);
|
||||
}
|
||||
|
@ -497,9 +497,12 @@ render_document_frames(struct session *ses, int no_cache)
|
||||
}
|
||||
}
|
||||
|
||||
/* comparison function for qsort() */
|
||||
static int
|
||||
comp_links(struct link *l1, struct link *l2)
|
||||
comp_links(const void *v1, const void *v2)
|
||||
{
|
||||
const struct link *l1 = v1, *l2 = v2;
|
||||
|
||||
assert(l1 && l2);
|
||||
if_assert_failed return 0;
|
||||
return (l1->number - l2->number);
|
||||
@ -519,7 +522,7 @@ sort_links(struct document *document)
|
||||
if_assert_failed return;
|
||||
|
||||
qsort(document->links, document->nlinks, sizeof(*document->links),
|
||||
(void *) comp_links);
|
||||
comp_links);
|
||||
|
||||
if (!document->height) return;
|
||||
|
||||
|
@ -973,9 +973,12 @@ struct entity_cache {
|
||||
unsigned char str[20]; /* Suffice in any case. */
|
||||
};
|
||||
|
||||
/* comparison function for qsort() */
|
||||
static int
|
||||
hits_cmp(struct entity_cache *a, struct entity_cache *b)
|
||||
hits_cmp(const void *v1, const void *v2)
|
||||
{
|
||||
const struct entity_cache *a = v1, *b = v2;
|
||||
|
||||
if (a->hits == b->hits) return 0;
|
||||
if (a->hits > b->hits) return -1;
|
||||
else return 1;
|
||||
@ -1134,7 +1137,7 @@ end:
|
||||
/* Sort entries by hit order. */
|
||||
if (nb_entity_cache[slen] > 1)
|
||||
qsort(&entity_cache[slen][0], nb_entity_cache[slen],
|
||||
sizeof(entity_cache[slen][0]), (void *) hits_cmp);
|
||||
sizeof(entity_cache[slen][0]), hits_cmp);
|
||||
|
||||
/* Increment number of cache entries if possible.
|
||||
* Else, just replace the least used entry. */
|
||||
|
@ -199,6 +199,128 @@ get_nntp_title(struct connection *conn)
|
||||
return title.source;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
decode_q_segment(struct string *str, unsigned char *in, unsigned char *end)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c = *in++) != 0 && (in <= end)) {
|
||||
if (c == '=') {
|
||||
int d = *in++;
|
||||
|
||||
if (d == '\n' || !d)
|
||||
break; /* drop trailing newline */
|
||||
d = (unhx(d) << 4) | unhx(*in++);
|
||||
add_format_to_string(str, "&#%d;", d);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '_') /* rfc2047 4.2 (2) */
|
||||
c = 0x20;
|
||||
add_char_to_string(str, c);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
decode_b_segment(struct string *str, unsigned char *in, unsigned char *end)
|
||||
{
|
||||
/* Decode in..ep, possibly in-place to ot */
|
||||
int c, pos = 0, acc = 0;
|
||||
|
||||
while ((c = *in++) != 0 && (in <= end)) {
|
||||
if (c == '+')
|
||||
c = 62;
|
||||
else if (c == '/')
|
||||
c = 63;
|
||||
else if ('A' <= c && c <= 'Z')
|
||||
c -= 'A';
|
||||
else if ('a' <= c && c <= 'z')
|
||||
c -= 'a' - 26;
|
||||
else if ('0' <= c && c <= '9')
|
||||
c -= '0' - 52;
|
||||
else if (c == '=') {
|
||||
/* padding is almost like (c == 0), except we do
|
||||
* not output NUL resulting only from it;
|
||||
* for now we just trust the data.
|
||||
*/
|
||||
c = 0;
|
||||
}
|
||||
else
|
||||
continue; /* garbage */
|
||||
|
||||
switch (pos++) {
|
||||
case 0:
|
||||
acc = (c << 2);
|
||||
break;
|
||||
case 1:
|
||||
add_format_to_string(str, "&#%d;", (acc | (c >> 4)));
|
||||
acc = (c & 15) << 4;
|
||||
break;
|
||||
case 2:
|
||||
add_format_to_string(str, "&#%d;", (acc | (c >> 2)));
|
||||
acc = (c & 3) << 6;
|
||||
break;
|
||||
case 3:
|
||||
add_format_to_string(str, "&#%d;", (acc | c));
|
||||
acc = pos = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_header_to_string(struct string *str, unsigned char *header)
|
||||
{
|
||||
unsigned char *end;
|
||||
int rfc2047 = 0;
|
||||
|
||||
while ((end = strstr(header, "=?")) != NULL) {
|
||||
int encoding;
|
||||
unsigned char charset_q[256];
|
||||
unsigned char *cp, *sp;
|
||||
|
||||
rfc2047 = 1;
|
||||
|
||||
if (header != end) {
|
||||
add_html_to_string(str, header, end - header);
|
||||
header = end;
|
||||
}
|
||||
|
||||
/* E.g.
|
||||
* ep : "=?iso-2022-jp?B?GyR...?= foo"
|
||||
* ep : "=?ISO-8859-1?Q?Foo=FCbar?= baz"
|
||||
*/
|
||||
end += 2;
|
||||
cp = strchr(end, '?');
|
||||
if (!cp)
|
||||
break;
|
||||
|
||||
for (sp = end; sp < cp; sp++)
|
||||
charset_q[sp - end] = tolower(*sp);
|
||||
charset_q[cp - end] = 0;
|
||||
encoding = tolower(cp[1]);
|
||||
|
||||
if (!encoding || cp[2] != '?')
|
||||
break;
|
||||
cp += 3;
|
||||
end = strstr(cp + 3, "?=");
|
||||
if (!end)
|
||||
break;
|
||||
if (encoding == 'b')
|
||||
decode_b_segment(str, cp, end);
|
||||
else if (encoding == 'q')
|
||||
decode_q_segment(str, cp, end);
|
||||
else
|
||||
break;
|
||||
|
||||
header = end + 2;
|
||||
}
|
||||
|
||||
add_html_to_string(str, header, strlen(header));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_nntp_html_start(struct string *html, struct connection *conn)
|
||||
{
|
||||
@ -235,7 +357,9 @@ add_nntp_html_start(struct string *html, struct connection *conn)
|
||||
continue;
|
||||
}
|
||||
|
||||
add_format_to_string(html, "<b>%s</b>: %s\n", entry, value);
|
||||
add_format_to_string(html, "<b>%s</b>: ", entry);
|
||||
add_header_to_string(html, value);
|
||||
add_char_to_string(html, '\n');
|
||||
mem_free(value);
|
||||
mem_free(entry);
|
||||
}
|
||||
@ -249,7 +373,7 @@ add_nntp_html_start(struct string *html, struct connection *conn)
|
||||
add_format_to_string(html,
|
||||
"<h2>%s</h2>\n"
|
||||
"<hr />\n"
|
||||
"<dl>",
|
||||
"<ol>",
|
||||
empty_string_or_(title));
|
||||
break;
|
||||
|
||||
@ -275,7 +399,7 @@ add_nntp_html_end(struct string *html, struct connection *conn)
|
||||
case NNTP_TARGET_ARTICLE_RANGE:
|
||||
case NNTP_TARGET_GROUP:
|
||||
case NNTP_TARGET_GROUPS:
|
||||
add_to_string(html, "</dl>");
|
||||
add_to_string(html, "</ol>");
|
||||
break;
|
||||
|
||||
case NNTP_TARGET_QUIT:
|
||||
@ -302,16 +426,33 @@ add_nntp_html_line(struct string *html, struct connection *conn,
|
||||
case NNTP_TARGET_GROUP:
|
||||
case NNTP_TARGET_GROUPS:
|
||||
{
|
||||
unsigned char *desc = strchr(line, '\t');
|
||||
unsigned char *field = line;
|
||||
|
||||
if (desc) {
|
||||
*desc++ = 0;
|
||||
} else {
|
||||
desc = "";
|
||||
line = strchr(line, '\t');
|
||||
if (!line)
|
||||
field = "";
|
||||
else
|
||||
*line++ = 0;
|
||||
add_format_to_string(html, "<li value=\"%s\"><a href=\"%s/%s\">",
|
||||
field, struri(conn->uri), field);
|
||||
|
||||
field = line;
|
||||
line = strchr(line, '\t');
|
||||
if (line)
|
||||
*line++ = 0;
|
||||
|
||||
add_header_to_string(html, field);
|
||||
add_to_string(html, "</a> ");
|
||||
|
||||
if (line) {
|
||||
field = line;
|
||||
line = strchr(line, '\t');
|
||||
if (line)
|
||||
*line++ = 0;
|
||||
|
||||
add_header_to_string(html, field);
|
||||
}
|
||||
|
||||
add_format_to_string(html, "<dt><a href=\"%s/%s\">%s</a></dt><dd>%s</dd>\n",
|
||||
struri(conn->uri), line, line, desc);
|
||||
add_to_string(html, "</li>");
|
||||
break;
|
||||
}
|
||||
case NNTP_TARGET_QUIT:
|
||||
|
@ -52,34 +52,35 @@ struct protocol_backend {
|
||||
unsigned int need_slash_after_host:1;
|
||||
unsigned int free_syntax:1;
|
||||
unsigned int need_ssl:1;
|
||||
unsigned int keep_double_slashes:1;
|
||||
};
|
||||
|
||||
static const struct protocol_backend protocol_backends[] = {
|
||||
{ "about", 0, about_protocol_handler, 0, 0, 1, 0 },
|
||||
{ "bittorrent", 0, bittorrent_protocol_handler, 0, 0, 1, 0 },
|
||||
{ "data", 0, data_protocol_handler, 0, 0, 1, 0 },
|
||||
{ "file", 0, file_protocol_handler, 1, 0, 0, 0 },
|
||||
{ "finger", 79, finger_protocol_handler, 1, 1, 0, 0 },
|
||||
{ "fsp", 21, fsp_protocol_handler, 1, 1, 0, 0 },
|
||||
{ "ftp", 21, ftp_protocol_handler, 1, 1, 0, 0 },
|
||||
{ "gopher", 70, gopher_protocol_handler, 1, 1, 0, 0 },
|
||||
{ "http", 80, http_protocol_handler, 1, 1, 0, 0 },
|
||||
{ "https", 443, https_protocol_handler, 1, 1, 0, 1 },
|
||||
{ "javascript", 0, NULL, 0, 0, 1, 0 },
|
||||
{ "news", 0, news_protocol_handler, 0, 0, 1, 0 },
|
||||
{ "nntp", 119, nntp_protocol_handler, 1, 1, 0, 0 },
|
||||
{ "nntps", 563, nntp_protocol_handler, 1, 1, 0, 1 },
|
||||
{ "proxy", 3128, proxy_protocol_handler, 1, 1, 0, 0 },
|
||||
{ "smb", 139, smb_protocol_handler, 1, 1, 0, 0 },
|
||||
{ "snews", 0, news_protocol_handler, 0, 0, 1, 0 },
|
||||
{ "about", 0, about_protocol_handler, 0, 0, 1, 0, 1 },
|
||||
{ "bittorrent", 0, bittorrent_protocol_handler, 0, 0, 1, 0, 1 },
|
||||
{ "data", 0, data_protocol_handler, 0, 0, 1, 0, 1 },
|
||||
{ "file", 0, file_protocol_handler, 1, 0, 0, 0, 0 },
|
||||
{ "finger", 79, finger_protocol_handler, 1, 1, 0, 0, 1 },
|
||||
{ "fsp", 21, fsp_protocol_handler, 1, 1, 0, 0, 1 },
|
||||
{ "ftp", 21, ftp_protocol_handler, 1, 1, 0, 0, 0 },
|
||||
{ "gopher", 70, gopher_protocol_handler, 1, 1, 0, 0, 1 },
|
||||
{ "http", 80, http_protocol_handler, 1, 1, 0, 0, 1 },
|
||||
{ "https", 443, https_protocol_handler, 1, 1, 0, 1, 1 },
|
||||
{ "javascript", 0, NULL, 0, 0, 1, 0, 1 },
|
||||
{ "news", 0, news_protocol_handler, 0, 0, 1, 0, 1 },
|
||||
{ "nntp", 119, nntp_protocol_handler, 1, 1, 0, 0, 0 },
|
||||
{ "nntps", 563, nntp_protocol_handler, 1, 1, 0, 1, 0 },
|
||||
{ "proxy", 3128, proxy_protocol_handler, 1, 1, 0, 0, 1 },
|
||||
{ "smb", 139, smb_protocol_handler, 1, 1, 0, 0, 1 },
|
||||
{ "snews", 0, news_protocol_handler, 0, 0, 1, 0, 1 },
|
||||
|
||||
/* Keep these last! */
|
||||
{ NULL, 0, NULL, 0, 0, 1, 0 },
|
||||
{ NULL, 0, NULL, 0, 0, 1, 0, 1 },
|
||||
|
||||
{ "user", 0, NULL, 0, 0, 0, 0 },
|
||||
{ "user", 0, NULL, 0, 0, 0, 0, 1 },
|
||||
/* Internal protocol for mapping to protocol.user.* handlers. Placed
|
||||
* last because it's checked first and else should be ignored. */
|
||||
{ "custom", 0, NULL, 0, 0, 1, 0 },
|
||||
{ "custom", 0, NULL, 0, 0, 1, 0, 1 },
|
||||
};
|
||||
|
||||
|
||||
@ -174,6 +175,14 @@ get_protocol_need_slash_after_host(enum protocol protocol)
|
||||
return protocol_backends[protocol].need_slash_after_host;
|
||||
}
|
||||
|
||||
int
|
||||
get_protocol_keep_double_slashes(enum protocol protocol)
|
||||
{
|
||||
assert(VALID_PROTOCOL(protocol));
|
||||
if_assert_failed return 0;
|
||||
return protocol_backends[protocol].keep_double_slashes;
|
||||
}
|
||||
|
||||
int
|
||||
get_protocol_free_syntax(enum protocol protocol)
|
||||
{
|
||||
|
@ -44,6 +44,7 @@ typedef void (protocol_external_handler_T)(struct session *, struct uri *);
|
||||
|
||||
int get_protocol_port(enum protocol protocol);
|
||||
int get_protocol_need_slashes(enum protocol protocol);
|
||||
int get_protocol_keep_double_slashes(enum protocol protocol);
|
||||
int get_protocol_need_slash_after_host(enum protocol protocol);
|
||||
int get_protocol_free_syntax(enum protocol protocol);
|
||||
int get_protocol_need_ssl(enum protocol protocol);
|
||||
|
@ -106,7 +106,7 @@ static struct option_info uri_rewrite_options[] = {
|
||||
#define INIT_OPT_DUMB_PREFIX(prefix, uri) \
|
||||
INIT_OPT_STRING("protocol.rewrite.dumb", NULL, prefix, 0, uri, NULL)
|
||||
|
||||
INIT_OPT_DUMB_PREFIX("elinks", ELINKS_HOMEPAGE),
|
||||
INIT_OPT_DUMB_PREFIX("elinks", ELINKS_WEBSITE_URL),
|
||||
INIT_OPT_DUMB_PREFIX("documentation", ELINKS_DOC_URL),
|
||||
INIT_OPT_DUMB_PREFIX("bz", ELINKS_BUGS_URL),
|
||||
INIT_OPT_DUMB_PREFIX("bug", ELINKS_BUGS_URL),
|
||||
|
55
src/protocol/test/test-get-translated-uri
Executable file
55
src/protocol/test/test-get-translated-uri
Executable file
@ -0,0 +1,55 @@
|
||||
#! /bin/sh
|
||||
|
||||
test_description='Test URI translation'
|
||||
|
||||
. "$TEST_LIB"
|
||||
|
||||
test_uri_translation () {
|
||||
before="$1"; shift
|
||||
cwd="$1"; shift
|
||||
translated="$(uri-test "$before" "$cwd")"
|
||||
cond=""
|
||||
for expected; do
|
||||
cond="${cond:+$cond ||
|
||||
}test \"$translated\" = \"$expected\""
|
||||
done
|
||||
|
||||
test_expect_success "Translate $before in $cwd" "$cond"
|
||||
}
|
||||
|
||||
################################################################
|
||||
|
||||
# RFC 1738 section 3.10 says "localhost" and "" as <host> mean
|
||||
# the same thing. So we disregard the spelling in these tests.
|
||||
|
||||
test_uri_translation "/usr/bin/elinks" "/srv/git" \
|
||||
"file://localhost/usr/bin/elinks" \
|
||||
"file:///usr/bin/elinks"
|
||||
|
||||
test_uri_translation "index.html" "/var/www" \
|
||||
"file://localhost/var/www/index.html" \
|
||||
"file:///var/www/index.html"
|
||||
|
||||
test_uri_translation "../" "/usr/share/doc" \
|
||||
"file://localhost/usr/share/" \
|
||||
"file:///usr/share/"
|
||||
|
||||
test_uri_translation "../../lib/libc.so" "/usr/include/rpc" \
|
||||
"file://localhost/usr/lib/libc.so" \
|
||||
"file:///usr/lib/libc.so"
|
||||
|
||||
test_uri_translation "etc/issue" "/" \
|
||||
"file://localhost/etc/issue" \
|
||||
"file:///etc/issue"
|
||||
|
||||
# SUSv2: "A pathname that begins with two successive slashes may be
|
||||
# interpreted in an implementation-defined manner." Domain/OS and
|
||||
# Cygwin are said to do so.
|
||||
test_uri_translation "apollo_logo" "//melchior/sys" \
|
||||
"file://melchior/sys/apollo_logo" \
|
||||
"file://localhost//melchior/sys/apollo_logo" \
|
||||
"file://localhost/%2Fmelchior/sys/apollo_logo" \
|
||||
"file:////melchior/sys/apollo_logo" \
|
||||
"file:///%2Fmelchior/sys/apollo_logo"
|
||||
|
||||
test_done
|
@ -16,6 +16,11 @@ main(int argc, char **argv)
|
||||
* taking arguments like --normalize-uri=<arg> etc. */
|
||||
if (argc == 2) {
|
||||
fprintf(stdout, "%s\n", normalize_uri(NULL, argv[1]));
|
||||
} else if (argc == 3) {
|
||||
struct uri *translated = get_translated_uri(argv[1], argv[2]);
|
||||
if (translated == NULL)
|
||||
return EXIT_FAILURE;
|
||||
fprintf(stdout, "%s\n", struri(translated));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ normalize_uri(struct uri *uri, unsigned char *uristring)
|
||||
{
|
||||
unsigned char *parse_string = uristring;
|
||||
unsigned char *src, *dest, *path;
|
||||
int need_slash = 0;
|
||||
int need_slash = 0, keep_dslash = 1;
|
||||
int parse = (uri == NULL);
|
||||
struct uri uri_struct;
|
||||
|
||||
@ -720,8 +720,10 @@ normalize_uri(struct uri *uri, unsigned char *uristring)
|
||||
if (get_protocol_free_syntax(uri->protocol))
|
||||
return uristring;
|
||||
|
||||
if (uri->protocol != PROTOCOL_UNKNOWN)
|
||||
if (uri->protocol != PROTOCOL_UNKNOWN) {
|
||||
need_slash = get_protocol_need_slash_after_host(uri->protocol);
|
||||
keep_dslash = get_protocol_keep_double_slashes(uri->protocol);
|
||||
}
|
||||
|
||||
path = uri->data - need_slash;
|
||||
dest = src = path;
|
||||
@ -785,8 +787,7 @@ normalize_uri(struct uri *uri, unsigned char *uristring)
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if (is_uri_dir_sep(uri, src[1]) &&
|
||||
uri->protocol == PROTOCOL_FILE) {
|
||||
} else if (is_uri_dir_sep(uri, src[1]) && !keep_dslash) {
|
||||
/* // - ignore first '/'. */
|
||||
src += 1;
|
||||
continue;
|
||||
|
@ -4,13 +4,18 @@
|
||||
|
||||
#define VERSION_STRING VERSION
|
||||
|
||||
#define COPYRIGHT_STRING "(C) 1999 - 2002 Mikulas Patocka\n" \
|
||||
"(C) 2001 - 2004 Petr Baudis\n" \
|
||||
"(C) 2002 - 2007 Jonas Fonseca\n"
|
||||
|
||||
/* This option will take effect when WWW_HOME environment variable is NOT
|
||||
* set - you'll go automatically to this URL. If the value is just "",
|
||||
* you'll get either goto dialog or empty page, depending on the value of
|
||||
* startup_goto_dialog. */
|
||||
#define WWW_HOME_URL ""
|
||||
|
||||
#define ELINKS_HOMEPAGE "http://elinks.cz/"
|
||||
#define ELINKS_WEBSITE_URL "http://elinks.cz/"
|
||||
#define ELINKS_AUTHORS_URL "http://elinks.cz/authors.html"
|
||||
#define ELINKS_DOC_URL "http://elinks.cz/documentation/"
|
||||
#define ELINKS_BUGS_URL "http://bugzilla.elinks.cz/"
|
||||
#define ELINKS_GITWEB_URL "http://repo.or.cz/w/elinks.git"
|
||||
|
@ -481,9 +481,12 @@ stat_date(struct string *string, struct stat *stp)
|
||||
/** @} */
|
||||
|
||||
|
||||
/* comparison function for qsort() */
|
||||
static int
|
||||
compare_dir_entries(struct directory_entry *d1, struct directory_entry *d2)
|
||||
compare_dir_entries(const void *v1, const void *v2)
|
||||
{
|
||||
const struct directory_entry *d1 = v1, *d2 = v2;
|
||||
|
||||
if (d1->name[0] == '.' && d1->name[1] == '.' && !d1->name[2]) return -1;
|
||||
if (d2->name[0] == '.' && d2->name[1] == '.' && !d2->name[2]) return 1;
|
||||
if (d1->attrib[0] == 'd' && d2->attrib[0] != 'd') return -1;
|
||||
@ -580,8 +583,7 @@ get_directory_entries(unsigned char *dirname, int get_hidden)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qsort(entries, size, sizeof(*entries),
|
||||
(int (*)(const void *, const void *)) compare_dir_entries);
|
||||
qsort(entries, size, sizeof(*entries), compare_dir_entries);
|
||||
|
||||
memset(&entries[size], 0, sizeof(*entries));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user