diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2015-01-24 14:36:40 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@debian.org> | 2015-01-24 14:37:05 +0000 |
commit | 8595cb4102d547388d0d9e699d10a14f8f7aa71c (patch) | |
tree | cd27e4b710769000b651b9af4db2704a1cd328dd | |
parent | Update Vcs-Browser (diff) | |
download | w3m-8595cb4102d547388d0d9e699d10a14f8f7aa71c.tar.gz w3m-8595cb4102d547388d0d9e699d10a14f8f7aa71c.zip |
Integrate Debian changes into 020_debian.patch (closes: #776112)
(debian/patches/*.patch except 010_upstream.patch are merged)
Diffstat (limited to '')
53 files changed, 11827 insertions, 12528 deletions
diff --git a/debian/patches/015_debian-version.patch b/debian/patches/015_debian-version.patch deleted file mode 100644 index f9373d1..0000000 --- a/debian/patches/015_debian-version.patch +++ /dev/null @@ -1,42 +0,0 @@ -Subject: Update CURRENT_VERSION to 0.5.3+gitYYYYMMDD (generate from ChangeLog) -From: Tatsuya Kinoshita <tats@debian.org> - -diff --git a/acinclude.m4 b/acinclude.m4 -index 52c8874..541cb74 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -6,7 +6,8 @@ dnl w3m autoconf macros - AC_DEFUN([AC_W3M_VERSION], - [AC_SUBST(CURRENT_VERSION) - cvsver=`$AWK '\$[1] ~ /Id:/ { print \$[3]}' $srcdir/ChangeLog` -- sed -e 's/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c -+ ymdver=`sed -e 's/ .*//;s/-//g;q' $srcdir/ChangeLog` -+ sed -e 's/define CURRENT_VERSION "\(.*\)YYYYMMDD/define CURRENT_VERSION "\1'$ymdver'/;s/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c - CURRENT_VERSION=`sed -n 's/.*define CURRENT_VERSION *"w3m\/\(.*\)".*$/\1/p' version.c`]) - # - # ---------------------------------------------------------------- -diff --git a/configure b/configure -index 2e37bb1..c09d70a 100755 ---- a/configure -+++ b/configure -@@ -9084,7 +9084,8 @@ _ACEOF - - - cvsver=`$AWK '\$1 ~ /Id:/ { print \$3}' $srcdir/ChangeLog` -- sed -e 's/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c -+ ymdver=`sed -e 's/ .*//;s/-//g;q' $srcdir/ChangeLog` -+ sed -e 's/define CURRENT_VERSION "\(.*\)YYYYMMDD/define CURRENT_VERSION "\1'$ymdver'/;s/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c - CURRENT_VERSION=`sed -n 's/.*define CURRENT_VERSION *"w3m\/\(.*\)".*$/\1/p' version.c` - ac_config_files="$ac_config_files Makefile posubst po/Makefile.in scripts/Makefile scripts/dirlist.cgi scripts/w3mhelp.cgi scripts/w3mmail.cgi scripts/xface2xpm scripts/multipart/Makefile scripts/multipart/multipart.cgi scripts/w3mman/Makefile scripts/w3mman/w3mman scripts/w3mman/w3mman.1 scripts/w3mman/w3mman2html.cgi libwc/Makefile w3mimg/Makefile w3mimg/fb/Makefile w3mimg/x11/Makefile w3mimg/win/Makefile w3mhelp-w3m_en.html w3mhelp-w3m_ja.html w3mhelp-lynx_en.html w3mhelp-lynx_ja.html" - -diff --git a/version.c.in b/version.c.in -index 31d30e4..ab25163 100644 ---- a/version.c.in -+++ b/version.c.in -@@ -1,5 +1,5 @@ - /* $Id: version.c.in,v 1.49 2012/05/22 09:45:56 inu Exp $ */ --#define CURRENT_VERSION "w3m/0.5.3+cvs" -+#define CURRENT_VERSION "w3m/0.5.3+gitYYYYMMDD" - - #ifndef FM_H - char *w3m_version = CURRENT_VERSION; diff --git a/debian/patches/020_button.patch b/debian/patches/020_button.patch deleted file mode 100644 index 0ed7b87..0000000 --- a/debian/patches/020_button.patch +++ /dev/null @@ -1,439 +0,0 @@ -Description: Support the button element as defined in HTML 4.01 -Origin: upstream, http://www.sic.med.tohoku.ac.jp/~satodai/w3m-dev/201009.month/4411.html -Bug-Debian: http://bugs.debian.org/136810 - -Index: file.c -=================================================================== -RCS file: /cvsroot/w3m/w3m/file.c,v -retrieving revision 1.264 -diff -u -r1.264 file.c ---- w3m.orig/file.c 3 Aug 2010 10:02:16 -0000 1.264 -+++ w3m/file.c 17 Sep 2010 12:18:55 -0000 -@@ -2467,6 +2467,7 @@ - bcopy((void *)&obuf->anchor, (void *)&obuf->bp.anchor, - sizeof(obuf->anchor)); - obuf->bp.img_alt = obuf->img_alt; -+ obuf->bp.input_alt = obuf->input_alt; - obuf->bp.in_bold = obuf->in_bold; - obuf->bp.in_italic = obuf->in_italic; - obuf->bp.in_under = obuf->in_under; -@@ -2484,6 +2485,7 @@ - bcopy((void *)&obuf->bp.anchor, (void *)&obuf->anchor, - sizeof(obuf->anchor)); - obuf->img_alt = obuf->bp.img_alt; -+ obuf->input_alt = obuf->bp.input_alt; - obuf->in_bold = obuf->bp.in_bold; - obuf->in_italic = obuf->bp.in_italic; - obuf->in_under = obuf->bp.in_under; -@@ -2727,7 +2729,7 @@ - Str line = obuf->line, pass = NULL; - char *hidden_anchor = NULL, *hidden_img = NULL, *hidden_bold = NULL, - *hidden_under = NULL, *hidden_italic = NULL, *hidden_strike = NULL, -- *hidden_ins = NULL, *hidden = NULL; -+ *hidden_ins = NULL, *hidden_input, *hidden = NULL; - - #ifdef DEBUG - if (w3m_debug) { -@@ -2759,6 +2761,12 @@ - hidden = hidden_img; - } - } -+ if (obuf->input_alt.in) { -+ if ((hidden_input = has_hidden_link(obuf, HTML_INPUT_ALT)) != NULL) { -+ if (!hidden || hidden_input < hidden) -+ hidden = hidden_input; -+ } -+ } - if (obuf->in_bold) { - if ((hidden_bold = has_hidden_link(obuf, HTML_B)) != NULL) { - if (!hidden || hidden_bold < hidden) -@@ -2810,6 +2818,8 @@ - Strcat_charp(line, "</a>"); - if (obuf->img_alt && !hidden_img) - Strcat_charp(line, "</img_alt>"); -+ if (obuf->input_alt.in && !hidden_input) -+ Strcat_charp(line, "</input_alt>"); - if (obuf->in_bold && !hidden_bold) - Strcat_charp(line, "</b>"); - if (obuf->in_italic && !hidden_italic) -@@ -3020,6 +3030,18 @@ - Strcat_charp(tmp, "\">"); - push_tag(obuf, tmp->ptr, HTML_IMG_ALT); - } -+ if (!hidden_input && obuf->input_alt.in) { -+ Str tmp; -+ if (obuf->input_alt.hseq > 0) -+ obuf->input_alt.hseq = - obuf->input_alt.hseq; -+ tmp = Sprintf("<INPUT_ALT hseq=\"%d\" fid=\"%d\" name=\"%s\" type=\"%s\" value=\"%s\">", -+ obuf->input_alt.hseq, -+ obuf->input_alt.fid, -+ obuf->input_alt.name->ptr, -+ obuf->input_alt.type->ptr, -+ obuf->input_alt.value->ptr); -+ push_tag(obuf, tmp->ptr, HTML_INPUT_ALT); -+ } - if (!hidden_bold && obuf->in_bold) - push_tag(obuf, "<B>", HTML_B); - if (!hidden_italic && obuf->in_italic) -@@ -3730,6 +3752,63 @@ - } - - Str -+process_button(struct parsed_tag *tag) -+{ -+ Str tmp = NULL; -+ char *p, *q, *r, *qq = ""; -+ int qlen, v; -+ -+ if (cur_form_id < 0) { -+ char *s = "<form_int method=internal action=none>"; -+ tmp = process_form(parse_tag(&s, TRUE)); -+ } -+ if (tmp == NULL) -+ tmp = Strnew(); -+ -+ p = "submit"; -+ parsedtag_get_value(tag, ATTR_TYPE, &p); -+ q = NULL; -+ parsedtag_get_value(tag, ATTR_VALUE, &q); -+ r = ""; -+ parsedtag_get_value(tag, ATTR_NAME, &r); -+ -+ v = formtype(p); -+ if (v == FORM_UNKNOWN) -+ return NULL; -+ -+ if (!q) { -+ switch (v) { -+ case FORM_INPUT_SUBMIT: -+ case FORM_INPUT_BUTTON: -+ q = "SUBMIT"; -+ break; -+ case FORM_INPUT_RESET: -+ q = "RESET"; -+ break; -+ } -+ } -+ if (q) { -+ qq = html_quote(q); -+ qlen = strlen(q); -+ } -+ -+ // Strcat_charp(tmp, "<pre_int>"); -+ Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s " -+ "name=\"%s\" value=\"%s\">", -+ cur_hseq++, cur_form_id, p, html_quote(r), qq)); -+ return tmp; -+} -+ -+Str -+process_n_button(void) -+{ -+ Str tmp = Strnew(); -+ Strcat_charp(tmp, "</input_alt>"); -+ // Strcat_charp(tmp, "</pre_int>"); -+ return tmp; -+} -+ -+Str - process_select(struct parsed_tag *tag) - { - Str tmp = NULL; -@@ -4859,7 +4938,35 @@ - if (i > obuf->bottom_margin) - obuf->bottom_margin = i; - } -+ if (parsedtag_get_value(tag, ATTR_HSEQ, &hseq)) { -+ obuf->input_alt.hseq = hseq; -+ } -+ if (parsedtag_get_value(tag, ATTR_FID, &i)) { -+ obuf->input_alt.fid = i; -+ } -+ if (parsedtag_get_value(tag, ATTR_TYPE, &p)) { -+ obuf->input_alt.type = Strnew_charp(p); -+ } -+ if (parsedtag_get_value(tag, ATTR_VALUE, &p)) { -+ obuf->input_alt.value = Strnew_charp(p); -+ } -+ if (parsedtag_get_value(tag, ATTR_NAME, &p)) { -+ obuf->input_alt.name = Strnew_charp(p); -+ } -+ obuf->input_alt.in = 1; - return 0; -+ case HTML_N_INPUT_ALT: -+ if (obuf->input_alt.in) { -+ if (!close_effect0(obuf, HTML_INPUT_ALT)) -+ push_tag(obuf, "</input_alt>", HTML_N_INPUT_ALT); -+ obuf->input_alt.hseq = 0; -+ obuf->input_alt.fid = -1; -+ obuf->input_alt.in = 0; -+ obuf->input_alt.type = NULL; -+ obuf->input_alt.name = NULL; -+ obuf->input_alt.value = NULL; -+ } -+ return 1; - case HTML_TABLE: - close_anchor(h_env, obuf); - obuf->table_level++; -@@ -4968,6 +5075,16 @@ - case HTML_INPUT: - close_anchor(h_env, obuf); - tmp = process_input(tag); -+ if (tmp) -+ HTMLlineproc1(tmp->ptr, h_env); -+ return 1; -+ case HTML_BUTTON: -+ tmp = process_button(tag); -+ if (tmp) -+ HTMLlineproc1(tmp->ptr, h_env); -+ return 1; -+ case HTML_N_BUTTON: -+ tmp = process_n_button(); - if (tmp) - HTMLlineproc1(tmp->ptr, h_env); - return 1; -@@ -5680,6 +5797,21 @@ - putHmarker(buf->hmarklist, currentLn(buf), - hpos, hseq - 1); - } -+ else if (hseq < 0) { -+ int h = -hseq - 1; -+ int hpos = pos; -+ if (*str == '[') -+ hpos++; -+ if (buf->hmarklist && -+ h < buf->hmarklist->nmark && -+ buf->hmarklist->marks[h].invalid) { -+ buf->hmarklist->marks[h].pos = hpos; -+ buf->hmarklist->marks[h].line = currentLn(buf); -+ buf->hmarklist->marks[h].invalid = 0; -+ hseq = -hseq; -+ } -+ } -+ - if (!form->target) - form->target = buf->baseTarget; - if (a_textarea && -@@ -6747,6 +6879,12 @@ - obuf->nobr_level = 0; - bzero((void *)&obuf->anchor, sizeof(obuf->anchor)); - obuf->img_alt = 0; -+ obuf->input_alt.hseq = 0; -+ obuf->input_alt.fid = -1; -+ obuf->input_alt.in = 0; -+ obuf->input_alt.type = NULL; -+ obuf->input_alt.name = NULL; -+ obuf->input_alt.value = NULL; - obuf->in_bold = 0; - obuf->in_italic = 0; - obuf->in_under = 0; -@@ -6782,6 +6920,15 @@ - push_tag(obuf, "</img_alt>", HTML_N_IMG_ALT); - obuf->img_alt = NULL; - } -+ if (obuf->input_alt.in) { -+ push_tag(obuf, "</input_alt>", HTML_N_INPUT_ALT); -+ obuf->input_alt.hseq = 0; -+ obuf->input_alt.fid = -1; -+ obuf->input_alt.in = 0; -+ obuf->input_alt.type = NULL; -+ obuf->input_alt.name = NULL; -+ obuf->input_alt.value = NULL; -+ } - if (obuf->in_bold) { - push_tag(obuf, "</b>", HTML_N_B); - obuf->in_bold = 0; -Index: fm.h -=================================================================== -RCS file: /cvsroot/w3m/w3m/fm.h,v -retrieving revision 1.149 -diff -u -r1.149 fm.h ---- w3m.orig/fm.h 20 Aug 2010 09:47:09 -0000 1.149 -+++ w3m/fm.h 17 Sep 2010 12:18:55 -0000 -@@ -562,6 +562,13 @@ - #define INIT_BUFFER_WIDTH ((_INIT_BUFFER_WIDTH > 0) ? _INIT_BUFFER_WIDTH : 0) - #define FOLD_BUFFER_WIDTH (FoldLine ? (INIT_BUFFER_WIDTH + 1) : -1) - -+struct input_alt_attr { -+ int hseq; -+ int fid; -+ int in; -+ Str type, name, value; -+}; -+ - typedef struct { - int pos; - int len; -@@ -569,6 +576,7 @@ - long flag; - Anchor anchor; - Str img_alt; -+ struct input_alt_attr input_alt; - char fontstat[FONTSTAT_SIZE]; - short nobr_level; - Lineprop prev_ctype; -@@ -591,6 +599,7 @@ - short nobr_level; - Anchor anchor; - Str img_alt; -+ struct input_alt_attr input_alt; - char fontstat[FONTSTAT_SIZE]; - char fontstat_stack[FONT_STACK_SIZE][FONTSTAT_SIZE]; - int fontstat_sp; -Index: html.c -=================================================================== -RCS file: /cvsroot/w3m/w3m/html.c,v -retrieving revision 1.32 -diff -u -r1.32 html.c ---- w3m.orig/html.c 14 Aug 2010 01:29:40 -0000 1.32 -+++ w3m/html.c 17 Sep 2010 12:18:55 -0000 -@@ -56,6 +56,9 @@ - ATTR_CORE - }; - #define MAXA_INPUT MAXA_CORE + 12 -+unsigned char ALST_BUTTON[] = -+ { ATTR_TYPE, ATTR_VALUE, ATTR_NAME, ATTR_CORE }; -+#define MAXA_BUTTON MAXA_CORE + 3 - unsigned char ALST_TEXTAREA[] = - { ATTR_COLS, ATTR_ROWS, ATTR_NAME, ATTR_READONLY, ATTR_CORE }; - #define MAXA_TEXTAREA MAXA_CORE + 4 -@@ -247,24 +250,24 @@ - {"/bdo", NULL, 0, TFLG_END}, /* 121 HTML_N_BDO */ - {"big", ALST_NOP, MAXA_NOP, 0}, /* 122 HTML_BIG */ - {"/big", NULL, 0, TFLG_END}, /* 123 HTML_N_BIG */ -- {"button", ALST_NOP, MAXA_NOP, 0}, /* 124 HTML_BUTTON */ -- {"fieldset", ALST_NOP, MAXA_NOP, 0}, /* 125 HTML_FIELDSET */ -- {"/fieldset", NULL, 0, TFLG_END}, /* 126 HTML_N_FIELDSET */ -- {"iframe", ALST_NOP, MAXA_NOP, 0}, /* 127 HTML_IFRAME */ -- {"label", ALST_NOP, MAXA_NOP, 0}, /* 128 HTML_LABEL */ -- {"/label", NULL, 0, TFLG_END}, /* 129 HTML_N_LABEL */ -- {"legend", ALST_NOP, MAXA_NOP, 0}, /* 130 HTML_LEGEND */ -- {"/legend", NULL, 0, TFLG_END}, /* 131 HTML_N_LEGEND */ -- {"noscript", ALST_NOP, MAXA_NOP, 0}, /* 132 HTML_NOSCRIPT */ -- {"/noscript", NULL, 0, TFLG_END}, /* 133 HTML_N_NOSCRIPT */ -- {"object", ALST_NOP, MAXA_NOP, 0}, /* 134 HTML_OBJECT */ -- {"optgroup", ALST_NOP, MAXA_NOP, 0}, /* 135 HTML_OPTGROUP */ -- {"/optgroup", NULL, 0, TFLG_END}, /* 136 HTML_N_OPTGROUP */ -- {"param", ALST_NOP, MAXA_NOP, 0}, /* 137 HTML_PARAM */ -- {"small", ALST_NOP, MAXA_NOP, 0}, /* 138 HTML_SMALL */ -- {"/small", NULL, 0, TFLG_END}, /* 139 HTML_N_SMALL */ -+ {"button", ALST_BUTTON, MAXA_BUTTON, 0}, /* 124 HTML_BUTTON */ -+ {"/button", NULL, 0, TFLG_END}, /* 125 HTML_N_BUTTON */ -+ {"fieldset", ALST_NOP, MAXA_NOP, 0}, /* 126 HTML_FIELDSET */ -+ {"/fieldset", NULL, 0, TFLG_END}, /* 127 HTML_N_FIELDSET */ -+ {"iframe", ALST_NOP, MAXA_NOP, 0}, /* 128 HTML_IFRAME */ -+ {"label", ALST_NOP, MAXA_NOP, 0}, /* 129 HTML_LABEL */ -+ {"/label", NULL, 0, TFLG_END}, /* 130 HTML_N_LABEL */ -+ {"legend", ALST_NOP, MAXA_NOP, 0}, /* 131 HTML_LEGEND */ -+ {"/legend", NULL, 0, TFLG_END}, /* 132 HTML_N_LEGEND */ -+ {"noscript", ALST_NOP, MAXA_NOP, 0}, /* 133 HTML_NOSCRIPT */ -+ {"/noscript", NULL, 0, TFLG_END}, /* 134 HTML_N_NOSCRIPT */ -+ {"object", ALST_NOP, MAXA_NOP, 0}, /* 135 HTML_OBJECT */ -+ {"optgroup", ALST_NOP, MAXA_NOP, 0}, /* 136 HTML_OPTGROUP */ -+ {"/optgroup", NULL, 0, TFLG_END}, /* 137 HTML_N_OPTGROUP */ -+ {"param", ALST_NOP, MAXA_NOP, 0}, /* 138 HTML_PARAM */ -+ {"small", ALST_NOP, MAXA_NOP, 0}, /* 139 HTML_SMALL */ -+ {"/small", NULL, 0, TFLG_END}, /* 140 HTML_N_SMALL */ - -- {NULL, NULL, 0, 0}, /* 140 Undefined */ - {NULL, NULL, 0, 0}, /* 141 Undefined */ - {NULL, NULL, 0, 0}, /* 142 Undefined */ - {NULL, NULL, 0, 0}, /* 143 Undefined */ -Index: html.h -=================================================================== -RCS file: /cvsroot/w3m/w3m/html.h,v -retrieving revision 1.31 -diff -u -r1.31 html.h ---- w3m.orig/html.h 14 Aug 2010 01:29:40 -0000 1.31 -+++ w3m/html.h 17 Sep 2010 12:18:55 -0000 -@@ -214,21 +214,22 @@ - #define HTML_BIG 122 - #define HTML_N_BIG 123 - #define HTML_BUTTON 124 --#define HTML_FIELDSET 125 --#define HTML_N_FIELDSET 126 --#define HTML_IFRAME 127 --#define HTML_LABEL 128 --#define HTML_N_LABEL 129 --#define HTML_LEGEND 130 --#define HTML_N_LEGEND 131 --#define HTML_NOSCRIPT 132 --#define HTML_N_NOSCRIPT 133 --#define HTML_OBJECT 134 --#define HTML_OPTGROUP 135 --#define HTML_N_OPTGROUP 136 --#define HTML_PARAM 137 --#define HTML_SMALL 138 --#define HTML_N_SMALL 139 -+#define HTML_N_BUTTON 125 -+#define HTML_FIELDSET 126 -+#define HTML_N_FIELDSET 127 -+#define HTML_IFRAME 128 -+#define HTML_LABEL 129 -+#define HTML_N_LABEL 130 -+#define HTML_LEGEND 131 -+#define HTML_N_LEGEND 132 -+#define HTML_NOSCRIPT 133 -+#define HTML_N_NOSCRIPT 134 -+#define HTML_OBJECT 135 -+#define HTML_OPTGROUP 136 -+#define HTML_N_OPTGROUP 137 -+#define HTML_PARAM 138 -+#define HTML_SMALL 139 -+#define HTML_N_SMALL 140 - - /* pseudo tag */ - #define HTML_SELECT_INT 160 -Index: proto.h -=================================================================== -RCS file: /cvsroot/w3m/w3m/proto.h,v -retrieving revision 1.104 -diff -u -r1.104 proto.h ---- w3m.orig/proto.h 25 Jul 2010 09:55:05 -0000 1.104 -+++ w3m/proto.h 17 Sep 2010 12:18:55 -0000 -@@ -207,6 +207,8 @@ - extern Str process_img(struct parsed_tag *tag, int width); - extern Str process_anchor(struct parsed_tag *tag, char *tagbuf); - extern Str process_input(struct parsed_tag *tag); -+extern Str process_button(struct parsed_tag *tag); -+extern Str process_n_button(void); - extern Str process_select(struct parsed_tag *tag); - extern Str process_n_select(void); - extern void feed_select(char *str); -Index: table.c -=================================================================== -RCS file: /cvsroot/w3m/w3m/table.c,v -retrieving revision 1.58 -diff -u -r1.58 table.c ---- w3m.orig/table.c 9 Aug 2010 11:59:19 -0000 1.58 -+++ w3m/table.c 17 Sep 2010 12:18:55 -0000 -@@ -2878,6 +2878,14 @@ - tmp = process_input(tag); - feed_table1(tbl, tmp, mode, width); - break; -+ case HTML_BUTTON: -+ tmp = process_button(tag); -+ feed_table1(tbl, tmp, mode, width); -+ break; -+ case HTML_N_BUTTON: -+ tmp = process_n_button(); -+ feed_table1(tbl, tmp, mode, width); -+ break; - case HTML_SELECT: - tmp = process_select(tag); - if (tmp) -Index: tagtable.tab -=================================================================== -RCS file: /cvsroot/w3m/w3m/tagtable.tab,v -retrieving revision 1.14 -diff -u -r1.14 tagtable.tab ---- w3m.orig/tagtable.tab 14 Aug 2010 01:29:40 -0000 1.14 -+++ w3m/tagtable.tab 17 Sep 2010 12:18:55 -0000 -@@ -176,6 +176,7 @@ - big HTML_BIG - /big HTML_N_BIG - button HTML_BUTTON -+/button HTML_N_BUTTON - fieldset HTML_FIELDSET - /fieldset HTML_N_FIELDSET - iframe HTML_IFRAME diff --git a/debian/patches/020_debian.patch b/debian/patches/020_debian.patch new file mode 100644 index 0000000..a53d97c --- /dev/null +++ b/debian/patches/020_debian.patch @@ -0,0 +1,11826 @@ +Description: Git master branch of Debian's w3m +Origin: http://anonscm.debian.org/cgit/collab-maint/w3m.git + +diff --git a/ChangeLog b/ChangeLog +index 88358ef..7629962 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,605 @@ ++2015-01-24 Tatsuya Kinoshita <tats@debian.org> ++ ++ * acinclude.m4, configure, version.c.in: ++ Update to 0.5.3+gitYYYYMMDD (generate from ChangeLog). ++ ++2015-01-15 Tatsuya Kinoshita <tats@debian.org> ++ ++ * alloc.h, main.c: Drop C99 features. ++ ++2015-01-15 Scarlett <scarlett@xavin.net> ++ ++ Add overflow detection. ++ Origin: http://marc.info/?l=openbsd-ports&m=142090828929750&w=2 ++ * main.c: Call exit(1) when out of memory to avoid dereferencing null ++ pointers when gc's malloc fails. ++ * alloc.h: Replacements for w3m's allocation macros which add ++ overflow detection and concentrate the macros in one file. ++ * indep.h, libwc/charset.c, libwc/status.c, matrix.c: Use the ++ overflow-detecting allocation macros from alloc.h. ++ ++2015-01-15 Tatsuya Kinoshita <tats@debian.org> ++ ++ * Str.c, cookie.c, map.c: ++ Do not use C99 printf format specifiers and asprintf. ++ ++2015-01-15 Scarlett <scarlett@xavin.net> ++ ++ Correct printf arguments and use asprintf. ++ Origin: http://marc.info/?l=openbsd-ports&m=142090828929750&w=2 ++ * Str.c: Use asprintf() instead of rolling our own printf string ++ length detection. ++ * cookie.c: Pass the char pointer in the string struct to printf %s ++ instead of the string struct itself. ++ Print time_t using %lld instead of %ld to allow for 64-bit time_t. ++ * main.c: Print a long int using the correct format specifier. ++ * map.c: Print size_t using the correct format specifier. ++ ++2014-12-06 Araki Ken <arakiken@users.sf.net> ++ ++ Support OSC 5379 remote imaging and sixel graphics. ++ Origin: https://bitbucket.org/arakiken/w3m/branch/remoteimg (2014-11-16) ++ ++ * doc/README.sixel, terms.c: Add README.sixel. W3M_IMG2SIXEL ++ environmental variable enables to specify options of img2sixel. ++ ++ * image.c, terms.c: ++ Add n_terminal_image argument to put_image_{sixel|osc5379}(). ++ Use struct winsize to calculate ppc and ppl. ++ ++ * terms.c: If SCREEN_VARIANT=sixel on GNU screen, exec img2sixel ++ without -P option. ++ ++ * terms.c: ttymode_set() -> ttymode_reset(). ++ ++ * terms.c: Fix. ++ ++ * terms.c: Support GNU screen. ++ ++ * terms.c: Show GIF (except animation GIF) correctly. ++ ++ * main.c, terms.c: img2sixel exits by Ctrl+C. Enable GIF Animation if ++ 'I' is pressed to show it. ++ ++ * image.c: Add declaration of get_pixel_per_cell(). ++ ++ * terms.c: Show the first frame of animation gif files. ++ ++ * terms.c: system() -> fork()&execvp() ++ ++ * display.c: Draw underline on anchor which contains cboth text and ++ images. ++ ++ * etc.c: Remove close_tty() from setup_child() because close_tty() ++ sometimes interrupts loadGeneralFile() in loadImage() and corrupt ++ image data can be cached in ~/.w3m. ++ ++ * image.c: Minor fix. ++ ++ * image.c: Cache image files if at all possible and convert them to ++ sixel when -sixel option is specified. ++ ++ * image.c: Init pixel_per_{char|line}_i if get_pixel_per_cell() fails. ++ ++ * display.c, file.c, fm.h, image.c, main.c, terms.c: ++ Add -sixel option which supports image processing by img2sixel. ++ ++ * image.c: Don't download image files whose size is specified in ++ <img> tag. ++ ++ * image.c: Minor fixes of parseImageHeader(). ++ ++ * image.c: Determine the format of an image file by its header data ++ not by its file name suffix. ++ ++ * image.c: Read width and height from jpeg, png and gif files directly ++ instead of executing w3mimgdisplay -size. ++ ++ * display.c: display.c: Draw underline on anchor text which is not ++ overlapped with any image. ++ ++ * terms.c: Clear fd_set by FD_ZERO() before select(). ++ ++ * file.c: nw and ni are rounded up instead of rounded off to show ++ every corner of images. ++ ++ * terms.c: Change time to wait for the response of "\x1b[14t\x1b[18t" ++ from 0.1 sec to 0.5 sec. ++ ++ * image.c: ++ - clearImage() works. ++ - Use cached image files created by w3m in getImage(). ++ ++ * file.c: Hack for alignment. ++ ++ * fm.h, image.c, terms.c: ++ - Adjust the image size to the terminal cell size. ++ - If the image size is specified in html source, skip to load the image. ++ ++ * display.c, fm.h, image.c, main.c, terms.c, w3mimg/x11/x11_w3mimg.c: ++ Support remote image by OSC 5379 show_picture sequence. ++ ++2014-12-06 Olaf Hering <olh@suse.de> ++ ++ * parsetagx.c: Fix crash in parse_tag() during every start. ++ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-parsetagx-crash.patch?expand=1 ++ ++ * fm.h: Change the default to alt_entity=0. ++ Change the default for the option "Use ASCII equivalents to ++ display entities" from YES to NO. ++ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-0.5.1-no-ASCII-equivalents-by-default.patch?expand=1 ++ Bug-Novell: https://bugzilla.novell.com/show_bug.cgi?id=247397 ++ ++ * anchor.c, libwc/gb18030.c, libwc/ucs.c, regex.c: ++ Fix a few harmless uninitialized variables. ++ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-uninitialized.patch?expand=1 ++ ++2014-12-06 Peter Poeml <poeml@suse.de> ++ ++ * terms.c: Prevent segfault when editing a textarea field with vi. ++ Add fix for segfault that can occur when editing a textarea field ++ with vi, and returning to w3m (it seems to happen if the terminal ++ is not writable, as when using w3m after 'su - some_user') ++ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-0.4.1-textarea-segfault.dif?expand=1 ++ ++2014-12-04 Tatsuya Kinoshita <tats@debian.org> ++ ++ * acinclude.m4: Follow updated configure. ++ ++2014-12-03 Yusuke Baba <babayaga1@y8.dion.ne.jp> ++ ++ * configure, w3mimg/fb/fb.c, w3mimg/fb/fb.h, w3mimg/fb/fb_w3mimg.c: ++ Support FreeBSD framebuffer. ++ Origin: http://www.ac.auone-net.jp/~baba/w3m-img/index.html ++ Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=122673 ++ ++2014-12-02 Naohiro Aota <naota@gentoo.org> ++ ++ * acinclude.m4, configure, w3mimg/fb/fb_gdkpixbuf.c: ++ * w3mimg/x11/x11_w3mimg.c: ++ Depend on gdk-pixbuf instead of gtk when gtk2. ++ Origin: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/w3m/files/w3m-0.5.3-gdk-pixbuf.patch?revision=1.1 ++ ++2014-12-02 Jeroen Roovers <jer@gentoo.org> ++ ++ * acinclude.m4, configure: Add tinfo to with_termlib. ++ Fix building against sys-libs/ncurses[tinfo]. ++ Origin: https://504588.bugs.gentoo.org/attachment.cgi?id=372650 ++ Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=504588 ++ ++2014-12-01 OBATA Akio <obache@netbsd.org> ++ ++ * acinclude.m4, configure: ++ Assume defined PKG_CONFIG points right location when gtk2. ++ Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/w3m/patches/patch-aa?rev=1.13&content-type=text/x-cvsweb-markup ++ Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/w3m/patches/patch-ak?rev=1.1&content-type=text/x-cvsweb-markup ++ ++2014-12-01 Vsevolod Stakhov <vsevolod@FreeBSD.org> ++ ++ * config.h.in: Disable USE_EGD for LibreSSL. ++ Disable use of RAND_egd as it is absent in FreeBSD. ++ This also fixes build error with LibreSSL. ++ Origin: https://bz-attachments.freebsd.org/attachment.cgi?id=144635 ++ Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191852 ++ Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191956 ++ ++2014-12-01 zimous <zimous@matfyz.cz> ++ ++ * po/ja.po: Set Language tag properly for Japanese translation. ++ Origin: https://512722.bugs.gentoo.org/attachment.cgi?id=378452 ++ Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=512722 ++ ++2014-11-30 Tatsuya Kinoshita <tats@debian.org> ++ ++ * doc/w3m.1: Typo fix. ++ ++2014-11-30 Markus Hiereth <post@hiereth.de> ++ ++ * doc/w3m.1: Miscellaneous changes to improve English manpage. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 ++ ++2014-11-29 Markus Hiereth <post@hiereth.de> ++ ++ * doc/w3m.1: Improve FILES. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 ++ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=403634 ++ ++ * doc/w3m.1: Improve EXAMPLES. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 ++ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=380560 ++ ++ * doc/w3m.1: Improve explanation about option -N. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 ++ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=345084 ++ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530468 ++ ++ * doc/w3m.1: Note that -cols only affects when HTML is rendered. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 ++ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=285251 ++ ++ * doc/w3m.1: Add more info on configuration. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 ++ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=268211 ++ ++2014-11-29 Justin B Rye <justin.byam.rye@gmail.com> ++ ++ * scripts/w3mman/w3mman.1.in: Tweak for W3MMAN_W3M. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771003#5 ++ ++ * scripts/w3mman/w3mman.1.in: English fixes. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#25 ++ ++2014-11-29 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-19+. ++ ++2014-11-29 Justin B Rye <justin.byam.rye@gmail.com> ++ ++ * scripts/w3mman/w3mman2html.cgi.in: Fix Perl warnings. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771004 ++ ++2014-10-21 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-19 ++ ++ * po/LINGUAS: Correct LINGUAS to a whitespace separated list ++ ++2014-10-21 Markus Hiereth <markus.hiereth@freenet.de> ++ ++ * po/LINGUAS, po/de.po: Add German translation ++ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763964 ++ ++2014-10-15 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-18 ++ ++ * doc-jp/README.SSL: Update README.SSL to follow default values ++ ++ * config.sub: Update config.sub with autotools-dev 20140911.1 ++ ++ * fm.h: Disable SSLv3 by default [CVE-2014-3566] ++ cf. https://blog.mozilla.org/security/2014/10/14/the-poodle-attack-and-the-end-of-ssl-3-0/ ++ ++2014-10-15 Ludwig Nussel <ludwig.nussel@suse.de> ++ ++ * fm.h: Force ssl_verify_server on and disable SSLv2 support ++ Origin: http://www.openwall.com/lists/oss-security/2010/06/14/4 ++ ++2014-10-13 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-17+ ++ ++2014-10-04 Tatsuya Kinoshita <tats@debian.org> ++ ++ * libwc/ambwidth_map.awk, libwc/map/ucs_ambwidth.map: ++ Fix incorrect generation of ucs_ambwidth_map ++ ++2014-08-22 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-17 ++ ++ * config.guess: ++ Update config.guess to 2014-03-23 with autotools-dev 20140510.1 ++ ++ * config.sub: ++ Update config.sub to 2014-05-01 with autotools-dev 20140510.1 ++ ++2014-08-22 Micah Cowan <micah@addictivecode.org> ++ ++ * main.c: Support Boehm GC 7.2 ++ Replace Gentoo's patch to prevent segfaults due to infinite recursion. ++ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=080_gc72.patch;att=1;bug=758831 ++ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758831 ++ Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=555467 ++ Bug: http://sourceforge.net/p/w3m/patches/63/ ++ Bug: http://sourceforge.net/p/w3m/patches/59/ ++ ++2014-08-22 Tatsuya Kinoshita <tats@debian.org> ++ ++ * main.c: ++ Revert "Support Boehm GC 7.2" (w3m-0.5.2-gc72.patch from Gentoo) ++ This reverts commit 4331db3e3e673ac4dbfe8e9f2b42a8e0478dc98a. ++ ++2014-06-23 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-16 ++ ++ * url.c: Disable ciphers that use keys smaller than 128 bits ++ Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/1325674 ++ ++2014-01-04 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-15 ++ ++2014-01-03 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-14 ++ ++ * acinclude.m4, configure: Use pkg-config to build with imlib2 1.4.6 ++ ++ * doc/HISTORY, doc/README.cookie, doc/README.m17n: ++ Prefer US-ASCII rathar than Japanese encodings in English documents ++ ++2013-12-27 Tatsuya Kinoshita <tats@debian.org> ++ ++ * doc-jp/MANUAL.html, doc/MANUAL.html: ++ Cleanup unusable links in MANUAL.html ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=517315 ++ ++ * version.c.in: Update to 0.5.3+debian-13+ ++ ++2013-12-17 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-13 ++ ++2013-12-14 Tatsuya Kinoshita <tats@debian.org> ++ ++ * config.guess: ++ Update config.guess to 2013-06-10 with autotools-dev 20130810.1 ++ ++ * config.sub: ++ Update config.sub to 2013-08-10 with autotools-dev 20130810.1 ++ ++2013-12-07 Reinhard Max <max@suse.de> ++ ++ * local.c: Fix a directory descriptor leak in loadLocalDir ++ Patch from openSUSE on 2009-09-07. ++ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-closedir.patch ++ Bug-Novell: https://bugzilla.novell.com/show_bug.cgi?id=531675 ++ ++2013-12-07 AIDA Shinra <shinra@j10n.org> ++ ++ * main.c: Fix crash after SEARCH_NEXT ++ Patch from <http://www.j10n.org/files/w3m-cvs-1.1055-search-next.patch>, ++ [w3m-dev:04473] on 2013-12-07. ++ ++2013-11-11 Paul Boekholt <p.boekholt@gmail.com> ++ ++ * file.c: Add support for single quoted meta refresh URL ++ Bug: https://sourceforge.net/p/w3m/patches/53/ ++ ++2013-11-07 Cristian Rodriguez <crrodriguez@opensuse.org> ++ ++ * url.c: Use SSL_OP_NO_COMPRESSION if available ++ Due to the "CRIME attack" (CVE-2012-4929) HTTPS clients that ++ negotiate TLS-level compression can be abused for MITM attacks. ++ * url.c: Use SSL_MODE_RELEASE_BUFFERS if available ++ Patch from openSUSE on 2012-11-12: ++ https://build.opensuse.org/request/show/141054 ++ ++2013-10-15 Tatsuya Kinoshita <tats@debian.org> ++ ++ * Makefile.in: ++ Depend on funcname.tab to fix parallel make issue of scripts ++ Bug: https://sourceforge.net/p/w3m/patches/64/ ++ Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=362249 ++ ++ * w3mimg/Makefile.in: ++ Avoid prerequisite $(IMGOBJS) to fix parallel make issue of w3mimg ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726188 ++ ++ * acinclude.m4, configure: ++ Explicitly add -lX11 to IMGX11LDFLAGS only when gtk2 ++ Bug: https://sourceforge.net/p/w3m/patches/57/ ++ ++ * w3mimg/Makefile.in: Revert "Fix parallel make issue" ++ This reverts commit aa6f871c6dcc108118142bcc786e4a6ac3d46867. ++ ++ * Makefile.in: ++ Revert "Explicitly link w3mimgdisplay with -lX11 to build with gcc 4.5" ++ This reverts commit 7410954066d68ac2ad6aea638801714447321fec. ++ ++2013-10-14 AIDA Shinra <shinra@j10n.org> ++ ++ * url.c: Define schemeNumToName() to fix scheme bug ++ Patch from <http://www.j10n.org/files/w3m-cvs-1.1055-schemebug.patch>, ++ [w3m-dev:04470] on 2013-10-14. ++ Bug: https://sourceforge.net/p/w3m/patches/60/ ++ ++ * config.h.in, file.c, fm.h, html.h, image.c, indep.c, indep.h: ++ * istream.c, istream.h, local.c, main.c, mimehead.c, proto.h: ++ Workaround of GC crash on Cygwin64 ++ Patch from <http://www.j10n.org/files/w3m-cvs-1.1055-win64gc.patch>, ++ [w3m-dev:04469] on 2013-10-14. ++ ++2013-10-14 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-12+ ++ ++2013-10-14 Jarek Czekalski <jarekczek@poczta.onet.pl> ++ ++ * terms.c: Fix paren in check_cygwin_console() ++ Bug: https://sourceforge.net/p/w3m/patches/66/ ++ ++2013-10-13 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-12 ++ ++ * doc-jp/MANUAL.html, doc-jp/w3m.1, doc/MANUAL.html, doc/w3m.1: ++ Update document for the -s option change ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=75527 ++ ++ * terms.c: Do not fail when LANG is not set ++ Check whether the value of LC_ALL, LC_CTYPE or LANG is not NULL in ++ check_cygwin_console(). ++ Bug: https://sourceforge.net/p/w3m/patches/66/ ++ ++2013-10-12 Tatsuya Kinoshita <tats@debian.org> ++ ++ * table.h: Bump MAXCOL to 256 ++ Bug: https://sourceforge.net/p/w3m/feature-requests/24/ ++ ++2013-10-12 Laurence Richert <laurencerichert@yahoo.de> ++ ++ * main.c, proto.h: vim/-perator like handling ++ - half page scrolling ++ - jumping to elements numbered by getLinkNumberStr() from Karsten ++ Schoelzel ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=724028 ++ ++2013-10-12 Tatsuya Kinoshita <tats@debian.org> ++ ++ * doc-jp/README, doc/README: ++ Mention project page rather than unavailable mailing lists ++ ++2013-10-09 Rafael Laboissiere <rafael@laboissiere.net> ++ ++ * doc/README.img: Fix typo ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=725892 ++ ++2013-08-12 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-11+ ++ ++ * ChangeLog: Update ChangeLog to use contributor's name ++ ++2013-08-08 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-11 ++ ++2013-08-04 Tatsuya Kinoshita <tats@debian.org> ++ ++ * Str.c: Check length for Strchop() ++ ++ * main.c: Fix potentially segfault of execdict() ++ ++ * version.c.in: Update to 0.5.3+debian-10+ ++ ++ * file.c: Fix segfault of loadGeneralFile() ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718612 ++ ++2013-08-02 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-10 ++ ++2013-08-02 Piotr P. Karwasz <piotr.p@karwasz.org> ++ ++ * scripts/w3mman/w3mman2html.cgi.in: ++ Correct underline processing and more UTF-8 support for w3mman2html.cgi ++ Patch from <https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/680202> ++ on 2010-11-23. ++ ++2013-08-01 Hilko Bengen <bengen@debian.org> ++ ++ * entity.c: Ignore SOFT HYPHEN to prevent drawing hyphens everywhere ++ Patch from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=441934> ++ on 2011-03-01. ++ ++2013-08-01 Tatsuya Kinoshita <tats@debian.org> ++ ++ * doc-jp/README, doc/README: Update contact list in README ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696209 ++ ++2013-07-30 Tatsuya Kinoshita <tats@debian.org> ++ ++ * config.guess, config.sub: ++ Update config.guess and config.sub to supprot aarch64 ++ Updated with Debian autotools-dev version 20130515.1. ++ ++2013-07-30 Conrad J.C. Hughes <debbugs@xrad.org> ++ ++ * main.c: Sort anchors by sequence number in -dump ++ Patch from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657666> ++ on 2012-01-27. ++ ++2013-07-30 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update to 0.5.3+debian-9+ ++ ++2013-07-29 Tatsuya Kinoshita <tats@debian.org> ++ ++ * version.c.in: Update version to w3m/0.5.3+debian-9 ++ ++ * version.c.in: Set CURRENT_VERSION to debian version ++ ++2013-07-28 Tatsuya Kinoshita <tats@debian.org> ++ ++ * file.c: Fix segfault of process_button() ++ ++2013-04-08 AIDA Shinra <shinra@j10n.org> ++ ++ * file.c: One more patch for siteconf from [w3m-dev 04464] ++ ++ * anchor.c, config.h.in, display.c, doc-jp/README.siteconf: ++ * doc/README.siteconf, file.c, fm.h, form.c, frame.c, func.c: ++ * history.c, indep.c, indep.h, linein.c, main.c, map.c, menu.c: ++ * po/ja.po, proto.h, rc.c, url.c: Support the siteconf feature ++ Patch to support the siteconf feature, from [w3m-dev 04463] ++ on 2012-06-27. ++ ++2013-04-08 Hayaki Saito <user@zuse.jp> ++ ++ * keybind.c, main.c, proto.h, terms.c: ++ Support SGR 1006 mouse reporting ++ Patch to support SGR 1006 mouse reporting, from [w3m-dev 04466] ++ on 2012-07-15. ++ ++2012-05-19 Hilko Bengen <bengen@debian.org> ++ ++ * form.c: Assume "text" if an input type is unknown ++ Patch from <http://bugs.debian.org/615843> on 2011-03-01. ++ ++2012-05-19 Simon Ruderich <simon@ruderich.org> ++ ++ * Makefile.in: Use $(CPPFLAGS) with $(CPP) ++ Patch from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=665491> ++ on 2012-03-24. ++ ++2012-05-03 Miroslav Šulc <fordfrog@gentoo.org> ++ ++ * w3mimg/Makefile.in: Fix parallel make issue ++ Patch from Gentoo ++ <http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/w3m/files/w3m-0.5.3-parallel-make.patch?revision=1.1&view=markup> ++ <https://bugs.gentoo.org/show_bug.cgi?id=353390> on 2011-02-01. ++ ++2012-05-03 MATSUU Takuto <matsuu@gentoo.org> ++ ++ * main.c: Support Boehm GC 7.2 ++ Patch from Gentoo ++ <http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/w3m/files/w3m-0.5.2-gc72.patch?revision=1.1&view=markup> ++ on 2009-12-13. ++ ++2012-05-02 Reinhard Tartler <siretart@tauware.de> ++ ++ * istream.c, istream.h: ++ Fix that struct file_handle conflicts with glibc 2.14 ++ Patch from <https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/935540> ++ on 2012-02-19. ++ ++2011-10-30 Colin Watson <cjwatson@ubuntu.com> ++ ++ * acinclude.m4, configure, w3mbookmark.c: ++ Appease gcc -Werror=format-security. ++ Patch from 0.5.3-3ubuntu1 on 2011-10-23. ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646321 ++ ++2011-06-19 Martin Pitt <martin.pitt@ubuntu.com> ++ ++ * Makefile.in: ++ Explicitly link w3mimgdisplay with -lX11 to build with gcc 4.5 ++ Patch from 0.5.2-10ubuntu1 on 2010-12-03. ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605761 ++ ++2011-06-19 Fumitoshi UKAI <ukai@debian.or.jp> ++ ++ * main.c: ++ Change the -s option to "squeeze multiple blank lines" for pager ++ Change the -s option from "display charset Shift_JIS" to "squeeze ++ multiple blank lines" to work as /usr/bin/pager. In addition, the ++ options -j and -e are disabled. To specify the display charset, ++ use -O{s|j|e} instead. ++ Patch from [w3m-dev 01275] on 2000-10-26. ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=75527 ++ ++2011-06-19 Hiroyuki Ito <ZXB01226@nifty.com> ++ ++ * file.c, fm.h, html.c, html.h, proto.h, table.c, tagtable.tab: ++ Support the button element as defined in HTML 4.01 ++ Patch from upstream, [w3m-dev 04411] on 2010-09-17, to support the ++ button element. It is discussed upstream and incomplete, but enough ++ to login Launchpad. ++ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=136810 ++ + 2012-05-22 Tatsuya Kinoshita <tats@vega.ocn.ne.jp> + + * [w3m-dev 04451] w3m/entity.h should be removed when `make clean' +diff --git a/Makefile.in b/Makefile.in +index 7d692f9..8fa799e 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -150,7 +150,7 @@ parsetagx.o: html.c + + funcname.tab: $(DEFUNS) + (echo '#define DEFUN(x,y,z) x y';\ +- sed -ne '/^DEFUN/{p;n;/^[ ]/p;}' $(DEFUNS)) | $(CPP) - | \ ++ sed -ne '/^DEFUN/{p;n;/^[ ]/p;}' $(DEFUNS)) | $(CPP) $(CPPFLAGS) - | \ + awk '$$1 ~ /^[_A-Za-z]/ { \ + for (i=2;i<=NF;i++) { print $$i, $$1} \ + }' > $@.tmp +@@ -250,7 +250,7 @@ install-po: + (cd $$subdir && $(MAKE) install); \ + done + +-all-scripts: ++all-scripts: funcname.tab + for dir in $(SCRIPTSUBDIRS); \ + do \ + (cd $$dir && $(MAKE) $(MAKE_ARGS)); \ +diff --git a/Str.c b/Str.c +index e5a0982..eff82a4 100644 +--- a/Str.c ++++ b/Str.c +@@ -278,8 +278,8 @@ void + Strchop(Str s) + { + STR_LENGTH_CHECK(s); +- while ((s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r') && +- s->length > 0) { ++ while (s->length > 0 && ++ (s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r')) { + s->length--; + } + s->ptr[s->length] = '\0'; +diff --git a/acinclude.m4 b/acinclude.m4 +index e4ccc3d..60705f4 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -6,7 +6,8 @@ dnl w3m autoconf macros + AC_DEFUN([AC_W3M_VERSION], + [AC_SUBST(CURRENT_VERSION) + cvsver=`$AWK '\$[1] ~ /Id:/ { print \$[3]}' $srcdir/ChangeLog` +- sed -e 's/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c ++ ymdver=`sed -e 's/ .*//;s/-//g;q' $srcdir/ChangeLog` ++ sed -e 's/define CURRENT_VERSION "\(.*\)YYYYMMDD/define CURRENT_VERSION "\1'$ymdver'/;s/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c + CURRENT_VERSION=`sed -n 's/.*define CURRENT_VERSION *"w3m\/\(.*\)".*$/\1/p' version.c`]) + # + # ---------------------------------------------------------------- +@@ -400,10 +401,10 @@ AC_DEFUN([AC_W3M_TERMLIB], + AC_ARG_WITH(termlib, + [ --with-termlib[=LIBS] terminal library + LIBS is space separated list of: +- terminfo mytinfo termcap ncurses curses],, ++ terminfo mytinfo termcap tinfo ncurses curses],, + [with_termlib="yes"]) + AC_MSG_RESULT($with_termlib) +- test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap ncurses curses" ++ test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap tinfo ncurses curses" + for lib in $with_termlib; do + AC_CHECK_LIB($lib, tgetent, [W3M_LIBS="$W3M_LIBS -l$lib"; break]) + done +@@ -600,7 +601,7 @@ AC_DEFUN([AC_W3M_IMAGE], + if test x"$enable_image" = xyes; then + enable_image=x11 + case "`uname -s`" in +- Linux|linux|LINUX) ++ Linux|linux|LINUX|FreeBSD|freebsd|FREEBSD) + if test -c /dev/fb0; then + enable_image=x11,fb + fi;; +@@ -649,6 +650,9 @@ AC_DEFUN([AC_W3M_IMAGE], + fi;; + imlib2) + with_imlib2="yes" ++ if test x"$PKG_CONFIG" = x; then ++ PKG_CONFIG=pkg-config ++ fi + if test x"$IMLIB2_CONFIG" = x; then + IMLIB2_CONFIG=imlib2-config + fi;; +@@ -661,8 +665,6 @@ AC_DEFUN([AC_W3M_IMAGE], + with_gtk2="yes" + if test x"$PKG_CONFIG" = x; then + PKG_CONFIG=pkg-config +- else +- PKG_CONFIG=: + fi;; + esac + done +@@ -705,8 +707,8 @@ AC_DEFUN([AC_W3M_IMAGE], + IMGTARGETS="x11" + AC_DEFINE(USE_GDKPIXBUF) + AC_DEFINE(USE_GTK2) +- IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" +- IMGX11LDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" ++ IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0`" ++ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0`" + elif test x"$have_gdkpixbuf" = xyes; then + AC_DEFINE(USE_W3MIMG_X11) + IMGOBJS="$IMGOBJS x11/x11_w3mimg.o" +@@ -728,7 +730,7 @@ AC_DEFUN([AC_W3M_IMAGE], + IMGTARGETS="x11" + AC_DEFINE(USE_IMLIB2) + IMGX11CFLAGS="`${IMLIB2_CONFIG} --cflags`" +- IMGX11LDFLAGS="`${IMLIB2_CONFIG} --libs`" ++ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs imlib2`" + else + AC_MSG_WARN([unable to build w3mimgdisplay with X11 support]) + fi +@@ -740,8 +742,8 @@ AC_DEFUN([AC_W3M_IMAGE], + IMGTARGETS="${IMGTARGETS} fb" + AC_DEFINE(USE_GDKPIXBUF) + AC_DEFINE(USE_GTK2) +- IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gtk+-2.0`" +- IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gtk+-2.0`" ++ IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0`" ++ IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0`" + elif test x"$have_gdkpixbuf" = xyes; then + AC_DEFINE(USE_W3MIMG_FB) + IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o" +@@ -756,7 +758,7 @@ AC_DEFUN([AC_W3M_IMAGE], + AC_DEFINE(USE_IMLIB2) + IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o" + IMGFBCFLAGS="`${IMLIB2_CONFIG} --cflags`" +- IMGFBLDFLAGS="`${IMLIB2_CONFIG} --libs`" ++ IMGFBLDFLAGS="`${PKG_CONFIG} --libs imlib2`" + else + AC_MSG_WARN([unable to build w3mimgdisplay with FB support]) + fi +@@ -866,7 +868,7 @@ AC_MSG_CHECKING(for sys_errlist) + AC_TRY_COMPILE( + changequote(<<,>>)dnl + <<extern char *sys_errlist[];>>, +-<<printf(sys_errlist[0]);>>, ++<<printf("%s", sys_errlist[0]);>>, + changequote([,])dnl + [have_sys_errlist="yes"; AC_DEFINE(HAVE_SYS_ERRLIST)], + [have_sys_errlist="no"]) +diff --git a/alloc.h b/alloc.h +new file mode 100644 +index 0000000..fa0d391 +--- /dev/null ++++ b/alloc.h +@@ -0,0 +1,39 @@ ++/* ++ * by Scarlett. public domain. ++ * replacements for w3m's allocation macros which add overflow ++ * detection and concentrate the macros in one file ++ */ ++#ifndef W3_ALLOC_H ++#define W3_ALLOC_H ++#include <gc.h> ++#include <stdlib.h> ++#include <stdio.h> ++#include <limits.h> ++ ++static inline size_t ++z_mult_no_oflow_(size_t n, size_t size) ++{ ++ if (size != 0 && n > ULONG_MAX / size) { ++ fprintf(stderr, ++ "w3m: overflow in malloc, %lu*%lu\n", (unsigned long)n, (unsigned long)size); ++ exit(1); ++ } ++ return n * size; ++} ++ ++#define New(type) \ ++ (GC_MALLOC(sizeof(type))) ++ ++#define NewAtom(type) \ ++ (GC_MALLOC_ATOMIC(sizeof(type))) ++ ++#define New_N(type, n) \ ++ (GC_MALLOC(z_mult_no_oflow_((n), sizeof(type)))) ++ ++#define NewAtom_N(type, n) \ ++ (GC_MALLOC_ATOMIC(z_mult_no_oflow_((n), sizeof(type)))) ++ ++#define New_Reuse(type, ptr, n) \ ++ (GC_REALLOC((ptr), z_mult_no_oflow_((n), sizeof(type)))) ++ ++#endif /* W3_ALLOC_H */ +diff --git a/anchor.c b/anchor.c +index 27bbd56..a353bb9 100644 +--- a/anchor.c ++++ b/anchor.c +@@ -11,7 +11,7 @@ putAnchor(AnchorList *al, char *url, char *target, Anchor **anchor_return, + { + int n, i, j; + Anchor *a; +- BufferPoint bp; ++ BufferPoint bp = { 0 }; + if (al == NULL) { + al = New(AnchorList); + al->anchors = NULL; +@@ -200,10 +200,11 @@ _put_anchor_news(Buffer *buf, char *p1, char *p2, int line, int pos) + if (*(p2 - 1) == '>') + p2--; + } +- tmp = wc_Str_conv_strict(Strnew_charp_n(p1, p2 - p1), InnerCharset, +- buf->document_charset); +- tmp = Sprintf("news:%s", file_quote(tmp->ptr)); +- return registerHref(buf, tmp->ptr, NULL, NO_REFERER, NULL, '\0', line, ++ tmp = Strnew_charp("news:"); ++ Strcat_charp_n(tmp, p1, p2 - p1); ++ return registerHref(buf, url_encode(tmp->ptr, baseURL(buf), ++ buf->document_charset), ++ NULL, NO_REFERER, NULL, '\0', line, + pos); + } + #endif /* USE_NNTP */ +@@ -213,9 +214,10 @@ _put_anchor_all(Buffer *buf, char *p1, char *p2, int line, int pos) + { + Str tmp; + +- tmp = wc_Str_conv_strict(Strnew_charp_n(p1, p2 - p1), InnerCharset, +- buf->document_charset); +- return registerHref(buf, url_quote(tmp->ptr), NULL, NO_REFERER, NULL, ++ tmp = Strnew_charp_n(p1, p2 - p1); ++ return registerHref(buf, url_encode(tmp->ptr, baseURL(buf), ++ buf->document_charset), ++ NULL, NO_REFERER, NULL, + '\0', line, pos); + } + +@@ -756,7 +758,7 @@ link_list_panel(Buffer *buf) + p = parsedURL2Str(&pu)->ptr; + u = html_quote(p); + if (DecodeURL) +- p = html_quote(url_unquote_conv(p, buf->document_charset)); ++ p = html_quote(url_decode2(p, buf)); + else + p = u; + } +@@ -787,7 +789,7 @@ link_list_panel(Buffer *buf) + p = parsedURL2Str(&pu)->ptr; + u = html_quote(p); + if (DecodeURL) +- p = html_quote(url_unquote_conv(p, buf->document_charset)); ++ p = html_quote(url_decode2(p, buf)); + else + p = u; + t = getAnchorText(buf, al, a); +@@ -809,16 +811,13 @@ link_list_panel(Buffer *buf) + p = parsedURL2Str(&pu)->ptr; + u = html_quote(p); + if (DecodeURL) +- p = html_quote(url_unquote_conv(p, buf->document_charset)); ++ p = html_quote(url_decode2(p, buf)); + else + p = u; + if (a->title && *a->title) + t = html_quote(a->title); +- else if (DecodeURL) +- t = html_quote(url_unquote_conv +- (a->url, buf->document_charset)); + else +- t = html_quote(a->url); ++ t = html_quote(url_decode2(a->url, buf)); + Strcat_m_charp(tmp, "<li><a href=\"", u, "\">", t, "</a><br>", p, + "\n", NULL); + a = retrieveAnchor(buf->formitem, a->start.line, a->start.pos); +@@ -842,19 +841,13 @@ link_list_panel(Buffer *buf) + p = parsedURL2Str(&pu)->ptr; + u = html_quote(p); + if (DecodeURL) +- p = html_quote(url_unquote_conv(p, +- buf-> +- document_charset)); ++ p = html_quote(url_decode2(p, buf)); + else + p = u; + if (m->alt && *m->alt) + t = html_quote(m->alt); +- else if (DecodeURL) +- t = html_quote(url_unquote_conv(m->url, +- buf-> +- document_charset)); + else +- t = html_quote(m->url); ++ t = html_quote(url_decode2(m->url, buf)); + Strcat_m_charp(tmp, "<li><a href=\"", u, "\">", t, + "</a><br>", p, "\n", NULL); + } +diff --git a/config.guess b/config.guess +index 51fab47..1f5c50c 100755 +--- a/config.guess ++++ b/config.guess +@@ -1,13 +1,12 @@ + #! /bin/sh + # Attempt to guess a canonical system name. +-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++# Copyright 1992-2014 Free Software Foundation, Inc. + +-timestamp='2004-03-12' ++timestamp='2014-03-23' + + # This file 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; either version 2 of the License, or ++# the Free Software Foundation; either version 3 of the License, or + # (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, but +@@ -16,24 +15,22 @@ timestamp='2004-03-12' + # General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++# along with this program; if not, see <http://www.gnu.org/licenses/>. + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under +-# the same distribution terms that you use for the rest of that program. +- +-# Originally written by Per Bothner <per@bothner.com>. +-# Please send patches to <config-patches@gnu.org>. Submit a context +-# diff and a properly formatted ChangeLog entry. ++# the same distribution terms that you use for the rest of that ++# program. This Exception is an additional permission under section 7 ++# of the GNU General Public License, version 3 ("GPLv3"). ++# ++# Originally written by Per Bothner. + # +-# This script attempts to guess a canonical system name similar to +-# config.sub. If it succeeds, it prints the system name on stdout, and +-# exits with 0. Otherwise, it exits with 1. ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + # +-# The plan is that this can be called by configure scripts if you +-# don't specify an explicit build system type. ++# Please send patches with a ChangeLog entry to config-patches@gnu.org. ++ + + me=`echo "$0" | sed -e 's,.*/,,'` + +@@ -53,8 +50,7 @@ version="\ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +-Free Software Foundation, Inc. ++Copyright 1992-2014 Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -66,11 +62,11 @@ Try \`$me --help' for more information." + while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) +- echo "$timestamp" ; exit 0 ;; ++ echo "$timestamp" ; exit ;; + --version | -v ) +- echo "$version" ; exit 0 ;; ++ echo "$version" ; exit ;; + --help | --h* | -h ) +- echo "$usage"; exit 0 ;; ++ echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. +@@ -104,7 +100,7 @@ set_cc_for_build=' + trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; + trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; + : ${TMPDIR=/tmp} ; +- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || ++ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +@@ -123,7 +119,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +-esac ;' ++esac ; set_cc_for_build= ;' + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. + # (ghazi@noc.rutgers.edu 1994-08-24) +@@ -136,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown + UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown + UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + ++case "${UNAME_SYSTEM}" in ++Linux|GNU|GNU/*) ++ # If the system lacks a compiler, then just pick glibc. ++ # We could probably try harder. ++ LIBC=gnu ++ ++ eval $set_cc_for_build ++ cat <<-EOF > $dummy.c ++ #include <features.h> ++ #if defined(__UCLIBC__) ++ LIBC=uclibc ++ #elif defined(__dietlibc__) ++ LIBC=dietlibc ++ #else ++ LIBC=gnu ++ #endif ++ EOF ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ++ ;; ++esac ++ + # Note: order is significant - the case branches are not exclusive. + + case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or +- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, ++ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward +@@ -158,6 +175,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; ++ sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched +@@ -166,7 +184,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ +- | grep __ELF__ >/dev/null ++ | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? +@@ -176,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + fi + ;; + *) +- os=netbsd ++ os=netbsd + ;; + esac + # The OS release +@@ -196,71 +214,34 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" +- exit 0 ;; +- amd64:OpenBSD:*:*) +- echo x86_64-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- amiga:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- arc:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- cats:OpenBSD:*:*) +- echo arm-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- hp300:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mac68k:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- macppc:OpenBSD:*:*) +- echo powerpc-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvme68k:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvme88k:OpenBSD:*:*) +- echo m88k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- mvmeppc:OpenBSD:*:*) +- echo powerpc-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- pegasos:OpenBSD:*:*) +- echo powerpc-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- pmax:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- sgi:OpenBSD:*:*) +- echo mipseb-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- sun3:OpenBSD:*:*) +- echo m68k-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; +- wgrisc:OpenBSD:*:*) +- echo mipsel-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; ++ *:Bitrig:*:*) ++ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` ++ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} ++ exit ;; + *:OpenBSD:*:*) +- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} +- exit 0 ;; ++ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` ++ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} ++ exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; ++ *:SolidBSD:*:*) ++ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} ++ exit ;; + macppc:MirBSD:*:*) +- echo powerppc-unknown-mirbsd${UNAME_RELEASE} +- exit 0 ;; ++ echo powerpc-unknown-mirbsd${UNAME_RELEASE} ++ exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) +- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on +@@ -306,40 +287,46 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- exit 0 ;; +- Alpha*:OpenVMS:*:*) +- echo alpha-hp-vms +- exit 0 ;; ++ # Reset EXIT trap before exiting to avoid spurious non-zero exit code. ++ exitcode=$? ++ trap '' 0 ++ exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix +- exit 0 ;; ++ exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 +- exit 0 ;; ++ exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 +- exit 0;; ++ exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos +- exit 0 ;; ++ exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos +- exit 0 ;; ++ exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition +- exit 0 ;; ++ exit ;; ++ *:z/VM:*:*) ++ echo s390-ibm-zvmoe ++ exit ;; + *:OS400:*:*) +- echo powerpc-ibm-os400 +- exit 0 ;; ++ echo powerpc-ibm-os400 ++ exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} +- exit 0;; ++ exit ;; ++ arm*:riscos:*:*|arm*:RISCOS:*:*) ++ echo arm-unknown-riscos ++ exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp +- exit 0;; ++ exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then +@@ -347,32 +334,51 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + else + echo pyramid-pyramid-bsd + fi +- exit 0 ;; ++ exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 +- exit 0 ;; ++ exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 +- exit 0 ;; +- DRS?6000:UNIX_SV:4.2*:7*) ++ exit ;; ++ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in +- sparc) echo sparc-icl-nx7 && exit 0 ;; ++ sparc) echo sparc-icl-nx7; exit ;; + esac ;; ++ s390x:SunOS:*:*) ++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; +- i86pc:SunOS:5.*:*) +- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; ++ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) ++ echo i386-pc-auroraux${UNAME_RELEASE} ++ exit ;; ++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) ++ eval $set_cc_for_build ++ SUN_ARCH="i386" ++ # If there is a compiler, see if it is configured for 64-bit objects. ++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. ++ # This test works for both compilers. ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ SUN_ARCH="x86_64" ++ fi ++ fi ++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) +@@ -381,10 +387,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` +- exit 0 ;; ++ exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 +@@ -396,10 +402,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac +- exit 0 ;; ++ exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor +@@ -409,41 +415,41 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ echo m68k-atari-mint${UNAME_RELEASE} ++ exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} +- exit 0 ;; ++ echo m68k-atari-mint${UNAME_RELEASE} ++ exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) +- echo m68k-milan-mint${UNAME_RELEASE} +- exit 0 ;; ++ echo m68k-milan-mint${UNAME_RELEASE} ++ exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) +- echo m68k-hades-mint${UNAME_RELEASE} +- exit 0 ;; ++ echo m68k-hades-mint${UNAME_RELEASE} ++ exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) +- echo m68k-unknown-mint${UNAME_RELEASE} +- exit 0 ;; ++ echo m68k-unknown-mint${UNAME_RELEASE} ++ exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 +- exit 0 ;; ++ exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +@@ -467,35 +473,36 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + exit (-1); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c \ +- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ +- && exit 0 ++ $CC_FOR_BUILD -o $dummy $dummy.c && ++ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && ++ SYSTEM_NAME=`$dummy $dummyarg` && ++ { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax +- exit 0 ;; ++ exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax +- exit 0 ;; ++ exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax +- exit 0 ;; ++ exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix +- exit 0 ;; ++ exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 +- exit 0 ;; ++ exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 +- exit 0 ;; ++ exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 +- exit 0 ;; ++ exit ;; + AViiON:dgux:*:*) +- # DG/UX returns AViiON for all architectures +- UNAME_PROCESSOR=`/usr/bin/uname -p` ++ # DG/UX returns AViiON for all architectures ++ UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ +@@ -508,29 +515,29 @@ EOF + else + echo i586-dg-dgux${UNAME_RELEASE} + fi +- exit 0 ;; ++ exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 +- exit 0 ;; ++ exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 +- exit 0 ;; ++ exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 +- exit 0 ;; ++ exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd +- exit 0 ;; ++ exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` +- exit 0 ;; ++ exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. +- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id +- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' ++ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id ++ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix +- exit 0 ;; ++ exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` +@@ -538,7 +545,7 @@ EOF + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} +- exit 0 ;; ++ exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build +@@ -553,15 +560,19 @@ EOF + exit(0); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 +- echo rs6000-ibm-aix3.2.5 ++ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` ++ then ++ echo "$SYSTEM_NAME" ++ else ++ echo rs6000-ibm-aix3.2.5 ++ fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi +- exit 0 ;; +- *:AIX:*:[45]) ++ exit ;; ++ *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 +@@ -574,28 +585,28 @@ EOF + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} +- exit 0 ;; ++ exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix +- exit 0 ;; ++ exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 +- exit 0 ;; ++ exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to +- exit 0 ;; # report: romp-ibm BSD 4.3 ++ exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx +- exit 0 ;; ++ exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 +- exit 0 ;; ++ exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd +- exit 0 ;; ++ exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 +- exit 0 ;; ++ exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in +@@ -604,52 +615,52 @@ EOF + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` +- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` +- case "${sc_cpu_version}" in +- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 +- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 +- 532) # CPU_PA_RISC2_0 +- case "${sc_kernel_bits}" in +- 32) HP_ARCH="hppa2.0n" ;; +- 64) HP_ARCH="hppa2.0w" ;; ++ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` ++ case "${sc_cpu_version}" in ++ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 ++ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 ++ 532) # CPU_PA_RISC2_0 ++ case "${sc_kernel_bits}" in ++ 32) HP_ARCH="hppa2.0n" ;; ++ 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 +- esac ;; +- esac ++ esac ;; ++ esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ sed 's/^ //' << EOF >$dummy.c + +- #define _HPUX_SOURCE +- #include <stdlib.h> +- #include <unistd.h> ++ #define _HPUX_SOURCE ++ #include <stdlib.h> ++ #include <unistd.h> + +- int main () +- { +- #if defined(_SC_KERNEL_BITS) +- long bits = sysconf(_SC_KERNEL_BITS); +- #endif +- long cpu = sysconf (_SC_CPU_VERSION); ++ int main () ++ { ++ #if defined(_SC_KERNEL_BITS) ++ long bits = sysconf(_SC_KERNEL_BITS); ++ #endif ++ long cpu = sysconf (_SC_CPU_VERSION); + +- switch (cpu) +- { +- case CPU_PA_RISC1_0: puts ("hppa1.0"); break; +- case CPU_PA_RISC1_1: puts ("hppa1.1"); break; +- case CPU_PA_RISC2_0: +- #if defined(_SC_KERNEL_BITS) +- switch (bits) +- { +- case 64: puts ("hppa2.0w"); break; +- case 32: puts ("hppa2.0n"); break; +- default: puts ("hppa2.0"); break; +- } break; +- #else /* !defined(_SC_KERNEL_BITS) */ +- puts ("hppa2.0"); break; +- #endif +- default: puts ("hppa1.0"); break; +- } +- exit (0); +- } ++ switch (cpu) ++ { ++ case CPU_PA_RISC1_0: puts ("hppa1.0"); break; ++ case CPU_PA_RISC1_1: puts ("hppa1.1"); break; ++ case CPU_PA_RISC2_0: ++ #if defined(_SC_KERNEL_BITS) ++ switch (bits) ++ { ++ case 64: puts ("hppa2.0w"); break; ++ case 32: puts ("hppa2.0n"); break; ++ default: puts ("hppa2.0"); break; ++ } break; ++ #else /* !defined(_SC_KERNEL_BITS) */ ++ puts ("hppa2.0"); break; ++ #endif ++ default: puts ("hppa1.0"); break; ++ } ++ exit (0); ++ } + EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa +@@ -657,9 +668,19 @@ EOF + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then +- # avoid double evaluation of $set_cc_for_build +- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build +- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null ++ eval $set_cc_for_build ++ ++ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating ++ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler ++ # generating 64-bit code. GNU and HP use different nomenclature: ++ # ++ # $ CC_FOR_BUILD=cc ./config.guess ++ # => hppa2.0w-hp-hpux11.23 ++ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess ++ # => hppa64-hp-hpux11.23 ++ ++ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | ++ grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else +@@ -667,11 +688,11 @@ EOF + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} +- exit 0 ;; ++ exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} +- exit 0 ;; ++ exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +@@ -699,340 +720,345 @@ EOF + exit (0); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 ++ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && ++ { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 +- exit 0 ;; ++ exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd +- exit 0 ;; ++ exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd +- exit 0 ;; ++ exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix +- exit 0 ;; ++ exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf +- exit 0 ;; ++ exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf +- exit 0 ;; ++ exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi +- exit 0 ;; ++ exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites +- exit 0 ;; ++ exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd +- exit 0 ;; ++ exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi +- exit 0 ;; ++ exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd +- exit 0 ;; ++ exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd +- exit 0 ;; ++ exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd +- exit 0 ;; ++ exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ exit ;; + *:UNICOS/mp:*:*) +- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' +- exit 0 ;; ++ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` +- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` +- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" +- exit 0 ;; ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` ++ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ exit ;; + 5000:UNIX_System_V:4.*:*) +- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` +- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" +- exit 0 ;; ++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` ++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` ++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" ++ exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:FreeBSD:*:*) +- # Determine whether the default compiler uses glibc. +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #include <features.h> +- #if __GLIBC__ >= 2 +- LIBC=gnu +- #else +- LIBC= +- #endif +-EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` +- # GNU/KFreeBSD systems have a "k" prefix to indicate we are using +- # FreeBSD's kernel, but not the complete OS. +- case ${LIBC} in gnu) kernel_only='k' ;; esac +- echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} +- exit 0 ;; ++ UNAME_PROCESSOR=`/usr/bin/uname -p` ++ case ${UNAME_PROCESSOR} in ++ amd64) ++ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ *) ++ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; ++ esac ++ exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin +- exit 0 ;; +- i*:MINGW*:*) ++ exit ;; ++ *:MINGW64*:*) ++ echo ${UNAME_MACHINE}-pc-mingw64 ++ exit ;; ++ *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 +- exit 0 ;; ++ exit ;; ++ *:MSYS*:*) ++ echo ${UNAME_MACHINE}-pc-msys ++ exit ;; ++ i*:windows32*:*) ++ # uname -m includes "-pc" on this system. ++ echo ${UNAME_MACHINE}-mingw32 ++ exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 +- exit 0 ;; +- x86:Interix*:[34]*) +- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' +- exit 0 ;; ++ exit ;; ++ *:Interix*:*) ++ case ${UNAME_MACHINE} in ++ x86) ++ echo i586-pc-interix${UNAME_RELEASE} ++ exit ;; ++ authenticamd | genuineintel | EM64T) ++ echo x86_64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ IA64) ++ echo ia64-unknown-interix${UNAME_RELEASE} ++ exit ;; ++ esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks +- exit 0 ;; ++ exit ;; ++ 8664:Windows_NT:*) ++ echo x86_64-pc-mks ++ exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix +- exit 0 ;; ++ exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin +- exit 0 ;; ++ exit ;; ++ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) ++ echo x86_64-unknown-cygwin ++ exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin +- exit 0 ;; ++ exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` +- exit 0 ;; ++ exit ;; + *:GNU:*:*) + # the GNU system +- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` +- exit 0 ;; ++ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` ++ exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland +- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu +- exit 0 ;; ++ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} ++ exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix +- exit 0 ;; ++ exit ;; ++ aarch64:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ aarch64_be:Linux:*:*) ++ UNAME_MACHINE=aarch64_be ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ alpha:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ EV5) UNAME_MACHINE=alphaev5 ;; ++ EV56) UNAME_MACHINE=alphaev56 ;; ++ PCA56) UNAME_MACHINE=alphapca56 ;; ++ PCA57) UNAME_MACHINE=alphapca56 ;; ++ EV6) UNAME_MACHINE=alphaev6 ;; ++ EV67) UNAME_MACHINE=alphaev67 ;; ++ EV68*) UNAME_MACHINE=alphaev68 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ arc:Linux:*:* | arceb:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; + arm*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ eval $set_cc_for_build ++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_EABI__ ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ else ++ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_PCS_VFP ++ then ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi ++ else ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf ++ fi ++ fi ++ exit ;; ++ avr32*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; + cris:Linux:*:*) +- echo cris-axis-linux-gnu +- exit 0 ;; ++ echo ${UNAME_MACHINE}-axis-linux-${LIBC} ++ exit ;; ++ crisv32:Linux:*:*) ++ echo ${UNAME_MACHINE}-axis-linux-${LIBC} ++ exit ;; ++ frv:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ hexagon:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ i*86:Linux:*:*) ++ echo ${UNAME_MACHINE}-pc-linux-${LIBC} ++ exit ;; + ia64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; + m32r*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; + m68*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; +- mips:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU +- #undef mips +- #undef mipsel ++ #undef ${UNAME_MACHINE} ++ #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mipsel ++ CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips ++ CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif + EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` +- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ++ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` ++ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + ;; +- mips64:Linux:*:*) +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #undef CPU +- #undef mips64 +- #undef mips64el +- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=mips64el +- #else +- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=mips64 +- #else +- CPU= +- #endif +- #endif +-EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` +- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 +- ;; +- ppc:Linux:*:*) +- echo powerpc-unknown-linux-gnu +- exit 0 ;; +- ppc64:Linux:*:*) +- echo powerpc64-unknown-linux-gnu +- exit 0 ;; +- alpha:Linux:*:*) +- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in +- EV5) UNAME_MACHINE=alphaev5 ;; +- EV56) UNAME_MACHINE=alphaev56 ;; +- PCA56) UNAME_MACHINE=alphapca56 ;; +- PCA57) UNAME_MACHINE=alphapca56 ;; +- EV6) UNAME_MACHINE=alphaev6 ;; +- EV67) UNAME_MACHINE=alphaev67 ;; +- EV68*) UNAME_MACHINE=alphaev68 ;; +- esac +- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null +- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi +- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} +- exit 0 ;; ++ openrisc*:Linux:*:*) ++ echo or1k-unknown-linux-${LIBC} ++ exit ;; ++ or32:Linux:*:* | or1k*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ padre:Linux:*:*) ++ echo sparc-unknown-linux-${LIBC} ++ exit ;; ++ parisc64:Linux:*:* | hppa64:Linux:*:*) ++ echo hppa64-unknown-linux-${LIBC} ++ exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in +- PA7*) echo hppa1.1-unknown-linux-gnu ;; +- PA8*) echo hppa2.0-unknown-linux-gnu ;; +- *) echo hppa-unknown-linux-gnu ;; ++ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; ++ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; ++ *) echo hppa-unknown-linux-${LIBC} ;; + esac +- exit 0 ;; +- parisc64:Linux:*:* | hppa64:Linux:*:*) +- echo hppa64-unknown-linux-gnu +- exit 0 ;; ++ exit ;; ++ ppc64:Linux:*:*) ++ echo powerpc64-unknown-linux-${LIBC} ++ exit ;; ++ ppc:Linux:*:*) ++ echo powerpc-unknown-linux-${LIBC} ++ exit ;; ++ ppc64le:Linux:*:*) ++ echo powerpc64le-unknown-linux-${LIBC} ++ exit ;; ++ ppcle:Linux:*:*) ++ echo powerpcle-unknown-linux-${LIBC} ++ exit ;; + s390:Linux:*:* | s390x:Linux:*:*) +- echo ${UNAME_MACHINE}-ibm-linux +- exit 0 ;; ++ echo ${UNAME_MACHINE}-ibm-linux-${LIBC} ++ exit ;; + sh64*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; + sh*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-gnu +- exit 0 ;; ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ tile*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ vax:Linux:*:*) ++ echo ${UNAME_MACHINE}-dec-linux-${LIBC} ++ exit ;; + x86_64:Linux:*:*) +- echo x86_64-unknown-linux-gnu +- exit 0 ;; +- i*86:Linux:*:*) +- # The BFD linker knows what the default object file format is, so +- # first see if it will tell us. cd to the root directory to prevent +- # problems with other programs or directories called `ld' in the path. +- # Set LC_ALL=C to ensure ld outputs messages in English. +- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ +- | sed -ne '/supported targets:/!d +- s/[ ][ ]*/ /g +- s/.*supported targets: *// +- s/ .*// +- p'` +- case "$ld_supported_targets" in +- elf32-i386) +- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" +- ;; +- a.out-i386-linux) +- echo "${UNAME_MACHINE}-pc-linux-gnuaout" +- exit 0 ;; +- coff-i386) +- echo "${UNAME_MACHINE}-pc-linux-gnucoff" +- exit 0 ;; +- "") +- # Either a pre-BFD a.out linker (linux-gnuoldld) or +- # one that does not give us useful --help. +- echo "${UNAME_MACHINE}-pc-linux-gnuoldld" +- exit 0 ;; +- esac +- # Determine whether the default compiler is a.out or elf +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c +- #include <features.h> +- #ifdef __ELF__ +- # ifdef __GLIBC__ +- # if __GLIBC__ >= 2 +- LIBC=gnu +- # else +- LIBC=gnulibc1 +- # endif +- # else +- LIBC=gnulibc1 +- # endif +- #else +- #ifdef __INTEL_COMPILER +- LIBC=gnu +- #else +- LIBC=gnuaout +- #endif +- #endif +- #ifdef __dietlibc__ +- LIBC=dietlibc +- #endif +-EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` +- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 +- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 +- ;; ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; ++ xtensa*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 +- exit 0 ;; ++ exit ;; + i*86:UNIX_SV:4.2MP:2.*) +- # Unixware is an offshoot of SVR4, but it has its own version +- # number series starting with 2... +- # I am not positive that other SVR4 systems won't match this, ++ # Unixware is an offshoot of SVR4, but it has its own version ++ # number series starting with 2... ++ # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. +- # Use sysv4.2uw... so that sysv4* matches it. ++ # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} +- exit 0 ;; ++ exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx +- exit 0 ;; ++ exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop +- exit 0 ;; ++ exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos +- exit 0 ;; +- i*86:syllable:*:*) ++ exit ;; ++ i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable +- exit 0 ;; +- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) ++ exit ;; ++ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp +- exit 0 ;; ++ exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then +@@ -1040,15 +1066,16 @@ EOF + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi +- exit 0 ;; +- i*86:*:5:[78]*) ++ exit ;; ++ i*86:*:5:[678]*) ++ # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} +- exit 0 ;; ++ exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` +@@ -1066,73 +1093,86 @@ EOF + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi +- exit 0 ;; ++ exit ;; + pc:*:*:*) + # Left here for compatibility: +- # uname -m prints for DJGPP always 'pc', but it prints nothing about +- # the processor, so we play safe by assuming i386. +- echo i386-pc-msdosdjgpp +- exit 0 ;; ++ # uname -m prints for DJGPP always 'pc', but it prints nothing about ++ # the processor, so we play safe by assuming i586. ++ # Note: whatever this is, it MUST be the same as what config.sub ++ # prints for the "djgpp" host, or else GDB configury will decide that ++ # this is a cross-build. ++ echo i586-pc-msdosdjgpp ++ exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 +- exit 0 ;; ++ exit ;; + paragon:*:*:*) + echo i860-intel-osf1 +- exit 0 ;; ++ exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi +- exit 0 ;; ++ exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv +- exit 0 ;; ++ exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv +- exit 0 ;; ++ exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix +- exit 0 ;; +- M68*:*:R3V[567]*:*) +- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; +- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) ++ exit ;; ++ M68*:*:R3V[5678]*:*) ++ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; ++ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && echo i486-ncr-sysv4.3${OS_REL} && exit 0 ++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ +- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) +- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && echo i486-ncr-sysv4 && exit 0 ;; ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4; exit; } ;; ++ NCR*:*:4.2:* | MPRAS*:*:4.2:*) ++ OS_REL='.3' ++ test -r /etc/.relid \ ++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` ++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ ++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ ++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 +- exit 0 ;; ++ exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; +- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) ++ exit ;; ++ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 +- exit 0 ;; ++ exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 +- exit 0 ;; ++ exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` +@@ -1140,68 +1180,109 @@ EOF + else + echo ns32k-sni-sysv + fi +- exit 0 ;; +- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort +- # says <Richard.M.Bartel@ccMail.Census.GOV> +- echo i586-unisys-sysv4 +- exit 0 ;; ++ exit ;; ++ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort ++ # says <Richard.M.Bartel@ccMail.Census.GOV> ++ echo i586-unisys-sysv4 ++ exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 +- exit 0 ;; ++ exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 +- exit 0 ;; ++ exit ;; ++ i*86:VOS:*:*) ++ # From Paul.Green@stratus.com. ++ echo ${UNAME_MACHINE}-stratus-vos ++ exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos +- exit 0 ;; ++ exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 +- exit 0 ;; ++ exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then +- echo mips-nec-sysv${UNAME_RELEASE} ++ echo mips-nec-sysv${UNAME_RELEASE} + else +- echo mips-unknown-sysv${UNAME_RELEASE} ++ echo mips-unknown-sysv${UNAME_RELEASE} + fi +- exit 0 ;; ++ exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos +- exit 0 ;; ++ exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos +- exit 0 ;; ++ exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos +- exit 0 ;; ++ exit ;; ++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. ++ echo i586-pc-haiku ++ exit ;; ++ x86_64:Haiku:*:*) ++ echo x86_64-unknown-haiku ++ exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; ++ SX-7:SUPER-UX:*:*) ++ echo sx7-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8:SUPER-UX:*:*) ++ echo sx8-nec-superux${UNAME_RELEASE} ++ exit ;; ++ SX-8R:SUPER-UX:*:*) ++ echo sx8r-nec-superux${UNAME_RELEASE} ++ exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Darwin:*:*) +- case `uname -p` in +- *86) UNAME_PROCESSOR=i686 ;; +- powerpc) UNAME_PROCESSOR=powerpc ;; +- esac ++ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown ++ eval $set_cc_for_build ++ if test "$UNAME_PROCESSOR" = unknown ; then ++ UNAME_PROCESSOR=powerpc ++ fi ++ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then ++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then ++ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ case $UNAME_PROCESSOR in ++ i386) UNAME_PROCESSOR=x86_64 ;; ++ powerpc) UNAME_PROCESSOR=powerpc64 ;; ++ esac ++ fi ++ fi ++ elif test "$UNAME_PROCESSOR" = i386 ; then ++ # Avoid executing cc on OS X 10.9, as it ships with a stub ++ # that puts up a graphical alert prompting to install ++ # developer tools. Any system running Mac OS X 10.7 or ++ # later (Darwin 11 and later) is required to have a 64-bit ++ # processor. This is not true of the ARM version of Darwin ++ # that Apple uses in portable devices. ++ UNAME_PROCESSOR=x86_64 ++ fi + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then +@@ -1209,22 +1290,28 @@ EOF + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:QNX:*:4*) + echo i386-pc-qnx +- exit 0 ;; ++ exit ;; ++ NEO-?:NONSTOP_KERNEL:*:*) ++ echo neo-tandem-nsk${UNAME_RELEASE} ++ exit ;; ++ NSE-*:NONSTOP_KERNEL:*:*) ++ echo nse-tandem-nsk${UNAME_RELEASE} ++ exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux +- exit 0 ;; ++ exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv +- exit 0 ;; ++ exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} +- exit 0 ;; ++ exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 +@@ -1235,183 +1322,55 @@ EOF + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 +- exit 0 ;; ++ exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 +- exit 0 ;; ++ exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex +- exit 0 ;; ++ exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 +- exit 0 ;; ++ exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 +- exit 0 ;; ++ exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 +- exit 0 ;; ++ exit ;; + *:ITS:*:*) + echo pdp10-unknown-its +- exit 0 ;; ++ exit ;; + SEI:*:*:SEIUX) +- echo mips-sei-seiux${UNAME_RELEASE} +- exit 0 ;; ++ echo mips-sei-seiux${UNAME_RELEASE} ++ exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` +- exit 0 ;; ++ exit ;; ++ *:*VMS:*:*) ++ UNAME_MACHINE=`(uname -p) 2>/dev/null` ++ case "${UNAME_MACHINE}" in ++ A*) echo alpha-dec-vms ; exit ;; ++ I*) echo ia64-dec-vms ; exit ;; ++ V*) echo vax-dec-vms ; exit ;; ++ esac ;; ++ *:XENIX:*:SysV) ++ echo i386-pc-xenix ++ exit ;; ++ i*86:skyos:*:*) ++ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' ++ exit ;; ++ i*86:rdos:*:*) ++ echo ${UNAME_MACHINE}-pc-rdos ++ exit ;; ++ i*86:AROS:*:*) ++ echo ${UNAME_MACHINE}-pc-aros ++ exit ;; ++ x86_64:VMkernel:*:*) ++ echo ${UNAME_MACHINE}-unknown-esx ++ exit ;; + esac + +-#echo '(No uname command or uname output not recognized.)' 1>&2 +-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +- +-eval $set_cc_for_build +-cat >$dummy.c <<EOF +-#ifdef _SEQUENT_ +-# include <sys/types.h> +-# include <sys/utsname.h> +-#endif +-main () +-{ +-#if defined (sony) +-#if defined (MIPSEB) +- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, +- I don't know.... */ +- printf ("mips-sony-bsd\n"); exit (0); +-#else +-#include <sys/param.h> +- printf ("m68k-sony-newsos%s\n", +-#ifdef NEWSOS4 +- "4" +-#else +- "" +-#endif +- ); exit (0); +-#endif +-#endif +- +-#if defined (__arm) && defined (__acorn) && defined (__unix) +- printf ("arm-acorn-riscix"); exit (0); +-#endif +- +-#if defined (hp300) && !defined (hpux) +- printf ("m68k-hp-bsd\n"); exit (0); +-#endif +- +-#if defined (NeXT) +-#if !defined (__ARCHITECTURE__) +-#define __ARCHITECTURE__ "m68k" +-#endif +- int version; +- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; +- if (version < 4) +- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); +- else +- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); +- exit (0); +-#endif +- +-#if defined (MULTIMAX) || defined (n16) +-#if defined (UMAXV) +- printf ("ns32k-encore-sysv\n"); exit (0); +-#else +-#if defined (CMU) +- printf ("ns32k-encore-mach\n"); exit (0); +-#else +- printf ("ns32k-encore-bsd\n"); exit (0); +-#endif +-#endif +-#endif +- +-#if defined (__386BSD__) +- printf ("i386-pc-bsd\n"); exit (0); +-#endif +- +-#if defined (sequent) +-#if defined (i386) +- printf ("i386-sequent-dynix\n"); exit (0); +-#endif +-#if defined (ns32000) +- printf ("ns32k-sequent-dynix\n"); exit (0); +-#endif +-#endif +- +-#if defined (_SEQUENT_) +- struct utsname un; +- +- uname(&un); +- +- if (strncmp(un.version, "V2", 2) == 0) { +- printf ("i386-sequent-ptx2\n"); exit (0); +- } +- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ +- printf ("i386-sequent-ptx1\n"); exit (0); +- } +- printf ("i386-sequent-ptx\n"); exit (0); +- +-#endif +- +-#if defined (vax) +-# if !defined (ultrix) +-# include <sys/param.h> +-# if defined (BSD) +-# if BSD == 43 +- printf ("vax-dec-bsd4.3\n"); exit (0); +-# else +-# if BSD == 199006 +- printf ("vax-dec-bsd4.3reno\n"); exit (0); +-# else +- printf ("vax-dec-bsd\n"); exit (0); +-# endif +-# endif +-# else +- printf ("vax-dec-bsd\n"); exit (0); +-# endif +-# else +- printf ("vax-dec-ultrix\n"); exit (0); +-# endif +-#endif +- +-#if defined (alliant) && defined (i860) +- printf ("i860-alliant-bsd\n"); exit (0); +-#endif +- +- exit (1); +-} +-EOF +- +-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +- +-# Apollos put the system type in the environment. +- +-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +- +-# Convex versions that predate uname can use getsysinfo(1) +- +-if [ -x /usr/convex/getsysinfo ] +-then +- case `getsysinfo -f cpu_type` in +- c1*) +- echo c1-convex-bsd +- exit 0 ;; +- c2*) +- if getsysinfo -f scalar_acc +- then echo c32-convex-bsd +- else echo c2-convex-bsd +- fi +- exit 0 ;; +- c34*) +- echo c34-convex-bsd +- exit 0 ;; +- c38*) +- echo c38-convex-bsd +- exit 0 ;; +- c4*) +- echo c4-convex-bsd +- exit 0 ;; +- esac +-fi +- + cat >&2 <<EOF + $0: unable to guess system type + +@@ -1419,7 +1378,9 @@ This script, last modified $timestamp, has failed to recognize + the operating system you are using. It is advised that you + download the most up to date version of the config scripts from + +- ftp://ftp.gnu.org/pub/gnu/config/ ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD ++and ++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + + If the version you run ($0) is already up to date, please + send the following data and any information you think might be +diff --git a/config.h.in b/config.h.in +index 2f41eed..3b575e4 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -25,6 +25,7 @@ + + #define PASSWD_FILE RC_DIR "/passwd" + #define PRE_FORM_FILE RC_DIR "/pre_form" ++#define SITECONF_FILE RC_DIR "/siteconf" + #define USER_MAILCAP RC_DIR "/mailcap" + #define SYS_MAILCAP CONF_DIR "/mailcap" + #define USER_MIMETYPES "~/.mime.types" +@@ -84,7 +85,7 @@ + #undef INET6 + #undef HAVE_SOCKLEN_T + #undef HAVE_OLD_SS_FAMILY +-#define USE_EGD ++#undef USE_EGD + #define ENABLE_REMOVE_TRAILINGSPACES + #undef MENU_THIN_FRAME + #undef USE_RAW_SCROLL +@@ -209,6 +210,10 @@ typedef RETSIGTYPE MySignalHandler; + #define SUPPORT_WIN9X_CONSOLE_MBCS 1 + #endif + ++#if defined(__CYGWIN__) && defined(__x86_64__) ++#define DONT_CALL_GC_AFTER_FORK ++#endif ++ + #if defined(__DJGPP__) + #define DEFAULT_TERM "dosansi" + #else +diff --git a/config.sub b/config.sub +index ba33103..bba4efb 100755 +--- a/config.sub ++++ b/config.sub +@@ -1,42 +1,40 @@ + #! /bin/sh + # Configuration validation subroutine script. +-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. ++# Copyright 1992-2014 Free Software Foundation, Inc. + +-timestamp='2004-03-12' ++timestamp='2014-09-11' + +-# This file is (in principle) common to ALL GNU software. +-# The presence of a machine in this file suggests that SOME GNU software +-# can handle that machine. It does not imply ALL GNU software can. +-# +-# This file 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; either version 2 of the License, or ++# This file 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; either version 3 of the License, or + # (at your option) any later version. + # +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. ++# This program is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. + # + # You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place - Suite 330, +-# Boston, MA 02111-1307, USA. +- ++# along with this program; if not, see <http://www.gnu.org/licenses/>. ++# + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under +-# the same distribution terms that you use for the rest of that program. ++# the same distribution terms that you use for the rest of that ++# program. This Exception is an additional permission under section 7 ++# of the GNU General Public License, version 3 ("GPLv3"). + +-# Please send patches to <config-patches@gnu.org>. Submit a context +-# diff and a properly formatted ChangeLog entry. ++ ++# Please send patches with a ChangeLog entry to config-patches@gnu.org. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. + # Otherwise, we print the canonical config type on stdout and succeed. + ++# You can get the latest version of this script from: ++# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD ++ + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases + # that are meaningful with *any* GNU software. +@@ -70,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>." + version="\ + GNU config.sub ($timestamp) + +-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +-Free Software Foundation, Inc. ++Copyright 1992-2014 Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -83,11 +80,11 @@ Try \`$me --help' for more information." + while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) +- echo "$timestamp" ; exit 0 ;; ++ echo "$timestamp" ; exit ;; + --version | -v ) +- echo "$version" ; exit 0 ;; ++ echo "$version" ; exit ;; + --help | --h* | -h ) +- echo "$usage"; exit 0 ;; ++ echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. +@@ -99,7 +96,7 @@ while test $# -gt 0 ; do + *local*) + # First pass through any local machine types. + echo $1 +- exit 0;; ++ exit ;; + + * ) + break ;; +@@ -118,11 +115,18 @@ esac + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in +- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ +- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) ++ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ ++ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ ++ knetbsd*-gnu* | netbsd*-gnu* | \ ++ kopensolaris*-gnu* | \ ++ storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; ++ android-linux) ++ os=-linux-android ++ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ++ ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] +@@ -145,10 +149,13 @@ case $os in + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ +- -apple | -axis) ++ -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; ++ -bluegene*) ++ os=-cnk ++ ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 +@@ -163,13 +170,17 @@ case $os in + os=-chorusos + basic_machine=$1 + ;; +- -chorusrdb) +- os=-chorusrdb ++ -chorusrdb) ++ os=-chorusrdb + basic_machine=$1 +- ;; ++ ;; + -hiux*) + os=-hiuxwe2 + ;; ++ -sco6) ++ os=-sco5v6 ++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ++ ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +@@ -186,6 +197,10 @@ case $os in + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; ++ -sco5v6*) ++ # Don't forget version if it is 3.2v4 or newer. ++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ++ ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` +@@ -203,6 +218,12 @@ case $os in + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; ++ -lynx*178) ++ os=-lynxos178 ++ ;; ++ -lynx*5) ++ os=-lynxos5 ++ ;; + -lynx*) + os=-lynxos + ;; +@@ -227,57 +248,109 @@ case $basic_machine in + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ ++ | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ +- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ +- | c4x | clipper \ ++ | arc | arceb \ ++ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ ++ | avr | avr32 \ ++ | be32 | be64 \ ++ | bfin \ ++ | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ +- | fr30 | frv \ ++ | epiphany \ ++ | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ ++ | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ +- | m32r | m32rle | m68000 | m68k | m88k | mcore \ ++ | k1om \ ++ | le32 | le64 \ ++ | lm32 \ ++ | m32c | m32r | m32rle | m68000 | m68k | m88k \ ++ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ +- | mips64vr | mips64vrel \ ++ | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ ++ | mips64r5900 | mips64r5900el \ ++ | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ ++ | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ ++ | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ ++ | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ ++ | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ ++ | moxie \ ++ | mt \ + | msp430 \ ++ | nds32 | nds32le | nds32be \ ++ | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ +- | openrisc | or32 \ ++ | open8 | or1k | or1knd | or32 \ + | pdp10 | pdp11 | pj | pjl \ +- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ ++ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ +- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ ++ | riscv32 | riscv64 \ ++ | rl78 | rx \ ++ | score \ ++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ +- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ +- | strongarm \ +- | tahoe | thumb | tic4x | tic80 | tron \ +- | v850 | v850e \ ++ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ ++ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ ++ | spu \ ++ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ ++ | ubicom32 \ ++ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ +- | x86 | xscale | xstormy16 | xtensa \ +- | z8k) ++ | x86 | xc16x | xstormy16 | xtensa \ ++ | z8k | z80) + basic_machine=$basic_machine-unknown + ;; +- m6811 | m68hc11 | m6812 | m68hc12) +- # Motorola 68HC11/12. ++ c54x) ++ basic_machine=tic54x-unknown ++ ;; ++ c55x) ++ basic_machine=tic55x-unknown ++ ;; ++ c6x) ++ basic_machine=tic6x-unknown ++ ;; ++ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; ++ ms1) ++ basic_machine=mt-unknown ++ ;; ++ ++ strongarm | thumb | xscale) ++ basic_machine=arm-unknown ++ ;; ++ xgate) ++ basic_machine=$basic_machine-unknown ++ os=-none ++ ;; ++ xscaleeb) ++ basic_machine=armeb-unknown ++ ;; ++ ++ xscaleel) ++ basic_machine=armel-unknown ++ ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and +@@ -293,59 +366,86 @@ case $basic_machine in + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ ++ | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ +- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ ++ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ +- | avr-* \ +- | bs2000-* \ +- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ +- | clipper-* | cydra-* \ ++ | avr-* | avr32-* \ ++ | be32-* | be64-* \ ++ | bfin-* | bs2000-* \ ++ | c[123]* | c30-* | [cjt]90-* | c4x-* \ ++ | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ +- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ ++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ ++ | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ +- | m32r-* | m32rle-* \ ++ | k1om-* \ ++ | le32-* | le64-* \ ++ | lm32-* \ ++ | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ +- | m88110-* | m88k-* | mcore-* \ ++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ ++ | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ +- | mips64vr-* | mips64vrel-* \ ++ | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ ++ | mips64r5900-* | mips64r5900el-* \ ++ | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ ++ | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ ++ | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ ++ | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ ++ | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ ++ | mmix-* \ ++ | mt-* \ + | msp430-* \ +- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ ++ | nds32-* | nds32le-* | nds32be-* \ ++ | nios-* | nios2-* | nios2eb-* | nios2el-* \ ++ | none-* | np1-* | ns16k-* | ns32k-* \ ++ | open8-* \ ++ | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ +- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ ++ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ +- | romp-* | rs6000-* \ +- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ ++ | rl78-* | romp-* | rs6000-* | rx-* \ ++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ +- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ +- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ +- | tahoe-* | thumb-* \ ++ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ ++ | sparclite-* \ ++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ ++ | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ ++ | tile*-* \ + | tron-* \ +- | v850-* | v850e-* | vax-* \ ++ | ubicom32-* \ ++ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ ++ | vax-* \ + | we32k-* \ +- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ +- | xtensa-* \ ++ | x86-* | x86_64-* | xc16x-* | xps100-* \ ++ | xstormy16-* | xtensa*-* \ + | ymp-* \ +- | z8k-*) ++ | z8k-* | z80-*) ++ ;; ++ # Recognize the basic CPU types without company name, with glob match. ++ xtensa*) ++ basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. +@@ -363,7 +463,7 @@ case $basic_machine in + basic_machine=a29k-amd + os=-udi + ;; +- abacus) ++ abacus) + basic_machine=abacus-unknown + ;; + adobe68k) +@@ -409,6 +509,10 @@ case $basic_machine in + basic_machine=m68k-apollo + os=-bsd + ;; ++ aros) ++ basic_machine=i386-pc ++ os=-aros ++ ;; + aux) + basic_machine=m68k-apple + os=-aux +@@ -417,10 +521,35 @@ case $basic_machine in + basic_machine=ns32k-sequent + os=-dynix + ;; ++ blackfin) ++ basic_machine=bfin-unknown ++ os=-linux ++ ;; ++ blackfin-*) ++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; ++ bluegene*) ++ basic_machine=powerpc-ibm ++ os=-cnk ++ ;; ++ c54x-*) ++ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ c55x-*) ++ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; ++ c6x-*) ++ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; ++ cegcc) ++ basic_machine=arm-unknown ++ os=-cegcc ++ ;; + convex-c1) + basic_machine=c1-convex + os=-bsd +@@ -445,13 +574,20 @@ case $basic_machine in + basic_machine=j90-cray + os=-unicos + ;; +- cr16c) +- basic_machine=cr16c-unknown ++ craynv) ++ basic_machine=craynv-cray ++ os=-unicosmp ++ ;; ++ cr16 | cr16-*) ++ basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; ++ crisv32 | crisv32-* | etraxfs*) ++ basic_machine=crisv32-axis ++ ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; +@@ -481,6 +617,14 @@ case $basic_machine in + basic_machine=m88k-motorola + os=-sysv3 + ;; ++ dicos) ++ basic_machine=i686-pc ++ os=-dicos ++ ;; ++ djgpp) ++ basic_machine=i586-pc ++ os=-msdosdjgpp ++ ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx +@@ -592,7 +736,6 @@ case $basic_machine in + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +-# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 +@@ -631,6 +774,14 @@ case $basic_machine in + basic_machine=m68k-isi + os=-sysv + ;; ++ m68knommu) ++ basic_machine=m68k-unknown ++ os=-linux ++ ;; ++ m68knommu-*) ++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + m88k-omron*) + basic_machine=m88k-omron + ;; +@@ -642,10 +793,21 @@ case $basic_machine in + basic_machine=ns32k-utek + os=-sysv + ;; ++ microblaze*) ++ basic_machine=microblaze-xilinx ++ ;; ++ mingw64) ++ basic_machine=x86_64-pc ++ os=-mingw64 ++ ;; + mingw32) +- basic_machine=i386-pc ++ basic_machine=i686-pc + os=-mingw32 + ;; ++ mingw32ce) ++ basic_machine=arm-unknown ++ os=-mingw32ce ++ ;; + miniframe) + basic_machine=m68000-convergent + ;; +@@ -659,10 +821,6 @@ case $basic_machine in + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; +- mmix*) +- basic_machine=mmix-knuth +- os=-mmixware +- ;; + monitor) + basic_machine=m68k-rom68k + os=-coff +@@ -671,14 +829,29 @@ case $basic_machine in + basic_machine=powerpc-unknown + os=-morphos + ;; ++ moxiebox) ++ basic_machine=moxie-unknown ++ os=-moxiebox ++ ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; ++ ms1-*) ++ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ++ ;; ++ msys) ++ basic_machine=i686-pc ++ os=-msys ++ ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ++ nacl) ++ basic_machine=le32-unknown ++ os=-nacl ++ ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 +@@ -743,9 +916,11 @@ case $basic_machine in + np1) + basic_machine=np1-gould + ;; +- nv1) +- basic_machine=nv1-cray +- os=-unicosmp ++ neo-tandem) ++ basic_machine=neo-tandem ++ ;; ++ nse-tandem) ++ basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem +@@ -754,9 +929,8 @@ case $basic_machine in + basic_machine=hppa1.1-oki + os=-proelf + ;; +- or32 | or32-*) ++ openrisc | openrisc-*) + basic_machine=or32-unknown +- os=-coff + ;; + os400) + basic_machine=powerpc-ibm +@@ -778,6 +952,14 @@ case $basic_machine in + basic_machine=i860-intel + os=-osf + ;; ++ parisc) ++ basic_machine=hppa-unknown ++ os=-linux ++ ;; ++ parisc-*) ++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` ++ os=-linux ++ ;; + pbd) + basic_machine=sparc-tti + ;; +@@ -787,6 +969,12 @@ case $basic_machine in + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; ++ pc98) ++ basic_machine=i386-pc ++ ;; ++ pc98-*) ++ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; +@@ -816,9 +1004,10 @@ case $basic_machine in + ;; + power) basic_machine=power-ibm + ;; +- ppc) basic_machine=powerpc-unknown ++ ppc | ppcbe) basic_machine=powerpc-unknown + ;; +- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ppc-* | ppcbe-*) ++ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown +@@ -843,6 +1032,14 @@ case $basic_machine in + basic_machine=i586-unknown + os=-pw32 + ;; ++ rdos | rdos64) ++ basic_machine=x86_64-pc ++ os=-rdos ++ ;; ++ rdos32) ++ basic_machine=i386-pc ++ os=-rdos ++ ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff +@@ -869,6 +1066,10 @@ case $basic_machine in + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; ++ sde) ++ basic_machine=mipsisa32-sde ++ os=-elf ++ ;; + sei) + basic_machine=mips-sei + os=-seiux +@@ -880,6 +1081,9 @@ case $basic_machine in + basic_machine=sh-hitachi + os=-hms + ;; ++ sh5el) ++ basic_machine=sh5le-unknown ++ ;; + sh64) + basic_machine=sh64-unknown + ;; +@@ -901,6 +1105,9 @@ case $basic_machine in + basic_machine=i860-stratus + os=-sysv4 + ;; ++ strongarm-* | thumb-*) ++ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ++ ;; + sun2) + basic_machine=m68000-sun + ;; +@@ -957,17 +1164,9 @@ case $basic_machine in + basic_machine=t90-cray + os=-unicos + ;; +- tic54x | c54x*) +- basic_machine=tic54x-unknown +- os=-coff +- ;; +- tic55x | c55x*) +- basic_machine=tic55x-unknown +- os=-coff +- ;; +- tic6x | c6x*) +- basic_machine=tic6x-unknown +- os=-coff ++ tile*) ++ basic_machine=$basic_machine-unknown ++ os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown +@@ -1029,9 +1228,16 @@ case $basic_machine in + basic_machine=hppa1.1-winbond + os=-proelf + ;; ++ xbox) ++ basic_machine=i686-pc ++ os=-mingw32 ++ ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; ++ xscale-* | xscalee[bl]-*) ++ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ++ ;; + ymp) + basic_machine=ymp-cray + os=-unicos +@@ -1040,6 +1246,10 @@ case $basic_machine in + basic_machine=z8k-unknown + os=-sim + ;; ++ z80-*-coff) ++ basic_machine=z80-unknown ++ os=-sim ++ ;; + none) + basic_machine=none-none + os=-none +@@ -1059,6 +1269,9 @@ case $basic_machine in + romp) + basic_machine=romp-ibm + ;; ++ mmix) ++ basic_machine=mmix-knuth ++ ;; + rs6000) + basic_machine=rs6000-ibm + ;; +@@ -1075,13 +1288,10 @@ case $basic_machine in + we32k) + basic_machine=we32k-att + ;; +- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) ++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; +- sh64) +- basic_machine=sh64-unknown +- ;; +- sparc | sparcv8 | sparcv9 | sparcv9b) ++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) +@@ -1125,9 +1335,12 @@ esac + if [ x"$os" != x"" ] + then + case $os in +- # First match some system type aliases +- # that might get confused with valid system types. ++ # First match some system type aliases ++ # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. ++ -auroraux) ++ os=-auroraux ++ ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; +@@ -1148,26 +1361,31 @@ case $os in + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ +- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ +- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ ++ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ ++ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ ++ | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ +- | -aos* \ ++ | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ +- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ ++ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ ++ | -bitrig* | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ +- | -chorusos* | -chorusrdb* \ +- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ +- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ ++ | -chorusos* | -chorusrdb* | -cegcc* \ ++ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ ++ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ ++ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ ++ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ +- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) ++ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ ++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) +@@ -1185,7 +1403,7 @@ case $os in + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ +- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ ++ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) +@@ -1206,7 +1424,7 @@ case $os in + -opened*) + os=-openedition + ;; +- -os400*) ++ -os400*) + os=-os400 + ;; + -wince*) +@@ -1255,7 +1473,7 @@ case $os in + -sinix*) + os=-sysv4 + ;; +- -tpf*) ++ -tpf*) + os=-tpf + ;; + -triton*) +@@ -1291,8 +1509,13 @@ case $os in + -aros*) + os=-aros + ;; +- -kaos*) +- os=-kaos ++ -zvmoe) ++ os=-zvmoe ++ ;; ++ -dicos*) ++ os=-dicos ++ ;; ++ -nacl*) + ;; + -none) + ;; +@@ -1316,6 +1539,12 @@ else + # system, and we'll never get to this point. + + case $basic_machine in ++ score-*) ++ os=-elf ++ ;; ++ spu-*) ++ os=-elf ++ ;; + *-acorn) + os=-riscix1.2 + ;; +@@ -1325,9 +1554,24 @@ case $basic_machine in + arm*-semi) + os=-aout + ;; +- c4x-* | tic4x-*) +- os=-coff +- ;; ++ c4x-* | tic4x-*) ++ os=-coff ++ ;; ++ c8051-*) ++ os=-elf ++ ;; ++ hexagon-*) ++ os=-elf ++ ;; ++ tic54x-*) ++ os=-coff ++ ;; ++ tic55x-*) ++ os=-coff ++ ;; ++ tic6x-*) ++ os=-coff ++ ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 +@@ -1346,13 +1590,13 @@ case $basic_machine in + ;; + m68000-sun) + os=-sunos3 +- # This also exists in the configure program, but was not the +- # default. +- # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; ++ mep-*) ++ os=-elf ++ ;; + mips*-cisco) + os=-elf + ;; +@@ -1371,9 +1615,15 @@ case $basic_machine in + *-be) + os=-beos + ;; ++ *-haiku) ++ os=-haiku ++ ;; + *-ibm) + os=-aix + ;; ++ *-knuth) ++ os=-mmixware ++ ;; + *-wec) + os=-proelf + ;; +@@ -1476,7 +1726,7 @@ case $basic_machine in + -sunos*) + vendor=sun + ;; +- -aix*) ++ -cnk*|-aix*) + vendor=ibm + ;; + -beos*) +@@ -1539,7 +1789,7 @@ case $basic_machine in + esac + + echo $basic_machine$os +-exit 0 ++exit + + # Local variables: + # eval: (add-hook 'write-file-hooks 'time-stamp) +diff --git a/configure b/configure +index 4c1bc06..c721825 100755 +--- a/configure ++++ b/configure +@@ -1490,7 +1490,7 @@ Optional Packages: + --with-ssl=PREFIX support https protocol + --with-termlib=LIBS terminal library + LIBS is space separated list of: +- terminfo mytinfo termcap ncurses curses ++ terminfo mytinfo termcap tinfo ncurses curses + --with-gc=PREFIX libgc PREFIX + + Some influential environment variables: +@@ -6755,7 +6755,7 @@ $as_echo "$enable_image" >&6; } + if test x"$enable_image" = xyes; then + enable_image=x11 + case "`uname -s`" in +- Linux|linux|LINUX) ++ Linux|linux|LINUX|FreeBSD|freebsd|FREEBSD) + if test -c /dev/fb0; then + enable_image=x11,fb + fi;; +@@ -6811,6 +6811,9 @@ $as_echo "$with_imagelib" >&6; } + fi;; + imlib2) + with_imlib2="yes" ++ if test x"$PKG_CONFIG" = x; then ++ PKG_CONFIG=pkg-config ++ fi + if test x"$IMLIB2_CONFIG" = x; then + IMLIB2_CONFIG=imlib2-config + fi;; +@@ -6823,8 +6826,6 @@ $as_echo "$with_imagelib" >&6; } + with_gtk2="yes" + if test x"$PKG_CONFIG" = x; then + PKG_CONFIG=pkg-config +- else +- PKG_CONFIG=: + fi;; + esac + done +@@ -6926,8 +6927,8 @@ $as_echo "$as_me: WARNING: Imlib2 is not installed. Install Imlib2 (version >= + + $as_echo "#define USE_GTK2 1" >>confdefs.h + +- IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" +- IMGX11LDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" ++ IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0`" ++ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0`" + elif test x"$have_gdkpixbuf" = xyes; then + $as_echo "#define USE_W3MIMG_X11 1" >>confdefs.h + +@@ -6955,7 +6956,7 @@ $as_echo "$as_me: WARNING: Imlib2 is not installed. Install Imlib2 (version >= + $as_echo "#define USE_IMLIB2 1" >>confdefs.h + + IMGX11CFLAGS="`${IMLIB2_CONFIG} --cflags`" +- IMGX11LDFLAGS="`${IMLIB2_CONFIG} --libs`" ++ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs imlib2`" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to build w3mimgdisplay with X11 support" >&5 + $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with X11 support" >&2;} +@@ -6971,8 +6972,8 @@ $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with X11 support" >&2;} + + $as_echo "#define USE_GTK2 1" >>confdefs.h + +- IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gtk+-2.0`" +- IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gtk+-2.0`" ++ IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0`" ++ IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0`" + elif test x"$have_gdkpixbuf" = xyes; then + $as_echo "#define USE_W3MIMG_FB 1" >>confdefs.h + +@@ -6991,7 +6992,7 @@ $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with X11 support" >&2;} + + IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o" + IMGFBCFLAGS="`${IMLIB2_CONFIG} --cflags`" +- IMGFBLDFLAGS="`${IMLIB2_CONFIG} --libs`" ++ IMGFBLDFLAGS="`${PKG_CONFIG} --libs imlib2`" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to build w3mimgdisplay with FB support" >&5 + $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with FB support" >&2;} +@@ -7977,7 +7978,7 @@ fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_termlib" >&5 + $as_echo "$with_termlib" >&6; } +- test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap ncurses curses" ++ test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap tinfo ncurses curses" + for lib in $with_termlib; do + as_ac_Lib=`$as_echo "ac_cv_lib_$lib''_tgetent" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -l$lib" >&5 +@@ -8986,7 +8987,7 @@ extern char *sys_errlist[]; + int + main () + { +-printf(sys_errlist[0]); ++printf("%s", sys_errlist[0]); + ; + return 0; + } +@@ -9084,7 +9085,8 @@ _ACEOF + + + cvsver=`$AWK '\$1 ~ /Id:/ { print \$3}' $srcdir/ChangeLog` +- sed -e 's/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c ++ ymdver=`sed -e 's/ .*//;s/-//g;q' $srcdir/ChangeLog` ++ sed -e 's/define CURRENT_VERSION "\(.*\)YYYYMMDD/define CURRENT_VERSION "\1'$ymdver'/;s/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c + CURRENT_VERSION=`sed -n 's/.*define CURRENT_VERSION *"w3m\/\(.*\)".*$/\1/p' version.c` + ac_config_files="$ac_config_files Makefile posubst po/Makefile.in scripts/Makefile scripts/dirlist.cgi scripts/w3mhelp.cgi scripts/w3mmail.cgi scripts/xface2xpm scripts/multipart/Makefile scripts/multipart/multipart.cgi scripts/w3mman/Makefile scripts/w3mman/w3mman scripts/w3mman/w3mman.1 scripts/w3mman/w3mman2html.cgi libwc/Makefile w3mimg/Makefile w3mimg/fb/Makefile w3mimg/x11/Makefile w3mimg/win/Makefile w3mhelp-w3m_en.html w3mhelp-w3m_ja.html w3mhelp-lynx_en.html w3mhelp-lynx_ja.html" + +diff --git a/cookie.c b/cookie.c +index 8020f6d..c11649c 100644 +--- a/cookie.c ++++ b/cookie.c +@@ -247,7 +247,7 @@ find_cookie(ParsedURL *pu) + Strcat(tmp, Sprintf("; $Domain=\"%s\"", p1->domain->ptr)); + if (p1->portl) + Strcat(tmp, +- Sprintf("; $Port=\"%s\"", portlist2str(p1->portl))); ++ Sprintf("; $Port=\"%s\"", portlist2str(p1->portl)->ptr)); + } + } + return tmp; +@@ -463,7 +463,7 @@ save_cookies(void) + continue; + fprintf(fp, "%s\t%s\t%s\t%ld\t%s\t%s\t%d\t%d\t%s\t%s\t%s\n", + parsedURL2Str(&p->url)->ptr, +- p->name->ptr, p->value->ptr, p->expires, ++ p->name->ptr, p->value->ptr, (long)p->expires, + p->domain->ptr, p->path->ptr, p->flag, + p->version, str2charp(p->comment), + (p->portl) ? portlist2str(p->portl)->ptr : "", +diff --git a/display.c b/display.c +index e00eb0c..d4f336a 100644 +--- a/display.c ++++ b/display.c +@@ -257,7 +257,7 @@ make_lastline_link(Buffer *buf, char *title, char *url) + parseURL2(url, &pu, baseURL(buf)); + u = parsedURL2Str(&pu); + if (DecodeURL) +- u = Strnew_charp(url_unquote_conv(u->ptr, buf->document_charset)); ++ u = Strnew_charp(url_decode2(u->ptr, buf)); + #ifdef USE_M17N + u = checkType(u, &pr, NULL); + #endif +@@ -487,7 +487,7 @@ displayBuffer(Buffer *buf, int mode) + term_title(conv_to_system(buf->buffername)); + refresh(); + #ifdef USE_IMAGE +- if (activeImage && displayImage && buf->img) { ++ if (activeImage && displayImage && buf->img && buf->image_loaded) { + drawImage(); + } + #endif +@@ -521,7 +521,15 @@ drawAnchorCursor0(Buffer *buf, AnchorList *al, int hseq, int prevhseq, + break; + } + if (hseq >= 0 && an->hseq == hseq) { ++ int start_pos = an->start.pos; ++ int end_pos = an->end.pos; + for (i = an->start.pos; i < an->end.pos; i++) { ++ if (enable_inline_image && (l->propBuf[i] & PE_IMAGE)) { ++ if (start_pos == i) ++ start_pos = i + 1; ++ else if (end_pos == an->end.pos) ++ end_pos = i - 1; ++ } + if (l->propBuf[i] & (PE_IMAGE | PE_ANCHOR | PE_FORM)) { + if (active) + l->propBuf[i] |= PE_ACTIVE; +@@ -529,9 +537,9 @@ drawAnchorCursor0(Buffer *buf, AnchorList *al, int hseq, int prevhseq, + l->propBuf[i] &= ~PE_ACTIVE; + } + } +- if (active) ++ if (active && start_pos < end_pos) + redrawLineRegion(buf, l, l->linenumber - tline + buf->rootY, +- an->start.pos, an->end.pos); ++ start_pos, end_pos); + } + else if (prevhseq >= 0 && an->hseq == prevhseq) { + if (active) +@@ -855,14 +863,16 @@ redrawLineImage(Buffer *buf, Line *l, int i) + y = (int)(i * pixel_per_line); + sx = (int)((rcol - COLPOS(l, a->start.pos)) * pixel_per_char); + sy = (int)((l->linenumber - image->y) * pixel_per_line); +- if (sx == 0 && x + image->xoffset >= 0) +- x += image->xoffset; +- else +- sx -= image->xoffset; +- if (sy == 0 && y + image->yoffset >= 0) +- y += image->yoffset; +- else +- sy -= image->yoffset; ++ if (! enable_inline_image) { ++ if (sx == 0 && x + image->xoffset >= 0) ++ x += image->xoffset; ++ else ++ sx -= image->xoffset; ++ if (sy == 0 && y + image->yoffset >= 0) ++ y += image->yoffset; ++ else ++ sy -= image->yoffset; ++ } + if (image->width > 0) + w = image->width - sx; + else +diff --git a/doc-jp/MANUAL.html b/doc-jp/MANUAL.html +index 41d70f1..a8623e2 100644 +--- a/doc-jp/MANUAL.html ++++ b/doc-jp/MANUAL.html +@@ -51,15 +51,9 @@ w3m + <dt>-l Կ + <dd>ɸϤƤɽȤ¸Կꤹ + 롥ǥեȤ 10000 +-<dt>-s +-<dd>Shift_JIS ɤɽ롥 +-<dt>-e +-<dd>EUC ɤɽ롥 +-<dt>-j +-<dd>JIS(ISO-2022-JP) ɤɽ롥 +-<dt>-O e|s|j|N|m|n ++<dt>-O ʸ + <dd>ɽѤʸɤꤹ롥 +-<dt>-I e|s ++<dt>-I ʸ + <dd>ʸʸɤꤹ롥 + <dt>-T + <dd>ɽʸΥפꤹ롥λ꤬ʤ硤ե +@@ -89,7 +83,7 @@ HTML + <dd>顼ɽʤ + <dt>-F + <dd>ե졼ưɽ롥 +-<dt>-S ++<dt>-s + <dd>Ϣ³Ԥ1ԤˤޤȤɽ롥 + <dt>-X + <dd>w3mλˡβ̤ʤ +@@ -489,8 +483,7 @@ w3m + w3mȤСHTTPФʤCGIץȤư뤳ȤǤޤ + ΤȤw3mФΤդƥץȤưνϤ + ɤߤɽ櫓Ǥ +-<a href="file:///$LIB/w3mbookmark?mode=panel&bmark=~/.w3m/bookmark.html&url=MANUAL.html&title=w3m+manual">֥åޡϿ</a> +-<a href="file:///$LIB/w3mhelperpanel?mode=panel">ӥ塼Խ</a> ++֥åޡϿȳӥ塼Խ + ϡlocal CGIΥץȤȤƼ¸Ƥޤ + local CGIȤСw3mѤΥեϥեȤ + ȤȤǤޤ +diff --git a/doc-jp/README b/doc-jp/README +index 074766f..e5e59b1 100644 +--- a/doc-jp/README ++++ b/doc-jp/README +@@ -122,7 +122,6 @@ w3m + ± + satodai@w3m.jp + +-ոۤMLޤǤ +- w3m-dev@sic.med.tohoku.ac.jp (ܸ) +- w3m-dev-en@sic.med.tohoku.ac.jp (Ѹ) ++ոۤ + http://w3m.sourceforge.net/ ++ https://sourceforge.net/projects/w3m/ +diff --git a/doc-jp/README.SSL b/doc-jp/README.SSL +index 4aedfde..670ed5f 100644 +--- a/doc-jp/README.SSL ++++ b/doc-jp/README.SSL +@@ -25,9 +25,9 @@ SSL + + ssl_forbid_method + ȤʤSSLåɤΥꥹ(2: SSLv2, 3: SSLv3, t: TLSv1) +- (ǥեȤ<NULL>). ++ (ǥեȤ2, 3). + ssl_verify_server ON/OFF +- SSLΥǧڤԤ(ǥեȤOFF). ++ SSLΥǧڤԤ(ǥեȤON). + ssl_cert_file ե̾ + SSLΥ饤PEMե(ǥեȤ<NULL>). + ssl_key_file ե̾ +diff --git a/doc-jp/README.siteconf b/doc-jp/README.siteconf +new file mode 100644 +index 0000000..58b51c7 +--- /dev/null ++++ b/doc-jp/README.siteconf +@@ -0,0 +1,60 @@ ++siteconf: ̥ޥ ++ ++siteconf ϡ URL Υѥȡɳդ줿꤫ޤ ++siteconf Ȥȡʸɤꤷ "decode_url" ++νϤꡢ Google Υ쥯ǽ ++ץ饤Х夵ꤹ뤳ȤǤޤ ++ ++ǥեȤǤ siteconf ~/.w3m/siteconf ɤ߹ޤޤ ++ ++===== ʸ ===== ++ ++url <url>|/<re-url>/|m@<re-url>@i [exact] ++substitute_url "<destination-url>" ++url_charset <charset> ++no_referer_from on|off ++no_referer_to on|off ++ ++˽줿Τͥ褵ޤ ++ ++===== ===== ++ ++url "http://twitter.com/#!/" ++substitute_url "http://mobile.twitter.com/" ++ ++twitter.com Х륵Ȥžޤ ++ ++url "http://your.bookmark.net/" ++no_referer_from on ++ ++your.bookmark.net ĥäéݤˡ HTTP referer ++ʤ褦ˤޤ ++ ++url "http://www.google.com/url?" exact ++substitute_url "file:///cgi-bin/your-redirector.cgi?" ++ ++Google Υ쥯 local CGI žޤ ++ ++url /^http:\/\/[a-z]*\.wikipedia\.org\// ++url_charset utf-8 ++ ++Ʊ "decode_url" ץˤȡ Wikipedia ؤ ++ UTF-8 Ȥƥǥɤɽޤ ++ ++===== ɽˤĤ ===== ++ ++ɽϤƱ̣ɽޤ ++ ++/http:\/\/www\.example\.com\// ++m/http:\/\/www\.example\.com\// ++m@http://www\.example\.com/@ ++m!http://www\.example\.com/! ++ ++Ǹ 'i' Ҥդȡʸʸ̤˾ȹԤޤ ++㤨С m@^http://www\.example\.com/abc/@i ϰʲΤȤפޤ ++ ++http://www.example.com/abc/ ++http://www.example.com/Abc/ ++http://www.example.com/ABC/ ++ ++ۥ̾ʬϾ˾ʸѴƤӤޤ +diff --git a/doc-jp/w3m.1 b/doc-jp/w3m.1 +index 89aacb6..099a803 100644 +--- a/doc-jp/w3m.1 ++++ b/doc-jp/w3m.1 +@@ -39,19 +39,10 @@ text/plain + ɸϤƤɽȤ¸Կꤹ롥 + ǥեȤ10000 + .TP +-.B \-s +-Shift_JISɤɽ롥 +-.TP +-.B \-e +-EUCɤɽ롥 +-.TP +-.B \-j +-JIS (ISO-2022-JP)ɤɽ롥 +-.TP +-.BI \-O\ e|s|j|N|m ++.BI \-O\ ʸ + ɽ˻Ȥʸɤꤹ. + .TP +-.BI \-I\ e|s ++.BI \-I\ ʸ + ʸʸɤꤹ롥 + .TP + .BI \-T\ +@@ -90,7 +81,7 @@ Bookmark + .B \-F + ե졼ưɽ롥 + .TP +-.B \-S ++.B \-s + Ϣ³Ԥ1ԤˤޤȤɽ롥 + .TP + .B \-X +diff --git a/doc/HISTORY b/doc/HISTORY +index b8f5b94..7f7ae2b 100644 +--- a/doc/HISTORY ++++ b/doc/HISTORY +@@ -588,7 +588,7 @@ From: Okabe Katsuya <okabek@guitar.ocn.ne.jp> + * space characters in a buffer are mapped into 0x80-0x9f. + * unprintable characters (0x80-0xa0) are displayed as \xxx. + +-From: Tsutomu Okada ($B2,ED(B $BJY(B) <okada@furuno.co.jp> ++From: Tsutomu Okada <okada@furuno.co.jp> + Subject: [w3m-dev 01354] minimize when #undef USE_GOPHER or USE_NNTP + + 2000/11/16 +@@ -1422,7 +1422,7 @@ HTML4.0 ID attribute support. + + From: Okabe Katsuya <okabe@fphy.hep.okayama-u.ac.jp> + table get weird when it contains <input type=hidden>. +-$B=$@5!%(B ++Fixed. + + 2000.2.12 + From: Rogue Metal - Jake Moorman <roguemtl@stampede.org> +@@ -1649,15 +1649,15 @@ From: patakuti + If an <input type=button> tag has no `name' attribute, + w3m adds it an inappropriate name attribute. + +-From: $B$d$^(B ++From: Yama + Now w3m can handle a frameset that has both ROWS and COLS. + + From: aito + Now bookmarking is done by a separate command w3mbookmark. + +-C-s $B$G2hLLI=<($,;_$^$C$F$$$?%P%0$N=$@5!%(B ++Bug fix that C-s hangs. + +-$BJ8;zF~NO;~$K(B C-g $B$GCf;_$G$-$k$h$&$K$7$?!%(B ++Enable C-g to quit for keyboard input. + + From: hovav@cs.stanford.edu + When downloading a file, an attempt to save it to a non-exist +@@ -1699,7 +1699,7 @@ Menu behavior is changed. + * Clicking outside the menu causes cancellation of sub-menu. + * <, >, +, - abandoned + +-From: $B$*$+$@(B <okada@furuno.co.jp> ++From: Okada <okada@furuno.co.jp> + Now C-a/C-e are bound to 'jump to the first/last item in menu.' + + From: "OMAE, jun" <jun-o@osb.att.ne.jp> +diff --git a/doc/MANUAL.html b/doc/MANUAL.html +index aff0189..8353f33 100644 +--- a/doc/MANUAL.html ++++ b/doc/MANUAL.html +@@ -55,12 +55,10 @@ If you don't specify this option, + <dt>-l number + <dd>Specify line number preserved internally when reading text/plain document + fron standard input. Default is 10000. +-<dt>-s +-<dd>Display documents with Shift_JIS code. +-<dt>-e +-<dd>Display documents with EUC_JP code. +-<dt>-j +-<dd>Display documents with ISO-2022-JP code. ++<dt>-O charset ++<dd>Specify display/output charset. ++<dt>-I charset ++<dd>Specify document charset. + <dt>-T type + <dd>Specify document type. Without this option, document type + is determined from extension of a file. If the determination +@@ -90,7 +88,7 @@ It is useful when reading E-mail or NetNews messages. + <dd>Monochrome display mode. + <dt>-F + <dd>Automatically render frame. +-<dt>-S ++<dt>-s + <dd>Squeeze blank lines. + <dt>-X + <dd>Upon exit, do not display preserved screen. +@@ -468,8 +466,7 @@ and <a href="keymap.lynx">keymap.lynx</a>) as examples. + You can run CGI scripts using w3m, without any HTTP server. + It means that w3m behaves like an HTTP server and activates CGI script, + then w3m reads the output of the script and display it. The +-<a href="file:///$LIB/w3mbookmark?mode=panel&bmark=~/.w3m/bookmark.html&url=MANUAL.html&title=w3m+manual">bookmark registration</a> +-and <a href="file:///$LIB/w3mhelperpanel?mode=panel">helper-app editor</a> ++bookmark registration and helper-app editor + are realized as local CGI scripts. + Using local CGI, w3m can be used as a general purpose form interface. + <P> +diff --git a/doc/README b/doc/README +index 324ea3e..60d6d19 100644 +--- a/doc/README ++++ b/doc/README +@@ -115,7 +115,6 @@ Current Maintainer + Tohoku University Hospital + satodai@w3m.jp + +-Feel free to send your opinion to the w3m mailing-lists. +- w3m-dev@sic.med.tohoku.ac.jp (Japanese) +- w3m-dev-en@sic.med.tohoku.ac.jp (English) ++Feel free to send your opinion to: + http://w3m.sourceforge.net/ ++ https://sourceforge.net/projects/w3m/ +diff --git a/doc/README.cookie b/doc/README.cookie +index 56cca50..da16947 100644 +--- a/doc/README.cookie ++++ b/doc/README.cookie +@@ -37,7 +37,7 @@ cookie support of w3m + (HDN: host domain name) + + +- If the number of "." in domain name is lesser than 2, it is ++ * If the number of "." in domain name is lesser than 2, it is + assumed as invalid cookie (cf. RFC 2109 4.3.2), however, you can + use cookie_avoid_wrong_number_of_dots to avoid this + restriction. You can set this in "Domains to avoid [wrong number +diff --git a/doc/README.img b/doc/README.img +index 0c10114..f11362f 100644 +--- a/doc/README.img ++++ b/doc/README.img +@@ -41,7 +41,7 @@ Key functions + Specify the following keymaps in ~/.w3m/keymap. + keymap X DISPLAY_IMAGE + keymap C-c STOP_IMAGE +- keyamp t SET_OPTION display_image=toggle ++ keymap t SET_OPTION display_image=toggle + + Commandline options + +diff --git a/doc/README.m17n b/doc/README.m17n +index c064d76..da5408b 100644 +--- a/doc/README.m17n ++++ b/doc/README.m17n +@@ -49,7 +49,7 @@ Supported encoding schemes (character set) + * Thai + TIS-620 (ISO-8859-11), CP874 + * Other +- US_ASCII, ISO-8859-1 10, 13 15, ++ US_ASCII, ISO-8859-1 - 10, 13 - 15, + KOI8-R, KOI8-U, NeXT, CP437, CP737, CP775, CP850, CP852, CP855, CP856, + CP857, CP860, CP861, CP862, CP863, CP864, CP865, CP866, CP869, CP1006, + CP1250, CP1251, CP1252, CP1253, CP1254, CP1255, CP1256, CP1257 +diff --git a/doc/README.siteconf b/doc/README.siteconf +new file mode 100644 +index 0000000..f173087 +--- /dev/null ++++ b/doc/README.siteconf +@@ -0,0 +1,60 @@ ++The siteconf: Site-specific preferences ++ ++The siteconf consists of URL patterns and preferences associated to them. ++You can improve "decode_url" feature by giving charsets of URLs site by site, ++or bypass Google's redirector for performance and your privacy. ++ ++The siteconf is read from ~/.w3m/siteconf by default. ++ ++===== The syntax ===== ++ ++url <url>|/<re-url>/|m@<re-url>@i [exact] ++substitute_url "<destination-url>" ++url_charset <charset> ++no_referer_from on|off ++no_referer_to on|off ++ ++The last match wins. ++ ++===== Examples ===== ++ ++url "http://twitter.com/#!/" ++substitute_url "http://mobile.twitter.com/" ++ ++This forwards the twitter.com to its mobile site. ++ ++url "http://your.bookmark.net/" ++no_referer_from on ++ ++This prevents HTTP referers from being sent when you follow links ++at the your.bookmark.net. ++ ++url "http://www.google.com/url?" exact ++substitute_url "file:///cgi-bin/your-redirector.cgi?" ++ ++This forwards the Google's redirector to your local CGI. ++ ++url /^http:\/\/[a-z]*\.wikipedia\.org\// ++url_charset utf-8 ++ ++When combinated with "decode_url" option turned on, links to ++Wikipedia will be human-readable. ++ ++===== Regular expressions notes ===== ++ ++Following expressions are all equivalent: ++ ++/http:\/\/www\.example\.com\// ++m/http:\/\/www\.example\.com\// ++m@http://www\.example\.com/@ ++m!http://www\.example\.com/! ++ ++With a trailing 'i' modifier, you can specify a case-insensitive match. ++For example, m@^http://www\.example\.com/abc/@i matches to: ++ ++http://www.example.com/abc/ ++http://www.example.com/Abc/ ++http://www.example.com/ABC/ ++ ++Hostnames, however, are always converted to lowercases before compared. ++ +diff --git a/doc/README.sixel b/doc/README.sixel +new file mode 100644 +index 0000000..588afc4 +--- /dev/null ++++ b/doc/README.sixel +@@ -0,0 +1,27 @@ ++Sixel support of w3m ++ 2014/11/05 ++ K. Araki ++ ++Introduction ++ ++ This is the extension for w3m to show inline images by sixel graphics. ++ ++Requirements ++ ++ Install 'img2sixel' command provided by libsixel project. ++ (https://github.com/saitoha/libsixel) ++ ++Build ++ ++ $ ./configure --enable-image ... ++ $ make ++ $ make install ++ ++Usage ++ ++ $ w3m -sixel http://... ++ ++ You can specify options of 'img2sixel' command by "W3M_IMG2SIXEL" ++ environmental variable. ++ ++ $ W3M_IMG2SIXEL="img2sixel -d atkinson" w3m -sixel http://... +diff --git a/doc/w3m.1 b/doc/w3m.1 +index 8f071c6..0762f51 100644 +--- a/doc/w3m.1 ++++ b/doc/w3m.1 +@@ -1,13 +1,11 @@ + .nr N -1 + .nr D 5 +-.TH W3M 1 Local ++.TH W3M 1 "2014-11-29" + .UC 4 + .SH NAME +-w3m \- a text based Web browser and pager ++w3m \- a text based web browser and pager + .SH SYNOPSIS +-.B w3m +-[options] [URL or filename] +-.PP ++w3m [OPTION]... [ \fIfile\fP | \fIURL\fP ]... + .SH DESCRIPTION + .\" This defines appropriate quote strings for nroff and troff + .ds lq \&" +@@ -17,234 +15,285 @@ w3m \- a text based Web browser and pager + .\" Just in case these number registers aren't set yet... + .if \nN==0 .nr N 10 + .if \nD==0 .nr D 5 +-.I +-w3m +-is a World Wide Web (WWW) text based client. It has English and +-Japanese help files and an option menu and can be configured to +-use either language. It will display hypertext markup language +-(HTML) documents containing links to files residing on the local +-system, as well as files residing on remote systems. It can +-display HTML tables and frames. +-In addition, it can be used as a "pager" in much the same manner +-as "more" or "less". +-Current versions of +-.I +-w3m +-run on +-Unix (Solaris, SunOS, HP-UX, Linux, FreeBSD, and EWS4800) +-and on +-Microsoft Windows 9x/NT. +-.PP ++ ++\fIw3m\fP is a text based browser which can display local or remote ++web pages as well as other documents. It is able to process HTML ++tables and frames but it ignores JavaScript and Cascading Style ++Sheets. \fIw3m\fP can also serve as a pager for text files named as ++arguments or passed on standard input, and as a general purpose ++directory browser. ++ ++\fIw3m\fP organizes its content in buffers or tabs, allowing easy ++navigation between them. With the w3m-img extension installed, \fIw3m\fP can ++display inline graphics in web pages. And whenever \fIw3m\fP's HTML ++rendering capabilities do not meet your needs, the target URL can be ++handed over to a graphical browser with a single command. ++ ++For help with runtime options, press \(lqH\(rq while running \fIw3m\fP. ++ ++.SH ARGUMENTS ++ ++When given one or more command line arguments, \fIw3m\fP will handle ++targets according to content type. For web, \fIw3m\fP gets this ++information from HTTP headers; for relative or absolute file system ++paths, it relies on filenames. ++ ++With no argument, \fIw3m\fP expects data from standard input and ++assumes \(lqtext/plain\(rq unless another MIME type is given by the user. ++ ++If provided with no target and no fallback target (see for instance ++option \fB\-v\fP below), \fIw3m\fP will exit with usage information. + .SH OPTIONS +-At start up, \fIw3m\fR will load any local +-file or remote URL specified at the command +-line. For help with runtime options, press \fB"H"\fR +-while running \fIw3m\fR. +-Command line options are: +-.PP ++Command line options are introduced with a single \(lq\-\(rq character and ++may take an argument. ++.SS General options: + .TP +-.B -t tab +-set tab width ++\fB\-B\fP ++with no other target defined, use the bookmark page for startup + .TP +-.B -r +-ignore backspace effect +-.TP +-.B -l line +-# of preserved line (default 10000) +-.TP +-.B -I charset +-document charset +-.TP +-.B -O charset +-display/output charset ++\fB\-M\fP ++monochrome display + .TP +-.B -B +-load bookmark ++\fB\-no-mouse\fP ++deactivate mouse support + .TP +-.B -bookmark file +-specify bookmark file ++\fB\-num\fP ++display each line's number + .TP +-.B -T type +-specify content-type ++\fB\-N\fP ++distribute multiple command line arguments to tabs. By default, a ++stack of buffers is used ++.TP ++\fB\-ppc \fInum\fR ++width of \fInum\fR pixels per character. Range of 4.0 to 32.0, default 8.0. ++Larger values will make tables narrower. (Implementation not verified) + .TP +-.B -m +-internet message mode ++\fB\-ppl \fInum\fR ++height of \fInum\fR pixels per line. Range of 4.0 to 64.0. (Implementation not verified) + .TP +-.B -v +-visual startup mode ++\fB\-title\fP, \fB\-title=TERM\fP ++use the buffer name as terminal title string. With specified TERM, ++this sets the title configuration style accordingly + .TP +-.B -M +-monochrome display ++\fB\-v\fP ++with no other target defined, welcome users with a built-in page + .TP +-.B -N +-open URL of command line on each new tab ++\fB\-W\fP ++toggle wrapping in searches + .TP +-.B -F +-automatically render frame ++\fB\-X\fP ++do not initialize/deinitialize the terminal + .TP +-.B -dump +-dump formatted page into stdout ++\fB+\fInum\fR ++go to line \fInum\fR; only effective for \fInum\fR larger than the number of lines in the terminal ++.SS Browser options: + .TP +-.B -cols width +-specify column width (used with -dump) ++\fB\-cols \fInum\fR ++with stdout as destination; HTML is rendered to lines of \fInum\fR characters + .TP +-.B -ppc count +-specify the number of pixels per character (4.0...32.0). +-Larger values will make tables narrower. [default 8.0] ++\fB\-cookie\fP, \fB\-no-cookie\fP ++use stored cookies and accept new ones, or do neither + .TP +-.B -ppl count +-specify the number of pixels per line (4.0...64.0) ++\fB\-F\fP ++render frames + .TP +-.B -dump_source +-dump page source into stdout ++\fB\-graph\fP, \fB\-no-graph\fP ++use or do not use graphic characters for drawing HTML table and frame borders + .TP +-.B -dump_head +-dump response of HEAD request into stdout ++\fB\-header \fIstring\fR ++append \fIstring\fR to the HTTP(S) request. Expected to match the header syntax \f(CW Variable: Value\fP + .TP +-.B -dump_both +-dump HEAD and source into stdout ++\fB\-m\fP ++Render the body of Usenet messages according to the header \(lqContent-type\(rq + .TP +-.B -dump_extra +-dump HEAD, source, and extra information into stdout ++\fB\-no-proxy\fP ++do not use proxy + .TP +-.B -post file +-use POST method with file content ++\fB\-post \fIfile\fR ++use POST method to upload data defined in \fIfile\fR. The syntax to be used ++is \f(CWvar1=value1[&var2=value2]...\fP + .TP +-.B -header string +-insert string as a header ++\fB\-4\fP ++IPv4 only. Corresponds to dns_order=4 in configuration files + .TP +-.B +<num> +-goto <num> line ++\fB\-6\fP ++IPv6 only. Corresponds to dns_order=6 in configuration files ++.SS Text pager options: + .TP +-.B -num +-show line number ++\fB\-l \fInum\fR ++number of lines preserved internally when receiving plain text from ++stdin (default 10,000) + .TP +-.B -no-proxy +-don't use proxy ++\fB\-r\fP ++use caret notation to display special escape characters (such ++as ANSI escapes or nroff-style backspaces for bold and underlined ++characters) instead of processing them + .TP +-.B -4 +-IPv4 only (-o dns_order=4) ++\fB\-s\fP ++squeeze multiple blank lines into one + .TP +-.B -6 +-IPv6 only (-o dns_order=6) ++\fB\-t\fP \fInum\fP ++set tab width to \fInum\fR columns. No effect on stdout ++.SS Data type/encoding options: + .TP +-.B -no-mouse +-don't use mouse ++\fB\-I \fIcharset\fR ++user defined character encoding of input data + .TP +-.B -cookie +-use cookie. ++\fB\-O \fIcharset\fR ++user defined character encoding of output data + .TP +-.B -no-cookie +-don't use cookie ++\fB\-T \fItype\fR ++explicit characterization of input data by MIME type ++.SS Options for data output, followed by immediate exit: + .TP +-.B -graph +-use graphic character ++\fB\-dump\fP ++dump rendered page into stdout. Set implicitly when output is directed ++to a file or pipe + .TP +-.B -no-graph +-don't use graphic character ++\fB\-dump_source\fP ++dump the page's source code into stdout + .TP +-.B -S +-squeeze multiple blank lines ++\fB\-dump_head\fP ++dump response of a HEAD request for a URL into stdout + .TP +-.B -W +-toggle wrap search mode ++\fB\-dump_both\fP ++dump HEAD, and source code for a URL into stdout + .TP +-.B -X +-don't use termcap init/deinit ++\fB\-dump_extra\fP ++dump HEAD, source code, and extra information for a URL into stdout + .TP +-.B -title [=TERM] +-set buffer name to terminal title string. +-If TERM is specified, use the TERM style title configuration. ++\fB\-help\fP ++show a summary of compiled-in features and command line options + .TP +-.B -o opt=value +-assign value to config option ++\fB\-show-option\fP ++show all available config options + .TP +-.B -show-option +-show all available config option ++\fB\-version\fP ++show the version of \fIw3m\fP ++.SS Options for overriding default settings and resources: + .TP +-.B -config file +-specify config file ++\fB\-bookmark \fIfile\fR ++use \fIfile\fR instead of the default bookmark.html file + .TP +-.B -help +-show usage ++\fB\-config \fIfile\fR ++use \fIfile\fR instead of the default config file + .TP +-.B -version +-show w3m version ++\fB\-debug\fP ++DO NOT USE + .TP +-.B -reqlog +-write request logfile ++\fB\-o \fIoption=value\fR ++modify one configuration item with an explicitly given value; without \fIoption=value\fR, equivalent to -show-option + .TP +-.B -debug +-DO NOT USE ++\fB\-reqlog\fP ++log headers of HTTP communication in file \f(CW~/.w3m/request.log\fP + .SH EXAMPLES ++.SS Pager-like usage ++.TP ++Combine snippets of HTML code and preview the page ++.EX ++$ cat header.html footer.html | w3m -T text/html ++.EE ++.TP ++Compare two files using tabs ++.EX ++$ w3m -N config.old config ++.EE ++.SS Browser-like usage ++.TP ++Display web content in monochrome terminal ++.EX ++$ w3m -M http://w3m.sourceforge.net ++.EE ++.TP ++Display embedded graphics ++.EX ++$ w3m -o auto_image=TRUE http://w3m.sourceforge.net ++.EE ++.TP ++Display content from Usenet ++.EX ++$ w3m -m nntp://news.aioe.org/comp.os.linux.networking ++.EE ++.TP ++Upload data for a URL using the POST method ++.EX ++$ w3m -post - http://example.com/form.php <<<'a=0&b=1' ++.EE ++.SS Filter-like usage ++.TP ++Convert an HTML file to plain text with a defined line length ++.EX ++$ w3m -cols 40 foo.html > foo.txt ++.EE ++.TP ++Output the bookmarks page as text with an appended list of links ++.EX ++$ w3m -B -o display_link_number=1 > out.txt ++.EE ++.TP ++Conversion of file format and character encoding ++.EX ++$ w3m -T text/html -I EUC-JP -O UTF-8 < foo.html > foo.txt ++.EE ++.SS Start with no input ++.TP ++Welcome users with a built-in page ++.EX ++$ w3m -v ++.EE ++.\".SH Errors ++.SH ENVIRONMENT ++\fIw3m\fP recognises the environment variable WWW_HOME as defining a ++fallback target for use if it is invoked without one. ++.SH FILES + .TP +-To use w3m as a pager: +-.br +-$ ls | w3m +-.br +-.TP +-To use w3m to translate HTML files: +-.br +-$ cat foo.html | w3m -T text/html ++\f(CW~/.w3m/bookmark.html\fP ++default bookmark file + .TP +-or +-.br +-$ cat foo.html | w3m -dump -T text/html >foo.txt +-.SH FILES ++\f(CW~/.w3m/config\fP ++user defined configuration file; overrides \f(CW/etc/w3m/config\fP + .TP +-.I ${HOME}/.w3m/config +-configuration file ++\f(CW~/.w3m/cookie\fP ++cookie jar; written on exit, read on launch + .TP +-.I ${HOME}/.w3m/keymap +-key binding configuration file +-.\" .TP +-.\" .I ${HOME}/.w3m/menu +-.\" ??? ++\f(CW~/.w3m/history\fP ++browser history - visited files and URLs + .TP +-.I ${HOME}/.w3m/mouse +-mouse configuration file ++\f(CW~/.w3m/keymap\fP ++user defined key bindings; overrides default key bindings + .TP +-.I ${HOME}/.w3m/cookie +-cookie file ++\f(CW~/.w3m/mailcap\fP ++external viewer configuration file + .TP +-.I ${HOME}/.w3m/history +-history file ++\f(CW~/.w3m/menu\fP ++user defined menu; overrides default menu + .TP +-.I ${HOME}/.w3m/passwd +-passowrd and username file ++\f(CW~/.w3m/mime.types\fP ++MIME types file + .TP +-.I ${HOME}/.w3m/pre_form +-form parameters file ++\f(CW~/.w3m/mouse\fP ++user defined mouse settings + .TP +-.I ${HOME}/.w3m/mailcap +-external viewer configuration file ++\f(CW~/.w3m/passwd\fP ++password and username file + .TP +-.I ${HOME}/.w3m/mime.types +-MIME types file ++\f(CW~/.w3m/pre_form\fP ++contains predefined values to fill recurrent HTML forms + .\" .TP +-.\" .I ${HOME}/.w3m/urimethodmap ++.\" .I $~/.w3m/urimethodmap + .\" ??? + .SH NOTES +-This is the +-.I +-w3m +-0.5.3 Release. +-.PP +-Please see the MANUAL.html file distributed with w3m for +-more detailed documentation. +- +-Additional information about +-.I +-w3m +-may be found on its Japanese language Web site located at: +- http://w3m.sourceforge.net/index.ja.html +-.br +-or on its English version of the site at: +- http://w3m.sourceforge.net/index.en.html ++This is the \fIw3m\fP 0.5.3 Release. ++.SH SEE ALSO ++README and example files are to be found in the doc directory of your \fIw3m\fP installation. Recent information about \fIw3m\fP may be found on ++.UR http://w3m.sourceforge.net ++the project's web pages at ++.UE + .SH ACKNOWLEDGMENTS +-.I +-w3m +-has incorporated code from several sources. ++\fIw3m\fP has incorporated code from several sources. + Users have contributed patches and suggestions over time. + .SH AUTHOR +-Akinori ITO <aito@fw.ipsj.or.jp> ++.UR aito@fw.ipsj.or.jp ++Akinori ITO ++.UE ++ +diff --git a/entity.c b/entity.c +index fdd8f64..45dc95e 100644 +--- a/entity.c ++++ b/entity.c +@@ -44,6 +44,8 @@ conv_entity(unsigned int c) + return " "; + if (c == 0xa0) + return NBSP; ++ if (c == 0xad) /* SOFT HYPHEN */ ++ return ""; + if (c < 0x100) { /* Latin1 (ISO 8859-1) */ + if (UseAltEntity) + return alt_latin1[c - 0xa0]; +diff --git a/etc.c b/etc.c +index 8fe1215..dcc6edd 100644 +--- a/etc.c ++++ b/etc.c +@@ -1365,7 +1365,13 @@ setup_child(int child, int i, int f) + if (!child) + SETPGRP(); + #endif /* __MINGW32_VERSION */ ++ /* ++ * I don't know why but close_tty() sometimes interrupts loadGeneralFile() in loadImage() ++ * and corrupt image data can be cached in ~/.w3m. ++ */ ++#if 0 + close_tty(); ++#endif + close_all_fds_except(i, f); + QuietMessage = TRUE; + fmInitialized = FALSE; +diff --git a/file.c b/file.c +index 567d41e..709a0c1 100644 +--- a/file.c ++++ b/file.c +@@ -47,11 +47,11 @@ static JMP_BUF AbortLoading; + static struct table *tables[MAX_TABLE]; + static struct table_mode table_mode[MAX_TABLE]; + +-#ifdef USE_IMAGE ++#if defined(USE_M17N) || defined(USE_IMAGE) + static ParsedURL *cur_baseURL = NULL; +-#ifdef USE_M17N +-static char cur_document_charset; + #endif ++#ifdef USE_M17N ++static wc_ces cur_document_charset = 0; + #endif + + static Str cur_title; +@@ -215,7 +215,6 @@ currentLn(Buffer *buf) + + static Buffer * + loadSomething(URLFile *f, +- char *path, + Buffer *(*loadproc) (URLFile *, Buffer *), Buffer *defaultbuf) + { + Buffer *buf; +@@ -223,17 +222,23 @@ loadSomething(URLFile *f, + if ((buf = loadproc(f, defaultbuf)) == NULL) + return NULL; + +- buf->filename = path; + if (buf->buffername == NULL || buf->buffername[0] == '\0') { + buf->buffername = checkHeader(buf, "Subject:"); +- if (buf->buffername == NULL) +- buf->buffername = conv_from_system(lastFileName(path)); ++ if (buf->buffername == NULL && buf->filename != NULL) ++ buf->buffername = conv_from_system(lastFileName(buf->filename)); + } + if (buf->currentURL.scheme == SCM_UNKNOWN) + buf->currentURL.scheme = f->scheme; +- buf->real_scheme = f->scheme; + if (f->scheme == SCM_LOCAL && buf->sourcefile == NULL) +- buf->sourcefile = path; ++ buf->sourcefile = buf->filename; ++ if (loadproc == loadHTMLBuffer ++#ifdef USE_IMAGE ++ || loadproc == loadImageBuffer ++#endif ++ ) ++ buf->type = "text/html"; ++ else ++ buf->type = "text/plain"; + return buf; + } + +@@ -484,28 +489,6 @@ convertLine0(URLFile *uf, Str line, int mode) + return line; + } + +-/* +- * loadFile: load file to buffer +- */ +-Buffer * +-loadFile(char *path) +-{ +- Buffer *buf; +- URLFile uf; +- init_stream(&uf, SCM_LOCAL, NULL); +- examineFile(path, &uf); +- if (uf.stream == NULL) +- return NULL; +- buf = newBuffer(INIT_BUFFER_WIDTH); +- current_content_length = 0; +-#ifdef USE_M17N +- content_charset = 0; +-#endif +- buf = loadSomething(&uf, path, loadBuffer, buf); +- UFclose(&uf); +- return buf; +-} +- + int + matchattr(char *p, char *attr, int len, Str *value) + { +@@ -694,6 +677,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) + #endif + init_stream(&f, SCM_LOCAL, newStrStream(src)); + loadHTMLstream(&f, newBuf, NULL, TRUE); ++ UFclose(&f); + for (l = newBuf->lastLine; l && l->real_linenumber; + l = l->prev) + l->real_linenumber = 0; +@@ -1697,13 +1681,15 @@ getLinkNumberStr(int correction) + /* + * loadGeneralFile: load file to buffer + */ ++#define DO_EXTERNAL ((Buffer *(*)(URLFile *, Buffer *))doExternal) + Buffer * + loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, + int flag, FormList *volatile request) + { + URLFile f, *volatile of = NULL; + ParsedURL pu; +- Buffer *b = NULL, *(*volatile proc)() = loadBuffer; ++ Buffer *b = NULL; ++ Buffer *(*volatile proc)(URLFile *, Buffer *) = loadBuffer; + char *volatile tpath; + char *volatile t = "text/plain", *p, *volatile real_type = NULL; + Buffer *volatile t_buf = NULL; +@@ -1730,7 +1716,22 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, + add_auth_cookie_flag = 0; + + checkRedirection(NULL); ++ + load_doc: ++ { ++ const char *sc_redirect; ++ parseURL2(tpath, &pu, current); ++ sc_redirect = query_SCONF_SUBSTITUTE_URL(&pu); ++ if (sc_redirect && *sc_redirect && checkRedirection(&pu)) { ++ tpath = (char *)sc_redirect; ++ request = NULL; ++ add_auth_cookie_flag = 0; ++ current = New(ParsedURL); ++ *current = pu; ++ status = HTST_NORMAL; ++ goto load_doc; ++ } ++ } + TRAP_OFF; + url_option.referer = referer; + url_option.flag = flag; +@@ -1863,7 +1864,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, + /* 302: Found */ + /* 303: See Other */ + /* 307: Temporary Redirect (HTTP/1.1) */ +- tpath = url_quote_conv(p, DocumentCharset); ++ tpath = url_encode(p, NULL, 0); + request = NULL; + UFclose(&f); + current = New(ParsedURL); +@@ -2022,7 +2023,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, + if (f.is_cgi && (p = checkHeader(t_buf, "Location:")) != NULL && + checkRedirection(&pu)) { + /* document moved */ +- tpath = url_quote_conv(remove_space(p), DocumentCharset); ++ tpath = url_encode(remove_space(p), NULL, 0); + request = NULL; + UFclose(&f); + add_auth_cookie_flag = 0; +@@ -2123,10 +2124,6 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, + if (real_type == NULL) + real_type = t; + proc = loadBuffer; +-#ifdef USE_IMAGE +- cur_baseURL = New(ParsedURL); +- copyParsedURL(cur_baseURL, &pu); +-#endif + + current_content_length = 0; + if ((p = checkHeader(t_buf, "Content-Length:")) != NULL) +@@ -2197,18 +2194,8 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, + #endif + else if (w3m_backend) ; + else if (!(w3m_dump & ~DUMP_FRAME) || is_dump_text_type(t)) { +- if (!do_download && doExternal(f, +- pu.real_file ? pu.real_file : pu.file, +- t, &b, t_buf)) { +- if (b && b != NO_BUFFER) { +- b->real_scheme = f.scheme; +- b->real_type = real_type; +- if (b->currentURL.host == NULL && b->currentURL.file == NULL) +- copyParsedURL(&b->currentURL, &pu); +- } +- UFclose(&f); +- TRAP_OFF; +- return b; ++ if (!do_download && searchExtViewer(t) != NULL) { ++ proc = DO_EXTERNAL; + } + else { + TRAP_OFF; +@@ -2232,36 +2219,30 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, + else if (w3m_dump & DUMP_FRAME) + return NULL; + ++ if (t_buf == NULL) ++ t_buf = newBuffer(INIT_BUFFER_WIDTH); ++ copyParsedURL(&t_buf->currentURL, &pu); ++ t_buf->filename = pu.real_file ? pu.real_file : ++ pu.file ? conv_to_system(pu.file) : NULL; + if (flag & RG_FRAME) { +- if (t_buf == NULL) +- t_buf = newBuffer(INIT_BUFFER_WIDTH); + t_buf->bufferprop |= BP_FRAME; + } + #ifdef USE_SSL +- if (t_buf) +- t_buf->ssl_certificate = f.ssl_certificate; ++ t_buf->ssl_certificate = f.ssl_certificate; + #endif + frame_source = flag & RG_FRAME_SRC; +- b = loadSomething(&f, pu.real_file ? pu.real_file : pu.file, proc, t_buf); ++ if (proc == DO_EXTERNAL) { ++ b = doExternal(f, t, t_buf); ++ } else { ++ b = loadSomething(&f, proc, t_buf); ++ } + UFclose(&f); + frame_source = 0; +- if (b) { ++ if (b && b != NO_BUFFER) { + b->real_scheme = f.scheme; + b->real_type = real_type; +- if (b->currentURL.host == NULL && b->currentURL.file == NULL) +- copyParsedURL(&b->currentURL, &pu); +- if (is_html_type(t)) +- b->type = "text/html"; +- else if (w3m_backend) { +- Str s = Strnew_charp(t); +- b->type = s->ptr; +- } +-#ifdef USE_IMAGE +- else if (proc == loadImageBuffer) +- b->type = "text/html"; +-#endif +- else +- b->type = "text/plain"; ++ if (w3m_backend) ++ b->type = allocStr(t, -1); + if (pu.label) { + if (proc == loadHTMLBuffer) { + Anchor *a; +@@ -2287,10 +2268,11 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, + if (header_string) + header_string = NULL; + #ifdef USE_NNTP +- if (f.scheme == SCM_NNTP || f.scheme == SCM_NEWS) ++ if (b && b != NO_BUFFER && (f.scheme == SCM_NNTP || f.scheme == SCM_NEWS)) + reAnchorNewsheader(b); + #endif +- preFormUpdateBuffer(b); ++ if (b && b != NO_BUFFER) ++ preFormUpdateBuffer(b); + TRAP_OFF; + return b; + } +@@ -2469,6 +2451,7 @@ set_breakpoint(struct readbuffer *obuf, int tag_length) + bcopy((void *)&obuf->anchor, (void *)&obuf->bp.anchor, + sizeof(obuf->anchor)); + obuf->bp.img_alt = obuf->img_alt; ++ obuf->bp.input_alt = obuf->input_alt; + obuf->bp.in_bold = obuf->in_bold; + obuf->bp.in_italic = obuf->in_italic; + obuf->bp.in_under = obuf->in_under; +@@ -2486,6 +2469,7 @@ back_to_breakpoint(struct readbuffer *obuf) + bcopy((void *)&obuf->bp.anchor, (void *)&obuf->anchor, + sizeof(obuf->anchor)); + obuf->img_alt = obuf->bp.img_alt; ++ obuf->input_alt = obuf->bp.input_alt; + obuf->in_bold = obuf->bp.in_bold; + obuf->in_italic = obuf->bp.in_italic; + obuf->in_under = obuf->bp.in_under; +@@ -2729,7 +2713,7 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, + Str line = obuf->line, pass = NULL; + char *hidden_anchor = NULL, *hidden_img = NULL, *hidden_bold = NULL, + *hidden_under = NULL, *hidden_italic = NULL, *hidden_strike = NULL, +- *hidden_ins = NULL, *hidden = NULL; ++ *hidden_ins = NULL, *hidden_input, *hidden = NULL; + + #ifdef DEBUG + if (w3m_debug) { +@@ -2761,6 +2745,12 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, + hidden = hidden_img; + } + } ++ if (obuf->input_alt.in) { ++ if ((hidden_input = has_hidden_link(obuf, HTML_INPUT_ALT)) != NULL) { ++ if (!hidden || hidden_input < hidden) ++ hidden = hidden_input; ++ } ++ } + if (obuf->in_bold) { + if ((hidden_bold = has_hidden_link(obuf, HTML_B)) != NULL) { + if (!hidden || hidden_bold < hidden) +@@ -2812,6 +2802,8 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, + Strcat_charp(line, "</a>"); + if (obuf->img_alt && !hidden_img) + Strcat_charp(line, "</img_alt>"); ++ if (obuf->input_alt.in && !hidden_input) ++ Strcat_charp(line, "</input_alt>"); + if (obuf->in_bold && !hidden_bold) + Strcat_charp(line, "</b>"); + if (obuf->in_italic && !hidden_italic) +@@ -3022,6 +3014,18 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, + Strcat_charp(tmp, "\">"); + push_tag(obuf, tmp->ptr, HTML_IMG_ALT); + } ++ if (!hidden_input && obuf->input_alt.in) { ++ Str tmp; ++ if (obuf->input_alt.hseq > 0) ++ obuf->input_alt.hseq = - obuf->input_alt.hseq; ++ tmp = Sprintf("<INPUT_ALT hseq=\"%d\" fid=\"%d\" name=\"%s\" type=\"%s\" value=\"%s\">", ++ obuf->input_alt.hseq, ++ obuf->input_alt.fid, ++ obuf->input_alt.name->ptr, ++ obuf->input_alt.type->ptr, ++ obuf->input_alt.value->ptr); ++ push_tag(obuf, tmp->ptr, HTML_INPUT_ALT); ++ } + if (!hidden_bold && obuf->in_bold) + push_tag(obuf, "<B>", HTML_B); + if (!hidden_italic && obuf->in_italic) +@@ -3228,7 +3232,7 @@ process_img(struct parsed_tag *tag, int width) + + if (!parsedtag_get_value(tag, ATTR_SRC, &p)) + return tmp; +- p = remove_space(p); ++ p = url_encode(remove_space(p), cur_baseURL, cur_document_charset); + q = NULL; + parsedtag_get_value(tag, ATTR_ALT, &q); + if (!pseudoInlines && (q == NULL || (*q == '\0' && ignore_null_img_alt))) +@@ -3322,12 +3326,7 @@ process_img(struct parsed_tag *tag, int width) + Image image; + ParsedURL u; + +-#ifdef USE_M17N +- parseURL2(wc_conv(p, InnerCharset, cur_document_charset)->ptr, &u, +- cur_baseURL); +-#else + parseURL2(p, &u, cur_baseURL); +-#endif + image.url = parsedURL2Str(&u)->ptr; + if (!uncompressed_file_type(u.file, &image.ext)) + image.ext = filename_extension(u.file, TRUE); +@@ -3346,8 +3345,14 @@ process_img(struct parsed_tag *tag, int width) + if (i < 0) + i = pixel_per_line; + } +- nw = (w > 3) ? (int)((w - 3) / pixel_per_char + 1) : 1; +- ni = (i > 3) ? (int)((i - 3) / pixel_per_line + 1) : 1; ++ if (enable_inline_image) { ++ nw = (w > 1) ? ((w - 1) / pixel_per_char_i + 1) : 1 ; ++ ni = (i > 1) ? ((i - 1) / pixel_per_line_i + 1) : 1 ; ++ } ++ else { ++ nw = (w > 3) ? (int)((w - 3) / pixel_per_char + 1) : 1; ++ ni = (i > 3) ? (int)((i - 3) / pixel_per_line + 1) : 1; ++ } + Strcat(tmp, + Sprintf("<pre_int><img_alt hseq=\"%d\" src=\"", cur_iseq++)); + pre_int = TRUE; +@@ -3378,19 +3383,21 @@ process_img(struct parsed_tag *tag, int width) + if (i0 >= 0) + Strcat(tmp, Sprintf(" height=%d", i0)); + switch (align) { ++ case ALIGN_MIDDLE: ++ if (!enable_inline_image) { ++ top = ni / 2; ++ bottom = top; ++ if (top * 2 == ni) ++ yoffset = (int)(((ni + 1) * pixel_per_line - i) / 2); ++ else ++ yoffset = (int)((ni * pixel_per_line - i) / 2); ++ break; ++ } + case ALIGN_TOP: + top = 0; + bottom = ni - 1; + yoffset = 0; + break; +- case ALIGN_MIDDLE: +- top = ni / 2; +- bottom = top; +- if (top * 2 == ni) +- yoffset = (int)(((ni + 1) * pixel_per_line - i) / 2); +- else +- yoffset = (int)((ni * pixel_per_line - i) / 2); +- break; + case ALIGN_BOTTOM: + top = ni - 1; + bottom = 0; +@@ -3408,7 +3415,12 @@ process_img(struct parsed_tag *tag, int width) + } + break; + } +- xoffset = (int)((nw * pixel_per_char - w) / 2); ++ ++ if (enable_inline_image) ++ xoffset = 0; ++ else ++ xoffset = (int)((nw * pixel_per_char - w) / 2); ++ + if (xoffset) + Strcat(tmp, Sprintf(" xoffset=%d", xoffset)); + if (yoffset) +@@ -3732,6 +3744,63 @@ process_input(struct parsed_tag *tag) + } + + Str ++process_button(struct parsed_tag *tag) ++{ ++ Str tmp = NULL; ++ char *p, *q, *r, *qq = ""; ++ int qlen, v; ++ ++ if (cur_form_id < 0) { ++ char *s = "<form_int method=internal action=none>"; ++ tmp = process_form(parse_tag(&s, TRUE)); ++ } ++ if (tmp == NULL) ++ tmp = Strnew(); ++ ++ p = "submit"; ++ parsedtag_get_value(tag, ATTR_TYPE, &p); ++ q = NULL; ++ parsedtag_get_value(tag, ATTR_VALUE, &q); ++ r = ""; ++ parsedtag_get_value(tag, ATTR_NAME, &r); ++ ++ v = formtype(p); ++ if (v == FORM_UNKNOWN) ++ return NULL; ++ ++ if (!q) { ++ switch (v) { ++ case FORM_INPUT_SUBMIT: ++ case FORM_INPUT_BUTTON: ++ q = "SUBMIT"; ++ break; ++ case FORM_INPUT_RESET: ++ q = "RESET"; ++ break; ++ } ++ } ++ if (q) { ++ qq = html_quote(q); ++ qlen = strlen(q); ++ } ++ ++ // Strcat_charp(tmp, "<pre_int>"); ++ Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s " ++ "name=\"%s\" value=\"%s\">", ++ cur_hseq++, cur_form_id, p, html_quote(r), qq)); ++ return tmp; ++} ++ ++Str ++process_n_button(void) ++{ ++ Str tmp = Strnew(); ++ Strcat_charp(tmp, "</input_alt>"); ++ // Strcat_charp(tmp, "</pre_int>"); ++ return tmp; ++} ++ ++Str + process_select(struct parsed_tag *tag) + { + Str tmp = NULL; +@@ -4084,6 +4153,7 @@ process_form_int(struct parsed_tag *tag, int fid) + parsedtag_get_value(tag, ATTR_METHOD, &p); + q = "!CURRENT_URL!"; + parsedtag_get_value(tag, ATTR_ACTION, &q); ++ q = url_encode(remove_space(q), cur_baseURL, cur_document_charset); + r = NULL; + #ifdef USE_M17N + if (parsedtag_get_value(tag, ATTR_ACCEPT_CHARSET, &r)) +@@ -4284,15 +4354,15 @@ getMetaRefreshParam(char *q, Str *refresh_uri) + while (*q) { + if (!strncasecmp(q, "url=", 4)) { + q += 4; +- if (*q == '\"') /* " */ ++ if (*q == '\"' || *q == '\'') /* " or ' */ + q++; + r = q; + while (*r && !IS_SPACE(*r) && *r != ';') + r++; + s_tmp = Strnew_charp_n(q, r - q); + +- if (s_tmp->ptr[s_tmp->length - 1] == '\"') { /* " +- */ ++ if (s_tmp->ptr[s_tmp->length - 1] == '\"' /* " */ ++ || s_tmp->ptr[s_tmp->length - 1] == '\'') { /* ' */ + s_tmp->length--; + s_tmp->ptr[s_tmp->length] = '\0'; + } +@@ -4861,7 +4931,35 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) + if (i > obuf->bottom_margin) + obuf->bottom_margin = i; + } ++ if (parsedtag_get_value(tag, ATTR_HSEQ, &hseq)) { ++ obuf->input_alt.hseq = hseq; ++ } ++ if (parsedtag_get_value(tag, ATTR_FID, &i)) { ++ obuf->input_alt.fid = i; ++ } ++ if (parsedtag_get_value(tag, ATTR_TYPE, &p)) { ++ obuf->input_alt.type = Strnew_charp(p); ++ } ++ if (parsedtag_get_value(tag, ATTR_VALUE, &p)) { ++ obuf->input_alt.value = Strnew_charp(p); ++ } ++ if (parsedtag_get_value(tag, ATTR_NAME, &p)) { ++ obuf->input_alt.name = Strnew_charp(p); ++ } ++ obuf->input_alt.in = 1; + return 0; ++ case HTML_N_INPUT_ALT: ++ if (obuf->input_alt.in) { ++ if (!close_effect0(obuf, HTML_INPUT_ALT)) ++ push_tag(obuf, "</input_alt>", HTML_N_INPUT_ALT); ++ obuf->input_alt.hseq = 0; ++ obuf->input_alt.fid = -1; ++ obuf->input_alt.in = 0; ++ obuf->input_alt.type = NULL; ++ obuf->input_alt.name = NULL; ++ obuf->input_alt.value = NULL; ++ } ++ return 1; + case HTML_TABLE: + close_anchor(h_env, obuf); + obuf->table_level++; +@@ -4970,6 +5068,16 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) + case HTML_INPUT: + close_anchor(h_env, obuf); + tmp = process_input(tag); ++ if (tmp) ++ HTMLlineproc1(tmp->ptr, h_env); ++ return 1; ++ case HTML_BUTTON: ++ tmp = process_button(tag); ++ if (tmp) ++ HTMLlineproc1(tmp->ptr, h_env); ++ return 1; ++ case HTML_N_BUTTON: ++ tmp = process_n_button(); + if (tmp) + HTMLlineproc1(tmp->ptr, h_env); + return 1; +@@ -5067,11 +5175,10 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) + } + return 1; + case HTML_BASE: +-#ifdef USE_IMAGE ++#if defined(USE_M17N) || defined(USE_IMAGE) + p = NULL; + if (parsedtag_get_value(tag, ATTR_HREF, &p)) { +- if (!cur_baseURL) +- cur_baseURL = New(ParsedURL); ++ cur_baseURL = New(ParsedURL); + parseURL(p, cur_baseURL, NULL); + } + #endif +@@ -5329,6 +5436,13 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + #ifdef MENU_SELECT + Anchor **a_select = NULL; + #endif ++#if defined(USE_M17N) || defined(USE_IMAGE) ++ ParsedURL *base = baseURL(buf); ++#endif ++#ifdef USE_M17N ++ wc_ces name_charset = url_to_charset(NULL, &buf->currentURL, ++ buf->document_charset); ++#endif + + if (out_size == 0) { + out_size = LINELEN; +@@ -5523,16 +5637,17 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + hseq = 0; + id = NULL; + if (parsedtag_get_value(tag, ATTR_NAME, &id)) { +- id = url_quote_conv(id, buf->document_charset); ++ id = url_quote_conv(id, name_charset); + registerName(buf, id, currentLn(buf), pos); + } + if (parsedtag_get_value(tag, ATTR_HREF, &p)) +- p = url_quote_conv(remove_space(p), +- buf->document_charset); ++ p = url_encode(remove_space(p), base, ++ buf->document_charset); + if (parsedtag_get_value(tag, ATTR_TARGET, &q)) + q = url_quote_conv(q, buf->document_charset); + if (parsedtag_get_value(tag, ATTR_REFERER, &r)) +- r = url_quote_conv(r, buf->document_charset); ++ r = url_encode(r, base, ++ buf->document_charset); + parsedtag_get_value(tag, ATTR_TITLE, &s); + parsedtag_get_value(tag, ATTR_ACCESSKEY, &t); + parsedtag_get_value(tag, ATTR_HSEQ, &hseq); +@@ -5618,7 +5733,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + ParsedURL u; + Image *image; + +- parseURL2(a_img->url, &u, cur_baseURL); ++ parseURL2(a_img->url, &u, base); + a_img->image = image = New(Image); + image->url = parsedURL2Str(&u)->ptr; + if (!uncompressed_file_type(u.file, &image->ext)) +@@ -5639,7 +5754,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + image->map = q; + image->ismap = ismap; + image->touch = 0; +- image->cache = getImage(image, cur_baseURL, ++ image->cache = getImage(image, base, + IMG_FLAG_SKIP); + } + else if (iseq < 0) { +@@ -5689,6 +5804,21 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + putHmarker(buf->hmarklist, currentLn(buf), + hpos, hseq - 1); + } ++ else if (hseq < 0) { ++ int h = -hseq - 1; ++ int hpos = pos; ++ if (*str == '[') ++ hpos++; ++ if (buf->hmarklist && ++ h < buf->hmarklist->nmark && ++ buf->hmarklist->marks[h].invalid) { ++ buf->hmarklist->marks[h].pos = hpos; ++ buf->hmarklist->marks[h].line = currentLn(buf); ++ buf->hmarklist->marks[h].invalid = 0; ++ hseq = -hseq; ++ } ++ } ++ + if (!form->target) + form->target = buf->baseTarget; + if (a_textarea && +@@ -5761,8 +5891,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + break; + if (parsedtag_get_value(tag, ATTR_HREF, &p)) { + MapArea *a; +- p = url_quote_conv(remove_space(p), +- buf->document_charset); ++ p = url_encode(remove_space(p), base, ++ buf->document_charset); + t = NULL; + parsedtag_get_value(tag, ATTR_TARGET, &t); + q = ""; +@@ -5811,11 +5941,14 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + break; + case HTML_BASE: + if (parsedtag_get_value(tag, ATTR_HREF, &p)) { +- p = url_quote_conv(remove_space(p), +- buf->document_charset); ++ p = url_encode(remove_space(p), NULL, ++ buf->document_charset); + if (!buf->baseURL) + buf->baseURL = New(ParsedURL); + parseURL(p, buf->baseURL, NULL); ++#if defined(USE_M17N) || defined(USE_IMAGE) ++ base = buf->baseURL; ++#endif + } + if (parsedtag_get_value(tag, ATTR_TARGET, &p)) + buf->baseTarget = +@@ -5830,8 +5963,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + int refresh_interval = getMetaRefreshParam(q, &tmp); + #ifdef USE_ALARM + if (tmp) { +- p = url_quote_conv(remove_space(tmp->ptr), +- buf->document_charset); ++ p = url_encode(remove_space(tmp->ptr), base, ++ buf->document_charset); + buf->event = setAlarmEvent(buf->event, + refresh_interval, + AL_IMPLICIT_ONCE, +@@ -5844,8 +5977,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + FUNCNAME_reload, NULL); + #else + if (tmp && refresh_interval == 0) { +- p = url_quote_conv(remove_space(tmp->ptr), +- buf->document_charset); ++ p = url_encode(remove_space(tmp->ptr), base, ++ buf->document_charset); + pushEvent(FUNCNAME_gorURL, p); + } + #endif +@@ -5929,7 +6062,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) + #ifdef ID_EXT + id = NULL; + if (parsedtag_get_value(tag, ATTR_ID, &id)) { +- id = url_quote_conv(id, buf->document_charset); ++ id = url_quote_conv(id, name_charset); + registerName(buf, id, currentLn(buf), pos); + } + if (renderFrameSet && +@@ -5982,7 +6115,8 @@ addLink(Buffer *buf, struct parsed_tag *tag) + + parsedtag_get_value(tag, ATTR_HREF, &href); + if (href) +- href = url_quote_conv(remove_space(href), buf->document_charset); ++ href = url_encode(remove_space(href), baseURL(buf), ++ buf->document_charset); + parsedtag_get_value(tag, ATTR_TITLE, &title); + parsedtag_get_value(tag, ATTR_TYPE, &ctype); + parsedtag_get_value(tag, ATTR_REL, &rel); +@@ -6756,6 +6890,12 @@ init_henv(struct html_feed_environ *h_env, struct readbuffer *obuf, + obuf->nobr_level = 0; + bzero((void *)&obuf->anchor, sizeof(obuf->anchor)); + obuf->img_alt = 0; ++ obuf->input_alt.hseq = 0; ++ obuf->input_alt.fid = -1; ++ obuf->input_alt.in = 0; ++ obuf->input_alt.type = NULL; ++ obuf->input_alt.name = NULL; ++ obuf->input_alt.value = NULL; + obuf->in_bold = 0; + obuf->in_italic = 0; + obuf->in_under = 0; +@@ -6791,6 +6931,15 @@ completeHTMLstream(struct html_feed_environ *h_env, struct readbuffer *obuf) + push_tag(obuf, "</img_alt>", HTML_N_IMG_ALT); + obuf->img_alt = NULL; + } ++ if (obuf->input_alt.in) { ++ push_tag(obuf, "</input_alt>", HTML_N_INPUT_ALT); ++ obuf->input_alt.hseq = 0; ++ obuf->input_alt.fid = -1; ++ obuf->input_alt.in = 0; ++ obuf->input_alt.type = NULL; ++ obuf->input_alt.name = NULL; ++ obuf->input_alt.value = NULL; ++ } + if (obuf->in_bold) { + push_tag(obuf, "</b>", HTML_N_B); + obuf->in_bold = 0; +@@ -6963,8 +7112,6 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) + image_flag = IMG_FLAG_AUTO; + else + image_flag = IMG_FLAG_SKIP; +- if (newBuf->currentURL.file) +- cur_baseURL = baseURL(newBuf); + #endif + + if (w3m_halfload) { +@@ -6987,6 +7134,9 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) + htmlenv1.f = stdout; + else + htmlenv1.buf = newTextLineList(); ++#if defined(USE_M17N) || defined(USE_IMAGE) ++ cur_baseURL = baseURL(newBuf); ++#endif + + if (SETJMP(AbortLoading) != 0) { + HTMLlineproc1("<br>Transfer Interrupted!<br>", &htmlenv1); +@@ -7048,7 +7198,7 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) + } + #endif + lineBuf2 = convertLine(f, lineBuf2, HTML_MODE, &charset, doc_charset); +-#if defined(USE_M17N) && defined(USE_IMAGE) ++#ifdef USE_M17N + cur_document_charset = charset; + #endif + HTMLlineproc0(lineBuf2->ptr, &htmlenv1, internal); +@@ -7060,6 +7210,12 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) + obuf.status = R_ST_NORMAL; + completeHTMLstream(&htmlenv1, &obuf); + flushline(&htmlenv1, &obuf, 0, 2, htmlenv1.limit); ++#if defined(USE_M17N) || defined(USE_IMAGE) ++ cur_baseURL = NULL; ++#endif ++#ifdef USE_M17N ++ cur_document_charset = 0; ++#endif + if (htmlenv1.title) + newBuf->buffername = htmlenv1.title; + if (w3m_halfdump) { +@@ -7096,16 +7252,17 @@ loadHTMLString(Str page) + MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; + Buffer *newBuf; + ++ init_stream(&f, SCM_LOCAL, newStrStream(page)); ++ + newBuf = newBuffer(INIT_BUFFER_WIDTH); + if (SETJMP(AbortLoading) != 0) { + TRAP_OFF; + discardBuffer(newBuf); ++ UFclose(&f); + return NULL; + } + TRAP_ON; + +- init_stream(&f, SCM_LOCAL, newStrStream(page)); +- + #ifdef USE_M17N + newBuf->document_charset = InnerCharset; + #endif +@@ -7115,6 +7272,7 @@ loadHTMLString(Str page) + #endif + + TRAP_OFF; ++ UFclose(&f); + newBuf->topLine = newBuf->firstLine; + newBuf->lastLine = newBuf->currentLine; + newBuf->currentLine = newBuf->firstLine; +@@ -7207,7 +7365,7 @@ loadGopherDir(URLFile *uf, ParsedURL *pu, wc_ces * charset) + q = Strnew_m_charp("gopher://", host->ptr, ":", port->ptr, + "/", file->ptr, NULL)->ptr; + Strcat_m_charp(tmp, "<a href=\"", +- html_quote(url_quote_conv(q, *charset)), ++ html_quote(url_encode(q, NULL, *charset)), + "\">", p, html_quote(name->ptr + 1), "</a>\n", NULL); + } + +@@ -7331,6 +7489,7 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) + URLFile f; + MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; + struct stat st; ++ const ParsedURL *pu = newBuf ? &newBuf->currentURL : NULL; + + loadImage(newBuf, IMG_FLAG_STOP); + image.url = uf->url; +@@ -7338,20 +7497,18 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) + image.width = -1; + image.height = -1; + image.cache = NULL; +- cache = getImage(&image, cur_baseURL, IMG_FLAG_AUTO); +- if (!cur_baseURL->is_nocache && cache->loaded & IMG_FLAG_LOADED && ++ cache = getImage(&image, (ParsedURL *)pu, IMG_FLAG_AUTO); ++ if (!(pu && pu->is_nocache) && cache->loaded & IMG_FLAG_LOADED && + !stat(cache->file, &st)) + goto image_buffer; + +- TRAP_ON; + if (IStype(uf->stream) != IST_ENCODED) + uf->stream = newEncodedStream(uf->stream, uf->encoding); ++ TRAP_ON; + if (save2tmp(*uf, cache->file) < 0) { +- UFclose(uf); + TRAP_OFF; + return NULL; + } +- UFclose(uf); + TRAP_OFF; + + cache->loaded = IMG_FLAG_LOADED; +@@ -7371,6 +7528,7 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) + + init_stream(&f, SCM_LOCAL, newStrStream(tmp)); + loadHTMLstream(&f, newBuf, src, TRUE); ++ UFclose(&f); + if (src) + fclose(src); + +@@ -7580,8 +7738,11 @@ openGeneralPagerBuffer(InputStream stream) + #ifdef USE_M17N + content_charset = 0; + #endif ++ t_buf = newBuffer(INIT_BUFFER_WIDTH); ++ copyParsedURL(&t_buf->currentURL, NULL); ++ t_buf->currentURL.scheme = SCM_LOCAL; ++ t_buf->currentURL.file = "-"; + if (SearchHeader) { +- t_buf = newBuffer(INIT_BUFFER_WIDTH); + readHeader(&uf, t_buf, TRUE, NULL); + t = checkContentType(t_buf); + if (t == NULL) +@@ -7609,14 +7770,13 @@ openGeneralPagerBuffer(InputStream stream) + #ifdef USE_IMAGE + else if (activeImage && displayImage && !useExtImageViewer && + !(w3m_dump & ~DUMP_FRAME) && !strncasecmp(t, "image/", 6)) { +- cur_baseURL = New(ParsedURL); +- parseURL("-", cur_baseURL, NULL); + buf = loadImageBuffer(&uf, t_buf); + buf->type = "text/html"; + } + #endif + else { +- if (doExternal(uf, "-", t, &buf, t_buf)) { ++ if (searchExtViewer(t)) { ++ buf = doExternal(uf, t, t_buf); + UFclose(&uf); + if (buf == NULL || buf == NO_BUFFER) + return buf; +@@ -7629,8 +7789,6 @@ openGeneralPagerBuffer(InputStream stream) + } + } + buf->real_type = t; +- buf->currentURL.scheme = SCM_LOCAL; +- buf->currentURL.file = "-"; + return buf; + } + +@@ -7766,6 +7924,8 @@ save2tmp(URLFile uf, char *tmpf) + clen_t linelen = 0, trbyte = 0; + MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; + static JMP_BUF env_bak; ++ volatile int retval = 0; ++ char *volatile buf = NULL; + + ff = fopen(tmpf, "wb"); + if (ff == NULL) { +@@ -7802,30 +7962,29 @@ save2tmp(URLFile uf, char *tmpf) + else + #endif /* USE_NNTP */ + { +- Str buf = Strnew_size(SAVE_BUF_SIZE); +- while (UFread(&uf, buf, SAVE_BUF_SIZE)) { +- if (Strfputs(buf, ff) != buf->length) { +- bcopy(env_bak, AbortLoading, sizeof(JMP_BUF)); +- TRAP_OFF; +- fclose(ff); +- current_content_length = 0; +- return -2; ++ int count; ++ ++ buf = NewWithoutGC_N(char, SAVE_BUF_SIZE); ++ while ((count = ISread_n(uf.stream, buf, SAVE_BUF_SIZE)) > 0) { ++ if (fwrite(buf, 1, count, ff) != count) { ++ retval = -2; ++ goto _end; + } +- linelen += buf->length; ++ linelen += count; + showProgress(&linelen, &trbyte); + } + } + _end: + bcopy(env_bak, AbortLoading, sizeof(JMP_BUF)); + TRAP_OFF; ++ xfree(buf); + fclose(ff); + current_content_length = 0; +- return 0; ++ return retval; + } + +-int +-doExternal(URLFile uf, char *path, char *type, Buffer **bufp, +- Buffer *defaultbuf) ++Buffer * ++doExternal(URLFile uf, char *type, Buffer *defaultbuf) + { + Str tmpf, command; + struct mailcap *mcap; +@@ -7834,7 +7993,7 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, + char *header, *src = NULL, *ext = uf.ext; + + if (!(mcap = searchExtViewer(type))) +- return 0; ++ return NULL; + + if (mcap->nametemplate) { + tmpf = unquote_mailcap(mcap->nametemplate, NULL, "", NULL, NULL); +@@ -7867,15 +8026,13 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, + UFclose(&uf); + myExec(command->ptr); + } +- *bufp = NO_BUFFER; +- return 1; ++ return NO_BUFFER; + } + else + #endif + { + if (save2tmp(uf, tmpf->ptr) < 0) { +- *bufp = NULL; +- return 1; ++ return NULL; + } + } + if (mcap->flags & (MAILCAP_HTMLOUTPUT | MAILCAP_COPIOUSOUTPUT)) { +@@ -7918,14 +8075,13 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, + buf = NO_BUFFER; + } + if (buf && buf != NO_BUFFER) { +- buf->filename = path; +- if (buf->buffername == NULL || buf->buffername[0] == '\0') +- buf->buffername = conv_from_system(lastFileName(path)); ++ if ((buf->buffername == NULL || buf->buffername[0] == '\0') && ++ buf->filename) ++ buf->buffername = conv_from_system(lastFileName(buf->filename)); + buf->edit = mcap->edit; + buf->mailcap = mcap; + } +- *bufp = buf; +- return 1; ++ return buf; + } + + static int +@@ -7935,7 +8091,8 @@ _MoveFile(char *path1, char *path2) + FILE *f2; + int is_pipe; + clen_t linelen = 0, trbyte = 0; +- Str buf; ++ char *buf = NULL; ++ int count; + + f1 = openIS(path1); + if (f1 == NULL) +@@ -7953,12 +8110,13 @@ _MoveFile(char *path1, char *path2) + return -1; + } + current_content_length = 0; +- buf = Strnew_size(SAVE_BUF_SIZE); +- while (ISread(f1, buf, SAVE_BUF_SIZE)) { +- Strfputs(buf, f2); +- linelen += buf->length; ++ buf = NewWithoutGC_N(char, SAVE_BUF_SIZE); ++ while ((count = ISread_n(f1, buf, SAVE_BUF_SIZE)) > 0) { ++ fwrite(buf, 1, count, f2); ++ linelen += count; + showProgress(&linelen, &trbyte); + } ++ xfree(buf); + ISclose(f1); + if (is_pipe) + pclose(f2); +@@ -8317,21 +8475,23 @@ uncompress_stream(URLFile *uf, char **src) + } + if (pid2 == 0) { + /* child2 */ +- Str buf = Strnew_size(SAVE_BUF_SIZE); ++ char *buf = NewWithoutGC_N(char, SAVE_BUF_SIZE); ++ int count; + FILE *f = NULL; + + setup_child(TRUE, 2, UFfileno(uf)); + if (tmpf) + f = fopen(tmpf, "wb"); +- while (UFread(uf, buf, SAVE_BUF_SIZE)) { +- if (Strfputs(buf, stdout) < 0) ++ while ((count = ISread_n(uf->stream, buf, SAVE_BUF_SIZE)) > 0) { ++ if (fwrite(buf, 1, count, stdout) != count) ++ break; ++ if (f && fwrite(buf, 1, count, f) != count) + break; +- if (f) +- Strfputs(buf, f); + } + UFclose(uf); + if (f) + fclose(f); ++ xfree(buf); + exit(0); + } + /* child1 */ +diff --git a/fm.h b/fm.h +index 8378939..8f594dc 100644 +--- a/fm.h ++++ b/fm.h +@@ -76,6 +76,7 @@ typedef int wc_ces; /* XXX: not used */ + #include "textlist.h" + #include "funcname1.h" + #include "terms.h" ++#include "istream.h" + + #ifndef HAVE_BCOPY + void bcopy(const void *, void *, int); +@@ -264,6 +265,18 @@ extern int REV_LB[]; + #define IMG_FLAG_ERROR 2 + #define IMG_FLAG_DONT_REMOVE 4 + ++#define IS_EMPTY_PARSED_URL(pu) ((pu)->scheme == SCM_UNKNOWN && !(pu)->file) ++#define SCONF_RESERVED 0 ++#define SCONF_SUBSTITUTE_URL 1 ++#define SCONF_URL_CHARSET 2 ++#define SCONF_NO_REFERER_FROM 3 ++#define SCONF_NO_REFERER_TO 4 ++#define SCONF_N_FIELD 5 ++#define query_SCONF_SUBSTITUTE_URL(pu) ((const char *)querySiteconf(pu, SCONF_SUBSTITUTE_URL)) ++#define query_SCONF_URL_CHARSET(pu) ((const wc_ces *)querySiteconf(pu, SCONF_URL_CHARSET)) ++#define query_SCONF_NO_REFERER_FROM(pu) ((const int *)querySiteconf(pu, SCONF_NO_REFERER_FROM)) ++#define query_SCONF_NO_REFERER_TO(pu) ((const int *)querySiteconf(pu, SCONF_NO_REFERER_TO)) ++ + /* + * Macros. + */ +@@ -276,8 +289,6 @@ extern int REV_LB[]; + #define inputFilenameHist(p,d,h) inputLineHist(p,d,IN_FILENAME,h) + #define inputChar(p) inputLine(p,"",IN_CHAR) + +-#define free(x) GC_free(x) /* let GC do it. */ +- + #ifdef __EMX__ + #define HAVE_STRCASECMP + #define strcasecmp stricmp +@@ -362,6 +373,8 @@ typedef struct _imageCache { + int index; + short width; + short height; ++ short a_width; ++ short a_height; + } ImageCache; + + typedef struct _image { +@@ -562,6 +575,13 @@ typedef struct _DownloadList { + #define INIT_BUFFER_WIDTH ((_INIT_BUFFER_WIDTH > 0) ? _INIT_BUFFER_WIDTH : 0) + #define FOLD_BUFFER_WIDTH (FoldLine ? (INIT_BUFFER_WIDTH + 1) : -1) + ++struct input_alt_attr { ++ int hseq; ++ int fid; ++ int in; ++ Str type, name, value; ++}; ++ + typedef struct { + int pos; + int len; +@@ -569,6 +589,7 @@ typedef struct { + long flag; + Anchor anchor; + Str img_alt; ++ struct input_alt_attr input_alt; + char fontstat[FONTSTAT_SIZE]; + short nobr_level; + Lineprop prev_ctype; +@@ -591,6 +612,7 @@ struct readbuffer { + short nobr_level; + Anchor anchor; + Str img_alt; ++ struct input_alt_attr input_alt; + char fontstat[FONTSTAT_SIZE]; + char fontstat_stack[FONT_STACK_SIZE][FONTSTAT_SIZE]; + int fontstat_sp; +@@ -874,6 +896,9 @@ global char *index_file init(NULL); + + global char *CurrentDir; + global int CurrentPid; ++#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) ++global char *MyProgramName init("w3m"); ++#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ + /* + * global Buffer *Currentbuf; + * global Buffer *Firstbuf; +@@ -896,6 +921,7 @@ global char *CurrentKeyData; + global char *CurrentCmdData; + global char *w3m_reqlog; + extern char *w3m_version; ++extern int enable_inline_image; + + #define DUMP_BUFFER 0x01 + #define DUMP_HEAD 0x02 +@@ -972,6 +998,7 @@ global int BackgroundExtViewer init(TRUE); + global int disable_secret_security_check init(FALSE); + global char *passwd_file init(PASSWD_FILE); + global char *pre_form_file init(PRE_FORM_FILE); ++global char *siteconf_file init(SITECONF_FILE); + global char *ftppasswd init(NULL); + global int ftppass_hostnamegen init(TRUE); + global int do_download init(FALSE); +@@ -1065,7 +1092,7 @@ global char SimplePreserveSpace init(FALSE); + #define wc_Str_conv(x,charset0,charset1) (x) + #define wc_Str_conv_strict(x,charset0,charset1) (x) + #endif +-global char UseAltEntity init(TRUE); ++global char UseAltEntity init(FALSE); + #define GRAPHIC_CHAR_ASCII 2 + #define GRAPHIC_CHAR_DEC 1 + #define GRAPHIC_CHAR_CHARSET 0 +@@ -1135,7 +1162,7 @@ global int view_unseenobject init(TRUE); + #endif + + #if defined(USE_SSL) && defined(USE_SSL_VERIFY) +-global int ssl_verify_server init(FALSE); ++global int ssl_verify_server init(TRUE); + global char *ssl_cert_file init(NULL); + global char *ssl_key_file init(NULL); + global char *ssl_ca_path init(NULL); +@@ -1144,15 +1171,17 @@ global int ssl_path_modified init(FALSE); + #endif /* defined(USE_SSL) && + * defined(USE_SSL_VERIFY) */ + #ifdef USE_SSL +-global char *ssl_forbid_method init(NULL); ++global char *ssl_forbid_method init("2, 3"); + #endif + + global int is_redisplay init(FALSE); + global int clear_buffer init(TRUE); + global double pixel_per_char init(DEFAULT_PIXEL_PER_CHAR); ++global int pixel_per_char_i init(DEFAULT_PIXEL_PER_CHAR); + global int set_pixel_per_char init(FALSE); + #ifdef USE_IMAGE + global double pixel_per_line init(DEFAULT_PIXEL_PER_LINE); ++global int pixel_per_line_i init(DEFAULT_PIXEL_PER_LINE); + global int set_pixel_per_line init(FALSE); + global double image_scale init(100); + #endif +diff --git a/form.c b/form.c +index b7556ca..62b568e 100644 +--- a/form.c ++++ b/form.c +@@ -196,7 +196,7 @@ formtype(char *typestr) + if (!strcasecmp(typestr, _formtypetbl[i])) + return i; + } +- return FORM_UNKNOWN; ++ return FORM_INPUT_TEXT; + } + + void +@@ -787,7 +787,7 @@ struct pre_form { + static struct pre_form *PreForm = NULL; + + static struct pre_form * +-add_pre_form(struct pre_form *prev, char *url, char *name, char *action) ++add_pre_form(struct pre_form *prev, char *url, Regex *re_url, char *name, char *action) + { + ParsedURL pu; + struct pre_form *new; +@@ -796,21 +796,13 @@ add_pre_form(struct pre_form *prev, char *url, char *name, char *action) + new = prev->next = New(struct pre_form); + else + new = PreForm = New(struct pre_form); +- if (url && *url == '/') { +- int l = strlen(url); +- if (l > 1 && url[l - 1] == '/') +- new->url = allocStr(url + 1, l - 2); +- else +- new->url = url + 1; +- new->re_url = newRegex(new->url, FALSE, NULL, NULL); +- if (!new->re_url) +- new->url = NULL; +- } +- else if (url) { ++ if (url && !re_url) { + parseURL2(url, &pu, NULL); + new->url = parsedURL2Str(&pu)->ptr; +- new->re_url = NULL; + } ++ else ++ new->url = url; ++ new->re_url = re_url; + new->name = (name && *name) ? name : NULL; + new->action = (action && *action) ? action : NULL; + new->item = NULL; +@@ -834,7 +826,7 @@ add_pre_form_item(struct pre_form *pf, struct pre_form_item *prev, int type, + new->name = name; + new->value = value; + if (checked && *checked && (!strcmp(checked, "0") || +- strcasecmp(checked, "off") ++ !strcasecmp(checked, "off") + || !strcasecmp(checked, "no"))) + new->checked = 0; + else +@@ -875,6 +867,7 @@ loadPreForm(void) + return; + while (1) { + char *p, *s, *arg; ++ Regex *re_arg; + + line = Strfgets(fp); + if (line->length == 0) +@@ -890,18 +883,20 @@ loadPreForm(void) + if (*p == '#' || *p == '\0') + continue; /* comment or empty line */ + s = getWord(&p); +- arg = getWord(&p); + + if (!strcmp(s, "url")) { ++ arg = getRegexWord((const char **)&p, &re_arg); + if (!arg || !*arg) + continue; + p = getQWord(&p); +- pf = add_pre_form(pf, arg, NULL, p); ++ pf = add_pre_form(pf, arg, re_arg, NULL, p); + pi = pf->item; + continue; + } + if (!pf) + continue; ++ ++ arg = getWord(&p); + if (!strcmp(s, "form")) { + if (!arg || !*arg) + continue; +@@ -913,7 +908,7 @@ loadPreForm(void) + } + if (pf->item) { + struct pre_form *prev = pf; +- pf = add_pre_form(prev, "", s, p); ++ pf = add_pre_form(prev, "", NULL, s, p); + /* copy previous URL */ + pf->url = prev->url; + pf->re_url = prev->re_url; +diff --git a/frame.c b/frame.c +index b431437..48c2d72 100644 +--- a/frame.c ++++ b/frame.c +@@ -91,7 +91,8 @@ newFrame(struct parsed_tag *tag, Buffer *buf) + body->baseURL = baseURL(buf); + if (tag) { + if (parsedtag_get_value(tag, ATTR_SRC, &p)) +- body->url = url_quote_conv(remove_space(p), buf->document_charset); ++ body->url = url_encode(remove_space(p), body->baseURL, ++ buf->document_charset); + if (parsedtag_get_value(tag, ATTR_NAME, &p) && *p != '_') + body->name = url_quote_conv(p, buf->document_charset); + } +@@ -639,7 +640,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level, + case HTML_BASE: + /* "BASE" is prohibit tag */ + if (parsedtag_get_value(tag, ATTR_HREF, &q)) { +- q = url_quote_conv(remove_space(q), charset); ++ q = url_encode(remove_space(q), NULL, charset); + parseURL(q, &base, NULL); + } + if (parsedtag_get_value(tag, ATTR_TARGET, &q)) { +@@ -768,8 +769,8 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level, + if (!tag->value[j]) + break; + tag->value[j] = +- url_quote_conv(remove_space(tag->value[j]), +- charset); ++ url_encode(remove_space(tag->value[j]), ++ &base, charset); + tag->need_reconstruct = TRUE; + parseURL2(tag->value[j], &url, &base); + if (url.scheme == SCM_UNKNOWN || +diff --git a/func.c b/func.c +index f389e00..8b5deac 100644 +--- a/func.c ++++ b/func.c +@@ -8,6 +8,7 @@ + #include "fm.h" + #include "func.h" + #include "myctype.h" ++#include "regex.h" + + #include "funcname.c" + #include "functable.c" +@@ -434,6 +435,93 @@ getQWord(char **str) + return tmp->ptr; + } + ++/* This extracts /regex/i or m@regex@i from the given string. ++ * Then advances *str to the end of regex. ++ * If the input does not seems to be a regex, this falls back to getQWord(). ++ * ++ * Returns a word (no matter whether regex or not) in the give string. ++ * If regex_ret is non-NULL, compiles the regex and stores there. ++ * ++ * XXX: Actually this is unrelated to func.c. ++ */ ++char * ++getRegexWord(const char **str, Regex **regex_ret) ++{ ++ char *word = NULL; ++ const char *p, *headp, *bodyp, *tailp; ++ char delimiter; ++ int esc; ++ int igncase = 0; ++ ++ p = *str; ++ SKIP_BLANKS(p); ++ headp = p; ++ ++ /* Get the opening delimiter */ ++ if (p[0] == 'm' && IS_PRINT(p[1]) && !IS_ALNUM(p[1]) && p[1] != '\\') { ++ delimiter = p[1]; ++ p += 2; ++ } ++ else if (p[0] == '/') { ++ delimiter = '/'; ++ p += 1; ++ } ++ else { ++ goto not_regex; ++ } ++ bodyp = p; ++ ++ /* Scan the end of the expression */ ++ for (esc = 0; *p; ++p) { ++ if (esc) { ++ esc = 0; ++ } else { ++ if (*p == delimiter) ++ break; ++ else if (*p == '\\') ++ esc = 1; ++ } ++ } ++ if (!*p && *headp == '/') ++ goto not_regex; ++ tailp = p; ++ ++ /* Check the modifiers */ ++ if (*p == delimiter) { ++ while (*++p && !IS_SPACE(*p)) { ++ switch (*p) { ++ case 'i': ++ igncase = 1; ++ break; ++ } ++ /* ignore unknown modifiers */ ++ } ++ } ++ ++ /* Save the expression */ ++ word = allocStr(headp, p - headp); ++ ++ /* Compile */ ++ if (regex_ret) { ++ if (*tailp == delimiter) ++ word[tailp - headp] = 0; ++ *regex_ret = newRegex(word + (bodyp - headp), igncase, NULL, NULL); ++ if (*tailp == delimiter) ++ word[tailp - headp] = delimiter; ++ } ++ goto last; ++ ++not_regex: ++ p = headp; ++ word = getQWord((char **)&p); ++ if (regex_ret) ++ *regex_ret = NULL; ++ ++last: ++ *str = p; ++ return word; ++} ++ + #ifdef USE_MOUSE + static MouseAction default_mouse_action = { + NULL, +diff --git a/history.c b/history.c +index 951ef83..e9be09b 100644 +--- a/history.c ++++ b/history.c +@@ -17,7 +17,7 @@ historyBuffer(Hist *hist) + for (item = hist->list->last; item; item = item->prev) { + q = html_quote((char *)item->ptr); + if (DecodeURL) +- p = html_quote(url_unquote_conv((char *)item->ptr, 0)); ++ p = html_quote(url_decode2((char *)item->ptr, NULL)); + else + p = q; + Strcat_charp(src, "<li><a href=\""); +diff --git a/html.c b/html.c +index bca227e..d9f08e9 100644 +--- a/html.c ++++ b/html.c +@@ -56,6 +56,9 @@ unsigned char ALST_INPUT[] = + ATTR_CORE + }; + #define MAXA_INPUT MAXA_CORE + 12 ++unsigned char ALST_BUTTON[] = ++ { ATTR_TYPE, ATTR_VALUE, ATTR_NAME, ATTR_CORE }; ++#define MAXA_BUTTON MAXA_CORE + 3 + unsigned char ALST_TEXTAREA[] = + { ATTR_COLS, ATTR_ROWS, ATTR_NAME, ATTR_READONLY, ATTR_CORE }; + #define MAXA_TEXTAREA MAXA_CORE + 4 +@@ -247,24 +250,24 @@ TagInfo TagMAP[MAX_HTMLTAG] = { + {"/bdo", NULL, 0, TFLG_END}, /* 121 HTML_N_BDO */ + {"big", ALST_NOP, MAXA_NOP, 0}, /* 122 HTML_BIG */ + {"/big", NULL, 0, TFLG_END}, /* 123 HTML_N_BIG */ +- {"button", ALST_NOP, MAXA_NOP, 0}, /* 124 HTML_BUTTON */ +- {"fieldset", ALST_NOP, MAXA_NOP, 0}, /* 125 HTML_FIELDSET */ +- {"/fieldset", NULL, 0, TFLG_END}, /* 126 HTML_N_FIELDSET */ +- {"iframe", ALST_NOP, MAXA_NOP, 0}, /* 127 HTML_IFRAME */ +- {"label", ALST_NOP, MAXA_NOP, 0}, /* 128 HTML_LABEL */ +- {"/label", NULL, 0, TFLG_END}, /* 129 HTML_N_LABEL */ +- {"legend", ALST_NOP, MAXA_NOP, 0}, /* 130 HTML_LEGEND */ +- {"/legend", NULL, 0, TFLG_END}, /* 131 HTML_N_LEGEND */ +- {"noscript", ALST_NOP, MAXA_NOP, 0}, /* 132 HTML_NOSCRIPT */ +- {"/noscript", NULL, 0, TFLG_END}, /* 133 HTML_N_NOSCRIPT */ +- {"object", ALST_NOP, MAXA_NOP, 0}, /* 134 HTML_OBJECT */ +- {"optgroup", ALST_NOP, MAXA_NOP, 0}, /* 135 HTML_OPTGROUP */ +- {"/optgroup", NULL, 0, TFLG_END}, /* 136 HTML_N_OPTGROUP */ +- {"param", ALST_NOP, MAXA_NOP, 0}, /* 137 HTML_PARAM */ +- {"small", ALST_NOP, MAXA_NOP, 0}, /* 138 HTML_SMALL */ +- {"/small", NULL, 0, TFLG_END}, /* 139 HTML_N_SMALL */ ++ {"button", ALST_BUTTON, MAXA_BUTTON, 0}, /* 124 HTML_BUTTON */ ++ {"/button", NULL, 0, TFLG_END}, /* 125 HTML_N_BUTTON */ ++ {"fieldset", ALST_NOP, MAXA_NOP, 0}, /* 126 HTML_FIELDSET */ ++ {"/fieldset", NULL, 0, TFLG_END}, /* 127 HTML_N_FIELDSET */ ++ {"iframe", ALST_NOP, MAXA_NOP, 0}, /* 128 HTML_IFRAME */ ++ {"label", ALST_NOP, MAXA_NOP, 0}, /* 129 HTML_LABEL */ ++ {"/label", NULL, 0, TFLG_END}, /* 130 HTML_N_LABEL */ ++ {"legend", ALST_NOP, MAXA_NOP, 0}, /* 131 HTML_LEGEND */ ++ {"/legend", NULL, 0, TFLG_END}, /* 132 HTML_N_LEGEND */ ++ {"noscript", ALST_NOP, MAXA_NOP, 0}, /* 133 HTML_NOSCRIPT */ ++ {"/noscript", NULL, 0, TFLG_END}, /* 134 HTML_N_NOSCRIPT */ ++ {"object", ALST_NOP, MAXA_NOP, 0}, /* 135 HTML_OBJECT */ ++ {"optgroup", ALST_NOP, MAXA_NOP, 0}, /* 136 HTML_OPTGROUP */ ++ {"/optgroup", NULL, 0, TFLG_END}, /* 137 HTML_N_OPTGROUP */ ++ {"param", ALST_NOP, MAXA_NOP, 0}, /* 138 HTML_PARAM */ ++ {"small", ALST_NOP, MAXA_NOP, 0}, /* 139 HTML_SMALL */ ++ {"/small", NULL, 0, TFLG_END}, /* 140 HTML_N_SMALL */ + +- {NULL, NULL, 0, 0}, /* 140 Undefined */ + {NULL, NULL, 0, 0}, /* 141 Undefined */ + {NULL, NULL, 0, 0}, /* 142 Undefined */ + {NULL, NULL, 0, 0}, /* 143 Undefined */ +diff --git a/html.h b/html.h +index 7abbd3b..b4b3df9 100644 +--- a/html.h ++++ b/html.h +@@ -1,19 +1,17 @@ + /* $Id: html.h,v 1.31 2010/08/14 01:29:40 htrb Exp $ */ + #ifndef _HTML_H + #define _HTML_H ++#include "config.h" + #ifdef USE_SSL + #include <openssl/bio.h> + #include <openssl/x509.h> + #include <openssl/ssl.h> + #endif /* USE_SSL */ + +-#include "istream.h" +- + #define StrUFgets(f) StrISgets((f)->stream) + #define StrmyUFgets(f) StrmyISgets((f)->stream) + #define UFgetc(f) ISgetc((f)->stream) + #define UFundogetc(f) ISundogetc((f)->stream) +-#define UFread(f,buf,len) ISread((f)->stream,buf,len) + #define UFclose(f) (void)(ISclose((f)->stream) == 0 && ((f)->stream = NULL)) + #define UFfileno(f) ISfileno((f)->stream) + +@@ -62,11 +60,12 @@ typedef struct _ParsedURL { + int is_nocache; + } ParsedURL; + ++union input_stream; + typedef struct { + unsigned char scheme; + char is_cgi; + char encoding; +- InputStream stream; ++ union input_stream *stream; + char *ext; + int compression; + int content_encoding; +@@ -214,21 +213,22 @@ typedef struct { + #define HTML_BIG 122 + #define HTML_N_BIG 123 + #define HTML_BUTTON 124 +-#define HTML_FIELDSET 125 +-#define HTML_N_FIELDSET 126 +-#define HTML_IFRAME 127 +-#define HTML_LABEL 128 +-#define HTML_N_LABEL 129 +-#define HTML_LEGEND 130 +-#define HTML_N_LEGEND 131 +-#define HTML_NOSCRIPT 132 +-#define HTML_N_NOSCRIPT 133 +-#define HTML_OBJECT 134 +-#define HTML_OPTGROUP 135 +-#define HTML_N_OPTGROUP 136 +-#define HTML_PARAM 137 +-#define HTML_SMALL 138 +-#define HTML_N_SMALL 139 ++#define HTML_N_BUTTON 125 ++#define HTML_FIELDSET 126 ++#define HTML_N_FIELDSET 127 ++#define HTML_IFRAME 128 ++#define HTML_LABEL 129 ++#define HTML_N_LABEL 130 ++#define HTML_LEGEND 131 ++#define HTML_N_LEGEND 132 ++#define HTML_NOSCRIPT 133 ++#define HTML_N_NOSCRIPT 134 ++#define HTML_OBJECT 135 ++#define HTML_OPTGROUP 136 ++#define HTML_N_OPTGROUP 137 ++#define HTML_PARAM 138 ++#define HTML_SMALL 139 ++#define HTML_N_SMALL 140 + + /* pseudo tag */ + #define HTML_SELECT_INT 160 +diff --git a/image.c b/image.c +index 5f5991a..91034ee 100644 +--- a/image.c ++++ b/image.c +@@ -44,6 +44,8 @@ initImage() + activeImage = TRUE; + } + ++int get_pixel_per_cell(int *ppc, int *ppl); ++ + int + getCharSize() + { +@@ -52,6 +54,24 @@ getCharSize() + int w = 0, h = 0; + + set_environ("W3M_TTY", ttyname_tty()); ++ ++ if (enable_inline_image) { ++ int ppc, ppl; ++ ++ if (get_pixel_per_cell(&ppc,&ppl)) { ++ pixel_per_char_i = ppc ; ++ pixel_per_line_i = ppl ; ++ pixel_per_char = (double)ppc; ++ pixel_per_line = (double)ppl; ++ } ++ else { ++ pixel_per_char_i = (int)pixel_per_char; ++ pixel_per_line_i = (int)pixel_per_line; ++ } ++ ++ return TRUE; ++ } ++ + tmp = Strnew(); + if (!strchr(Imgdisplay, '/')) + Strcat_m_charp(tmp, w3m_auxbin_dir(), "/", NULL); +@@ -90,17 +110,18 @@ termImage() + static int + openImgdisplay() + { ++ char *cmd; ++ ++ if (!strchr(Imgdisplay, '/')) ++ cmd = Strnew_m_charp(w3m_auxbin_dir(), "/", Imgdisplay, NULL)->ptr; ++ else ++ cmd = Imgdisplay; + Imgdisplay_pid = open_pipe_rw(&Imgdisplay_rf, &Imgdisplay_wf); + if (Imgdisplay_pid < 0) + goto err0; + if (Imgdisplay_pid == 0) { + /* child */ +- char *cmd; + setup_child(FALSE, 2, -1); +- if (!strchr(Imgdisplay, '/')) +- cmd = Strnew_m_charp(w3m_auxbin_dir(), "/", Imgdisplay, NULL)->ptr; +- else +- cmd = Imgdisplay; + myExec(cmd); + /* XXX: ifdef __EMX__, use start /f ? */ + } +@@ -155,6 +176,10 @@ addImage(ImageCache * cache, int x, int y, int sx, int sy, int w, int h) + static void + syncImage(void) + { ++ if (enable_inline_image) { ++ return; ++ } ++ + fputs("3;\n", Imgdisplay_wf); /* XSync() */ + fputs("4;\n", Imgdisplay_wf); /* put '\n' */ + while (fflush(Imgdisplay_wf) != 0) { +@@ -170,12 +195,16 @@ syncImage(void) + n_terminal_image = 0; + } + ++void put_image_osc5379(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh, int n_terminal_image); ++void put_image_sixel(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh, int n_terminal_image); ++ + void + drawImage() + { + static char buf[64]; + int j, draw = FALSE; + TerminalImage *i; ++ struct stat st ; + + if (!activeImage) + return; +@@ -183,6 +212,47 @@ drawImage() + return; + for (j = 0; j < n_terminal_image; j++) { + i = &terminal_image[j]; ++ ++ if (enable_inline_image) { ++ #if 0 ++ fprintf(stderr,"file %s x %d y %d w %d h %d sx %d sy %d sw %d sh %d (ppc %d ppl %d)\n", ++ ((enable_inline_image == 2 || getenv("WINDOWID")) && ++ i->cache->touch) ? i->cache->file : i->cache->url, ++ i->x, i->y, ++ i->cache->width > 0 ? i->cache->width : 0, ++ i->cache->height > 0 ? i->cache->height : 0, ++ i->sx, i->sy, i->width, i->height, ++ pixel_per_char_i, pixel_per_line_i); ++ #endif ++ (enable_inline_image == 2 ? put_image_sixel : put_image_osc5379)( ++ ((enable_inline_image == 2 /* sixel */ || getenv("WINDOWID")) && ++ /* XXX I don't know why but sometimes i->cache->file doesn't exist. */ ++ i->cache->touch && stat(i->cache->file,&st) == 0) ? ++ /* local */ i->cache->file : /* remote */ i->cache->url, ++ i->x / pixel_per_char_i, ++ i->y / pixel_per_line_i, ++ #if 1 ++ i->cache->a_width > 0 ? ++ (i->cache->width + i->x % pixel_per_char_i + pixel_per_char_i - 1) / ++ pixel_per_char_i : ++ #endif ++ 0, ++ ++ #if 1 ++ i->cache->a_height > 0 ? ++ (i->cache->height + i->y % pixel_per_line_i + pixel_per_line_i - 1) / ++ pixel_per_line_i : ++ #endif ++ 0, ++ i->sx / pixel_per_char_i, ++ i->sy / pixel_per_line_i, ++ (i->width + i->sx % pixel_per_char_i + pixel_per_char_i - 1) / pixel_per_char_i, ++ (i->height + i->sy % pixel_per_line_i + pixel_per_line_i - 1) / pixel_per_line_i, ++ n_terminal_image); ++ ++ continue ; ++ } ++ + if (!(i->cache->loaded & IMG_FLAG_LOADED && + i->width > 0 && i->height > 0)) + continue; +@@ -206,9 +276,15 @@ drawImage() + fputs("\n", Imgdisplay_wf); + draw = TRUE; + } +- if (!draw) +- return; +- syncImage(); ++ ++ if (!enable_inline_image) { ++ if (!draw) ++ return; ++ syncImage(); ++ } ++ else ++ n_terminal_image = 0; ++ + touch_cursor(); + refresh(); + } +@@ -320,6 +396,8 @@ showImageProgress(Buffer *buf) + } + } + if (n) { ++ if (enable_inline_image && n == l) ++ drawImage(); + message(Sprintf("%d/%d images loaded", l, n)->ptr, + buf->cursorX + buf->rootX, buf->cursorY + buf->rootY); + refresh(); +@@ -333,6 +411,9 @@ loadImage(Buffer *buf, int flag) + struct stat st; + int i, draw = FALSE; + /* int wait_st; */ ++#ifdef DONT_CALL_GC_AFTER_FORK ++ char *loadargs[7]; ++#endif + + if (maxLoadImage > MAX_LOAD_IMAGE) + maxLoadImage = MAX_LOAD_IMAGE; +@@ -346,7 +427,7 @@ loadImage(Buffer *buf, int flag) + } + for (i = 0; i < n_load_image; i++) { + cache = image_cache[i]; +- if (!cache) ++ if (!cache || !cache->touch) + continue; + if (lstat(cache->touch, &st)) + continue; +@@ -377,7 +458,7 @@ loadImage(Buffer *buf, int flag) + + for (i = (buf != image_buffer) ? 0 : maxLoadImage; i < n_load_image; i++) { + cache = image_cache[i]; +- if (!cache) ++ if (!cache || !cache->touch) + continue; + if (cache->pid) { + kill(cache->pid, SIGKILL); +@@ -403,7 +484,8 @@ loadImage(Buffer *buf, int flag) + } + + if (draw && image_buffer) { +- drawImage(); ++ if (!enable_inline_image) ++ drawImage(); + showImageProgress(image_buffer); + } + +@@ -431,8 +513,29 @@ loadImage(Buffer *buf, int flag) + break; + } + image_cache[i] = cache; ++ if (!cache->touch) { ++ continue; ++ } + + flush_tty(); ++#ifdef DONT_CALL_GC_AFTER_FORK ++ loadargs[0] = MyProgramName; ++ loadargs[1] = "-$$getimage"; ++ loadargs[2] = conv_to_system(cache->url); ++ loadargs[3] = conv_to_system(parsedURL2Str(cache->current)->ptr); ++ loadargs[4] = cache->file; ++ loadargs[5] = cache->touch; ++ loadargs[6] = NULL; ++ if ((cache->pid = fork()) == 0) { ++ setup_child(FALSE, 0, -1); ++ execvp(MyProgramName, loadargs); ++ exit(1); ++ } ++ else if (cache->pid < 0) { ++ cache->pid = 0; ++ return; ++ } ++#else /* !DONT_CALL_GC_AFTER_FORK */ + if ((cache->pid = fork()) == 0) { + Buffer *b; + /* +@@ -458,6 +561,7 @@ loadImage(Buffer *buf, int flag) + cache->pid = 0; + return; + } ++#endif /* !DONT_CALL_GC_AFTER_FORK */ + } + } + +@@ -492,12 +596,30 @@ getImage(Image * image, ParsedURL *current, int flag) + cache->url = image->url; + cache->current = current; + cache->file = tmpfname(TMPF_DFL, image->ext)->ptr; +- cache->touch = tmpfname(TMPF_DFL, NULL)->ptr; + cache->pid = 0; + cache->index = 0; + cache->loaded = IMG_FLAG_UNLOADED; +- cache->width = image->width; +- cache->height = image->height; ++ if (enable_inline_image == 1) { ++ if (image->width > 0 && image->width % pixel_per_char_i > 0) ++ image->width += (pixel_per_char_i - image->width % pixel_per_char_i); ++ ++ if (image->height > 0 && image->height % pixel_per_line_i > 0) ++ image->height += (pixel_per_line_i - image->height % pixel_per_line_i); ++ if (image->height > 0 && image->width > 0) { ++ cache->loaded = IMG_FLAG_LOADED; ++ } ++ } ++ if (cache->loaded == IMG_FLAG_UNLOADED) { ++ cache->touch = tmpfname(TMPF_DFL, NULL)->ptr; ++ } ++ else { ++ cache->touch = NULL; ++ } ++ ++ cache->width = image->width ; ++ cache->height = image->height ; ++ cache->a_width = image->width; ++ cache->a_height = image->height; + putHash_sv(image_hash, key->ptr, (void *)cache); + } + if (flag != IMG_FLAG_SKIP) { +@@ -519,6 +641,78 @@ getImage(Image * image, ParsedURL *current, int flag) + return cache; + } + ++static int ++parseImageHeader(char *path, u_int *width, u_int *height) ++{ ++ FILE *fp; ++ u_char buf[8]; ++ ++ if (!(fp = fopen(path, "r"))) return FALSE; ++ ++ if (fread(buf, 1, 2, fp) != 2) goto error; ++ ++ if (memcmp(buf, "\xff\xd8", 2) == 0) { ++ /* JPEG */ ++ if (fseek(fp, 2, SEEK_CUR) < 0) goto error; /* 0xffe0 */ ++ while (fread(buf, 1, 2, fp) == 2) { ++ size_t len = ((buf[0] << 8) | buf[1]) - 2; ++ if (fseek(fp, len, SEEK_CUR) < 0) goto error; ++ if (fread(buf, 1, 2, fp) == 2 && ++ /* SOF0 or SOF2 */ ++ (memcmp(buf, "\xff\xc0", 2) == 0 || memcmp(buf, "\xff\xc2", 2) == 0)) { ++ fseek(fp, 3, SEEK_CUR); ++ if (fread(buf, 1, 2, fp) == 2) { ++ *height = (buf[0] << 8) | buf[1]; ++ if (fread(buf, 1, 2, fp) == 2) { ++ *width = (buf[0] << 8) | buf[1]; ++ goto success; ++ } ++ } ++ break; ++ } ++ } ++ goto error; ++ } ++ ++ if (fread(buf + 2, 1, 1, fp) != 1) goto error; ++ ++ if (memcmp(buf, "GIF", 3) == 0) { ++ /* GIF */ ++ if (fseek(fp, 3, SEEK_CUR) < 0) goto error; ++ if (fread(buf, 1, 2, fp) == 2) { ++ *width = (buf[1] << 8) | buf[0]; ++ if (fread(buf, 1, 2, fp) == 2) { ++ *height = (buf[1] << 8) | buf[0]; ++ goto success; ++ } ++ } ++ goto error; ++ } ++ ++ if (fread(buf + 3, 1, 5, fp) != 5) goto error; ++ ++ if (memcmp(buf, "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8) == 0) { ++ /* PNG */ ++ if (fseek(fp, 8, SEEK_CUR) < 0) goto error; ++ if (fread(buf, 1, 4, fp) == 4) { ++ *width = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; ++ if (fread(buf, 1, 4, fp) == 4) { ++ *height = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; ++ goto success; ++ } ++ } ++ goto error; ++ } ++ ++error: ++ fclose(fp); ++ return FALSE; ++ ++success: ++ fclose(fp); ++ return TRUE; ++} ++ + int + getImageSize(ImageCache * cache) + { +@@ -531,6 +725,10 @@ getImageSize(ImageCache * cache) + if (!cache || !(cache->loaded & IMG_FLAG_LOADED) || + (cache->width > 0 && cache->height > 0)) + return FALSE; ++ ++ if (parseImageHeader(cache->file, &w, &h)) ++ goto got_image_size; ++ + tmp = Strnew(); + if (!strchr(Imgdisplay, '/')) + Strcat_m_charp(tmp, w3m_auxbin_dir(), "/", NULL); +@@ -546,6 +744,8 @@ getImageSize(ImageCache * cache) + + if (!(w > 0 && h > 0)) + return FALSE; ++ ++got_image_size: + w = (int)(w * image_scale / 100 + 0.5); + if (w == 0) + w = 1; +@@ -558,11 +758,11 @@ getImageSize(ImageCache * cache) + } + else if (cache->width < 0) { + int tmp = (int)((double)cache->height * w / h + 0.5); +- cache->width = (tmp > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : tmp; ++ cache->a_width = cache->width = (tmp > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : tmp; + } + else if (cache->height < 0) { + int tmp = (int)((double)cache->width * h / w + 0.5); +- cache->height = (tmp > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : tmp; ++ cache->a_height = cache->height = (tmp > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : tmp; + } + if (cache->width == 0) + cache->width = 1; +diff --git a/indep.c b/indep.c +index 65b04aa..5c5de06 100644 +--- a/indep.c ++++ b/indep.c +@@ -357,6 +357,20 @@ strcasemstr(char *str, char *srch[], char **ret_ptr) + return -1; + } + ++int ++strmatchlen(const char *s1, const char *s2, int maxlen) ++{ ++ int i; ++ ++ /* To allow the maxlen to be negatie (infinity), ++ * compare by "!=" instead of "<=". */ ++ for (i = 0; i != maxlen; ++i) { ++ if (!s1[i] || !s2[i] || s1[i] != s2[i]) ++ break; ++ } ++ return i; ++} ++ + char * + remove_space(char *str) + { +@@ -707,6 +721,111 @@ shell_quote(char *str) + return str; + } + ++void * ++xrealloc(void *ptr, size_t size) ++{ ++ void *newptr = realloc(ptr, size); ++ if (newptr == NULL) { ++ fprintf(stderr, "Out of memory\n"); ++ exit(-1); ++ } ++ return newptr; ++} ++ ++/* Define this as a separate function in case the free() has ++ * an incompatible prototype. */ ++void ++xfree(void *ptr) ++{ ++ free(ptr); ++} ++ ++void * ++w3m_GC_realloc_atomic(void *ptr, size_t size) ++{ ++ return ptr ? GC_REALLOC(ptr, size) : GC_MALLOC_ATOMIC(size); ++} ++ ++void ++w3m_GC_free(void *ptr) ++{ ++ GC_FREE(ptr); ++} ++ ++void ++growbuf_init(struct growbuf *gb) ++{ ++ gb->ptr = NULL; ++ gb->length = 0; ++ gb->area_size = 0; ++ gb->realloc_proc = &w3m_GC_realloc_atomic; ++ gb->free_proc = &w3m_GC_free; ++} ++ ++void ++growbuf_init_without_GC(struct growbuf *gb) ++{ ++ gb->ptr = NULL; ++ gb->length = 0; ++ gb->area_size = 0; ++ gb->realloc_proc = &xrealloc; ++ gb->free_proc = &xfree; ++} ++ ++void ++growbuf_clear(struct growbuf *gb) ++{ ++ (*gb->free_proc) (gb->ptr); ++ gb->ptr = NULL; ++ gb->length = 0; ++ gb->area_size = 0; ++} ++ ++Str ++growbuf_to_Str(struct growbuf *gb) ++{ ++ Str s; ++ ++ if (gb->free_proc == &w3m_GC_free) { ++ growbuf_reserve(gb, gb->length + 1); ++ gb->ptr[gb->length] = '\0'; ++ s = New(struct _Str); ++ s->ptr = gb->ptr; ++ s->length = gb->length; ++ s->area_size = gb->area_size; ++ } else { ++ s = Strnew_charp_n(gb->ptr, gb->length); ++ (*gb->free_proc) (gb->ptr); ++ } ++ gb->ptr = NULL; ++ gb->length = 0; ++ gb->area_size = 0; ++ return s; ++} ++ ++void ++growbuf_reserve(struct growbuf *gb, int leastarea) ++{ ++ int newarea; ++ ++ if (gb->area_size < leastarea) { ++ newarea = gb->area_size * 3 / 2; ++ if (newarea < leastarea) ++ newarea = leastarea; ++ newarea += 16; ++ gb->ptr = (*gb->realloc_proc) (gb->ptr, newarea); ++ gb->area_size = newarea; ++ } ++} ++ ++void ++growbuf_append(struct growbuf *gb, const char *src, int len) ++{ ++ growbuf_reserve(gb, gb->length + len); ++ memcpy(&gb->ptr[gb->length], src, len); ++ gb->length += len; ++} ++ + static char * + w3m_dir(const char *name, char *dft) + { +diff --git a/indep.h b/indep.h +index b3819a3..2809832 100644 +--- a/indep.h ++++ b/indep.h +@@ -1,7 +1,7 @@ + /* $Id: indep.h,v 1.16 2003/09/22 21:02:19 ukai Exp $ */ + #ifndef INDEP_H + #define INDEP_H +-#include <gc.h> ++#include "alloc.h" + #include "Str.h" + #include "config.h" + +@@ -12,6 +12,14 @@ + #define FALSE 0 + #endif /* FALSE */ + ++struct growbuf { ++ char *ptr; ++ int length; ++ int area_size; ++ void *(*realloc_proc) (void *, size_t); ++ void (*free_proc) (void *); ++}; ++ + #define RAW_MODE 0 + #define PAGER_MODE 1 + #define HTML_MODE 2 +@@ -52,6 +60,7 @@ extern int strncasecmp(const char *s1, const char *s2, size_t n); + extern char *strcasestr(const char *s1, const char *s2); + #endif + extern int strcasemstr(char *str, char *srch[], char **ret_ptr); ++int strmatchlen(const char *s1, const char *s2, int maxlen); + extern char *remove_space(char *str); + extern int non_null(char *s); + extern void cleanup_line(Str s, int mode); +@@ -64,6 +73,18 @@ extern Str Str_url_unquote(Str x, int is_form, int safe); + extern Str Str_form_quote(Str x); + #define Str_form_unquote(x) Str_url_unquote((x), TRUE, FALSE) + extern char *shell_quote(char *str); ++#define xmalloc(s) xrealloc(NULL, s) ++extern void *xrealloc(void *ptr, size_t size); ++extern void xfree(void *ptr); ++extern void *w3m_GC_realloc_atomic(void *ptr, size_t size); ++extern void w3m_GC_free(void *ptr); ++extern void growbuf_init(struct growbuf *gb); ++extern void growbuf_init_without_GC(struct growbuf *gb); ++extern void growbuf_clear(struct growbuf *gb); ++extern Str growbuf_to_Str(struct growbuf *gb); ++extern void growbuf_reserve(struct growbuf *gb, int leastarea); ++extern void growbuf_append(struct growbuf *gb, const char *src, int len); ++#define GROWBUF_ADD_CHAR(gb,ch) ((((gb)->length>=(gb)->area_size)?growbuf_reserve(gb,(gb)->length+1):(void)0),(void)((gb)->ptr[(gb)->length++] = (ch))) + + extern char *w3m_auxbin_dir(); + extern char *w3m_lib_dir(); +@@ -71,10 +92,8 @@ extern char *w3m_etc_dir(); + extern char *w3m_conf_dir(); + extern char *w3m_help_dir(); + +-#define New(type) ((type*)GC_MALLOC(sizeof(type))) +-#define NewAtom(type) ((type*)GC_MALLOC_ATOMIC(sizeof(type))) +-#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) +-#define NewAtom_N(type,n) ((type*)GC_MALLOC_ATOMIC((n)*sizeof(type))) +-#define New_Reuse(type,ptr,n) ((type*)GC_REALLOC((ptr),(n)*sizeof(type))) ++#define NewWithoutGC(type) ((type*)xmalloc(sizeof(type))) ++#define NewWithoutGC_N(type,n) ((type*)xmalloc((n)*sizeof(type))) ++#define NewWithoutGC_Reuse(type,ptr,n) ((type*)xrealloc(ptr,(n)*sizeof(type))) + + #endif /* INDEP_H */ +diff --git a/istream.c b/istream.c +index 8967280..3126142 100644 +--- a/istream.c ++++ b/istream.c +@@ -22,8 +22,8 @@ + static void basic_close(int *handle); + static int basic_read(int *handle, char *buf, int len); + +-static void file_close(struct file_handle *handle); +-static int file_read(struct file_handle *handle, char *buf, int len); ++static void file_close(struct io_file_handle *handle); ++static int file_read(struct io_file_handle *handle, char *buf, int len); + + static int str_read(Str handle, char *buf, int len); + +@@ -35,12 +35,14 @@ static int ssl_read(struct ssl_handle *handle, char *buf, int len); + static int ens_read(struct ens_handle *handle, char *buf, int len); + static void ens_close(struct ens_handle *handle); + ++static void memchop(char *p, int *len); ++ + static void + do_update(BaseStream base) + { + int len; + base->stream.cur = base->stream.next = 0; +- len = base->read(base->handle, base->stream.buf, base->stream.size); ++ len = (*base->read) (base->handle, base->stream.buf, base->stream.size); + if (len <= 0) + base->iseos = TRUE; + else +@@ -66,12 +68,12 @@ init_buffer(BaseStream base, char *buf, int bufsize) + StreamBuffer sb = &base->stream; + sb->size = bufsize; + sb->cur = 0; ++ sb->buf = NewWithoutGC_N(uchar, bufsize); + if (buf) { +- sb->buf = (uchar *) buf; ++ memcpy(sb->buf, buf, bufsize); + sb->next = bufsize; + } + else { +- sb->buf = NewAtom_N(uchar, bufsize); + sb->next = 0; + } + base->iseos = FALSE; +@@ -95,10 +97,10 @@ newInputStream(int des) + InputStream stream; + if (des < 0) + return NULL; +- stream = New(union input_stream); ++ stream = NewWithoutGC(union input_stream); + init_base_stream(&stream->base, STREAM_BUF_SIZE); + stream->base.type = IST_BASIC; +- stream->base.handle = New(int); ++ stream->base.handle = NewWithoutGC(int); + *(int *)stream->base.handle = des; + stream->base.read = (int (*)())basic_read; + stream->base.close = (void (*)())basic_close; +@@ -111,10 +113,10 @@ newFileStream(FILE * f, void (*closep) ()) + InputStream stream; + if (f == NULL) + return NULL; +- stream = New(union input_stream); ++ stream = NewWithoutGC(union input_stream); + init_base_stream(&stream->base, STREAM_BUF_SIZE); + stream->file.type = IST_FILE; +- stream->file.handle = New(struct file_handle); ++ stream->file.handle = NewWithoutGC(struct io_file_handle); + stream->file.handle->f = f; + if (closep) + stream->file.handle->close = closep; +@@ -131,10 +133,10 @@ newStrStream(Str s) + InputStream stream; + if (s == NULL) + return NULL; +- stream = New(union input_stream); ++ stream = NewWithoutGC(union input_stream); + init_str_stream(&stream->base, s); + stream->str.type = IST_STR; +- stream->str.handle = s; ++ stream->str.handle = NULL; + stream->str.read = (int (*)())str_read; + stream->str.close = NULL; + return stream; +@@ -147,10 +149,10 @@ newSSLStream(SSL * ssl, int sock) + InputStream stream; + if (sock < 0) + return NULL; +- stream = New(union input_stream); ++ stream = NewWithoutGC(union input_stream); + init_base_stream(&stream->base, SSL_BUF_SIZE); + stream->ssl.type = IST_SSL; +- stream->ssl.handle = New(struct ssl_handle); ++ stream->ssl.handle = NewWithoutGC(struct ssl_handle); + stream->ssl.handle->ssl = ssl; + stream->ssl.handle->sock = sock; + stream->ssl.read = (int (*)())ssl_read; +@@ -166,14 +168,14 @@ newEncodedStream(InputStream is, char encoding) + if (is == NULL || (encoding != ENC_QUOTE && encoding != ENC_BASE64 && + encoding != ENC_UUENCODE)) + return is; +- stream = New(union input_stream); ++ stream = NewWithoutGC(union input_stream); + init_base_stream(&stream->base, STREAM_BUF_SIZE); + stream->ens.type = IST_ENCODED; +- stream->ens.handle = New(struct ens_handle); ++ stream->ens.handle = NewWithoutGC(struct ens_handle); + stream->ens.handle->is = is; + stream->ens.handle->pos = 0; + stream->ens.handle->encoding = encoding; +- stream->ens.handle->s = NULL; ++ growbuf_init_without_GC(&stream->ens.handle->gb); + stream->ens.read = (int (*)())ens_read; + stream->ens.close = (void (*)())ens_close; + return stream; +@@ -187,8 +189,10 @@ ISclose(InputStream stream) + stream->base.type & IST_UNCLOSE) + return -1; + prevtrap = mySignal(SIGINT, SIG_IGN); +- stream->base.close(stream->base.handle); ++ stream->base.close (stream->base.handle); + mySignal(SIGINT, prevtrap); ++ xfree(stream->base.stream.buf); ++ xfree(stream); + return 0; + } + +@@ -218,122 +222,97 @@ ISundogetc(InputStream stream) + return -1; + } + +-#define MARGIN_STR_SIZE 10 + Str +-StrISgets(InputStream stream) ++StrISgets2(InputStream stream, char crnl) + { +- BaseStream base; +- StreamBuffer sb; +- Str s = NULL; +- uchar *p; +- int len; ++ struct growbuf gb; + + if (stream == NULL) +- return '\0'; +- base = &stream->base; +- sb = &base->stream; +- +- while (!base->iseos) { +- if (MUST_BE_UPDATED(base)) { +- do_update(base); +- } +- else { +- if ((p = memchr(&sb->buf[sb->cur], '\n', sb->next - sb->cur))) { +- len = p - &sb->buf[sb->cur] + 1; +- if (s == NULL) +- s = Strnew_size(len); +- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], len); +- sb->cur += len; +- return s; +- } +- else { +- if (s == NULL) +- s = Strnew_size(sb->next - sb->cur + MARGIN_STR_SIZE); +- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], +- sb->next - sb->cur); +- sb->cur = sb->next; +- } +- } +- } +- +- if (s == NULL) +- return Strnew(); +- return s; ++ return NULL; ++ growbuf_init(&gb); ++ ISgets_to_growbuf(stream, &gb, crnl); ++ return growbuf_to_Str(&gb); + } + +-Str +-StrmyISgets(InputStream stream) ++void ++ISgets_to_growbuf(InputStream stream, struct growbuf *gb, char crnl) + { +- BaseStream base; +- StreamBuffer sb; +- Str s = NULL; +- int i, len; ++ BaseStream base = &stream->base; ++ StreamBuffer sb = &base->stream; ++ int i; + +- if (stream == NULL) +- return '\0'; +- base = &stream->base; +- sb = &base->stream; ++ gb->length = 0; + + while (!base->iseos) { + if (MUST_BE_UPDATED(base)) { + do_update(base); ++ continue; + } +- else { +- if (s && Strlastchar(s) == '\r') { +- if (sb->buf[sb->cur] == '\n') +- Strcat_char(s, (char)sb->buf[sb->cur++]); +- return s; ++ if (crnl && gb->length > 0 && gb->ptr[gb->length - 1] == '\r') { ++ if (sb->buf[sb->cur] == '\n') { ++ GROWBUF_ADD_CHAR(gb, '\n'); ++ ++sb->cur; + } +- for (i = sb->cur; +- i < sb->next && sb->buf[i] != '\n' && sb->buf[i] != '\r'; +- i++) ; +- if (i < sb->next) { +- len = i - sb->cur + 1; +- if (s == NULL) +- s = Strnew_size(len + MARGIN_STR_SIZE); +- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], len); +- sb->cur = i + 1; +- if (sb->buf[i] == '\n') +- return s; +- } +- else { +- if (s == NULL) +- s = Strnew_size(sb->next - sb->cur + MARGIN_STR_SIZE); +- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], +- sb->next - sb->cur); +- sb->cur = sb->next; ++ break; ++ } ++ for (i = sb->cur; i < sb->next; ++i) { ++ if (sb->buf[i] == '\n' || (crnl && sb->buf[i] == '\r')) { ++ ++i; ++ break; + } + } ++ growbuf_append(gb, &sb->buf[sb->cur], i - sb->cur); ++ sb->cur = i; ++ if (gb->length > 0 && gb->ptr[gb->length - 1] == '\n') ++ break; + } + +- if (s == NULL) +- return Strnew(); +- return s; ++ growbuf_reserve(gb, gb->length + 1); ++ gb->ptr[gb->length] = '\0'; ++ return; + } + ++#ifdef unused + int + ISread(InputStream stream, Str buf, int count) + { +- int rest, len; ++ int len; ++ ++ if (count + 1 > buf->area_size) { ++ char *newptr = GC_MALLOC_ATOMIC(count + 1); ++ memcpy(newptr, buf->ptr, buf->length); ++ newptr[buf->length] = '\0'; ++ buf->ptr = newptr; ++ buf->area_size = count + 1; ++ } ++ len = ISread_n(stream, buf->ptr, count); ++ buf->length = (len > 0) ? len : 0; ++ buf->ptr[buf->length] = '\0'; ++ return (len > 0) ? 1 : 0; ++} ++#endif ++ ++int ++ISread_n(InputStream stream, char *dst, int count) ++{ ++ int len, l; + BaseStream base; + +- if (stream == NULL || (base = &stream->base)->iseos) ++ if (stream == NULL || count <= 0) ++ return -1; ++ if ((base = &stream->base)->iseos) + return 0; + +- len = buffer_read(&base->stream, buf->ptr, count); +- rest = count - len; ++ len = buffer_read(&base->stream, dst, count); + if (MUST_BE_UPDATED(base)) { +- len = base->read(base->handle, &buf->ptr[len], rest); +- if (len <= 0) { ++ l = (*base->read) (base->handle, &dst[len], count - len); ++ if (l <= 0) { + base->iseos = TRUE; +- len = 0; ++ } else { ++ len += l; + } +- rest -= len; + } +- Strtruncate(buf, count - rest); +- if (buf->length > 0) +- return 1; +- return 0; ++ return len; + } + + int +@@ -645,6 +624,7 @@ basic_close(int *handle) + #else + close(*(int *)handle); + #endif ++ xfree(handle); + } + + static int +@@ -658,13 +638,14 @@ basic_read(int *handle, char *buf, int len) + } + + static void +-file_close(struct file_handle *handle) ++file_close(struct io_file_handle *handle) + { + handle->close(handle->f); ++ xfree(handle); + } + + static int +-file_read(struct file_handle *handle, char *buf, int len) ++file_read(struct io_file_handle *handle, char *buf, int len) + { + return fread(buf, 1, len, handle->f); + } +@@ -682,6 +663,7 @@ ssl_close(struct ssl_handle *handle) + close(handle->sock); + if (handle->ssl) + SSL_free(handle->ssl); ++ xfree(handle); + } + + static int +@@ -717,38 +699,60 @@ static void + ens_close(struct ens_handle *handle) + { + ISclose(handle->is); ++ growbuf_clear(&handle->gb); ++ xfree(handle); + } + + static int + ens_read(struct ens_handle *handle, char *buf, int len) + { +- if (handle->s == NULL || handle->pos == handle->s->length) { ++ if (handle->pos == handle->gb.length) { + char *p; +- handle->s = StrmyISgets(handle->is); +- if (handle->s->length == 0) ++ struct growbuf gbtmp; ++ ++ ISgets_to_growbuf(handle->is, &handle->gb, TRUE); ++ if (handle->gb.length == 0) + return 0; +- cleanup_line(handle->s, PAGER_MODE); + if (handle->encoding == ENC_BASE64) +- Strchop(handle->s); ++ memchop(handle->gb.ptr, &handle->gb.length); + else if (handle->encoding == ENC_UUENCODE) { +- if (!strncmp(handle->s->ptr, "begin", 5)) +- handle->s = StrmyISgets(handle->is); +- Strchop(handle->s); ++ if (handle->gb.length >= 5 && ++ !strncmp(handle->gb.ptr, "begin", 5)) ++ ISgets_to_growbuf(handle->is, &handle->gb, TRUE); ++ memchop(handle->gb.ptr, &handle->gb.length); + } +- p = handle->s->ptr; ++ growbuf_init_without_GC(&gbtmp); ++ p = handle->gb.ptr; + if (handle->encoding == ENC_QUOTE) +- handle->s = decodeQP(&p); ++ decodeQP_to_growbuf(&gbtmp, &p); + else if (handle->encoding == ENC_BASE64) +- handle->s = decodeB(&p); ++ decodeB_to_growbuf(&gbtmp, &p); + else if (handle->encoding == ENC_UUENCODE) +- handle->s = decodeU(&p); ++ decodeU_to_growbuf(&gbtmp, &p); ++ growbuf_clear(&handle->gb); ++ handle->gb = gbtmp; + handle->pos = 0; + } + +- if (len > handle->s->length - handle->pos) +- len = handle->s->length - handle->pos; ++ if (len > handle->gb.length - handle->pos) ++ len = handle->gb.length - handle->pos; + +- bcopy(&handle->s->ptr[handle->pos], buf, len); ++ memcpy(buf, &handle->gb.ptr[handle->pos], len); + handle->pos += len; + return len; + } ++ ++static void ++memchop(char *p, int *len) ++{ ++ char *q; ++ ++ for (q = p + *len; q > p; --q) { ++ if (q[-1] != '\n' && q[-1] != '\r') ++ break; ++ } ++ if (q != p + *len) ++ *q = '\0'; ++ *len = q - p; ++ return; ++} +diff --git a/istream.h b/istream.h +index a220d8b..5a04be0 100644 +--- a/istream.h ++++ b/istream.h +@@ -2,13 +2,13 @@ + #ifndef IO_STREAM_H + #define IO_STREAM_H + ++#include "indep.h" + #include <stdio.h> + #ifdef USE_SSL + #include <openssl/bio.h> + #include <openssl/x509.h> + #include <openssl/ssl.h> + #endif +-#include "Str.h" + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> +@@ -20,7 +20,7 @@ struct stream_buffer { + + typedef struct stream_buffer *StreamBuffer; + +-struct file_handle { ++struct io_file_handle { + FILE *f; + void (*close) (); + }; +@@ -36,7 +36,7 @@ union input_stream; + + struct ens_handle { + union input_stream *is; +- Str s; ++ struct growbuf gb; + int pos; + char encoding; + }; +@@ -53,7 +53,7 @@ struct base_stream { + + struct file_stream { + struct stream_buffer stream; +- struct file_handle *handle; ++ struct io_file_handle *handle; + char type; + char iseos; + int (*read) (); +@@ -119,9 +119,14 @@ extern InputStream newEncodedStream(InputStream is, char encoding); + extern int ISclose(InputStream stream); + extern int ISgetc(InputStream stream); + extern int ISundogetc(InputStream stream); +-extern Str StrISgets(InputStream stream); +-extern Str StrmyISgets(InputStream stream); ++extern Str StrISgets2(InputStream stream, char crnl); ++#define StrISgets(stream) StrISgets2(stream, FALSE) ++#define StrmyISgets(stream) StrISgets2(stream, TRUE) ++void ISgets_to_growbuf(InputStream stream, struct growbuf *gb, char crnl); ++#ifdef unused + extern int ISread(InputStream stream, Str buf, int count); ++#endif ++int ISread_n(InputStream stream, char *dst, int bufsize); + extern int ISfileno(InputStream stream); + extern int ISeos(InputStream stream); + #ifdef USE_SSL +diff --git a/keybind.c b/keybind.c +index a490962..fec0c65 100644 +--- a/keybind.c ++++ b/keybind.c +@@ -91,7 +91,7 @@ unsigned char EscBKeymap[128] = { + /* 0 1 2 3 4 5 6 7 */ + nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, + /* 8 9 : ; < = > ? */ +- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, ++ nulcmd, nulcmd, nulcmd, nulcmd, sgrmouse, nulcmd, nulcmd, nulcmd, + /* @ A B C D E F G */ + nulcmd, movU, movD, movR, movL, nulcmd, goLineL, pgFore, + /* H I J K L M N O */ +diff --git a/libwc/ambwidth_map.awk b/libwc/ambwidth_map.awk +index 8544f58..1d9d25f 100644 +--- a/libwc/ambwidth_map.awk ++++ b/libwc/ambwidth_map.awk +@@ -3,9 +3,15 @@ BEGIN { + i = 0; + } + $2 == "A" { +- code = sprintf("0x%s", $1); +- if (strtonum(code) < 0x10000) { +- map[i] = code ++ code = code2 = strtonum(sprintf("0x%s", $1)) ++ if (match($1, /[.]+[0-9A-Fa-f]+/)) { ++ s = substr($1, RSTART, RLENGTH) ++ sub(/[.]+/, "0x", s) ++ code2 = strtonum(s) ++ } ++ for (; code <= code2; code++) { ++ if (code >= 0x10000) { break } ++ map[i] = sprintf("0x%04X", code) + i++; + } + } +@@ -15,28 +21,14 @@ END { + prev = strtonum(map[0]); + for (j = 1; j < i; j++) { + cur = strtonum(map[j]); +- if (match(map[j], "[.]+")) { ++ if (cur - prev > 1) { + map2[n] = sprintf("%s, %s", start, map[j - 1]); + n++; +- gsub("[.]+", ", 0x", map[j]) +- map2[n] = map[j]; +- n++; +- start = map[j + 1]; +- cur = strtonum(start); +- } else { +- if (cur - prev > 2) { +- map2[n] = sprintf("%s, %s", start, map[j - 1]); +- start = map[j]; +- n++; +- } +- +- if (j == i - 1) { +- map2[n] = sprintf("%s, %s", start, map[j]); +- n++; +- } ++ start = map[j]; + } + prev = cur; + } ++ if (i > 0) { map2[n] = sprintf("%s, %s", start, map[i - 1]); n++ } + + printf("static wc_map ucs_ambwidth_map[] = {\n"); + for (j = 0; j < n; j++) { +diff --git a/libwc/charset.c b/libwc/charset.c +index 3f0b74d..ea79b1c 100644 +--- a/libwc/charset.c ++++ b/libwc/charset.c +@@ -1,8 +1,7 @@ + + #include <stdlib.h> + #include <ctype.h> +-#include <gc.h> +-#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) ++#include "../alloc.h" + + #include "wc.h" + +diff --git a/libwc/gb18030.c b/libwc/gb18030.c +index c195d49..d5c9018 100644 +--- a/libwc/gb18030.c ++++ b/libwc/gb18030.c +@@ -151,6 +151,7 @@ wc_ucs_to_gb18030(wc_uint32 ucs) + return cc; + } + cc.ccs = WC_CCS_UNKNOWN; ++ cc.code = 0; + return cc; + } + #endif +diff --git a/libwc/map/ucs_ambwidth.map b/libwc/map/ucs_ambwidth.map +index 6f03ba8..35ceedb 100644 +--- a/libwc/map/ucs_ambwidth.map ++++ b/libwc/map/ucs_ambwidth.map +@@ -1,50 +1,82 @@ + static wc_map ucs_ambwidth_map[] = { + { 0x00A1, 0x00A1 }, + { 0x00A4, 0x00A4 }, +- { 0x00A7, 0x00AA }, +- { 0x00AD, 0x00BF }, ++ { 0x00A7, 0x00A8 }, ++ { 0x00AA, 0x00AA }, ++ { 0x00AD, 0x00AE }, ++ { 0x00B0, 0x00B4 }, ++ { 0x00B6, 0x00BA }, ++ { 0x00BC, 0x00BF }, + { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, + { 0x00D7, 0x00D8 }, + { 0x00DE, 0x00E1 }, +- { 0x00E6, 0x00ED }, +- { 0x00F0, 0x00F3 }, +- { 0x00F7, 0x00FE }, ++ { 0x00E6, 0x00E6 }, ++ { 0x00E8, 0x00EA }, ++ { 0x00EC, 0x00ED }, ++ { 0x00F0, 0x00F0 }, ++ { 0x00F2, 0x00F3 }, ++ { 0x00F7, 0x00FA }, ++ { 0x00FC, 0x00FC }, ++ { 0x00FE, 0x00FE }, + { 0x0101, 0x0101 }, +- { 0x0111, 0x0113 }, ++ { 0x0111, 0x0111 }, ++ { 0x0113, 0x0113 }, + { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, + { 0x012B, 0x012B }, + { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, +- { 0x013F, 0x0144 }, +- { 0x0148, 0x014D }, ++ { 0x013F, 0x0142 }, ++ { 0x0144, 0x0144 }, ++ { 0x0148, 0x014B }, ++ { 0x014D, 0x014D }, + { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, + { 0x016B, 0x016B }, +- { 0x01CE, 0x01DC }, ++ { 0x01CE, 0x01CE }, ++ { 0x01D0, 0x01D0 }, ++ { 0x01D2, 0x01D2 }, ++ { 0x01D4, 0x01D4 }, ++ { 0x01D6, 0x01D6 }, ++ { 0x01D8, 0x01D8 }, ++ { 0x01DA, 0x01DA }, ++ { 0x01DC, 0x01DC }, + { 0x0251, 0x0251 }, + { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, +- { 0x02C7, 0x02CD }, ++ { 0x02C7, 0x02C7 }, ++ { 0x02C9, 0x02CB }, ++ { 0x02CD, 0x02CD }, + { 0x02D0, 0x02D0 }, +- { 0x02D8, 0x02DF }, ++ { 0x02D8, 0x02DB }, ++ { 0x02DD, 0x02DD }, ++ { 0x02DF, 0x02DF }, + { 0x0300, 0x036F }, +- { 0x0391, 0x03A9 }, +- { 0x03B1, 0x03C9 }, ++ { 0x0391, 0x03A1 }, ++ { 0x03A3, 0x03A9 }, ++ { 0x03B1, 0x03C1 }, ++ { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, +- { 0x0410, 0x0451 }, ++ { 0x0410, 0x044F }, ++ { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, +- { 0x2013, 0x2019 }, ++ { 0x2013, 0x2016 }, ++ { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, +- { 0x2020, 0x2027 }, +- { 0x2030, 0x2035 }, ++ { 0x2020, 0x2022 }, ++ { 0x2024, 0x2027 }, ++ { 0x2030, 0x2030 }, ++ { 0x2032, 0x2033 }, ++ { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, + { 0x203E, 0x203E }, + { 0x2074, 0x2074 }, +- { 0x207F, 0x2084 }, ++ { 0x207F, 0x207F }, ++ { 0x2081, 0x2084 }, + { 0x20AC, 0x20AC }, +- { 0x2103, 0x2105 }, ++ { 0x2103, 0x2103 }, ++ { 0x2105, 0x2105 }, + { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, + { 0x2116, 0x2116 }, +@@ -52,21 +84,28 @@ static wc_map ucs_ambwidth_map[] = { + { 0x2126, 0x2126 }, + { 0x212B, 0x212B }, + { 0x2153, 0x2154 }, +- { 0x215B, 0x216B }, ++ { 0x215B, 0x215E }, ++ { 0x2160, 0x216B }, + { 0x2170, 0x2179 }, + { 0x2189, 0x2189 }, + { 0x2190, 0x2199 }, + { 0x21B8, 0x21B9 }, +- { 0x21D2, 0x21D4 }, ++ { 0x21D2, 0x21D2 }, ++ { 0x21D4, 0x21D4 }, + { 0x21E7, 0x21E7 }, +- { 0x2200, 0x2203 }, ++ { 0x2200, 0x2200 }, ++ { 0x2202, 0x2203 }, + { 0x2207, 0x2208 }, + { 0x220B, 0x220B }, +- { 0x220F, 0x2211 }, ++ { 0x220F, 0x220F }, ++ { 0x2211, 0x2211 }, + { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, + { 0x221D, 0x2220 }, +- { 0x2223, 0x222E }, ++ { 0x2223, 0x2223 }, ++ { 0x2225, 0x2225 }, ++ { 0x2227, 0x222C }, ++ { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, + { 0x223C, 0x223D }, + { 0x2248, 0x2248 }, +@@ -83,11 +122,13 @@ static wc_map ucs_ambwidth_map[] = { + { 0x22A5, 0x22A5 }, + { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, +- { 0x2460, 0x254B }, ++ { 0x2460, 0x24E9 }, ++ { 0x24EB, 0x254B }, + { 0x2550, 0x2573 }, + { 0x2580, 0x258F }, + { 0x2592, 0x2595 }, +- { 0x25A0, 0x25A9 }, ++ { 0x25A0, 0x25A1 }, ++ { 0x25A3, 0x25A9 }, + { 0x25B2, 0x25B3 }, + { 0x25B6, 0x25B7 }, + { 0x25BC, 0x25BD }, +@@ -101,12 +142,20 @@ static wc_map ucs_ambwidth_map[] = { + { 0x2609, 0x2609 }, + { 0x260E, 0x260F }, + { 0x2614, 0x2615 }, +- { 0x261C, 0x261E }, +- { 0x2640, 0x2642 }, +- { 0x2660, 0x266F }, ++ { 0x261C, 0x261C }, ++ { 0x261E, 0x261E }, ++ { 0x2640, 0x2640 }, ++ { 0x2642, 0x2642 }, ++ { 0x2660, 0x2661 }, ++ { 0x2663, 0x2665 }, ++ { 0x2667, 0x266A }, ++ { 0x266C, 0x266D }, ++ { 0x266F, 0x266F }, + { 0x269E, 0x269F }, + { 0x26BE, 0x26BF }, +- { 0x26C4, 0x26E3 }, ++ { 0x26C4, 0x26CD }, ++ { 0x26CF, 0x26E1 }, ++ { 0x26E3, 0x26E3 }, + { 0x26E8, 0x26FF }, + { 0x273D, 0x273D }, + { 0x2757, 0x2757 }, +diff --git a/libwc/status.c b/libwc/status.c +index d25c924..4a2ebf8 100644 +--- a/libwc/status.c ++++ b/libwc/status.c +@@ -1,7 +1,6 @@ + + #include <string.h> +-#include <gc.h> +-#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) ++#include "../alloc.h" + + #include "wc.h" + #ifdef USE_UNICODE +diff --git a/libwc/ucs.c b/libwc/ucs.c +index d7b6948..5e78b4e 100644 +--- a/libwc/ucs.c ++++ b/libwc/ucs.c +@@ -100,6 +100,7 @@ wc_ucs_to_any(wc_uint32 ucs, wc_table *t) + return t->conv(t->ccs, map->code2); + } + cc.ccs = WC_CCS_UNKNOWN; ++ cc.code = 0; + return cc; + } + +diff --git a/linein.c b/linein.c +index b7e81b6..572b015 100644 +--- a/linein.c ++++ b/linein.c +@@ -1026,7 +1026,7 @@ _prev(void) + strCurrentBuf = strBuf; + } + if (DecodeURL && (cm_mode & CPL_URL) ) +- p = url_unquote_conv(p, 0); ++ p = url_decode2(p, NULL); + strBuf = Strnew_charp(p); + CLen = CPos = setStrType(strBuf, strProp); + offset = 0; +@@ -1045,7 +1045,7 @@ _next(void) + p = nextHist(hist); + if (p) { + if (DecodeURL && (cm_mode & CPL_URL) ) +- p = url_unquote_conv(p, 0); ++ p = url_decode2(p, NULL); + strBuf = Strnew_charp(p); + } + else { +diff --git a/local.c b/local.c +index f5a73a2..9428319 100644 +--- a/local.c ++++ b/local.c +@@ -109,6 +109,7 @@ loadLocalDir(char *dname) + n++; + } + } ++ closedir(d); + + if (multicolList) { + l = COLS / (maxlen + 2); +@@ -359,6 +360,10 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) + int status; + pid_t pid; + char *file = uri, *name = uri, *path_info = NULL, *tmpf = NULL; ++#ifdef HAVE_CHDIR ++ char *cgi_dir; ++#endif ++ char *cgi_basename; + + #ifdef __MINGW32_VERSION + return NULL; +@@ -373,7 +378,14 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) + if (!fw) + return NULL; + } ++ if (qstr) ++ uri = Strnew_m_charp(uri, "?", qstr, NULL)->ptr; ++#ifdef HAVE_CHDIR ++ cgi_dir = mydirname(file); ++#endif ++ cgi_basename = mybasename(file); + pid = open_pipe_rw(&fr, NULL); ++ /* Don't invoke gc after here, or the program might crash in some platforms */ + if (pid < 0) + return NULL; + else if (pid) { +@@ -383,8 +395,6 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) + } + setup_child(TRUE, 2, fw ? fileno(fw) : -1); + +- if (qstr) +- uri = Strnew_m_charp(uri, "?", qstr, NULL)->ptr; + set_cgi_environ(name, file, uri); + if (path_info) + set_environ("PATH_INFO", path_info); +@@ -415,11 +425,11 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) + } + + #ifdef HAVE_CHDIR /* ifndef __EMX__ ? */ +- chdir(mydirname(file)); ++ chdir(cgi_dir); + #endif +- execl(file, mybasename(file), NULL); ++ execl(file, cgi_basename, NULL); + fprintf(stderr, "execl(\"%s\", \"%s\", NULL): %s\n", +- file, mybasename(file), strerror(errno)); ++ file, cgi_basename, strerror(errno)); + exit(1); + return NULL; + #endif +diff --git a/main.c b/main.c +index b421943..d37b243 100644 +--- a/main.c ++++ b/main.c +@@ -11,6 +11,9 @@ + #include <sys/wait.h> + #endif + #include <time.h> ++#if defined(__CYGWIN__) && defined(USE_BINMODE_STREAM) ++#include <io.h> ++#endif + #include "terms.h" + #include "myctype.h" + #include "regex.h" +@@ -119,6 +122,8 @@ static int searchKeyNum(void); + #define help() fusage(stdout, 0) + #define usage() fusage(stderr, 1) + ++int enable_inline_image; /* 1 == mlterm OSC 5379, 2 == sixel */ ++ + static void + fversion(FILE * f) + { +@@ -200,10 +205,12 @@ fusage(FILE * f, int err) + #ifdef USE_M17N + fprintf(f, " -I charset document charset\n"); + fprintf(f, " -O charset display/output charset\n"); ++#if 0 /* use -O{s|j|e} instead */ + fprintf(f, " -e EUC-JP\n"); + fprintf(f, " -s Shift_JIS\n"); + fprintf(f, " -j JIS\n"); + #endif ++#endif + fprintf(f, " -B load bookmark\n"); + fprintf(f, " -bookmark file specify bookmark file\n"); + fprintf(f, " -T type specify content-type\n"); +@@ -248,7 +255,11 @@ fusage(FILE * f, int err) + #endif /* USE_COOKIE */ + fprintf(f, " -graph use DEC special graphics for border of table and menu\n"); + fprintf(f, " -no-graph use ACII character for border of table and menu\n"); ++#if 1 /* pager requires -s */ ++ fprintf(f, " -s squeeze multiple blank lines\n"); ++#else + fprintf(f, " -S squeeze multiple blank lines\n"); ++#endif + fprintf(f, " -W toggle wrap search mode\n"); + fprintf(f, " -X don't use termcap init/deinit\n"); + fprintf(f, +@@ -372,6 +383,13 @@ make_optional_header_string(char *s) + return hs; + } + ++static void * ++die_oom(size_t bytes) ++{ ++ fprintf(stderr, "Out of memory: %lu bytes unavailable!\n", (unsigned long)bytes); ++ exit(1); ++} ++ + int + main(int argc, char **argv, char **envp) + { +@@ -397,7 +415,11 @@ main(int argc, char **argv, char **envp) + wc_ces CodePage; + #endif + #endif ++#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) ++ char **getimage_args = NULL; ++#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ + GC_INIT(); ++ GC_set_oom_fn(die_oom); + #if defined(ENABLE_NLS) || (defined(USE_M17N) && defined(HAVE_LANGINFO_CODESET)) + setlocale(LC_ALL, ""); + #endif +@@ -418,6 +440,10 @@ main(int argc, char **argv, char **envp) + + CurrentDir = currentdir(); + CurrentPid = (int)getpid(); ++#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) ++ if (argv[0] && *argv[0]) ++ MyProgramName = argv[0]; ++#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ + BookmarkFile = NULL; + config_file = NULL; + +@@ -530,12 +556,14 @@ main(int argc, char **argv, char **envp) + PagerMax = atoi(argv[i]); + } + #ifdef USE_M17N ++#if 0 /* use -O{s|j|e} instead */ + else if (!strcmp("-s", argv[i])) + DisplayCharset = WC_CES_SHIFT_JIS; + else if (!strcmp("-j", argv[i])) + DisplayCharset = WC_CES_ISO_2022_JP; + else if (!strcmp("-e", argv[i])) + DisplayCharset = WC_CES_EUC_JP; ++#endif + else if (!strncmp("-I", argv[i], 2)) { + if (argv[i][2] != '\0') + p = argv[i] + 2; +@@ -660,6 +688,12 @@ main(int argc, char **argv, char **envp) + } + } + #endif ++ else if (!strcmp("-ri", argv[i])) { ++ enable_inline_image = 1; ++ } ++ else if (!strcmp("-sixel", argv[i])) { ++ enable_inline_image = 2; ++ } + else if (!strcmp("-num", argv[i])) + showLineNum = TRUE; + else if (!strcmp("-no-proxy", argv[i])) +@@ -703,7 +737,11 @@ main(int argc, char **argv, char **envp) + accept_cookie = TRUE; + } + #endif /* USE_COOKIE */ ++#if 1 /* pager requires -s */ ++ else if (!strcmp("-s", argv[i])) ++#else + else if (!strcmp("-S", argv[i])) ++#endif + squeezeBlankLine = TRUE; + else if (!strcmp("-X", argv[i])) + Do_not_use_ti_te = TRUE; +@@ -735,6 +773,15 @@ main(int argc, char **argv, char **envp) + else if (!strcmp("-reqlog",argv[i])) { + w3m_reqlog=rcFile("request.log"); + } ++#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) ++ else if (!strcmp("-$$getimage", argv[i])) { ++ ++i; ++ getimage_args = argv + i; ++ i += 4; ++ if (i > argc) ++ usage(); ++ } ++#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ + else { + usage(); + } +@@ -823,6 +870,30 @@ main(int argc, char **argv, char **envp) + + if (w3m_backend) + backend(); ++#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) ++ if (getimage_args) { ++ char *image_url = conv_from_system(getimage_args[0]); ++ char *base_url = conv_from_system(getimage_args[1]); ++ ParsedURL base_pu; ++ ++ parseURL2(base_url, &base_pu, NULL); ++ image_source = getimage_args[2]; ++ newbuf = loadGeneralFile(image_url, &base_pu, NULL, 0, NULL); ++ if (!newbuf || !newbuf->real_type || ++ strncasecmp(newbuf->real_type, "image/", 6)) ++ unlink(getimage_args[2]); ++#if defined(HAVE_SYMLINK) && defined(HAVE_LSTAT) ++ symlink(getimage_args[2], getimage_args[3]); ++#else ++ { ++ FILE *f = fopen(getimage_args[3], "w"); ++ if (f) ++ fclose(f); ++ } ++#endif ++ w3m_exit(0); ++ } ++#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ + + if (w3m_dump) + mySignal(SIGINT, SIG_IGN); +@@ -833,7 +904,12 @@ main(int argc, char **argv, char **envp) + mySignal(SIGPIPE, SigPipe); + #endif + ++#if GC_VERSION_MAJOR >= 7 && GC_VERSION_MINOR >= 2 ++ orig_GC_warn_proc = GC_get_warn_proc(); ++ GC_set_warn_proc(wrap_GC_warn_proc); ++#else + orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc); ++#endif + err_msg = Strnew(); + if (load_argc == 0) { + /* no URL specified */ +@@ -894,12 +970,17 @@ main(int argc, char **argv, char **envp) + if (i >= 0) { + SearchHeader = search_header; + DefaultType = default_type; ++ char *url; ++ ++ url = load_argv[i]; ++ if (getURLScheme(&url) == SCM_MISSING && !ArgvIsURL) ++ url = file_to_url(load_argv[i]); ++ else ++ url = url_encode(conv_from_system(load_argv[i]), NULL, 0); + if (w3m_dump == DUMP_HEAD) { + request = New(FormList); + request->method = FORM_METHOD_HEAD; +- newbuf = +- loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, +- request); ++ newbuf = loadGeneralFile(url, NULL, NO_REFERER, 0, request); + } + else { + if (post_file && i == 0) { +@@ -928,9 +1009,7 @@ main(int argc, char **argv, char **envp) + else { + request = NULL; + } +- newbuf = +- loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, +- request); ++ newbuf = loadGeneralFile(url, NULL, NO_REFERER, 0, request); + } + if (newbuf == NULL) { + /* FIXME: gettextize? */ +@@ -945,7 +1024,7 @@ main(int argc, char **argv, char **envp) + break; + case SCM_LOCAL: + case SCM_LOCAL_CGI: +- unshiftHist(LoadHist, conv_from_system(load_argv[i])); ++ unshiftHist(LoadHist, url); + default: + pushHashHist(URLHist, parsedURL2Str(&newbuf->currentURL)->ptr); + break; +@@ -1246,6 +1325,12 @@ dump_extra(Buffer *buf) + #endif + } + ++static int ++cmp_anchor_hseq(const void *a, const void *b) ++{ ++ return (*((const Anchor **) a))->hseq - (*((const Anchor **) b))->hseq; ++} ++ + static void + do_dump(Buffer *buf) + { +@@ -1266,18 +1351,20 @@ do_dump(Buffer *buf) + int i; + saveBuffer(buf, stdout, FALSE); + if (displayLinkNumber && buf->href) { ++ int nanchor = buf->href->nanchor; + printf("\nReferences:\n\n"); +- for (i = 0; i < buf->href->nanchor; i++) { +- ParsedURL pu; +- static Str s = NULL; +- if (buf->href->anchors[i].slave) ++ Anchor **in_order = New_N(Anchor *, buf->href->nanchor); ++ for (i = 0; i < nanchor; i++) ++ in_order[i] = buf->href->anchors + i; ++ qsort(in_order, nanchor, sizeof(Anchor *), cmp_anchor_hseq); ++ for (i = 0; i < nanchor; i++) { ++ ParsedURL pu; ++ char *url; ++ if (in_order[i]->slave) + continue; +- parseURL2(buf->href->anchors[i].url, &pu, baseURL(buf)); +- s = parsedURL2Str(&pu); +- if (DecodeURL) +- s = Strnew_charp(url_unquote_conv +- (s->ptr, Currentbuf->document_charset)); +- printf("[%d] %s\n", buf->href->anchors[i].hseq + 1, s->ptr); ++ parseURL2(in_order[i]->url, &pu, baseURL(buf)); ++ url = url_decode2(parsedURL2Str(&pu)->ptr, Currentbuf); ++ printf("[%d] %s\n", in_order[i]->hseq + 1, url); + } + } + } +@@ -1566,6 +1653,18 @@ DEFUN(pgBack, PREV_PAGE, "Move to previous page") + * (Currentbuf->LINES - 1)), prec_num ? B_SCROLL : B_NORMAL); + } + ++/* Move half page forward */ ++DEFUN(hpgFore, NEXT_HALF_PAGE, "Scroll down half page") ++{ ++ nscroll(searchKeyNum() * (Currentbuf->LINES / 2 - 1), B_NORMAL); ++} ++ ++/* Move half page backward */ ++DEFUN(hpgBack, PREV_HALF_PAGE, "Scroll up half page") ++{ ++ nscroll(-searchKeyNum() * (Currentbuf->LINES / 2 - 1), B_NORMAL); ++} ++ + /* 1 line up */ + DEFUN(lup1, UP, "Scroll up one line") + { +@@ -1844,6 +1943,10 @@ srch_nxtprv(int reverse) + result = srchcore(SearchString, routine[reverse]); + if (result & SR_FOUND) + clear_mark(Currentbuf->currentLine); ++ else { ++ if (reverse == 0) ++ Currentbuf->pos -= 1; ++ } + displayBuffer(Currentbuf, B_NORMAL); + disp_srchresult(result, (reverse ? "Backward: " : "Forward: "), + SearchString); +@@ -2261,7 +2364,7 @@ DEFUN(movR1, MOVE_RIGHT1, + static wc_uint32 + getChar(char *p) + { +- return wc_any_to_ucs(wtf_parse1(&p)); ++ return wc_any_to_ucs(wtf_parse1((wc_uchar **)&p)); + } + + static int +@@ -2804,12 +2907,15 @@ loadLink(char *url, char *target, char *referer, FormList *request) + union frameset_element *f_element = NULL; + int flag = 0; + ParsedURL *base, pu; ++ const int *no_referer_ptr; + + message(Sprintf("loading %s", url)->ptr, 0, 0); + refresh(); + ++ no_referer_ptr = query_SCONF_NO_REFERER_FROM(&Currentbuf->currentURL); + base = baseURL(Currentbuf); +- if (base == NULL || ++ if ((no_referer_ptr && *no_referer_ptr) || ++ base == NULL || + base->scheme == SCM_LOCAL || base->scheme == SCM_LOCAL_CGI) + referer = NO_REFERER; + if (referer == NULL) +@@ -3568,6 +3674,33 @@ DEFUN(lastA, LINK_END, "Go to the last link") + displayBuffer(Currentbuf, B_NORMAL); + } + ++/* go to the nth anchor */ ++DEFUN(nthA, LINK_N, "Go to the nth link") ++{ ++ HmarkerList *hl = Currentbuf->hmarklist; ++ BufferPoint *po; ++ Anchor *an; ++ ++ int n = searchKeyNum(); ++ if (n < 0 || n > hl->nmark) return; ++ ++ if (Currentbuf->firstLine == NULL) ++ return; ++ if (!hl || hl->nmark == 0) ++ return; ++ ++ po = hl->marks + n-1; ++ an = retrieveAnchor(Currentbuf->href, po->line, po->pos); ++ if (an == NULL) ++ an = retrieveAnchor(Currentbuf->formitem, po->line, po->pos); ++ if (an == NULL) return; ++ ++ gotoLine(Currentbuf, po->line); ++ Currentbuf->pos = po->pos; ++ arrangeCursor(Currentbuf); ++ displayBuffer(Currentbuf, B_NORMAL); ++} ++ + /* go to the next anchor */ + DEFUN(nextA, NEXT_LINK, "Move to next link") + { +@@ -4055,6 +4188,7 @@ goURL0(char *prompt, int relative) + char *url, *referer; + ParsedURL p_url, *current; + Buffer *cur_buf = Currentbuf; ++ const int *no_referer_ptr; + + url = searchKeyData(); + if (url == NULL) { +@@ -4064,11 +4198,8 @@ goURL0(char *prompt, int relative) + current = baseURL(Currentbuf); + if (current) { + char *c_url = parsedURL2Str(current)->ptr; +- if (DefaultURLString == DEFAULT_URL_CURRENT) { +- url = c_url; +- if (DecodeURL) +- url = url_unquote_conv(url, 0); +- } ++ if (DefaultURLString == DEFAULT_URL_CURRENT) ++ url = url_decode2(c_url, NULL); + else + pushHist(hist, c_url); + } +@@ -4077,11 +4208,8 @@ goURL0(char *prompt, int relative) + char *a_url; + parseURL2(a->url, &p_url, current); + a_url = parsedURL2Str(&p_url)->ptr; +- if (DefaultURLString == DEFAULT_URL_LINK) { +- url = a_url; +- if (DecodeURL) +- url = url_unquote_conv(url, Currentbuf->document_charset); +- } ++ if (DefaultURLString == DEFAULT_URL_LINK) ++ url = url_decode2(a_url, Currentbuf); + else + pushHist(hist, a_url); + } +@@ -4089,15 +4217,22 @@ goURL0(char *prompt, int relative) + if (url != NULL) + SKIP_BLANKS(url); + } +-#ifdef USE_M17N +- if (url != NULL) { +- if ((relative || *url == '#') && Currentbuf->document_charset) +- url = wc_conv_strict(url, InnerCharset, +- Currentbuf->document_charset)->ptr; ++ if (relative) { ++ no_referer_ptr = query_SCONF_NO_REFERER_FROM(&Currentbuf->currentURL); ++ current = baseURL(Currentbuf); ++ if ((no_referer_ptr && *no_referer_ptr) || ++ current == NULL || ++ current->scheme == SCM_LOCAL || current->scheme == SCM_LOCAL_CGI) ++ referer = NO_REFERER; + else +- url = conv_to_system(url); ++ referer = parsedURL2Str(&Currentbuf->currentURL)->ptr; ++ url = url_encode(url, current, Currentbuf->document_charset); ++ } ++ else { ++ current = NULL; ++ referer = NULL; ++ url = url_encode(url, NULL, 0); + } +-#endif + if (url == NULL || *url == '\0') { + displayBuffer(Currentbuf, B_FORCE_REDRAW); + return; +@@ -4106,14 +4241,6 @@ goURL0(char *prompt, int relative) + gotoLabel(url + 1); + return; + } +- if (relative) { +- current = baseURL(Currentbuf); +- referer = parsedURL2Str(&Currentbuf->currentURL)->ptr; +- } +- else { +- current = NULL; +- referer = NULL; +- } + parseURL2(url, &p_url, current); + pushHashHist(URLHist, parsedURL2Str(&p_url)->ptr); + cmd_loadURL(url, current, referer, NULL); +@@ -4510,8 +4637,7 @@ _peekURL(int only_img) + s = parsedURL2Str(&pu); + } + if (DecodeURL) +- s = Strnew_charp(url_unquote_conv +- (s->ptr, Currentbuf->document_charset)); ++ s = Strnew_charp(url_decode2(s->ptr, Currentbuf)); + #ifdef USE_M17N + s = checkType(s, &pp, NULL); + p = NewAtom_N(Lineprop, s->length); +@@ -4570,7 +4696,7 @@ DEFUN(curURL, PEEK, "Peek current URL") + offset = 0; + s = currentURL(); + if (DecodeURL) +- s = Strnew_charp(url_unquote_conv(s->ptr, 0)); ++ s = Strnew_charp(url_decode2(s->ptr, NULL)); + #ifdef USE_M17N + s = checkType(s, &pp, NULL); + p = NewAtom_N(Lineprop, s->length); +@@ -5398,6 +5524,58 @@ DEFUN(mouse, MOUSE, "mouse operation") + process_mouse(btn, x, y); + } + ++DEFUN(sgrmouse, SGRMOUSE, "SGR 1006 mouse operation") ++{ ++ int btn = 0, x = 0, y = 0; ++ unsigned char c; ++ ++ do { ++ c = getch(); ++ if (IS_DIGIT(c)) ++ btn = btn * 10 + c - '0'; ++ else if (c == ';') ++ break; ++ else ++ return; ++ } while (1); ++ ++#if defined(__CYGWIN__) && CYGWIN_VERSION_DLL_MAJOR < 1005 ++ if (cygwin_mouse_btn_swapped) { ++ if (btn == MOUSE_BTN2_DOWN) ++ btn = MOUSE_BTN3_DOWN; ++ else if (btn == MOUSE_BTN3_DOWN) ++ btn = MOUSE_BTN2_DOWN; ++ }; ++#endif ++ ++ do { ++ c = getch(); ++ if (IS_DIGIT(c)) ++ x = x * 10 + c - '0'; ++ else if (c == ';') ++ break; ++ else ++ return; ++ } while (1); ++ ++ do { ++ c = getch(); ++ if (IS_DIGIT(c)) ++ y = y * 10 + c - '0'; ++ else if (c == 'M') ++ break; ++ else if (c == 'm') { ++ btn |= 3; ++ break; ++ } else ++ return; ++ } while (1); ++ ++ if (x < 0 || x >= COLS || y < 0 || y > LASTLINE) ++ return; ++ process_mouse(btn, x, y); ++} ++ + #ifdef USE_GPM + int + gpm_process_mouse(Gpm_Event * event, void *data) +@@ -5604,7 +5782,7 @@ execdict(char *word) + disp_message("Execution failed", TRUE); + return; + } +- else { ++ else if (buf != NO_BUFFER) { + buf->filename = w; + buf->buffername = Sprintf("%s %s", DICTBUFFERNAME, word)->ptr; + if (buf->type == NULL) +@@ -5671,7 +5849,7 @@ set_buffer_environ(Buffer *buf) + set_environ("W3M_CURRENT_FORM", form2str((FormItemList *)a->url)); + else + set_environ("W3M_CURRENT_FORM", ""); +- set_environ("W3M_CURRENT_LINE", Sprintf("%d", ++ set_environ("W3M_CURRENT_LINE", Sprintf("%ld", + l->real_linenumber)->ptr); + set_environ("W3M_CURRENT_COLUMN", Sprintf("%d", + buf->currentColumn + +@@ -5747,8 +5925,14 @@ deleteFiles() + Firstbuf = buf; + } + } +- while ((f = popText(fileToDelete)) != NULL) ++ while ((f = popText(fileToDelete)) != NULL) { + unlink(f); ++ if (enable_inline_image == 2 && strcmp(f+strlen(f)-4, ".gif") == 0) { ++ Str firstframe = Strnew_charp(f); ++ Strcat_charp(firstframe, "-1"); ++ unlink(firstframe->ptr); ++ } ++ } + } + + void +diff --git a/map.c b/map.c +index 90aa35a..bb240ea 100644 +--- a/map.c ++++ b/map.c +@@ -279,7 +279,7 @@ follow_map_panel(Buffer *buf, char *name) + p = parsedURL2Str(&pu)->ptr; + q = html_quote(p); + if (DecodeURL) +- p = html_quote(url_unquote_conv(p, buf->document_charset)); ++ p = html_quote(url_decode2(p, buf)); + else + p = q; + Strcat_m_charp(mappage, "<tr valign=top><td><a href=\"", q, "\">", +@@ -417,10 +417,7 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi) + continue; + parseURL2(a->url, &pu, baseURL(buf)); + q = html_quote(parsedURL2Str(&pu)->ptr); +- if (DecodeURL) +- p = html_quote(url_unquote_conv(a->url, buf->document_charset)); +- else +- p = html_quote(a->url); ++ p = html_quote(url_decode2(a->url, buf)); + Strcat_m_charp(tmp, "<tr valign=top><td> <td><a href=\"", + q, "\">", + html_quote(*a->alt ? a->alt : mybasename(a->url)), +@@ -457,10 +454,8 @@ append_link_info(Buffer *buf, Str html, LinkList * link) + Strcat_charp(html, "[Rev]"); + if (!l->url) + url = "(empty)"; +- else if (DecodeURL) +- url = html_quote(url_unquote_conv(l->url, buf->document_charset)); + else +- url = html_quote(l->url); ++ url = html_quote(url_decode2(l->url, buf)); + Strcat_m_charp(html, "<td>", url, NULL); + if (l->ctype) + Strcat_m_charp(html, " (", html_quote(l->ctype), ")", NULL); +@@ -498,8 +493,7 @@ append_frame_info(Buffer *buf, Str html, struct frameset *set, int level) + Strcat_charp(html, p); + } + if (DecodeURL) +- p = html_quote(url_unquote_conv(frame.body->url, +- buf->document_charset)); ++ p = html_quote(url_decode2(frame.body->url, buf)); + else + p = q; + Strcat_m_charp(html, " ", p, "</a></pre_int><br>\n", NULL); +@@ -550,9 +544,7 @@ page_info_panel(Buffer *buf) + #ifdef USE_M17N + Strcat_charp(tmp, "<form method=internal action=charset>"); + #endif +- p = parsedURL2Str(&buf->currentURL)->ptr; +- if (DecodeURL) +- p = url_unquote_conv(p, 0); ++ p = url_decode2(parsedURL2Str(&buf->currentURL)->ptr, NULL); + Strcat_m_charp(tmp, "<table cellpadding=0>", + "<tr valign=top><td nowrap>Title<td>", + html_quote(buf->buffername), +@@ -581,7 +573,7 @@ page_info_panel(Buffer *buf) + "<tr valign=top><td nowrap>Number of lines<td>", + Sprintf("%d", all)->ptr, + "<tr valign=top><td nowrap>Transferred bytes<td>", +- Sprintf("%d", buf->trbyte)->ptr, NULL); ++ Sprintf("%lu", (unsigned long)buf->trbyte)->ptr, NULL); + + a = retrieveCurrentAnchor(buf); + if (a != NULL) { +@@ -589,7 +581,7 @@ page_info_panel(Buffer *buf) + p = parsedURL2Str(&pu)->ptr; + q = html_quote(p); + if (DecodeURL) +- p = html_quote(url_unquote_conv(p, buf->document_charset)); ++ p = html_quote(url_decode2(p, buf)); + else + p = q; + Strcat_m_charp(tmp, +@@ -602,7 +594,7 @@ page_info_panel(Buffer *buf) + p = parsedURL2Str(&pu)->ptr; + q = html_quote(p); + if (DecodeURL) +- p = html_quote(url_unquote_conv(p, buf->document_charset)); ++ p = html_quote(url_decode2(p, buf)); + else + p = q; + Strcat_m_charp(tmp, +@@ -613,10 +605,7 @@ page_info_panel(Buffer *buf) + if (a != NULL) { + FormItemList *fi = (FormItemList *)a->url; + p = form2str(fi); +- if (DecodeURL) +- p = html_quote(url_unquote_conv(p, buf->document_charset)); +- else +- p = html_quote(p); ++ p = html_quote(url_decode2(p, buf)); + Strcat_m_charp(tmp, + "<tr valign=top><td nowrap>Method/type of current form <td>", + p, NULL); +diff --git a/matrix.c b/matrix.c +index 64fd0ad..bc7a5be 100644 +--- a/matrix.c ++++ b/matrix.c +@@ -34,18 +34,12 @@ + + #include "config.h" + #include "matrix.h" +-#include <gc.h> ++#include "alloc.h" + + /* + * Macros from "fm.h". + */ + +-#define New(type) ((type*)GC_MALLOC(sizeof(type))) +-#define NewAtom(type) ((type*)GC_MALLOC_ATOMIC(sizeof(type))) +-#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) +-#define NewAtom_N(type,n) ((type*)GC_MALLOC_ATOMIC((n)*sizeof(type))) +-#define Renew_N(type,ptr,n) ((type*)GC_REALLOC((ptr),(n)*sizeof(type))) +- + #define SWAPD(a,b) { double tmp = a; a = b; b = tmp; } + #define SWAPI(a,b) { int tmp = a; a = b; b = tmp; } + +diff --git a/menu.c b/menu.c +index 774b1bd..0f66583 100644 +--- a/menu.c ++++ b/menu.c +@@ -1365,9 +1365,7 @@ initSelectMenu(void) + break; + default: + Strcat_char(str, ' '); +- p = parsedURL2Str(&buf->currentURL)->ptr; +- if (DecodeURL) +- p = url_unquote_conv(p, 0); ++ p = url_decode2(parsedURL2Str(&buf->currentURL)->ptr, NULL); + Strcat_charp(str, p); + break; + } +@@ -1513,9 +1511,7 @@ initSelTabMenu(void) + case SCM_MISSING: + break; + default: +- p = parsedURL2Str(&buf->currentURL)->ptr; +- if (DecodeURL) +- p = url_unquote_conv(p, 0); ++ p = url_decode2(parsedURL2Str(&buf->currentURL)->ptr, NULL); + Strcat_charp(str, p); + break; + } +@@ -1845,10 +1841,8 @@ link_menu(Buffer *buf) + Strcat_charp(str, " "); + if (!l->url) + p = ""; +- else if (DecodeURL) +- p = url_unquote_conv(l->url, buf->document_charset); + else +- p = l->url; ++ p = url_decode2(l->url, buf); + Strcat_charp(str, p); + label[i] = str->ptr; + if (len < str->length) +diff --git a/mimehead.c b/mimehead.c +index 78997e0..d16270c 100644 +--- a/mimehead.c ++++ b/mimehead.c +@@ -64,12 +64,22 @@ ha2d(char x, char y) + Str + decodeB(char **ww) + { ++ struct growbuf gb; ++ ++ growbuf_init(&gb); ++ decodeB_to_growbuf(&gb, ww); ++ return growbuf_to_Str(&gb); ++} ++ ++void ++decodeB_to_growbuf(struct growbuf *gb, char **ww) ++{ + unsigned char c[4]; + char *wp = *ww; + char d[3]; + int i, n_pad; +- Str ap = Strnew_size(strlen(wp)); + ++ growbuf_reserve(gb, strlen(wp) + 1); + n_pad = 0; + while (1) { + for (i = 0; i < 4; i++) { +@@ -93,39 +103,50 @@ decodeB(char **ww) + for (i = 0; i < 4; i++) { + c[i] = c2e(c[i]); + if (c[i] == BAD_BASE64) { +- *ww = wp; +- return ap; ++ goto last; + } + } + d[0] = ((c[0] << 2) | (c[1] >> 4)); + d[1] = ((c[1] << 4) | (c[2] >> 2)); + d[2] = ((c[2] << 6) | c[3]); + for (i = 0; i < 3 - n_pad; i++) { +- Strcat_char(ap, d[i]); ++ GROWBUF_ADD_CHAR(gb, d[i]); + } + if (n_pad || *wp == '\0' || *wp == '?') + break; + } ++last: ++ growbuf_reserve(gb, gb->length + 1); ++ gb->ptr[gb->length] = '\0'; + *ww = wp; +- return ap; ++ return; + } + + Str + decodeU(char **ww) + { ++ struct growbuf gb; ++ ++ growbuf_init(&gb); ++ decodeU_to_growbuf(&gb, ww); ++ return growbuf_to_Str(&gb); ++} ++ ++void ++decodeU_to_growbuf(struct growbuf *gb, char **ww) ++{ + unsigned char c1, c2; + char *w = *ww; + int n, i; +- Str a; + + if (*w <= 0x20 || *w >= 0x60) +- return Strnew_size(0); ++ return; + n = *w - 0x20; +- a = Strnew_size(n); ++ growbuf_reserve(gb, n + 1); + for (w++, i = 2; *w != '\0' && n; n--) { + c1 = (w[0] - 0x20) % 0x40; + c2 = (w[1] - 0x20) % 0x40; +- Strcat_char(a, (c1 << i) | (c2 >> (6 - i))); ++ gb->ptr[gb->length++] = (c1 << i) | (c2 >> (6 - i)); + if (i == 6) { + w += 2; + i = 2; +@@ -135,7 +156,8 @@ decodeU(char **ww) + i += 2; + } + } +- return a; ++ gb->ptr[gb->length] = '\0'; ++ return; + } + + /* RFC2047 (4.2. The "Q" encoding) */ +@@ -165,9 +187,19 @@ decodeQ(char **ww) + Str + decodeQP(char **ww) + { ++ struct growbuf gb; ++ ++ growbuf_init(&gb); ++ decodeQP_to_growbuf(&gb, ww); ++ return growbuf_to_Str(&gb); ++} ++ ++void ++decodeQP_to_growbuf(struct growbuf *gb, char **ww) ++{ + char *w = *ww; +- Str a = Strnew_size(strlen(w)); + ++ growbuf_reserve(gb, strlen(w) + 1); + for (; *w != '\0'; w++) { + if (*w == '=') { + w++; +@@ -180,15 +212,16 @@ decodeQP(char **ww) + else { + if (*w == '\0' || *(w + 1) == '\0') + break; +- Strcat_char(a, ha2d(*w, *(w + 1))); ++ gb->ptr[gb->length++] = ha2d(*w, *(w + 1)); + w++; + } + } + else +- Strcat_char(a, *w); ++ gb->ptr[gb->length++] = *w; + } ++ gb->ptr[gb->length] = '\0'; + *ww = w; +- return a; ++ return; + } + + #ifdef USE_M17N +diff --git a/parsetagx.c b/parsetagx.c +index 6b627d2..3435f9f 100644 +--- a/parsetagx.c ++++ b/parsetagx.c +@@ -221,6 +221,7 @@ parse_tag(char **s, int internal) + int j, hidden=FALSE; + for (j=0; j<i; j++) { + if (tag->attrid[j] == ATTR_TYPE && ++ tag->value[j] && + strcmp("hidden",tag->value[j]) == 0) { + hidden=TRUE; + break; +diff --git a/po/LINGUAS b/po/LINGUAS +index 1489115..ade7ca2 100644 +--- a/po/LINGUAS ++++ b/po/LINGUAS +@@ -1,2 +1,2 @@ + # Set of available languages. +-ja ++ja de +diff --git a/po/de.po b/po/de.po +new file mode 100644 +index 0000000..5e84022 +--- /dev/null ++++ b/po/de.po +@@ -0,0 +1,903 @@ ++# German translation of w3m ++# Copyright (C) 2014 Fumitoshi UKAI ++# This file is distributed under the same license as the w3m package. ++# Markus Hiereth <markus.hiereth@freenet.de>, 2014. ++msgid "" ++msgstr "" ++"Project-Id-Version: w3m 0.5.3\n" ++"Report-Msgid-Bugs-To: satodai@w3m.jp\n" ++"POT-Creation-Date: 2010-08-20 18:44+0900\n" ++"PO-Revision-Date: 2014-10-19 11:15+0200\n" ++"Last-Translator: Markus Hiereth <markus.hiereth@freenet.de>\n" ++"Language-Team: German <debian-l10n-german@lists.debian.org>\n" ++"Language: de\n" ++"MIME-Version: 1.0\n" ++"Content-Type: text/plain; charset=UTF-8\n" ++"Content-Transfer-Encoding: 8bit\n" ++"Plural-Forms: nplurals=2; plural=(n != 1);\n" ++"X-Generator: Virtaal 0.7.1\n" ++ ++#: menu.c:267 ++msgid " Back (b) " ++msgstr " Zurück (b) " ++ ++#: menu.c:268 ++msgid " Select Buffer(s) " ++msgstr " Puffer auswählen (s) " ++ ++#: menu.c:270 ++msgid " Select Tab (t) " ++msgstr " Reiter auswählen (t) " ++ ++#: menu.c:272 ++msgid " View Source (v) " ++msgstr " Codeansicht (v) " ++ ++#: menu.c:273 ++msgid " Edit Source (e) " ++msgstr " Code bearbeiten (e) " ++ ++#: menu.c:274 ++msgid " Save Source (S) " ++msgstr " Code speichern (S) " ++ ++#: menu.c:275 ++msgid " Reload (r) " ++msgstr " Erneut laden (r) " ++ ++#: menu.c:276 menu.c:283 menu.c:287 ++msgid " ---------------- " ++msgstr " ---------------------- " ++ ++#: menu.c:277 ++msgid " Go Link (a) " ++msgstr " Ziel öffnen.. (a) " ++ ++#: menu.c:278 ++msgid " on New Tab (n) " ++msgstr " ..in neuem Reiter (n) " ++ ++#: menu.c:279 ++msgid " Save Link (A) " ++msgstr " Ziel speichern (A) " ++ ++#: menu.c:280 ++msgid " View Image (i) " ++msgstr " Bild anzeigen (i) " ++ ++#: menu.c:281 ++msgid " Save Image (I) " ++msgstr " Bild speichern (I) " ++ ++#: menu.c:282 ++msgid " View Frame (f) " ++msgstr " Frames zeigen (f) " ++ ++#: menu.c:284 ++msgid " Bookmark (B) " ++msgstr " Lesezeichen (B) " ++ ++#: menu.c:285 ++msgid " Help (h) " ++msgstr " Hilfe (h) " ++ ++#: menu.c:286 ++msgid " Option (o) " ++msgstr " Einstellungen (o) " ++ ++#: menu.c:288 ++msgid " Quit (q) " ++msgstr " Programm verlassen (q) " ++ ++#: rc.c:60 ++msgid "External Viewer Setup" ++msgstr "Konfiguration für externe Anzeigeprogramme" ++ ++#: rc.c:61 ++msgid "Tab width in characters" ++msgstr "Tabulatorbreite in Zeichen" ++ ++#: rc.c:62 ++msgid "Indent for HTML rendering" ++msgstr "Einzug bei HTML-Darstellung" ++ ++#: rc.c:63 ++msgid "Number of pixels per character (4.0...32.0)" ++msgstr "Anzahl von Pixeln pro Zeichen (4.0 bis 32.0)" ++ ++#: rc.c:64 ++msgid "Number of pixels per line (4.0...64.0)" ++msgstr "Anzahl von Pixeln pro Zeile (4.0 bis 64.0)" ++ ++#: rc.c:65 ++#entsprechend Bescheibung aus MANUAL.html, mh 14.10.2014 ++msgid "Number of remembered lines when used as a pager" ++msgstr "Anzahl gemerkter, über die Standardeingabe erhaltener Zeilen" ++ ++#: rc.c:66 ++msgid "Use URL history" ++msgstr "URL-Chronik verwenden" ++ ++#: rc.c:67 ++msgid "Number of remembered URL" ++msgstr "Anzahl von URLs in Chronik" ++ ++#: rc.c:68 ++msgid "Save URL history" ++msgstr "URL-Chronik speichern" ++ ++#: rc.c:69 ++msgid "Render frames automatically" ++msgstr "Frames selbstständig darstellen" ++ ++#: rc.c:70 ++msgid "Treat argument without scheme as URL" ++msgstr "Eingabe ohne Protokoll-Präfix als URL auffassen" ++ ++#: rc.c:71 ++msgid "Use _self as default target" ++msgstr "_self als Standard-Zielfenster verwenden" ++ ++#: rc.c:72 ++msgid "Open link on new tab if target is _blank or _new" ++msgstr "Link in neuem Reiter öffnen, falls für Zielfenster _blank oder _new definiert ist" ++ ++#: rc.c:73 ++msgid "Open download list panel on new tab" ++msgstr "Downloadliste in neuem Reiter öffnen" ++ ++#: rc.c:74 ++msgid "Display link URL automatically" ++msgstr "URL der Links selbstständig anzeigen" ++ ++#: rc.c:75 ++msgid "Display link numbers" ++msgstr "Linknummern anzeigen" ++ ++#: rc.c:76 ++msgid "Display decoded URL" ++msgstr "URL entschlüsselt anzeigen" ++ ++#: rc.c:77 ++msgid "Display current line number" ++msgstr "Aktuelle Zeilennummer anzeigen" ++ ++#: rc.c:78 ++msgid "Display inline images" ++msgstr "Eingebettete Bilder anzeigen" ++ ++#: rc.c:79 ++msgid "Display pseudo-ALTs for inline images with no ALT or TITLE string" ++msgstr "Pseudo-ALTs zu eingebetteten Bildern ohne ALT oder TITLE anzeigen" ++ ++#: rc.c:81 ++msgid "Load inline images automatically" ++msgstr "Eingebettete Bilder selbstständig laden" ++ ++#: rc.c:82 ++msgid "Maximum processes for parallel image loading" ++msgstr "Anzahl zulässiger Prozesse zum gleichzeitigen Laden von Bildern" ++ ++#: rc.c:83 ++msgid "Use external image viewer" ++msgstr "Externen Bildbetrachter verwenden" ++ ++#: rc.c:84 ++msgid "Scale of image (%)" ++msgstr "Bilder prozentual skalieren" ++ ++#: rc.c:85 ++msgid "External command to display image" ++msgstr "Befehl für externen Bildbetrachter" ++ ++#: rc.c:86 ++msgid "Use link list of image map" ++msgstr "Bei Grafiken mit eingebetteten Links Ziele auflisten" ++ ++#: rc.c:88 ++msgid "Display file names in multi-column format" ++msgstr "Dateinamen auf Spalten verteilt anzeigen" ++ ++#: rc.c:89 ++msgid "Use ASCII equivalents to display entities" ++msgstr "ASCII-Ersatz für in HTML benannte Zeichen verwenden" ++ ++#: rc.c:90 ++msgid "Character type for border of table and menu" ++msgstr "Zeichen zum Einrahmen von Tabellen und Menüs" ++ ++#: rc.c:91 ++msgid "Fold lines in TEXTAREA" ++msgstr "In Eingabefeldern vom Typ TEXTAREA Texte umbrechen" ++ ++#: rc.c:92 ++msgid "Display INS, DEL, S and STRIKE element" ++msgstr "Umsetzung der Elemente INS, DEL, S und STRIKE" ++ ++#: rc.c:93 ++msgid "Display with color" ++msgstr "In Farbe anzeigen" ++ ++#: rc.c:94 ++msgid "Color of normal character" ++msgstr "Farbe für normalen Text" ++ ++#: rc.c:95 ++msgid "Color of anchor" ++msgstr "Farbe für Links / Element A" ++ ++#: rc.c:96 ++msgid "Color of image link" ++msgstr "Farbe für Bilder / Element IMG" ++ ++#: rc.c:97 ++msgid "Color of form" ++msgstr "Farbe für Eingaben / Element INPUT" ++ ++#: rc.c:98 ++msgid "Enable coloring of active link" ++msgstr "Aktiven Link farblich hervorheben" ++ ++#: rc.c:99 ++msgid "Color of currently active link" ++msgstr "Farbe des derzeit aktiven Links " ++ ++#: rc.c:100 ++msgid "Use visited link color" ++msgstr "Besuchte Links farblich hervorheben" ++ ++#: rc.c:101 ++msgid "Color of visited link" ++msgstr "Farbe für besuchte Links" ++ ++#: rc.c:102 ++msgid "Color of background" ++msgstr "Hintergrundfarbe" ++ ++#: rc.c:103 ++msgid "Color of mark" ++msgstr "Farbe für Textmarken" ++#msgstr "Farbe für Textmarkierungen" ++ ++#: rc.c:104 ++msgid "Use proxy" ++msgstr "Proxy verwenden" ++ ++#: rc.c:105 ++msgid "URL of HTTP proxy host" ++msgstr "URL des HTTP-Proxy-Hosts" ++ ++#: rc.c:107 ++msgid "URL of HTTPS proxy host" ++msgstr "URL des HTTPS-Proxy-Hosts" ++ ++#: rc.c:110 ++msgid "URL of GOPHER proxy host" ++msgstr "URL des GOPHER-Proxy-Hosts" ++ ++#: rc.c:112 ++msgid "URL of FTP proxy host" ++msgstr "URL des FTP-Proxy-Hosts" ++ ++#: rc.c:113 ++msgid "Domains to be accessed directly (no proxy)" ++msgstr "Ohne Proxy, direkt zu kontaktierende Domains" ++ ++#: rc.c:114 ++msgid "Check noproxy by network address" ++msgstr "Direkten Datentransfer ohne Proxy mittels Netzwerkadresse sicherstellen" ++ ++#: rc.c:115 ++msgid "Disable cache" ++msgstr "Zwischenspeicherung deaktivieren" ++ ++#: rc.c:117 ++msgid "News server" ++msgstr "News-Server" ++ ++#: rc.c:118 ++msgid "Mode of news server" ++msgstr "Modus des News-Servers" ++ ++#: rc.c:119 ++msgid "Number of news messages" ++msgstr "News-Anzahl" ++ ++#: rc.c:121 ++msgid "Order of name resolution" ++msgstr "Reihenfolge der Namens-Auflösung" ++ ++#: rc.c:122 ++msgid "Directory corresponding to / (document root)" ++msgstr "Wurzelverzeichnis für Dokumente (/)" ++ ++#: rc.c:123 ++msgid "Directory corresponding to /~user" ++msgstr "Pfad zum Benutzerverzeichnis (~)" ++ ++#: rc.c:124 ++msgid "Directory corresponding to /cgi-bin" ++msgstr "Verzeichnis für ausführbare Skripte (cgi-bin)" ++ ++#: rc.c:125 ++msgid "Confirm when quitting with q" ++msgstr "Das Programm erst nach Bestätigung verlassen" ++ ++#: rc.c:126 ++msgid "Close tab if buffer is last when back" ++msgstr "Reiter mit nur einem Puffer auf Zurück-Befehl hin schließen" ++ ++#: rc.c:128 ++msgid "Enable mark operations" ++msgstr "Arbeit mit Textmarken ermöglichen" ++#msgstr "Arbeit mit Textmarkierungen ermöglichen" ++ ++#: rc.c:130 ++msgid "Enable Emacs-style line editing" ++msgstr "Zeilen wie in Emacs bearbeiten" ++ ++#: rc.c:131 ++msgid "Enable vi-like numeric prefix" ++msgstr "Vorangestellte Zahlen wie in vi aktivieren" ++ ++#: rc.c:132 ++msgid "Move cursor to top line when going to label" ++msgstr "Labels nach Aufsuchen immer oben positionieren" ++ ++#: rc.c:133 ++msgid "Move cursor to top line when moving to next page" ++msgstr "Beim Umblättern Eingabemarke nach oben setzen" ++ ++#: rc.c:134 ++msgid "Fold lines of plain text file" ++msgstr "Zeilen in Textdateien umbrechen" ++ ++#: rc.c:135 ++msgid "Show line numbers" ++msgstr "Zeilennummern anzeigen" ++ ++#: rc.c:136 ++msgid "Show search string" ++msgstr "Suchbegriff anzeigen" ++ ++#: rc.c:137 ++msgid "List of mime.types files" ++msgstr "Liste der mime.types-Dateien" ++ ++#: rc.c:138 ++msgid "List of mailcap files" ++msgstr "Liste der mailcap-Dateien" ++ ++#: rc.c:139 ++msgid "List of urimethodmap files" ++msgstr "Liste von Dateien mit URI-Methode-Zuordnungen" ++ ++#: rc.c:140 ++msgid "Editor" ++msgstr "Editor" ++ ++#: rc.c:141 ++msgid "Mailer" ++msgstr "Mail-Programm" ++ ++#: rc.c:142 ++# korrespondiert mit Pulldown-Menü, daher verkürzt. mh 09.10.2014 ++msgid "How to call Mailer for mailto URLs with options" ++msgstr "Umgang mit mailto-URLs" ++ ++#: rc.c:143 ++msgid "External Browser" ++msgstr "Externer Browser" ++ ++#: rc.c:144 ++msgid "Second External Browser" ++msgstr "Zweiter externer Browser" ++ ++#: rc.c:145 ++msgid "Third External Browser" ++msgstr "Dritter externer Browser" ++ ++#: rc.c:146 ++# entsprechend file:///usr/share/doc/w3m/README.passwd ++# Prüfung beanstandete auch passwd_file mit Zugriffbytes 600, mh, 05.10.2014 ++msgid "Disable secret file security check" ++msgstr "Keine Prüfung der Sicherheit bei Dateien mit geheimem Inhalt" ++ ++#: rc.c:147 ++msgid "Password file" ++msgstr "Passwort-Datei" ++ ++#: rc.c:148 ++msgid "File for setting form on loading" ++msgstr "Datei mit vordefinierten Eingaben für Formulare" ++ ++#: rc.c:149 ++msgid "Password for anonymous FTP (your mail address)" ++msgstr "Passwort für anonyme FTP-Anmeldung (Ihre Mailadresse)" ++ ++#: rc.c:150 ++msgid "Generate domain part of password for FTP" ++msgstr "Domain-Teil des FTP-Passwortes erzeugen" ++ ++#: rc.c:151 ++msgid "User-Agent identification string" ++msgstr "Browserkennung übermitteln" ++ ++#: rc.c:152 ++msgid "Accept-Encoding header" ++msgstr "Accept-Encoding-Kopfzeile" ++ ++#: rc.c:153 ++msgid "Accept header" ++msgstr "Accept-Kopfzeile" ++ ++#: rc.c:154 ++msgid "Accept-Language header" ++msgstr "Accept-Language-Kopfzeile" ++ ++#: rc.c:155 ++msgid "Treat URL-like strings as links in all pages" ++msgstr "URL-artige Zeichenketten auf allen Seiten als Links auffassen" ++ ++#: rc.c:156 ++msgid "Wrap search" ++msgstr "Im Dokument umlaufend suchen" ++ ++#: rc.c:157 ++msgid "Display unseen objects (e.g. bgimage tag)" ++msgstr "Nicht gezeigte Objekte melden (z.B. Hintergrundbild)" ++ ++#: rc.c:158 ++msgid "Uncompress compressed data automatically when downloading" ++msgstr "Komprimierte Daten beim Download selbstständig dekomprimieren" ++ ++#: rc.c:160 ++# String nicht in Optionen-Menü gefunden. mh, 05.10.2014 ++msgid "Run external viewer in a separate session" ++msgstr "Externe Anzeigeprogramme in eigener Sitzung laufen lassen" ++ ++#: rc.c:162 ++msgid "Run external viewer in the background" ++msgstr "Externe Anzeigeprogramme im Hintergrund laufen lassen" ++ ++#: rc.c:164 ++msgid "Use external program for directory listing" ++msgstr "Externes Programm zum Auflisten von Verzeichnissen verwenden" ++ ++#: rc.c:165 ++msgid "URL of directory listing command" ++msgstr "URL des Befehls zum Auflisten von Verzeichnissen" ++ ++#: rc.c:167 ++msgid "Enable dictionary lookup through CGI" ++msgstr "Wörterbuchabfrage mittels CGI aktivieren" ++ ++#: rc.c:168 ++msgid "URL of dictionary lookup command" ++msgstr "URL des Befehls zur Wörterbuch-Abfrage" ++ ++#: rc.c:170 ++msgid "Display link name for images lacking ALT" ++msgstr "Bei Bildern ohne ALT-Angabe Linkziel anzeigen" ++ ++#: rc.c:171 ++msgid "Index file for directories" ++msgstr "Indexdatei für Verzeichnisse" ++ ++#: rc.c:172 ++msgid "Prepend http:// to URL automatically" ++msgstr "Ziel-Eingaben gegebenenfalls http:// voranstellen" ++ ++#: rc.c:173 ++msgid "Default value for open-URL command" ++msgstr "Vorgabewert bei der Adresseneingabe" ++ ++#: rc.c:174 ++msgid "Decode Content-Transfer-Encoding when saving" ++msgstr "Beim Speichern entsprechend Content-Transfer-Encoding entschlüsseln" ++ ++#: rc.c:175 ++msgid "Preserve timestamp when saving" ++msgstr "Zeitstempel beim Speichern erhalten" ++ ++#: rc.c:177 ++msgid "Enable mouse" ++msgstr "Maus aktivieren" ++ ++#: rc.c:178 ++msgid "Scroll in reverse direction of mouse drag" ++msgstr "Mausbewegungen entgegengesetzt scrollen" ++ ++#: rc.c:179 ++msgid "Behavior of wheel scroll speed" ++msgstr "Umsetzung der Mausradbewegung" ++ ++#: rc.c:180 ++msgid "(A only)Scroll by # (%) of screen" ++msgstr "(nur A) Um # % des Fensters scrollen" ++ ++#: rc.c:181 ++msgid "(B only)Scroll by # lines" ++msgstr "(nur B) Um # Zeilen scrollen" ++ ++#: rc.c:183 ++msgid "Free memory of undisplayed buffers" ++msgstr "Speicherplatz nicht angezeigter Puffer freigeben" ++ ++#: rc.c:184 ++msgid "Suppress `Referer:' header" ++msgstr "Referer-Kopfzeile unterdrücken" ++ ++#: rc.c:185 ++msgid "Search case-insensitively" ++msgstr "Groß- und Kleinschreibung beim Suchen ignorieren" ++ ++#: rc.c:186 ++msgid "Use LESSOPEN" ++msgstr "LESSOPEN verwenden" ++ ++#: rc.c:189 ++msgid "Perform SSL server verification" ++msgstr "SSL-Server-Verifizierung durchführen" ++ ++#: rc.c:190 ++msgid "PEM encoded certificate file of client" ++msgstr "PEM-kodierte Zertifikatsdatei des Clients" ++ ++#: rc.c:191 ++msgid "PEM encoded private key file of client" ++msgstr "PEM-kodierte private Schlüsseldatei des Clients" ++ ++#: rc.c:192 ++msgid "Path to directory for PEM encoded certificates of CAs" ++msgstr "Pfad zum Verzeichnis für PEM-kodierte Zertifikate von CAs" ++ ++#: rc.c:193 ++msgid "File consisting of PEM encoded certificates of CAs" ++msgstr "Datei mit PEM-kodierten Zertifikaten von CAs" ++ ++#: rc.c:195 ++msgid "List of forbidden SSL methods (2: SSLv2, 3: SSLv3, t:TLSv1)" ++msgstr "Liste unzulässiger SSL-Verfahren (2: SSLv2, 3: SSLv3, t: TLSv1)" ++ ++#: rc.c:198 ++msgid "Enable cookie processing" ++msgstr "Cookie-Verarbeitung aktivieren" ++ ++#: rc.c:199 ++msgid "Print a message when receiving a cookie" ++msgstr "Den Empfang von Cookies melden" ++ ++#: rc.c:200 ++msgid "Accept cookies" ++msgstr "Cookies akzeptieren" ++ ++#: rc.c:201 ++msgid "Action to be taken on invalid cookie" ++msgstr "Reaktion auf ungültiges Cookie" ++ ++#: rc.c:202 ++msgid "Domains to reject cookies from" ++msgstr "Domains, deren Cookies abzulehnen sind" ++ ++#: rc.c:203 ++msgid "Domains to accept cookies from" ++msgstr "Domains, deren Cookies akzeptiert werden" ++ ++#: rc.c:204 ++# Variable vom Typ String im Abschnitt Cookies-Einstellungen, mh 10.10.2014 ++#, fuzzy ++msgid "Domains to avoid [wrong number of dots]" ++msgstr "Zu meidende Domains (falsche Anzahl von Punkten)" ++ ++#: rc.c:206 ++msgid "Number of redirections to follow" ++msgstr "Anzahl zu akzeptierender Umleitungen" ++ ++# Konfigurationsvariable vom Typ string, mh, 05.10.2014 ++#: rc.c:207 ++msgid "Enable processing of meta-refresh tag" ++msgstr "Meta-Refresh-Element verarbeiten" ++ ++#: rc.c:210 ++msgid "Enable Migemo (Roma-ji search)" ++msgstr "Romaji-Suche mittels Migemo aktivieren" ++ ++#: rc.c:211 ++msgid "Migemo command" ++msgstr "Migemo-Befehl" ++ ++#: rc.c:215 ++msgid "Display charset" ++msgstr "Zeichenkodierung der Anzeige" ++ ++#: rc.c:216 ++msgid "Default document charset" ++msgstr "Zeichenkodierungs-Vorgabe für Dokumente" ++ ++#: rc.c:217 ++msgid "Automatic charset detect when loading" ++msgstr "Selbstständige Erkennung der Zeichenkodierung beim Laden" ++ ++#: rc.c:218 ++msgid "System charset" ++msgstr "Zeichenkodierung des Systems" ++ ++#: rc.c:219 ++msgid "System charset follows locale(LC_CTYPE)" ++msgstr "Zeichenkodierung des Systems entsprechend Locale (LC_CTYPE)" ++ ++#: rc.c:220 ++# war zuvor ++# msgstr "Halfdump mit der zur Anzeige benutzten Zeichenkodierung exportieren" ++msgid "Output halfdump with display charset" ++msgstr "Halfdump in der zur Anzeige benutzten Kodierung" ++ ++#: rc.c:221 ++# Konfigurationsvariable vom Typ boolean, mh, 05.10.2014 ++#, fuzzy ++msgid "Use multi column characters" ++msgstr "Spaltenübergreifende Zeichen verwenden" ++ ++#: rc.c:222 ++msgid "Use combining characters" ++msgstr "Kombinationszeichen verwenden" ++ ++#: rc.c:223 ++msgid "Use double width for some Unicode characters" ++msgstr "Einzelnen Unicode-Zeichen zwei Spalten einräumen" ++ ++#: rc.c:224 ++msgid "Use Unicode language tags" ++msgstr "Unicode-Sprach-Tags verwenden" ++ ++#: rc.c:225 ++msgid "Charset conversion using Unicode map" ++msgstr "Zeichen in Unicode kodieren" ++ ++#: rc.c:226 ++msgid "Charset conversion when loading" ++msgstr "Zeichenkodierung beim Laden anpassen" ++ ++#: rc.c:227 ++msgid "Adjust search string for document charset" ++msgstr "Zu suchende Zeichenkette der Kodierung des Dokumentes anpassen" ++ ++#: rc.c:228 ++msgid "Fix character width when conversion" ++msgstr "Bei Umwandlung an der Breite von Zeichen festhalten" ++ ++#: rc.c:229 ++msgid "Use GB 12345 Unicode map instead of GB 2312's" ++msgstr "GB-12345-Unicode statt GB 2312 verwenden" ++ ++#: rc.c:230 ++msgid "Use JIS X 0201 Roman for ISO-2022-JP" ++msgstr "JIS X 0201 Roman statt ISO-2022-JP verwenden" ++ ++#: rc.c:231 ++msgid "Use JIS C 6226:1978 for ISO-2022-JP" ++msgstr "JIS C 6226:1978 statt ISO-2022-JP verwenden" ++ ++#: rc.c:232 ++msgid "Use JIS X 0201 Katakana" ++msgstr "JIS X 0201 Katakana verwenden" ++ ++#: rc.c:233 ++msgid "Use JIS X 0212:1990 (Supplemental Kanji)" ++msgstr "JIS X 0212:1990 verwenden (ergänzendes Kanji)" ++ ++#: rc.c:234 ++msgid "Use JIS X 0213:2000 (2000JIS)" ++msgstr "JIS X 0213:2000 verwenden (2000JIS)" ++ ++#: rc.c:235 ++msgid "Strict ISO-2022-JP/KR/CN" ++msgstr "Striktes ISO-2022-JP/KR/CN" ++ ++#: rc.c:236 ++msgid "Treat 4 bytes char. of GB18030 as Unicode" ++msgstr "4-Byte-Zeichen von GB 18030 als Unicode auffassen" ++ ++#: rc.c:237 ++msgid "Simple Preserve space" ++msgstr "Einfache Platzerhaltung" ++ ++#: rc.c:240 ++msgid "keymap file" ++msgstr "Tastaturbelegungs-Datei" ++ ++#: rc.c:257 ++msgid "black" ++msgstr "schwarz" ++ ++#: rc.c:258 ++msgid "red" ++msgstr "rot" ++ ++#: rc.c:259 ++msgid "green" ++msgstr "grün" ++ ++#: rc.c:260 ++msgid "yellow" ++msgstr "gelb" ++ ++#: rc.c:261 ++msgid "blue" ++msgstr "blau" ++ ++#: rc.c:262 ++msgid "magenta" ++msgstr "magenta" ++ ++#: rc.c:263 ++msgid "cyan" ++msgstr "cyan" ++ ++#: rc.c:264 ++msgid "white" ++msgstr "weiß" ++ ++#: rc.c:265 ++msgid "terminal" ++msgstr "wie Terminal" ++ ++#: rc.c:284 ++msgid "none" ++msgstr "keiner" ++ ++#: rc.c:285 ++msgid "current URL" ++msgstr "aktuelle URL" ++ ++#: rc.c:286 ++msgid "link URL" ++msgstr "Link-URL" ++ ++#: rc.c:291 ++msgid "simple" ++msgstr "einfach" ++ ++#: rc.c:292 ++msgid "use tag" ++msgstr "durch Tags" ++ ++#: rc.c:293 ++msgid "fontify" ++msgstr "hervorgehoben" ++ ++#: rc.c:299 ++msgid "A:relative to screen height" ++msgstr "A: relativ zu Fensterhöhe" ++ ++#: rc.c:300 ++msgid "B:fixed speed" ++msgstr "B: feste Geschwindigkeit" ++ ++#: rc.c:307 ++msgid "unspecified" ++msgstr "nicht spezifiziert" ++ ++#: rc.c:308 ++msgid "inet inet6" ++msgstr "inet inet6" ++ ++#: rc.c:309 ++msgid "inet6 inet" ++msgstr "inet6 inet" ++ ++#: rc.c:310 ++msgid "inet only" ++msgstr "nur inet" ++ ++#: rc.c:311 ++msgid "inet6 only" ++msgstr "nur inet6" ++ ++#: rc.c:318 ++msgid "discard" ++msgstr "verwerfen" ++ ++#: rc.c:320 ++msgid "accept" ++msgstr "annehmen" ++ ++#: rc.c:322 ++msgid "ask" ++msgstr "nachfragen" ++ ++#: rc.c:329 ++# gehört zu rc.c:142 ++# erscheint in Pulldown-Menü, daher verkürzt. mh 09.10.2014 ++msgid "use internal mailer instead" ++msgstr "Mail intern erstellen" ++ ++#: rc.c:331 ++# gehört zu rc.c:142 ++# erscheint in Pulldown-Menü, daher verkürzt. mh 09.10.2014 ++msgid "ignore options and use only the address" ++msgstr "Optionen ignorieren" ++ ++#: rc.c:332 ++# gehört zu rc.c:142 ++# erscheint in Pulldown-Menü, daher verkürzt. mh 09.10.2014 ++msgid "use full mailto URL" ++msgstr "komplett verwenden" ++ ++#: rc.c:341 ++msgid "OFF" ++msgstr "AUS" ++ ++#: rc.c:342 ++msgid "Only ISO 2022" ++msgstr "Nur ISO-2022" ++ ++#: rc.c:343 ++msgid "ON" ++msgstr "AN" ++ ++#: rc.c:349 ++# Wert aus einem Set zur Wiedergabe von Rändern, mh, 05.10.2014 ++msgid "ASCII" ++msgstr "ASCII" ++ ++#: rc.c:350 ++# Wert aus einem Set zur Wiedergabe von Rändern, mh, 05.10.2014 ++# hier ist "Zeichensatz" akzeptabel mh, 09.10.2014 ++msgid "charset specific" ++msgstr "zeichensatzspezifisch" ++ ++#: rc.c:351 ++# Wert aus einem Set zur Wiedergabe von Rändern, mh, 05.10.2014 ++msgid "DEC special graphics" ++msgstr "mit DEC-Grafiken" ++ ++#: rc.c:714 ++msgid "Display Settings" ++msgstr "Einstellungen zur Anzeige" ++ ++#: rc.c:716 ++msgid "Color Settings" ++msgstr "Farbeinstellungen" ++ ++#: rc.c:718 ++msgid "Miscellaneous Settings" ++msgstr "Weitere Einstellungen" ++ ++#: rc.c:719 ++msgid "Directory Settings" ++msgstr "Verzeichnis-Einstellungen" ++ ++#: rc.c:720 ++msgid "External Program Settings" ++msgstr "Einstellungen für externe Programme" ++ ++#: rc.c:721 ++msgid "Network Settings" ++msgstr "Netzwerk-Einstellungen" ++ ++#: rc.c:722 ++msgid "Proxy Settings" ++msgstr "Proxy-Einstellungen" ++ ++#: rc.c:724 ++msgid "SSL Settings" ++msgstr "SSL-Einstellungen" ++ ++#: rc.c:727 ++msgid "Cookie Settings" ++msgstr "Cookie-Einstellungen" ++ ++#: rc.c:730 ++msgid "Charset Settings" ++msgstr "Zeichenkodierungs-Einstellungen" ++ ++#. TRANSLATORS: ++#. * AcceptLang default: this is used in Accept-Language: HTTP request ++#. * header. For example, ja.po should translate it as ++#. * "ja;q=1.0, en;q=0.5" like that. ++#. ++#: rc.c:1209 ++msgid "en;q=1.0" ++msgstr "de;q=1.0, en;q=0.5" +diff --git a/po/ja.po b/po/ja.po +index d67c695..c16557a 100644 +--- a/po/ja.po ++++ b/po/ja.po +@@ -12,7 +12,7 @@ msgstr "" + "PO-Revision-Date: 2010-08-20 18:45+0900\n" + "Last-Translator: Fumitoshi UKAI <ukai@debian.or.jp>\n" + "Language-Team: Japanese\n" +-"Language: \n" ++"Language: ja\n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=UTF-8\n" + "Content-Transfer-Encoding: 8bit\n" +@@ -407,6 +407,10 @@ msgid "File for setting form on loading" + msgstr "文書読込時のフォーム設定用ファイル" + + #: rc.c:149 ++msgid "File for preferences for each site" ++msgstr "サイト別設定のファイル" ++ ++#: rc.c:149 + msgid "Password for anonymous FTP (your mail address)" + msgstr "FTPのパスワード(普通は自分のmail addressを使う)" + +diff --git a/proto.h b/proto.h +index f8a7345..0d8beb5 100644 +--- a/proto.h ++++ b/proto.h +@@ -11,6 +11,8 @@ extern void pushEvent(int cmd, void *data); + extern MySignalHandler intTrap(SIGNAL_ARG); + extern void pgFore(void); + extern void pgBack(void); ++extern void hpgFore(void); ++extern void hpgBack(void); + extern void lup1(void); + extern void ldown1(void); + extern void ctrCsrV(void); +@@ -61,6 +63,7 @@ extern void submitForm(void); + extern void followForm(void); + extern void topA(void); + extern void lastA(void); ++extern void nthA(void); + extern void onA(void); + + extern void nextA(void); +@@ -162,6 +165,24 @@ extern Str searchURIMethods(ParsedURL *pu); + extern void chkExternalURIBuffer(Buffer *buf); + #endif + extern ParsedURL *schemeToProxy(int scheme); ++#ifdef USE_M17N ++extern wc_ces url_to_charset(const char *url, const ParsedURL *base, ++ wc_ces doc_charset); ++extern char *url_encode(const char *url, const ParsedURL *base, ++ wc_ces doc_charset); ++#if 0 ++extern char *url_decode(const char *url, const ParsedURL *base, ++ wc_ces doc_charset); ++#endif ++extern char *url_decode2(const char *url, const Buffer *buf); ++#else /* !defined(USE_M17N) */ ++#define url_encode(url, base, cs) url_quote(url) ++extern char *url_decode0(const char *url); ++#if 0 ++#define url_decode(url, base, cs) url_decode0(url) ++#endif ++#define url_decode2(url, buf) url_decode0(url) ++#endif /* !defined(USE_M17N) */ + extern void examineFile(char *path, URLFile *uf); + extern char *acceptableEncoding(); + extern int dir_exist(char *path); +@@ -180,7 +201,6 @@ extern void push_symbol(Str str, char symbol, int width, int n); + #ifdef USE_UNICODE + extern void update_utf8_symbol(void); + #endif +-extern Buffer *loadFile(char *path); + extern Buffer *loadGeneralFile(char *path, ParsedURL *current, char *referer, + int flag, FormList *request); + extern int is_boundary(unsigned char *, unsigned char *); +@@ -207,6 +227,8 @@ extern int getImageSize(ImageCache * cache); + extern Str process_img(struct parsed_tag *tag, int width); + extern Str process_anchor(struct parsed_tag *tag, char *tagbuf); + extern Str process_input(struct parsed_tag *tag); ++extern Str process_button(struct parsed_tag *tag); ++extern Str process_n_button(void); + extern Str process_select(struct parsed_tag *tag); + extern Str process_n_select(void); + extern void feed_select(char *str); +@@ -249,8 +271,7 @@ extern Buffer *openPagerBuffer(InputStream stream, Buffer *buf); + extern Buffer *openGeneralPagerBuffer(InputStream stream); + extern Line *getNextPage(Buffer *buf, int plen); + extern int save2tmp(URLFile uf, char *tmpf); +-extern int doExternal(URLFile uf, char *path, char *type, Buffer **bufp, +- Buffer *defaultbuf); ++extern Buffer *doExternal(URLFile uf, char *type, Buffer *defaultbuf); + extern int _doFileCopy(char *tmpf, char *defstr, int download); + #define doFileCopy(tmpf, defstr) _doFileCopy(tmpf, defstr, FALSE); + extern int doFileMove(char *tmpf, char *defstr); +@@ -507,7 +528,7 @@ extern ParsedURL *baseURL(Buffer *buf); + extern int openSocket(char *hostname, char *remoteport_name, + unsigned short remoteport_num); + extern void parseURL(char *url, ParsedURL *p_url, ParsedURL *current); +-extern void copyParsedURL(ParsedURL *p, ParsedURL *q); ++extern void copyParsedURL(ParsedURL *p, const ParsedURL *q); + extern void parseURL2(char *url, ParsedURL *pu, ParsedURL *current); + extern Str parsedURL2Str(ParsedURL *pu); + extern int getURLScheme(char **url); +@@ -586,9 +607,12 @@ extern char *getAnchorText(Buffer *buf, AnchorList *al, Anchor *a); + extern Buffer *link_list_panel(Buffer *buf); + + extern Str decodeB(char **ww); ++extern void decodeB_to_growbuf(struct growbuf *gb, char **ww); + extern Str decodeQ(char **ww); + extern Str decodeQP(char **ww); ++extern void decodeQP_to_growbuf(struct growbuf *gb, char **ww); + extern Str decodeU(char **ww); ++extern void decodeU_to_growbuf(struct growbuf *gb, char **ww); + #ifdef USE_M17N + extern Str decodeWord(char **ow, wc_ces * charset); + extern Str decodeMIME(Str orgstr, wc_ces * charset); +@@ -611,6 +635,7 @@ extern char *confFile(char *base); + extern char *auxbinFile(char *base); + extern char *libFile(char *base); + extern char *helpFile(char *base); ++extern const void *querySiteconf(const ParsedURL *query_pu, int field); + extern Str localCookie(void); + extern Str loadLocalDir(char *dirname); + extern void set_environ(char *var, char *value); +@@ -683,6 +708,7 @@ extern void reMark(void); + + #ifdef USE_MOUSE + extern void mouse(void); ++extern void sgrmouse(void); + extern void mouse_init(void); + extern void mouse_end(void); + extern void mouse_active(void); +@@ -723,6 +749,8 @@ extern int getKey(char *s); + extern char *getKeyData(int key); + extern char *getWord(char **str); + extern char *getQWord(char **str); ++struct regex; ++extern char *getRegexWord(const char **str, struct regex **regex_ret); + #ifdef USE_MOUSE + extern void initMouseAction(void); + #endif +@@ -786,5 +814,3 @@ extern void dispVer(void); + void srand48(long); + long lrand48(void); + #endif +- +-#include "indep.h" +diff --git a/rc.c b/rc.c +index 8441a39..3bf6cea 100644 +--- a/rc.c ++++ b/rc.c +@@ -9,7 +9,9 @@ + #include <errno.h> + #include "parsetag.h" + #include "local.h" ++#include "regex.h" + #include <stdlib.h> ++#include <stddef.h> + + struct param_ptr { + char *name; +@@ -146,6 +148,7 @@ static int OptionEncode = FALSE; + #define CMT_DISABLE_SECRET_SECURITY_CHECK N_("Disable secret file security check") + #define CMT_PASSWDFILE N_("Password file") + #define CMT_PRE_FORM_FILE N_("File for setting form on loading") ++#define CMT_SITECONF_FILE N_("File for preferences for each site") + #define CMT_FTPPASS N_("Password for anonymous FTP (your mail address)") + #define CMT_FTPPASS_HOSTNAMEGEN N_("Generate domain part of password for FTP") + #define CMT_USERAGENT N_("User-Agent identification string") +@@ -619,6 +622,8 @@ struct param_ptr params9[] = { + CMT_FTPPASS_HOSTNAMEGEN, NULL}, + {"pre_form_file", P_STRING, PI_TEXT, (void *)&pre_form_file, + CMT_PRE_FORM_FILE, NULL}, ++ {"siteconf_file", P_STRING, PI_TEXT, (void *)&siteconf_file, ++ CMT_SITECONF_FILE, NULL}, + {"user_agent", P_STRING, PI_TEXT, (void *)&UserAgent, CMT_USERAGENT, NULL}, + {"no_referer", P_INT, PI_ONOFF, (void *)&NoSendReferer, CMT_NOSENDREFERER, + NULL}, +@@ -1173,6 +1178,8 @@ do_mkdir(const char *dir, long mode) + #endif /* not __MINW32_VERSION */ + #endif /* not __EMX__ */ + ++static void loadSiteconf(void); ++ + void + sync_with_option(void) + { +@@ -1199,6 +1206,7 @@ sync_with_option(void) + #endif + loadPasswd(); + loadPreForm(); ++ loadSiteconf(); + + if (AcceptLang == NULL || *AcceptLang == '\0') { + /* TRANSLATORS: +@@ -1556,3 +1564,217 @@ helpFile(char *base) + return expandPath(Strnew_m_charp(w3m_help_dir(), "/", base, NULL)->ptr); + } + #endif ++ ++/* siteconf */ ++/* ++ * url "<url>"|/<re-url>/|m@<re-url>@i [exact] ++ * substitute_url "<destination-url>" ++ * url_charset <charset> ++ * no_referer_from on|off ++ * no_referer_to on|off ++ * ++ * The last match wins. ++ */ ++ ++struct siteconf_rec { ++ struct siteconf_rec *next; ++ char *url; ++ Regex *re_url; ++ int url_exact; ++ unsigned char mask[(SCONF_N_FIELD + 7) >> 3]; ++ ++ char *substitute_url; ++#ifdef USE_M17N ++ wc_ces url_charset; ++#endif ++ int no_referer_from; ++ int no_referer_to; ++}; ++#define SCONF_TEST(ent, f) ((ent)->mask[(f)>>3] & (1U<<((f)&7))) ++#define SCONF_SET(ent, f) ((ent)->mask[(f)>>3] |= (1U<<((f)&7))) ++#define SCONF_CLEAR(ent, f) ((ent)->mask[(f)>>3] &= ~(1U<<((f)&7))) ++ ++static struct siteconf_rec *siteconf_head = NULL; ++static struct siteconf_rec *newSiteconfRec(void); ++ ++static struct siteconf_rec * ++newSiteconfRec(void) ++{ ++ struct siteconf_rec *ent; ++ ++ ent = New(struct siteconf_rec); ++ ent->next = NULL; ++ ent->url = NULL; ++ ent->re_url = NULL; ++ ent->url_exact = FALSE; ++ memset(ent->mask, 0, sizeof(ent->mask)); ++ ++ ent->substitute_url = NULL; ++#ifdef USE_M17N ++ ent->url_charset = 0; ++#endif ++ return ent; ++} ++ ++static void ++loadSiteconf(void) ++{ ++ char *efname; ++ FILE *fp; ++ Str line; ++ struct siteconf_rec *ent = NULL; ++ ++ siteconf_head = NULL; ++ if (!siteconf_file) ++ return; ++ if ((efname = expandPath(siteconf_file)) == NULL) ++ return; ++ fp = fopen(efname, "r"); ++ if (fp == NULL) ++ return; ++ while (line = Strfgets(fp), line->length > 0) { ++ char *p, *s; ++ ++ Strchop(line); ++ p = line->ptr; ++ SKIP_BLANKS(p); ++ if (*p == '#' || *p == '\0') ++ continue; ++ s = getWord(&p); ++ ++ /* The "url" begins a new record. */ ++ if (strcmp(s, "url") == 0) { ++ char *url, *opt; ++ struct siteconf_rec *newent; ++ ++ /* First, register the current record. */ ++ if (ent) { ++ ent->next = siteconf_head; ++ siteconf_head = ent; ++ ent = NULL; ++ } ++ ++ /* Second, create a new record. */ ++ newent = newSiteconfRec(); ++ url = getRegexWord((const char **)&p, &newent->re_url); ++ opt = getWord(&p); ++ SKIP_BLANKS(p); ++ if (!newent->re_url) { ++ ParsedURL pu; ++ if (!url || !*url) ++ continue; ++ parseURL2(url, &pu, NULL); ++ newent->url = parsedURL2Str(&pu)->ptr; ++ } ++ /* If we have an extra or unknown option, ignore this record ++ * for future extensions. */ ++ if (strcmp(opt, "exact") == 0) { ++ newent->url_exact = TRUE; ++ } ++ else if (*opt != 0) ++ continue; ++ if (*p) ++ continue; ++ ent = newent; ++ continue; ++ } ++ ++ /* If the current record is broken, skip to the next "url". */ ++ if (!ent) ++ continue; ++ ++ /* Fill the new record. */ ++ if (strcmp(s, "substitute_url") == 0) { ++ ent->substitute_url = getQWord(&p); ++ SCONF_SET(ent, SCONF_SUBSTITUTE_URL); ++ } ++#ifdef USE_M17N ++ else if (strcmp(s, "url_charset") == 0) { ++ char *charset = getWord(&p); ++ ent->url_charset = (charset && *charset) ? ++ wc_charset_to_ces(charset) : 0; ++ SCONF_SET(ent, SCONF_URL_CHARSET); ++ } ++#endif /* USE_M17N */ ++ else if (strcmp(s, "no_referer_from") == 0) { ++ ent->no_referer_from = str_to_bool(getWord(&p), 0); ++ SCONF_SET(ent, SCONF_NO_REFERER_FROM); ++ } ++ else if (strcmp(s, "no_referer_to") == 0) { ++ ent->no_referer_to = str_to_bool(getWord(&p), 0); ++ SCONF_SET(ent, SCONF_NO_REFERER_TO); ++ } ++ } ++ if (ent) { ++ ent->next = siteconf_head; ++ siteconf_head = ent; ++ ent = NULL; ++ } ++ fclose(fp); ++} ++ ++const void * ++querySiteconf(const ParsedURL *query_pu, int field) ++{ ++ const struct siteconf_rec *ent; ++ Str u; ++ char *firstp, *lastp; ++ ++ if (field < 0 || field >= SCONF_N_FIELD) ++ return NULL; ++ if (!query_pu || IS_EMPTY_PARSED_URL(query_pu)) ++ return NULL; ++ u = parsedURL2Str((ParsedURL *)query_pu); ++ if (u->length == 0) ++ return NULL; ++ ++ for (ent = siteconf_head; ent; ent = ent->next) { ++ if (!SCONF_TEST(ent, field)) ++ continue; ++ if (ent->re_url) { ++ if (RegexMatch(ent->re_url, u->ptr, u->length, 1)) { ++ MatchedPosition(ent->re_url, &firstp, &lastp); ++ if (!ent->url_exact) ++ goto url_found; ++ if (firstp != u->ptr || lastp == firstp) ++ continue; ++ if (*lastp == 0 || *lastp == '?' || *(lastp - 1) == '?' || ++ *lastp == '#' || *(lastp - 1) == '#') ++ goto url_found; ++ } ++ } else { ++ int matchlen = strmatchlen(ent->url, u->ptr, u->length); ++ if (matchlen == 0 || ent->url[matchlen] != 0) ++ continue; ++ firstp = u->ptr; ++ lastp = u->ptr + matchlen; ++ if (*lastp == 0 || *lastp == '?' || *(lastp - 1) == '?' || ++ *lastp == '#' || *(lastp - 1) == '#') ++ goto url_found; ++ if (!ent->url_exact && (*lastp == '/' || *(lastp - 1) == '/')) ++ goto url_found; ++ } ++ } ++ return NULL; ++ ++url_found: ++ switch (field) { ++ case SCONF_SUBSTITUTE_URL: ++ if (ent->substitute_url && *ent->substitute_url) { ++ Str tmp = Strnew_charp_n(u->ptr, firstp - u->ptr); ++ Strcat_charp(tmp, ent->substitute_url); ++ Strcat_charp(tmp, lastp); ++ return tmp->ptr; ++ } ++ return NULL; ++#ifdef USE_M17N ++ case SCONF_URL_CHARSET: ++ return &ent->url_charset; ++#endif ++ case SCONF_NO_REFERER_FROM: ++ return &ent->no_referer_from; ++ case SCONF_NO_REFERER_TO: ++ return &ent->no_referer_to; ++ } ++ return NULL; ++} +diff --git a/regex.c b/regex.c +index 5bee4b2..5675d09 100644 +--- a/regex.c ++++ b/regex.c +@@ -77,7 +77,7 @@ static longchar + set_longchar(char *str) + { + unsigned char *p = (unsigned char *)str; +- longchar r; ++ longchar r = { }; + + #ifdef USE_M17N + if (*p & 0x80) { +diff --git a/scripts/w3mman/w3mman.1.in b/scripts/w3mman/w3mman.1.in +index 1c0361d..1b1d990 100644 +--- a/scripts/w3mman/w3mman.1.in ++++ b/scripts/w3mman/w3mman.1.in +@@ -1,4 +1,4 @@ +-.TH W3MMAN 1 "Nov 5, 2005" ++.TH W3MMAN 1 "Nov 23, 2014" + .\" Please adjust this date whenever revising the manpage. + .\" + .\" Some roff macros, for reference: +@@ -12,19 +12,19 @@ + .\" .sp <n> insert n+1 empty lines + .\" for manpage-specific macros, see man(7) + .SH NAME +-w3mman \- an interface to the on-line reference manuals by w3m(1) ++w3mman \- an interface to the on-line reference manuals via w3m(1) + .SH SYNOPSIS + .B w3mman +-.RI "[-M " path ] " " [ section ] " page" ++.RI "[\-M " path ] " " [ section ] " page" + .br + .B w3mman +-.RI "[-M " path "] -k " keyword ++.RI "[\-M " path "] \-k " keyword + .br + .B w3mman +-.RI -l " file ++.RI \-l " file + .SH DESCRIPTION + .B w3mman +-is the system's manual pager by ++is a pager for manual pages, using + .BR w3m (1). + .SH OPTIONS + A summary of options is included below. +@@ -42,6 +42,7 @@ Specify + Specify a + .I file. + .SH ENVIRONMENT ++Two variables are available for debugging. + .TP + .B W3MMAN_W3M + If W3MMAN_W3M is set, its value is used instead of @W3M@. +@@ -51,7 +52,7 @@ If W3MMAN_MAN is set, its value is used instead of @MAN@. + .SH FILES + .TP + .I @libexecdir@/@PACKAGE@/cgi-bin/w3mman2html.cgi +-convert manual page to html. ++manual page to HTML convertor. + .SH SEE ALSO + .BR man (1), + .BR w3m (1). +diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in +index f430307..2cd00f9 100644 +--- a/scripts/w3mman/w3mman2html.cgi.in ++++ b/scripts/w3mman/w3mman2html.cgi.in +@@ -34,7 +34,6 @@ Content-Type: text/html + EOF + $keyword =~ s:([^-\w\200-\377.,])::g; + open(F, "$MAN -k $keyword 2> /dev/null |"); +- @line = (); + while(<F>) { + chop; + $_ = &html_quote($_); +@@ -126,12 +125,14 @@ while(<F>) { + s/\&/\&/g; + s/\</\</g; + s/\>/\>/g; ++ # non ASCII UTF-8 codepoint ++ my $utf8="[\300-\337][\200-\277]|[\340-\357][\200-\277]{2}|[\360-\367][\200-\277]{3}|[\370-\373][\200-\277]{4}|[\374\375][\200-\277]{5}"; + +- s@([\200-\377].)(\010{1,2}\1)+@<b>$1</b>@g; ++ s@($utf8)(\010\1)+@<b>$1</b>@g; + s@(\&\w+;|.)(\010\1)+@<b>$1</b>@g; +- s@__\010{1,2}((\<b\>)?[\200-\377].(\</b\>)?)@<u>$1</u>@g; ++ s@_\010((\<b\>)?($utf8)(\</b\>)?)@<u>$1</u>@g; + s@_\010((\<b\>)?(\&\w+\;|.)(\</b\>)?)@<u>$1</u>@g; +- s@((\<b\>)?[\200-\377].(\</b\>)?)\010{1,2}__@<u>$1</u>@g; ++ s@((\<b\>)?($utf8)(\</b\>)?)\010_@<u>$1</u>@g; + s@((\<b\>)?(\&\w+\;|.)(\</b\>)?)\010_@<u>$1</u>@g; + s@.\010(.)@$1@g; + +@@ -156,7 +157,7 @@ EOF + } + + s@(http|ftp)://[\w.\-/~]+[\w/]@<a href="$&">$&</a>@g; +- s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1<a href="mailto:$3">$2$3</a>@g; ++ s@\b(mailto:|)(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@<a href="mailto:$2">$1$2</a>@g; + s@(\W)(\~?/[\w.][\w.\-/~]*)@$1 . &file_ref($2)@ge; + s@(include(<\/?[bu]\>|\s)*\<)([\w.\-/]+)@$1 . &include_ref($3)@ge; + if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\</[bu]\>)*(\([\dm]\w*\))@) { +@@ -220,7 +221,7 @@ sub is_command { + local($p); + + (! -d && -x) || return 0; +- if (! defined(%PATH)) { ++ if (! %PATH) { + for $p (split(":", $ENV{'PATH'})) { + $p =~ s@/+$@@; + $PATH{$p} = 1; +diff --git a/table.c b/table.c +index e1243ff..d376284 100644 +--- a/table.c ++++ b/table.c +@@ -2878,6 +2878,14 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, + tmp = process_input(tag); + feed_table1(tbl, tmp, mode, width); + break; ++ case HTML_BUTTON: ++ tmp = process_button(tag); ++ feed_table1(tbl, tmp, mode, width); ++ break; ++ case HTML_N_BUTTON: ++ tmp = process_n_button(); ++ feed_table1(tbl, tmp, mode, width); ++ break; + case HTML_SELECT: + tmp = process_select(tag); + if (tmp) +diff --git a/table.h b/table.h +index 83b661f..fdcdef3 100644 +--- a/table.h ++++ b/table.h +@@ -17,7 +17,7 @@ + #define MAX_TABLE_N 20 /* maximum number of table in same level */ + + #define MAXROW 50 +-#define MAXCOL 50 ++#define MAXCOL 256 + + #define MAX_WIDTH 80 + +diff --git a/tagtable.tab b/tagtable.tab +index f9b7b76..f5a2c30 100644 +--- a/tagtable.tab ++++ b/tagtable.tab +@@ -176,6 +176,7 @@ bdo HTML_BDO + big HTML_BIG + /big HTML_N_BIG + button HTML_BUTTON ++/button HTML_N_BUTTON + fieldset HTML_FIELDSET + /fieldset HTML_N_FIELDSET + iframe HTML_IFRAME +diff --git a/terms.c b/terms.c +index 7a3c987..79996f1 100644 +--- a/terms.c ++++ b/terms.c +@@ -12,6 +12,7 @@ + #include <unistd.h> + #include "config.h" + #include <string.h> ++#include <sys/wait.h> + #ifdef HAVE_SYS_SELECT_H + #include <sys/select.h> + #endif +@@ -222,6 +223,7 @@ static void + check_cygwin_console(void) + { + char *term = getenv("TERM"); ++ char *ctype; + HANDLE hWnd; + + if (term == NULL) +@@ -236,7 +238,9 @@ check_cygwin_console(void) + isLocalConsole = 1; + } + } +- if (strncmp(getenv("LANG"), "ja", 2) == 0) { ++ if (((ctype = getenv("LC_ALL")) || ++ (ctype = getenv("LC_CTYPE")) || ++ (ctype = getenv("LANG"))) && strncmp(ctype, "ja", 2) == 0) { + isWinConsole = TERM_CYGWIN_RESERVE_IME; + } + #ifdef SUPPORT_WIN9X_CONSOLE_MBCS +@@ -463,6 +467,260 @@ writestr(char *s) + + #define MOVE(line,column) writestr(tgoto(T_cm,column,line)); + ++void ++put_image_osc5379(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh, int n_terminal_image) ++{ ++ Str buf; ++ char *size ; ++ ++ if (w > 0 && h > 0) ++ size = Sprintf("%dx%d",w,h)->ptr; ++ else ++ size = ""; ++ ++ MOVE(y,x); ++ buf = Sprintf("\x1b]5379;show_picture %s %s %dx%d+%d+%d\x07",url,size,sw,sh,sx,sy); ++ writestr(buf->ptr); ++ MOVE(Currentbuf->cursorY,Currentbuf->cursorX); ++} ++ ++static void ++save_gif(const char *path, u_char *header, size_t header_size, u_char *body, size_t body_size) ++{ ++ int fd; ++ ++ if ((fd = open(path, O_WRONLY|O_CREAT, 0600)) >= 0) { ++ write(fd, header, header_size) ; ++ write(fd, body, body_size) ; ++ write(fd, "\x3b" , 1) ; ++ close(fd) ; ++ } ++} ++ ++static u_char * ++skip_gif_header(u_char *p) ++{ ++ /* Header */ ++ p += 10; ++ ++ if (*(p) & 0x80) { ++ p += (3 * (2 << ((*p) & 0x7))); ++ } ++ p += 3; ++ ++ return p; ++} ++ ++static Str ++save_first_animation_frame(const char *path) ++{ ++ int fd; ++ struct stat st; ++ u_char *header; ++ size_t header_size; ++ u_char *body; ++ u_char *p; ++ ssize_t len; ++ Str new_path; ++ ++ new_path = Strnew_charp(path); ++ Strcat_charp(new_path, "-1"); ++ if (stat(new_path->ptr, &st) == 0) { ++ return new_path; ++ } ++ ++ if ((fd = open( path, O_RDONLY)) < 0) { ++ return NULL; ++ } ++ ++ if (fstat( fd, &st) != 0 || ! (header = GC_malloc( st.st_size))){ ++ close( fd); ++ return NULL; ++ } ++ ++ len = read(fd, header, st.st_size); ++ close(fd); ++ ++ /* Header */ ++ ++ if (len != st.st_size || strncmp(header, "GIF89a", 6) != 0) { ++ return NULL; ++ } ++ ++ p = skip_gif_header(header); ++ header_size = p - header; ++ ++ /* Application Extension */ ++ if (p[0] == 0x21 && p[1] == 0xff) { ++ p += 19; ++ } ++ ++ /* Other blocks */ ++ body = NULL; ++ while (p + 2 < header + st.st_size) { ++ if (*(p++) == 0x21 && *(p++) == 0xf9 && *(p++) == 0x04) { ++ if( body) { ++ /* Graphic Control Extension */ ++ save_gif(new_path->ptr, header, header_size, body, p - 3 - body); ++ return new_path; ++ } ++ else { ++ /* skip the first frame. */ ++ } ++ body = p - 3; ++ } ++ } ++ ++ return NULL; ++} ++ ++void ttymode_set(int mode, int imode); ++void ttymode_reset(int mode, int imode); ++ ++void ++put_image_sixel(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh, int n_terminal_image) ++{ ++ pid_t pid; ++ int do_anim; ++ MySignalHandler(*volatile previntr) (SIGNAL_ARG); ++ MySignalHandler(*volatile prevquit) (SIGNAL_ARG); ++ MySignalHandler(*volatile prevstop) (SIGNAL_ARG); ++ ++ MOVE(y,x); ++ flush_tty(); ++ ++ do_anim = (n_terminal_image == 1 && x == 0 && y == 0 && sx == 0 && sy == 0); ++ ++ previntr = mySignal(SIGINT, SIG_IGN); ++ prevquit = mySignal(SIGQUIT, SIG_IGN); ++ prevstop = mySignal(SIGTSTP, SIG_IGN); ++ ++ if ((pid = fork()) == 0) { ++ char *env; ++ int n = 0; ++ char *argv[20]; ++ char digit[2][11+1]; ++ char clip[44+3+1]; ++ Str str_url; ++ ++ close(STDERR_FILENO); /* Don't output error message. */ ++ if (do_anim) { ++ writestr("\x1b[?80h"); ++ } ++ else if (!strstr(url, "://") && strcmp(url+strlen(url)-4, ".gif") == 0 && ++ (str_url = save_first_animation_frame(url))) { ++ url = str_url->ptr; ++ } ++ ttymode_set(ISIG, 0); ++ ++ if ((env = getenv("W3M_IMG2SIXEL"))) { ++ char *p; ++ env = Strnew_charp(env)->ptr; ++ while (n < 8 && (p = strchr(env, ' '))) { ++ *p = '\0'; ++ if (*env != '\0') { ++ argv[n++] = env; ++ } ++ env = p+1; ++ } ++ if (*env != '\0') { ++ argv[n++] = env; ++ } ++ } ++ else { ++ argv[n++] = "img2sixel"; ++ } ++ argv[n++] = "-l"; ++ argv[n++] = do_anim ? "auto" : "disable"; ++ argv[n++] = "-w"; ++ sprintf(digit[0], "%d", w*pixel_per_char_i); ++ argv[n++] = digit[0]; ++ argv[n++] = "-h"; ++ sprintf(digit[1], "%d", h*pixel_per_line_i); ++ argv[n++] = digit[1]; ++ argv[n++] = "-c"; ++ sprintf(clip, "%dx%d+%d+%d", sw*pixel_per_char_i, sh*pixel_per_line_i, ++ sx*pixel_per_char_i, sy*pixel_per_line_i); ++ argv[n++] = clip; ++ argv[n++] = url; ++ if (getenv("TERM") && strcmp(getenv("TERM"), "screen") == 0 && ++ (!getenv("SCREEN_VARIANT") || strcmp(getenv("SCREEN_VARIANT"), "sixel") != 0)) { ++ argv[n++] = "-P"; ++ } ++ argv[n++] = NULL; ++ execvp(argv[0],argv); ++ exit(0); ++ } ++ else if (pid > 0) { ++ int status; ++ waitpid(pid, &status, 0); ++ ttymode_reset(ISIG, 0); ++ mySignal(SIGINT, previntr); ++ mySignal(SIGQUIT, prevquit); ++ mySignal(SIGTSTP, prevstop); ++ if (do_anim) { ++ writestr("\x1b[?80l"); ++ } ++ } ++ ++ MOVE(Currentbuf->cursorY,Currentbuf->cursorX); ++} ++ ++int ++get_pixel_per_cell(int *ppc, int *ppl) ++{ ++ fd_set rfd; ++ struct timeval tval; ++ char buf[100]; ++ char *p; ++ ssize_t len; ++ ssize_t left; ++ int wp,hp,wc,hc; ++ int i; ++ ++#ifdef TIOCGWINSZ ++ struct winsize ws; ++ if (ioctl(tty, TIOCGWINSZ, &ws) == 0 && ws.ws_ypixel > 0 && ws.ws_row > 0 && ++ ws.ws_xpixel > 0 && ws.ws_col > 0) { ++ *ppc = ws.ws_xpixel / ws.ws_col; ++ *ppl = ws.ws_ypixel / ws.ws_row; ++ return 1; ++ } ++#endif ++ ++ fputs("\x1b[14t\x1b[18t",ttyf); flush_tty(); ++ ++ p = buf; ++ left = sizeof(buf) - 1; ++ for (i = 0; i < 10; i++) { ++ tval.tv_usec = 200000; /* 0.2 sec * 10 */ ++ tval.tv_sec = 0; ++ FD_ZERO(&rfd); ++ FD_SET(tty,&rfd); ++ if (select(tty+1,&rfd,NULL,NULL,&tval) <= 0 || ! FD_ISSET(tty,&rfd)) ++ continue; ++ ++ if ((len = read(tty,p,left)) <= 0) ++ continue; ++ p[len] = '\0'; ++ ++ if (sscanf(buf,"\x1b[4;%d;%dt\x1b[8;%d;%dt",&hp,&wp,&hc,&wc) == 4) { ++ if (wp > 0 && wc > 0 && hp > 0 && hc > 0) { ++ *ppc = wp / wc; ++ *ppl = hp / hc; ++ return 1; ++ } ++ else { ++ return 0; ++ } ++ } ++ p += len; ++ left -= len; ++ } ++ ++ return 0; ++} ++ + #ifdef USE_MOUSE + #define W3M_TERM_INFO(name, title, mouse) name, title, mouse + #define NEED_XTERM_ON (1) +@@ -634,7 +892,8 @@ reset_tty(void) + writestr(T_se); /* reset terminal */ + flush_tty(); + TerminalSet(tty, &d_ioval); +- close_tty(); ++ if (tty != 2) ++ close_tty(); + } + + static MySignalHandler +@@ -2027,8 +2286,8 @@ sleep_till_anykey(int sec, int purge) + + #ifdef USE_MOUSE + +-#define XTERM_ON {fputs("\033[?1001s\033[?1000h",ttyf); flush_tty();} +-#define XTERM_OFF {fputs("\033[?1000l\033[?1001r",ttyf); flush_tty();} ++#define XTERM_ON {fputs("\033[?1001s\033[?1000h\033[?1006h",ttyf); flush_tty();} ++#define XTERM_OFF {fputs("\033[?1006l\033[?1000l\033[?1001r",ttyf); flush_tty();} + #define CYGWIN_ON {fputs("\033[?1000h",ttyf); flush_tty();} + #define CYGWIN_OFF {fputs("\033[?1000l",ttyf); flush_tty();} + +diff --git a/url.c b/url.c +index ed6062e..10089ca 100644 +--- a/url.c ++++ b/url.c +@@ -121,6 +121,7 @@ static struct table2 DefaultGuess[] = { + }; + + static void add_index_file(ParsedURL *pu, URLFile *uf); ++static char * schemeNumToName(int scheme); + + /* #define HTTP_DEFAULT_FILE "/index.html" */ + +@@ -326,6 +327,7 @@ openSSLHandle(int sock, char *hostname, char **p_cert) + SSL_load_error_strings(); + if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method()))) + goto eend; ++ SSL_CTX_set_cipher_list(ssl_ctx, "DEFAULT:!LOW:!EXP"); + option = SSL_OP_ALL; + if (ssl_forbid_method) { + if (strchr(ssl_forbid_method, '2')) +@@ -337,7 +339,15 @@ openSSLHandle(int sock, char *hostname, char **p_cert) + if (strchr(ssl_forbid_method, 'T')) + option |= SSL_OP_NO_TLSv1; + } ++#ifdef SSL_OP_NO_COMPRESSION ++ option |= SSL_OP_NO_COMPRESSION; ++#endif + SSL_CTX_set_options(ssl_ctx, option); ++ ++#ifdef SSL_MODE_RELEASE_BUFFERS ++ SSL_CTX_set_mode (ssl_ctx, SSL_MODE_RELEASE_BUFFERS); ++#endif ++ + #ifdef USE_SSL_VERIFY + /* derived from openssl-0.9.5/apps/s_{client,cb}.c */ + #if 1 /* use SSL_get_verify_result() to verify cert */ +@@ -444,6 +454,8 @@ baseURL(Buffer *buf) + /* <BASE> tag is defined in the document */ + return buf->baseURL; + } ++ else if (IS_EMPTY_PARSED_URL(&buf->currentURL)) ++ return NULL; + else + return &buf->currentURL; + } +@@ -638,16 +650,21 @@ openSocket(char *const hostname, + #define COPYPATH_SPC_ALLOW 0 + #define COPYPATH_SPC_IGNORE 1 + #define COPYPATH_SPC_REPLACE 2 ++#define COPYPATH_SPC_MASK 3 ++#define COPYPATH_LOWERCASE 4 + + static char * + copyPath(char *orgpath, int length, int option) + { + Str tmp = Strnew(); +- while (*orgpath && length != 0) { +- if (IS_SPACE(*orgpath)) { +- switch (option) { ++ char ch; ++ while ((ch = *orgpath) != 0 && length != 0) { ++ if (option & COPYPATH_LOWERCASE) ++ ch = TOLOWER(ch); ++ if (IS_SPACE(ch)) { ++ switch (option & COPYPATH_SPC_MASK) { + case COPYPATH_SPC_ALLOW: +- Strcat_char(tmp, *orgpath); ++ Strcat_char(tmp, ch); + break; + case COPYPATH_SPC_IGNORE: + /* do nothing */ +@@ -658,7 +675,7 @@ copyPath(char *orgpath, int length, int option) + } + } + else +- Strcat_char(tmp, *orgpath); ++ Strcat_char(tmp, ch); + orgpath++; + length--; + } +@@ -668,22 +685,14 @@ copyPath(char *orgpath, int length, int option) + void + parseURL(char *url, ParsedURL *p_url, ParsedURL *current) + { +- char *p, *q; ++ char *p, *q, *qq; + Str tmp; + + url = url_quote(url); /* quote 0x01-0x20, 0x7F-0xFF */ + + p = url; ++ copyParsedURL(p_url, NULL); + p_url->scheme = SCM_MISSING; +- p_url->port = 0; +- p_url->user = NULL; +- p_url->pass = NULL; +- p_url->host = NULL; +- p_url->is_nocache = 0; +- p_url->file = NULL; +- p_url->real_file = NULL; +- p_url->query = NULL; +- p_url->label = NULL; + + /* RFC1808: Relative Uniform Resource Locators + * 4. Resolving Relative URLs +@@ -694,7 +703,7 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current) + goto do_label; + } + #if defined( __EMX__ ) || defined( __CYGWIN__ ) +- if (!strncmp(url, "file://localhost/", 17)) { ++ if (!strncasecmp(url, "file://localhost/", 17)) { + p_url->scheme = SCM_LOCAL; + p += 17 - 1; + url += 17 - 1; +@@ -802,19 +811,20 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current) + /* scheme://user:pass@host or + * scheme://host:port + */ +- p_url->host = copyPath(q, p - q, COPYPATH_SPC_IGNORE); ++ qq = q; + q = ++p; + while (*p && strchr("@/?#", *p) == NULL) + p++; + if (*p == '@') { + /* scheme://user:pass@... */ ++ p_url->user = copyPath(qq, q - 1 - qq, COPYPATH_SPC_IGNORE); + p_url->pass = copyPath(q, p - q, COPYPATH_SPC_ALLOW); + q = ++p; +- p_url->user = p_url->host; +- p_url->host = NULL; + goto analyze_url; + } + /* scheme://host:port/ */ ++ p_url->host = copyPath(qq, q - 1 - qq, ++ COPYPATH_SPC_IGNORE | COPYPATH_LOWERCASE); + tmp = Strnew_charp_n(q, p - q); + p_url->port = atoi(tmp->ptr); + /* *p is one of ['\0', '/', '?', '#'] */ +@@ -829,7 +839,8 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current) + case '/': + case '?': + case '#': +- p_url->host = copyPath(q, p - q, COPYPATH_SPC_IGNORE); ++ p_url->host = copyPath(q, p - q, ++ COPYPATH_SPC_IGNORE | COPYPATH_LOWERCASE); + p_url->port = DefaultPort[p_url->scheme]; + break; + } +@@ -956,12 +967,16 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current) + p_url->label = NULL; + } + +-#define initParsedURL(p) bzero(p,sizeof(ParsedURL)) + #define ALLOC_STR(s) ((s)==NULL?NULL:allocStr(s,-1)) + + void +-copyParsedURL(ParsedURL *p, ParsedURL *q) ++copyParsedURL(ParsedURL *p, const ParsedURL *q) + { ++ if (q == NULL) { ++ memset(p, 0, sizeof(ParsedURL)); ++ p->scheme = SCM_UNKNOWN; ++ return; ++ } + p->scheme = q->scheme; + p->port = q->port; + p->is_nocache = q->is_nocache; +@@ -1280,9 +1295,23 @@ getURLScheme(char **url) + } + + static char * ++schemeNumToName(int scheme) ++{ ++ int i; ++ ++ for (i = 0; schemetable[i].cmdname != NULL; i++) { ++ if (schemetable[i].cmd == scheme) ++ return schemetable[i].cmdname; ++ } ++ return NULL; ++} ++ ++static char * + otherinfo(ParsedURL *target, ParsedURL *current, char *referer) + { + Str s = Strnew(); ++ const int *no_referer_ptr; ++ int no_referer; + + Strcat_charp(s, "User-Agent: "); + if (UserAgent == NULL || *UserAgent == '\0') +@@ -1306,7 +1335,12 @@ otherinfo(ParsedURL *target, ParsedURL *current, char *referer) + Strcat_charp(s, "Pragma: no-cache\r\n"); + Strcat_charp(s, "Cache-control: no-cache\r\n"); + } +- if (!NoSendReferer) { ++ no_referer = NoSendReferer; ++ no_referer_ptr = query_SCONF_NO_REFERER_FROM(current); ++ no_referer = NoSendReferer || (no_referer_ptr && *no_referer_ptr); ++ no_referer_ptr = query_SCONF_NO_REFERER_TO(target); ++ no_referer = no_referer || (no_referer_ptr && *no_referer_ptr); ++ if (!no_referer) { + #ifdef USE_SSL + if (current && current->scheme == SCM_HTTPS && target->scheme != SCM_HTTPS) { + /* Don't send Referer: if https:// -> http:// */ +@@ -1314,6 +1348,7 @@ otherinfo(ParsedURL *target, ParsedURL *current, char *referer) + else + #endif + if (referer == NULL && current && current->scheme != SCM_LOCAL && ++ current->scheme != SCM_LOCAL_CGI && + (current->scheme != SCM_FTP || + (current->user == NULL && current->pass == NULL))) { + char *p = current->label; +@@ -1603,7 +1638,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, + pu->host != NULL && !check_no_proxy(pu->host)) { + hr->flag |= HR_FLAG_PROXY; + sock = openSocket(FTP_proxy_parsed.host, +- schemetable[FTP_proxy_parsed.scheme].cmdname, ++ schemeNumToName(FTP_proxy_parsed.scheme), + FTP_proxy_parsed.port); + if (sock < 0) + return uf; +@@ -1645,15 +1680,15 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, + } + else if (pu->scheme == SCM_HTTPS) { + sock = openSocket(HTTPS_proxy_parsed.host, +- schemetable[HTTPS_proxy_parsed.scheme]. +- cmdname, HTTPS_proxy_parsed.port); ++ schemeNumToName(HTTPS_proxy_parsed.scheme), ++ HTTPS_proxy_parsed.port); + sslh = NULL; + } + else { + #endif /* USE_SSL */ + sock = openSocket(HTTP_proxy_parsed.host, +- schemetable[HTTP_proxy_parsed.scheme]. +- cmdname, HTTP_proxy_parsed.port); ++ schemeNumToName(HTTP_proxy_parsed.scheme), ++ HTTP_proxy_parsed.port); + #ifdef USE_SSL + sslh = NULL; + } +@@ -1685,8 +1720,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, + } + } + else { +- sock = openSocket(pu->host, +- schemetable[pu->scheme].cmdname, pu->port); ++ sock = openSocket(pu->host, schemeNumToName(pu->scheme), pu->port); + if (sock < 0) { + *status = HTST_MISSING; + return uf; +@@ -1750,7 +1784,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, + pu->host != NULL && !check_no_proxy(pu->host)) { + hr->flag |= HR_FLAG_PROXY; + sock = openSocket(GOPHER_proxy_parsed.host, +- schemetable[GOPHER_proxy_parsed.scheme].cmdname, ++ schemeNumToName(GOPHER_proxy_parsed.scheme), + GOPHER_proxy_parsed.port); + if (sock < 0) + return uf; +@@ -1758,8 +1792,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, + tmp = HTTPrequest(pu, current, hr, extra_header); + } + else { +- sock = openSocket(pu->host, +- schemetable[pu->scheme].cmdname, pu->port); ++ sock = openSocket(pu->host, schemeNumToName(pu->scheme), pu->port); + if (sock < 0) + return uf; + if (pu->file == NULL) +@@ -2234,3 +2267,66 @@ schemeToProxy(int scheme) + } + return pu; + } ++ ++#ifdef USE_M17N ++wc_ces ++url_to_charset(const char *url, const ParsedURL *base, wc_ces doc_charset) ++{ ++ const ParsedURL *pu; ++ ParsedURL pu_buf; ++ const wc_ces *csptr; ++ ++ if (url && *url && *url != '#') { ++ parseURL2((char *)url, &pu_buf, (ParsedURL *)base); ++ pu = &pu_buf; ++ } else { ++ pu = base; ++ } ++ if (pu && (pu->scheme == SCM_LOCAL || pu->scheme == SCM_LOCAL_CGI)) ++ return SystemCharset; ++ csptr = query_SCONF_URL_CHARSET(pu); ++ return (csptr && *csptr) ? *csptr : ++ doc_charset ? doc_charset : DocumentCharset; ++} ++ ++char * ++url_encode(const char *url, const ParsedURL *base, wc_ces doc_charset) ++{ ++ return url_quote_conv((char *)url, ++ url_to_charset(url, base, doc_charset)); ++} ++ ++#if 0 /* unused */ ++char * ++url_decode(const char *url, const ParsedURL *base, wc_ces doc_charset) ++{ ++ if (!DecodeURL) ++ return (char *)url; ++ return url_unquote_conv((char *)url, ++ url_to_charset(url, base, doc_charset)); ++} ++#endif ++ ++char * ++url_decode2(const char *url, const Buffer *buf) ++{ ++ wc_ces url_charset; ++ ++ if (!DecodeURL) ++ return (char *)url; ++ url_charset = buf ? ++ url_to_charset(url, baseURL((Buffer *)buf), buf->document_charset) : ++ url_to_charset(url, NULL, 0); ++ return url_unquote_conv((char *)url, url_charset); ++} ++ ++#else /* !defined(USE_M17N) */ ++ ++char * ++url_decode0(const char *url) ++{ ++ if (!DecodeURL) ++ return (char *)url; ++ return url_unquote_conv((char *)url, 0); ++} ++#endif /* !defined(USE_M17N) */ +diff --git a/version.c.in b/version.c.in +index 31d30e4..ab25163 100644 +--- a/version.c.in ++++ b/version.c.in +@@ -1,5 +1,5 @@ + /* $Id: version.c.in,v 1.49 2012/05/22 09:45:56 inu Exp $ */ +-#define CURRENT_VERSION "w3m/0.5.3+cvs" ++#define CURRENT_VERSION "w3m/0.5.3+gitYYYYMMDD" + + #ifndef FM_H + char *w3m_version = CURRENT_VERSION; +diff --git a/w3mbookmark.c b/w3mbookmark.c +index 4355536..fcbad11 100644 +--- a/w3mbookmark.c ++++ b/w3mbookmark.c +@@ -99,7 +99,7 @@ create_new_bookmark(char *bmark, char *section, char *title, char *url, + fprintf(f, "<body>\n<h1>Bookmarks</h1>\n"); + fprintf(f, "<h2>%s</h2>\n<ul>\n", section); + fprintf(f, "<li><a href=\"%s\">%s</a>\n", url, title); +- fprintf(f, end_section); ++ fprintf(f, "%s", end_section); + fprintf(f, "</ul>\n</body>\n</html>\n"); + fclose(f); + } +diff --git a/w3mimg/Makefile.in b/w3mimg/Makefile.in +index dfc550c..8e2ad73 100644 +--- a/w3mimg/Makefile.in ++++ b/w3mimg/Makefile.in +@@ -16,9 +16,9 @@ IMGCFLAGS=@IMGX11CFLAGS@ @IMGFBCFLAGS@ @IMGWINCFLAGS@ + IMGOBJS=@IMGOBJS@ + + .PHONY: $(SUBDIRS) +-all: @IMGTARGETS@ w3mimg.a ++all: w3mimg.a + +-w3mimg.a: $(IMGOBJS) ++w3mimg.a: w3mimg.o @IMGTARGETS@ + $(AR) rv $@ $(IMGOBJS) + $(RANLIB) $@ + +diff --git a/w3mimg/fb/fb.c b/w3mimg/fb/fb.c +index cd11128..7b6f23b 100644 +--- a/w3mimg/fb/fb.c ++++ b/w3mimg/fb/fb.c +@@ -12,12 +12,24 @@ + #include <errno.h> + #include <sys/ioctl.h> + #include <sys/mman.h> ++#if defined(__linux__) + #include <linux/fb.h> ++#elif defined(__FreeBSD__) ++#include <sys/fbio.h> ++#endif ++#if defined(__FreeBSD__) ++#include <sys/types.h> ++#include <machine/param.h> ++#endif + + #include "fb.h" + + #define FB_ENV "FRAMEBUFFER" ++#if defined(__linux__) + #define FB_DEFDEV "/dev/fb0" ++#elif defined(__FreeBSD__) ++#define FB_DEFDEV "/dev/ttyv0" ++#endif + + #define MONO_OFFSET_8BIT 0x40 + #define COLORS_MONO_8BIT 0x40 +@@ -38,22 +50,65 @@ + + #define IMAGE_SIZE_MAX 10000 + ++#if defined(__linux__) + static struct fb_cmap *fb_cmap_create(struct fb_fix_screeninfo *, + struct fb_var_screeninfo *); ++#elif defined(__FreeBSD__) ++static video_color_palette_t *fb_cmap_create(video_info_t *video_info, ++ video_adapter_info_t *video_adapter_info); ++#endif ++#if defined(__linux__) + static void fb_cmap_destroy(struct fb_cmap *cmap); ++#elif defined(__FreeBSD__) ++static void fb_cmap_destroy(video_color_palette_t *cmap); ++#endif ++#if defined(__linux__) + static int fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo); ++#endif ++#if defined(__linux__) + static void *fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo); ++#elif defined(__FreeBSD__) ++static void *fb_mmap(int fbfp, video_adapter_info_t *video_adapter_info); ++#endif ++#if defined(__linux__) + static int fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo); ++#elif defined(__FreeBSD__) ++static int fb_munmap(void *buf, video_adapter_info_t *video_adapter_info); ++#endif ++#if defined(__linux__) + static int fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo); ++#endif ++#if defined(__linux__) + static int fb_cmap_set(int fbfp, struct fb_cmap *cmap); ++#elif defined(__FreeBSD__) ++static int fb_cmap_set(int fbfp, video_color_palette_t *cmap); ++#endif ++#if defined(__linux__) + static int fb_cmap_get(int fbfp, struct fb_cmap *cmap); ++#elif defined(__FreeBSD__) ++static int fb_cmap_get(int fbfp, video_color_palette_t *cmap); ++#endif + static int fb_cmap_init(void); + static int fb_get_cmap_index(int r, int g, int b); + static unsigned long fb_get_packed_color(int r, int g, int b); ++#if defined(__FreeBSD__) ++static int fb_video_mode_get(int fbfp, int *video_mode); ++static int fb_video_info_get(int fbfp, video_info_t *video_info); ++static int fb_video_adapter_info_get(int fbfp, video_adapter_info_t *video_adapter_info); ++#endif + ++#if defined(__linux__) + static struct fb_fix_screeninfo fscinfo; + static struct fb_var_screeninfo vscinfo; ++#elif defined(__FreeBSD__) ++static video_info_t video_info; ++static video_adapter_info_t video_adapter_info; ++#endif ++#if defined(__linux__) + static struct fb_cmap *cmap = NULL, *cmap_org = NULL; ++#elif defined(__FreeBSD__) ++static video_color_palette_t *cmap = NULL, *cmap_org = NULL; ++#endif + static int is_open = FALSE; + static int fbfp = -1; + static size_t pixel_size = 0; +@@ -63,6 +118,9 @@ int + fb_open(void) + { + char *fbdev = { FB_DEFDEV }; ++#if defined(__FreeBSD__) ++ int video_mode; ++#endif + + if (is_open == TRUE) + return 1; +@@ -76,6 +134,7 @@ fb_open(void) + goto ERR_END; + } + ++#if defined(__linux__) + if (fb_fscrn_get(fbfp, &fscinfo)) { + goto ERR_END; + } +@@ -83,22 +142,67 @@ fb_open(void) + if (fb_vscrn_get(fbfp, &vscinfo)) { + goto ERR_END; + } ++#elif defined(__FreeBSD__) ++ if (fb_video_mode_get(fbfp, &video_mode)) { ++ goto ERR_END; ++ } ++ video_info.vi_mode = video_mode; ++ ++ if (fb_video_info_get(fbfp, &video_info)) { ++ goto ERR_END; ++ } + ++ if (fb_video_adapter_info_get(fbfp, &video_adapter_info)) { ++ goto ERR_END; ++ } ++ if (!(video_info.vi_flags & V_INFO_GRAPHICS) || ++ !(video_info.vi_flags & V_INFO_LINEAR)) { ++ goto ERR_END; ++ } ++#endif ++ ++#if defined(__linux__) + if ((cmap = fb_cmap_create(&fscinfo, &vscinfo)) == (struct fb_cmap *)-1) { + goto ERR_END; + } ++#elif defined(__FreeBSD__) ++ if ((cmap = fb_cmap_create(&video_info, &video_adapter_info)) == (video_color_palette_t *)-1) { ++ goto ERR_END; ++ } ++#endif + ++#if defined(__linux__) + if (!(buf = fb_mmap(fbfp, &fscinfo))) { + fprintf(stderr, "Can't allocate memory.\n"); + goto ERR_END; + } ++#elif defined(__FreeBSD__) ++ if (!(buf = fb_mmap(fbfp, &video_adapter_info))) { ++ fprintf(stderr, "Can't allocate memory.\n"); ++ goto ERR_END; ++ } ++#endif + ++#if defined(__linux__) + if (fscinfo.type != FB_TYPE_PACKED_PIXELS) { + fprintf(stderr, "This type of framebuffer is not supported.\n"); + goto ERR_END; + } ++#elif defined(__FreeBSD__) ++ if (!(video_info.vi_mem_model == V_INFO_MM_PACKED || ++ video_info.vi_mem_model == V_INFO_MM_DIRECT)) { ++ fprintf(stderr, "This type of framebuffer is not supported.\n"); ++ goto ERR_END; ++ } ++#endif + ++#if defined(__linux__) + if (fscinfo.visual == FB_VISUAL_PSEUDOCOLOR && vscinfo.bits_per_pixel == 8) { ++#elif defined(__FreeBSD__) ++ if (video_adapter_info.va_flags & V_ADP_PALETTE && ++ video_info.vi_mem_model == V_INFO_MM_PACKED && ++ video_info.vi_depth == 8) { ++#endif + if (fb_cmap_get(fbfp, cmap)) { + fprintf(stderr, "Can't get color map.\n"); + fb_cmap_destroy(cmap); +@@ -111,12 +215,20 @@ fb_open(void) + + pixel_size = 1; + } ++#if defined(__linux__) + else if ((fscinfo.visual == FB_VISUAL_TRUECOLOR || + fscinfo.visual == FB_VISUAL_DIRECTCOLOR) && + (vscinfo.bits_per_pixel == 15 || + vscinfo.bits_per_pixel == 16 || + vscinfo.bits_per_pixel == 24 || vscinfo.bits_per_pixel == 32)) { + pixel_size = (vscinfo.bits_per_pixel + 7) / CHAR_BIT; ++#elif defined(__FreeBSD__) ++ else if (video_info.vi_mem_model == V_INFO_MM_DIRECT && ++ (video_info.vi_depth == 15 || ++ video_info.vi_depth == 16 || ++ video_info.vi_depth == 24 || video_info.vi_depth == 32)) { ++ pixel_size = (video_info.vi_depth + 7) / CHAR_BIT; ++#endif + } + else { + fprintf(stderr, "This type of framebuffer is not supported.\n"); +@@ -147,7 +259,11 @@ fb_close(void) + cmap = NULL; + } + if (buf != NULL) { ++#if defined(__linux__) + fb_munmap(buf, &fscinfo); ++#elif defined(__FreeBSD__) ++ fb_munmap(buf, &video_adapter_info); ++#endif + buf = NULL; + } + +@@ -259,11 +375,19 @@ fb_image_draw(FB_IMAGE * image, int x, int y, int sx, int sy, int width, + if (y + height > fb_height()) + height = fb_height() - y; + ++#if defined(__linux__) + offset_fb = fscinfo.line_length * y + pixel_size * x; ++#elif defined(__FreeBSD__) ++ offset_fb = video_adapter_info.va_line_width * y + pixel_size * x; ++#endif + offset_img = image->rowstride * sy + pixel_size * sx; + for (i = 0; i < height; i++) { + memcpy(buf + offset_fb, image->data + offset_img, pixel_size * width); ++#if defined(__linux__) + offset_fb += fscinfo.line_length; ++#elif defined(__FreeBSD__) ++ offset_fb += video_adapter_info.va_line_width; ++#endif + offset_img += image->rowstride; + } + +@@ -336,7 +460,11 @@ fb_width(void) + if (is_open != TRUE) + return 0; + ++#if defined(__linux__) + return vscinfo.xres; ++#elif defined(__FreeBSD__) ++ return video_info.vi_width; ++#endif + } + + int +@@ -345,7 +473,11 @@ fb_height(void) + if (is_open != TRUE) + return 0; + ++#if defined(__linux__) + return vscinfo.yres; ++#elif defined(__FreeBSD__) ++ return video_info.vi_height; ++#endif + } + + int +@@ -369,7 +501,11 @@ fb_clear(int x, int y, int w, int h, int r, int g, int b) + h = fb_height() - y; + + if (tmp == NULL) { ++#if defined(__linux__) + tmp = malloc(fscinfo.line_length); ++#elif defined(__FreeBSD__) ++ tmp = malloc(video_adapter_info.va_line_width); ++#endif + if (tmp == NULL) + return 1; + } +@@ -384,10 +520,18 @@ fb_clear(int x, int y, int w, int h, int r, int g, int b) + gg = g; + bb = b; + } ++#if defined(__linux__) + offset_fb = fscinfo.line_length * y + pixel_size * x; ++#elif defined(__FreeBSD__) ++ offset_fb = video_adapter_info.va_line_width * y + pixel_size * x; ++#endif + for (i = 0; i < h; i++) { + memcpy(buf + offset_fb, tmp, pixel_size * w); ++#if defined(__linux__) + offset_fb += fscinfo.line_length; ++#elif defined(__FreeBSD__) ++ offset_fb += video_adapter_info.va_line_width; ++#endif + } + return 0; + } +@@ -400,11 +544,21 @@ fb_get_packed_color(int r, int g, int b) + return fb_get_cmap_index(r, g, b); + } + else { ++#if defined(__linux__) + return + ((r >> (CHAR_BIT - vscinfo.red.length)) << vscinfo.red.offset) + + ((g >> (CHAR_BIT - vscinfo.green.length)) << vscinfo.green. + offset) + + ((b >> (CHAR_BIT - vscinfo.blue.length)) << vscinfo.blue.offset); ++#elif defined(__FreeBSD__) ++ return ++ ((r >> (CHAR_BIT - video_info.vi_pixel_fsizes[0])) << ++ video_info.vi_pixel_fields[0]) + ++ ((g >> (CHAR_BIT - video_info.vi_pixel_fsizes[1])) << ++ video_info.vi_pixel_fields[1]) + ++ ((b >> (CHAR_BIT - video_info.vi_pixel_fsizes[2])) << ++ video_info.vi_pixel_fields[2]); ++#endif + } + } + +@@ -433,16 +587,31 @@ fb_cmap_init(void) + if (cmap == NULL) + return 1; + ++#if defined(__linux__) + if (cmap->len < COLOR_OFFSET_8BIT + COLORS_8BIT) { + fprintf(stderr, "Can't allocate enough color.\n"); + return 1; + } ++#elif defined(__FreeBSD__) ++ if (cmap->count < COLOR_OFFSET_8BIT + COLORS_8BIT) { ++ fprintf(stderr, "Can't allocate enough color.\n"); ++ return 1; ++ } ++#endif + + if (cmap_org == NULL) { ++#if defined(__linux__) + if ((cmap_org = + fb_cmap_create(&fscinfo, &vscinfo)) == (struct fb_cmap *)-1) { + return 1; + } ++#elif defined(__FreeBSD__) ++ if ((cmap_org = ++ fb_cmap_create(&video_info, &video_adapter_info)) == ++ (video_color_palette_t *)-1) { ++ return 1; ++ } ++#endif + + if (fb_cmap_get(fbfp, cmap_org)) { + fprintf(stderr, "Can't get color map.\n"); +@@ -452,8 +621,13 @@ fb_cmap_init(void) + } + } + ++#if defined(__linux__) + cmap->start = MONO_OFFSET_8BIT; + cmap->len = COLORS_8BIT + COLORS_MONO_8BIT; ++#elif defined(__FreeBSD__) ++ cmap->index = MONO_OFFSET_8BIT; ++ cmap->count = COLORS_8BIT + COLORS_MONO_8BIT; ++#endif + + for (lp = 0; lp < COLORS_MONO_8BIT; lp++) { + int c; +@@ -506,73 +680,213 @@ fb_cmap_init(void) + + #define LUT_MAX (256) + ++#if defined(__linux__) + static struct fb_cmap * + fb_cmap_create(struct fb_fix_screeninfo *fscinfo, + struct fb_var_screeninfo *vscinfo) ++#elif defined(__FreeBSD__) ++static video_color_palette_t * ++fb_cmap_create(video_info_t *video_info, ++ video_adapter_info_t *video_adapter_info) ++#endif + { ++#if defined(__linux__) + struct fb_cmap *cmap; ++#elif defined(__FreeBSD__) ++ video_color_palette_t *cmap; ++#endif + int cmaplen = LUT_MAX; + + /* check the existence of colormap */ ++#if defined(__linux__) + if (fscinfo->visual == FB_VISUAL_MONO01 || + fscinfo->visual == FB_VISUAL_MONO10 || + fscinfo->visual == FB_VISUAL_TRUECOLOR) + return NULL; ++#elif defined(__FreeBSD__) ++ if (!(video_adapter_info->va_flags & V_ADP_PALETTE)) ++ return NULL; ++#endif + ++#if defined(__linux__) + cmap = (struct fb_cmap *)malloc(sizeof(struct fb_cmap)); ++#elif defined(__FreeBSD__) ++ cmap = (video_color_palette_t *)malloc(sizeof(video_color_palette_t)); ++#endif + if (!cmap) { + perror("cmap malloc error\n"); ++#if defined(__linux__) + return (struct fb_cmap *)-1; ++#elif defined(__FreeBSD__) ++ return (video_color_palette_t *)-1; ++#endif + } ++#if defined(__linux__) + memset(cmap, 0, sizeof(struct fb_cmap)); ++#elif defined(__FreeBSD__) ++ memset(cmap, 0, sizeof(video_color_palette_t)); ++#endif ++ ++#if defined(__FreeBSD__) ++ if (video_info->vi_mem_model == V_INFO_MM_PACKED) { ++ cmap->red = (u_char *) malloc(sizeof(u_char) * cmaplen); ++ if (!cmap->red) { ++ perror("red lut malloc error\n"); ++ return (video_color_palette_t *)-1; ++ } ++ cmap->green = (u_char *) malloc(sizeof(u_char) * cmaplen); ++ if (!cmap->green) { ++ perror("green lut malloc error\n"); ++ free(cmap->red); ++ return (video_color_palette_t *)-1; ++ } ++ cmap->blue = (u_char *) malloc(sizeof(u_char) * cmaplen); ++ if (!cmap->blue) { ++ perror("blue lut malloc error\n"); ++ free(cmap->red); ++ free(cmap->green); ++ return (video_color_palette_t *)-1; ++ } ++ cmap->transparent = (u_char *) malloc(sizeof(u_char) * cmaplen); ++ if (!cmap->transparent) { ++ perror("transparent lut malloc error\n"); ++ free(cmap->red); ++ free(cmap->green); ++ free(cmap->blue); ++ return (video_color_palette_t *)-1; ++ } ++ cmap->count = cmaplen; ++ return cmap; ++ } ++#endif + + /* Allocates memory for a colormap */ ++#if defined(__linux__) + if (vscinfo->red.length) { + cmap->red = (__u16 *) malloc(sizeof(__u16) * cmaplen); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[0]) { ++ cmap->red = (u_char *) malloc(sizeof(u_char) * cmaplen); ++#endif + if (!cmap->red) { + perror("red lut malloc error\n"); ++#if defined(__linux__) + return (struct fb_cmap *)-1; ++#elif defined(__FreeBSD__) ++ return (video_color_palette_t *)-1; ++#endif + } + } ++#if defined(__linux__) + if (vscinfo->green.length) { + cmap->green = (__u16 *) malloc(sizeof(__u16) * cmaplen); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[1]) { ++ cmap->green = (u_char *) malloc(sizeof(u_char) * cmaplen); ++#endif + if (!cmap->green) { ++#if defined(__linux__) + if (vscinfo->red.length) + free(cmap->red); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[0]) ++ free(cmap->red); ++#endif + perror("green lut malloc error\n"); ++#if defined(__linux__) + return (struct fb_cmap *)-1; ++#elif defined(__FreeBSD__) ++ return (video_color_palette_t *)-1; ++#endif + } + } ++#if defined(__linux__) + if (vscinfo->blue.length) { + cmap->blue = (__u16 *) malloc(sizeof(__u16) * cmaplen); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[2]) { ++ cmap->blue = (u_char *) malloc(sizeof(u_char) * cmaplen); ++#endif + if (!cmap->blue) { ++#if defined(__linux__) + if (vscinfo->red.length) + free(cmap->red); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[0]) ++ free(cmap->red); ++#endif ++#if defined(__linux__) + if (vscinfo->green.length) + free(cmap->green); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[1]) ++ free(cmap->green); ++#endif + perror("blue lut malloc error\n"); ++#if defined(__linux__) + return (struct fb_cmap *)-1; ++#elif defined(__FreeBSD__) ++ return (video_color_palette_t *)-1; ++#endif + } + } ++#if defined(__linux__) + if (vscinfo->transp.length) { + cmap->transp = (__u16 *) malloc(sizeof(__u16) * cmaplen); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[3]) { ++ cmap->transparent = (u_char *) malloc(sizeof(u_char) * cmaplen); ++#endif ++#if defined(__linux__) + if (!cmap->transp) { ++#elif defined(__FreeBSD__) ++ if (!cmap->transparent) { ++#endif ++#if defined(__linux__) + if (vscinfo->red.length) + free(cmap->red); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[0]) ++ free(cmap->red); ++#endif ++#if defined(__linux__) + if (vscinfo->green.length) + free(cmap->green); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[1]) ++ free(cmap->green); ++#endif ++#if defined(__linux__) + if (vscinfo->blue.length) + free(cmap->blue); + perror("transp lut malloc error\n"); ++#elif defined(__FreeBSD__) ++ if (video_info->vi_pixel_fsizes[2]) ++ free(cmap->blue); ++ perror("transparent lut malloc error\n"); ++#endif ++#if defined(__linux__) + return (struct fb_cmap *)-1; ++#elif defined(__FreeBSD__) ++ return (video_color_palette_t *)-1; ++#endif + } + } ++#if defined(__linux__) + cmap->len = cmaplen; ++#elif defined(__FreeBSD__) ++ cmap->count = cmaplen; ++#endif + return cmap; + } + ++#if defined(__linux__) + static void + fb_cmap_destroy(struct fb_cmap *cmap) ++#elif defined(__FreeBSD__) ++static void ++fb_cmap_destroy(video_color_palette_t *cmap) ++#endif + { + if (cmap->red) + free(cmap->red); +@@ -580,28 +894,57 @@ fb_cmap_destroy(struct fb_cmap *cmap) + free(cmap->green); + if (cmap->blue) + free(cmap->blue); ++#if defined(__linux__) + if (cmap->transp) + free(cmap->transp); ++#elif defined(__FreeBSD__) ++ if (cmap->transparent) ++ free(cmap->transparent); ++#endif + free(cmap); + } + ++#if defined(__linux__) + static int + fb_cmap_get(int fbfp, struct fb_cmap *cmap) ++#elif defined(__FreeBSD__) ++static int ++fb_cmap_get(int fbfp, video_color_palette_t *cmap) ++#endif + { ++#if defined(__linux__) + if (ioctl(fbfp, FBIOGETCMAP, cmap)) { + perror("ioctl FBIOGETCMAP error\n"); + return -1; + } ++#elif defined(__FreeBSD__) ++ if (ioctl(fbfp, FBIO_GETPALETTE, cmap) == -1) { ++ perror("ioctl FBIO_GETPALETTE error\n"); ++ return -1; ++ } ++#endif + return 0; + } + ++#if defined(__linux__) + static int + fb_cmap_set(int fbfp, struct fb_cmap *cmap) ++#elif defined(__FreeBSD__) ++static int ++fb_cmap_set(int fbfp, video_color_palette_t *cmap) ++#endif + { ++#if defined(__linux__) + if (ioctl(fbfp, FBIOPUTCMAP, cmap)) { + perror("ioctl FBIOPUTCMAP error\n"); + return -1; + } ++#elif defined(__FreeBSD__) ++ if (ioctl(fbfp, FBIO_SETPALETTE, cmap) == -1) { ++ perror("ioctl FBIO_SETPALETTE error\n"); ++ return -1; ++ } ++#endif + return 0; + } + +@@ -612,10 +955,16 @@ fb_cmap_set(int fbfp, struct fb_cmap *cmap) + * fb_munmap() deletes the mappings + */ + ++#if defined(__linux__) + static void * + fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo) ++#elif defined(__FreeBSD__) ++static void * ++fb_mmap(int fbfp, video_adapter_info_t *video_adapter_info) ++#endif + { + void *buf; ++#if defined(__linux__) + if ((buf = (unsigned char *) + mmap(NULL, scinfo->smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbfp, + (off_t) 0)) +@@ -623,13 +972,41 @@ fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo) + perror("mmap error"); + return NULL; + } ++#elif defined(__FreeBSD__) ++ size_t mmap_offset; ++ size_t mmap_length; ++ mmap_offset = (size_t)(video_adapter_info->va_window) & (PAGE_MASK); ++ mmap_length = (size_t)(video_adapter_info->va_window_size + ++ mmap_offset + PAGE_MASK) & (~PAGE_MASK); ++ if ((buf = (unsigned char *) ++ mmap(NULL, mmap_length, PROT_READ | PROT_WRITE, MAP_SHARED, fbfp, ++ (off_t) 0)) ++ == MAP_FAILED) { ++ perror("mmap error"); ++ return NULL; ++ } ++#endif + return buf; + } + ++#if defined(__linux__) + static int + fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo) ++#elif defined(__FreeBSD__) ++static int ++fb_munmap(void *buf, video_adapter_info_t *video_adapter_info) ++#endif + { ++#if defined(__linux__) + return munmap(buf, scinfo->smem_len); ++#elif defined(__FreeBSD__) ++ size_t mmap_offset; ++ size_t mmap_length; ++ mmap_offset = (size_t)(video_adapter_info->va_window) & (PAGE_MASK); ++ mmap_length = (size_t)(video_adapter_info->va_window_size + ++ mmap_offset + PAGE_MASK) & (~PAGE_MASK); ++ return munmap((void *)((u_long)buf & (~PAGE_MASK)), mmap_length); ++#endif + } + + /* +@@ -637,6 +1014,7 @@ fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo) + * + * fb_fscrn_get() get information + */ ++#if defined(__linux__) + static int + fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo) + { +@@ -646,12 +1024,14 @@ fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo) + } + return 0; + } ++#endif + + /* + * (struct fb_var_screeninfo) device independent variable information + * + * fb_vscrn_get() get information + */ ++#if defined(__linux__) + static int + fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo) + { +@@ -661,3 +1041,41 @@ fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo) + } + return 0; + } ++#endif ++ ++#if defined(__FreeBSD__) ++static int ++fb_video_mode_get(int fbfp, int *video_mode) ++{ ++ if (ioctl(fbfp, FBIO_GETMODE, video_mode) == -1) { ++ perror("ioctl FBIO_GETMODE error\n"); ++ return -1; ++ } ++ return 0; ++} ++#endif ++ ++#if defined(__FreeBSD__) ++static int ++fb_video_info_get(int fbfp, video_info_t *video_info) ++{ ++ if (ioctl(fbfp, FBIO_MODEINFO, video_info) == -1) { ++ perror("ioctl FBIO_MODEINFO error\n"); ++ return -1; ++ } ++ return 0; ++} ++#endif ++ ++#if defined(__FreeBSD__) ++static int ++fb_video_adapter_info_get(int fbfp, video_adapter_info_t *video_adapter_info) ++{ ++ if (ioctl(fbfp, FBIO_ADPINFO, video_adapter_info) == -1) { ++ perror("ioctl FBIO_ADPINFO error\n"); ++ return -1; ++ } ++ return 0; ++} ++#endif ++ +diff --git a/w3mimg/fb/fb.h b/w3mimg/fb/fb.h +index 1138bb0..5d86454 100644 +--- a/w3mimg/fb/fb.h ++++ b/w3mimg/fb/fb.h +@@ -1,7 +1,11 @@ + /* $Id: fb.h,v 1.7 2003/07/07 15:48:17 ukai Exp $ */ + #ifndef fb_header + #define fb_header ++#if defined(__linux__) + #include <linux/fb.h> ++#elif defined(__FreeBSD__) ++#include <sys/fbio.h> ++#endif + + typedef struct { + int num; +diff --git a/w3mimg/fb/fb_gdkpixbuf.c b/w3mimg/fb/fb_gdkpixbuf.c +index 36e3b62..f1e8d97 100644 +--- a/w3mimg/fb/fb_gdkpixbuf.c ++++ b/w3mimg/fb/fb_gdkpixbuf.c +@@ -6,7 +6,7 @@ + #include "config.h" + #if defined(USE_GTK2) + #include <glib-object.h> +-#include <gdk/gdk.h> ++#include <gdk-pixbuf/gdk-pixbuf.h> + #endif + #include <gdk-pixbuf/gdk-pixbuf.h> + #include "fb.h" +diff --git a/w3mimg/fb/fb_w3mimg.c b/w3mimg/fb/fb_w3mimg.c +index d3ae5a9..fb323f5 100644 +--- a/w3mimg/fb/fb_w3mimg.c ++++ b/w3mimg/fb/fb_w3mimg.c +@@ -153,10 +153,15 @@ check_tty_console(char *tty) + return 0; + if (strncmp(tty, "/dev/", 5) == 0) + tty += 5; ++#if defined(__linux__) + if (strncmp(tty, "tty", 3) == 0 && isdigit(*(tty + 3))) + return 1; + if (strncmp(tty, "vc/", 3) == 0 && isdigit(*(tty + 3))) + return 1; ++#elif defined(__FreeBSD__) ++ if (strncmp(tty, "ttyv", 4) == 0 && isxdigit(*(tty + 4))) ++ return 1; ++#endif + return 0; + } + #else +@@ -172,7 +177,9 @@ w3mimg_fbopen() + return NULL; + memset(wop, 0, sizeof(w3mimg_op)); + +- if (!check_tty_console(getenv("W3M_TTY")) && strcmp("jfbterm", getenv("TERM")) != 0) { ++ if (!check_tty_console(getenv("W3M_TTY")) && ++ strcmp("jfbterm", getenv("TERM")) != 0 && ++ strncmp("jfbterm-", getenv("TERM"), 8) != 0) { + fprintf(stderr, "w3mimgdisplay/fb: tty is not console\n"); + goto error; + } +diff --git a/w3mimg/x11/x11_w3mimg.c b/w3mimg/x11/x11_w3mimg.c +index f5be4a8..bc8d0aa 100644 +--- a/w3mimg/x11/x11_w3mimg.c ++++ b/w3mimg/x11/x11_w3mimg.c +@@ -14,7 +14,7 @@ + #elif defined(USE_GDKPIXBUF) + #if defined(USE_GTK2) + #include <glib-object.h> +-#include <gdk/gdk.h> ++#include <gdk-pixbuf/gdk-pixbuf.h> + #include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h> + #else + #include <gdk-pixbuf/gdk-pixbuf-xlib.h> +@@ -121,16 +121,21 @@ x11_init(w3mimg_op * self) + if (self == NULL) + return 0; + xi = (struct x11_info *)self->priv; ++#if defined(USE_IMLIB) + if (xi == NULL) + return 0; +-#if defined(USE_IMLIB) + if (!xi->id) { + xi->id = Imlib_init(xi->display); + if (!xi->id) + return 0; + } + #elif defined(USE_GDKPIXBUF) +- if (!xi->init_flag) { ++ if (!xi) { ++#if defined(USE_GTK2) ++ g_type_init(); ++#endif ++ } ++ else if (!xi->init_flag) { + #if defined(USE_GTK2) + g_type_init(); + #endif +@@ -138,7 +143,7 @@ x11_init(w3mimg_op * self) + xi->init_flag = TRUE; + } + #endif +- if (!xi->imageGC) { ++ if (xi && !xi->imageGC) { + xi->imageGC = XCreateGC(xi->display, xi->parent, 0, NULL); + if (!xi->imageGC) + return 0; +@@ -653,9 +658,11 @@ x11_get_image_size(w3mimg_op * self, W3MImage * img, char *fname, int *w, + + if (self == NULL) + return 0; ++#if defined(USE_IMLIB) && defined(USE_IMLIB2) + xi = (struct x11_info *)self->priv; + if (xi == NULL) + return 0; ++#endif + + #if defined(USE_IMLIB) + im = Imlib_load_image(xi->id, fname); +@@ -755,6 +762,9 @@ w3mimg_x11open() + return NULL; + memset(wop, 0, sizeof(w3mimg_op)); + ++ if (getenv("W3M_USE_REMOTE_IMAGE")) ++ goto end; ++ + xi = (struct x11_info *)malloc(sizeof(struct x11_info)); + if (xi == NULL) + goto error; +@@ -807,6 +817,7 @@ w3mimg_x11open() + + wop->priv = xi; + ++ end: + wop->init = x11_init; + wop->finish = x11_finish; + wop->active = x11_active; diff --git a/debian/patches/030_pager-s-option.patch b/debian/patches/030_pager-s-option.patch deleted file mode 100644 index 572e70f..0000000 --- a/debian/patches/030_pager-s-option.patch +++ /dev/null @@ -1,181 +0,0 @@ -Description: Change the -s option to "squeeze multiple blank lines" for pager - Change the -s option from "display charset Shift_JIS" to "squeeze multiple - blank lines" to work as /usr/bin/pager. In addition, the options -j and -e - are disabled. To specify the display charset, use -O{s|j|e} instead. - . - The patch was committed to the upstream on 2000-10-27. However, it was - rejected because of Debian specific on 2010-08-03. -Origin: upstream, http://www.sic.med.tohoku.ac.jp/~satodai/w3m-dev/200010.month/1275.html -Bug-Debian: http://bugs.debian.org/75527 - -diff -urN w3m.orig/main.c w3m/main.c ---- w3m.orig/main.c 2010-08-04 23:06:36.000000000 +0900 -+++ w3m/main.c 2010-08-05 19:28:46.000000000 +0900 -@@ -194,10 +194,12 @@ - #ifdef USE_M17N - fprintf(f, " -I charset document charset\n"); - fprintf(f, " -O charset display/output charset\n"); -+#if 0 /* use -O{s|j|e} instead */ - fprintf(f, " -e EUC-JP\n"); - fprintf(f, " -s Shift_JIS\n"); - fprintf(f, " -j JIS\n"); - #endif -+#endif - fprintf(f, " -B load bookmark\n"); - fprintf(f, " -bookmark file specify bookmark file\n"); - fprintf(f, " -T type specify content-type\n"); -@@ -242,7 +244,11 @@ - #endif /* USE_COOKIE */ - fprintf(f, " -graph use DEC special graphics for border of table and menu\n"); - fprintf(f, " -no-graph use ACII character for border of table and menu\n"); -+#if 1 /* pager requires -s */ -+ fprintf(f, " -s squeeze multiple blank lines\n"); -+#else - fprintf(f, " -S squeeze multiple blank lines\n"); -+#endif - fprintf(f, " -W toggle wrap search mode\n"); - fprintf(f, " -X don't use termcap init/deinit\n"); - fprintf(f, -@@ -524,12 +530,14 @@ - PagerMax = atoi(argv[i]); - } - #ifdef USE_M17N -+#if 0 /* use -O{s|j|e} instead */ - else if (!strcmp("-s", argv[i])) - DisplayCharset = WC_CES_SHIFT_JIS; - else if (!strcmp("-j", argv[i])) - DisplayCharset = WC_CES_ISO_2022_JP; - else if (!strcmp("-e", argv[i])) - DisplayCharset = WC_CES_EUC_JP; -+#endif - else if (!strncmp("-I", argv[i], 2)) { - if (argv[i][2] != '\0') - p = argv[i] + 2; -@@ -694,7 +702,11 @@ - accept_cookie = TRUE; - } - #endif /* USE_COOKIE */ -+#if 1 /* pager requires -s */ -+ else if (!strcmp("-s", argv[i])) -+#else - else if (!strcmp("-S", argv[i])) -+#endif - squeezeBlankLine = TRUE; - else if (!strcmp("-X", argv[i])) - Do_not_use_ti_te = TRUE; - -commit 7d4d6cdd31f09b964f436651217dd0e2488e5e7b -Author: Tatsuya Kinoshita <tats@debian.org> -Date: Sun Oct 13 14:06:32 2013 +0900 - - Update document for the -s option change - -diff --git a/doc-jp/MANUAL.html b/doc-jp/MANUAL.html -index 41d70f1..f197cfb 100644 ---- a/doc-jp/MANUAL.html -+++ b/doc-jp/MANUAL.html -@@ -51,15 +51,9 @@ w3m - <dt>-l Կ - <dd>ɸϤƤɽȤ¸Կꤹ - 롥ǥեȤ 10000 --<dt>-s --<dd>Shift_JIS ɤɽ롥 --<dt>-e --<dd>EUC ɤɽ롥 --<dt>-j --<dd>JIS(ISO-2022-JP) ɤɽ롥 --<dt>-O e|s|j|N|m|n -+<dt>-O ʸ - <dd>ɽѤʸɤꤹ롥 --<dt>-I e|s -+<dt>-I ʸ - <dd>ʸʸɤꤹ롥 - <dt>-T - <dd>ɽʸΥפꤹ롥λ꤬ʤ硤ե -@@ -89,7 +83,7 @@ HTML - <dd>顼ɽʤ - <dt>-F - <dd>ե졼ưɽ롥 --<dt>-S -+<dt>-s - <dd>Ϣ³Ԥ1ԤˤޤȤɽ롥 - <dt>-X - <dd>w3mλˡβ̤ʤ -diff --git a/doc-jp/w3m.1 b/doc-jp/w3m.1 -index 89aacb6..099a803 100644 ---- a/doc-jp/w3m.1 -+++ b/doc-jp/w3m.1 -@@ -39,19 +39,10 @@ text/plain - ɸϤƤɽȤ¸Կꤹ롥 - ǥեȤ10000 - .TP --.B \-s --Shift_JISɤɽ롥 --.TP --.B \-e --EUCɤɽ롥 --.TP --.B \-j --JIS (ISO-2022-JP)ɤɽ롥 --.TP --.BI \-O\ e|s|j|N|m -+.BI \-O\ ʸ - ɽ˻Ȥʸɤꤹ. - .TP --.BI \-I\ e|s -+.BI \-I\ ʸ - ʸʸɤꤹ롥 - .TP - .BI \-T\ -@@ -90,7 +81,7 @@ Bookmark - .B \-F - ե졼ưɽ롥 - .TP --.B \-S -+.B \-s - Ϣ³Ԥ1ԤˤޤȤɽ롥 - .TP - .B \-X -diff --git a/doc/MANUAL.html b/doc/MANUAL.html -index aff0189..0a00b59 100644 ---- a/doc/MANUAL.html -+++ b/doc/MANUAL.html -@@ -55,12 +55,10 @@ If you don't specify this option, - <dt>-l number - <dd>Specify line number preserved internally when reading text/plain document - fron standard input. Default is 10000. --<dt>-s --<dd>Display documents with Shift_JIS code. --<dt>-e --<dd>Display documents with EUC_JP code. --<dt>-j --<dd>Display documents with ISO-2022-JP code. -+<dt>-O charset -+<dd>Specify display/output charset. -+<dt>-I charset -+<dd>Specify document charset. - <dt>-T type - <dd>Specify document type. Without this option, document type - is determined from extension of a file. If the determination -@@ -90,7 +88,7 @@ It is useful when reading E-mail or NetNews messages. - <dd>Monochrome display mode. - <dt>-F - <dd>Automatically render frame. --<dt>-S -+<dt>-s - <dd>Squeeze blank lines. - <dt>-X - <dd>Upon exit, do not display preserved screen. -diff --git a/doc/w3m.1 b/doc/w3m.1 -index aeb4a60..da4fdbb 100644 ---- a/doc/w3m.1 -+++ b/doc/w3m.1 -@@ -143,7 +143,7 @@ use graphic character - .B -no-graph - don't use graphic character - .TP --.B -S -+.B -s - squeeze multiple blank lines - .TP - .B -W diff --git a/debian/patches/040_link-gtk2.patch b/debian/patches/040_link-gtk2.patch deleted file mode 100644 index 4bbc486..0000000 --- a/debian/patches/040_link-gtk2.patch +++ /dev/null @@ -1,31 +0,0 @@ -Subject: Explicitly add -lX11 to IMGX11LDFLAGS only when gtk2 -From: Tatsuya Kinoshita <tats@debian.org> -Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605761 -Bug: https://sourceforge.net/p/w3m/patches/57/ - -diff --git a/acinclude.m4 b/acinclude.m4 -index e4ccc3d..3b180dd 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -706,7 +706,7 @@ AC_DEFUN([AC_W3M_IMAGE], - AC_DEFINE(USE_GDKPIXBUF) - AC_DEFINE(USE_GTK2) - IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" -- IMGX11LDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" -+ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" - elif test x"$have_gdkpixbuf" = xyes; then - AC_DEFINE(USE_W3MIMG_X11) - IMGOBJS="$IMGOBJS x11/x11_w3mimg.o" -diff --git a/configure b/configure -index 4c1bc06..30edf21 100755 ---- a/configure -+++ b/configure -@@ -6927,7 +6927,7 @@ $as_echo "$as_me: WARNING: Imlib2 is not installed. Install Imlib2 (version >= - $as_echo "#define USE_GTK2 1" >>confdefs.h - - IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" -- IMGX11LDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" -+ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" - elif test x"$have_gdkpixbuf" = xyes; then - $as_echo "#define USE_W3MIMG_X11 1" >>confdefs.h - diff --git a/debian/patches/050_autotools-config.patch b/debian/patches/050_autotools-config.patch deleted file mode 100644 index 0fc7591..0000000 --- a/debian/patches/050_autotools-config.patch +++ /dev/null @@ -1,2813 +0,0 @@ -Subject: Update config.guess and config.sub -From: Tatsuya Kinoshita <tats@debian.org> - -Updated with autotools-dev 20140911.1 - -Note that Debian package uses autotools-dev dh addon, -dh_autotools-dev_updateconfig and dh_autotools-dev_restoreconfig, -instead of this patch. - -diff --git a/config.guess b/config.guess -index 51fab47..1f5c50c 100755 ---- a/config.guess -+++ b/config.guess -@@ -1,13 +1,12 @@ - #! /bin/sh - # Attempt to guess a canonical system name. --# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, --# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -+# Copyright 1992-2014 Free Software Foundation, Inc. - --timestamp='2004-03-12' -+timestamp='2014-03-23' - - # This file 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; either version 2 of the License, or -+# the Free Software Foundation; either version 3 of the License, or - # (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, but -@@ -16,24 +15,22 @@ timestamp='2004-03-12' - # General Public License for more details. - # - # You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+# along with this program; if not, see <http://www.gnu.org/licenses/>. - # - # As a special exception to the GNU General Public License, if you - # distribute this file as part of a program that contains a - # configuration script generated by Autoconf, you may include it under --# the same distribution terms that you use for the rest of that program. -- --# Originally written by Per Bothner <per@bothner.com>. --# Please send patches to <config-patches@gnu.org>. Submit a context --# diff and a properly formatted ChangeLog entry. -+# the same distribution terms that you use for the rest of that -+# program. This Exception is an additional permission under section 7 -+# of the GNU General Public License, version 3 ("GPLv3"). -+# -+# Originally written by Per Bothner. - # --# This script attempts to guess a canonical system name similar to --# config.sub. If it succeeds, it prints the system name on stdout, and --# exits with 0. Otherwise, it exits with 1. -+# You can get the latest version of this script from: -+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD - # --# The plan is that this can be called by configure scripts if you --# don't specify an explicit build system type. -+# Please send patches with a ChangeLog entry to config-patches@gnu.org. -+ - - me=`echo "$0" | sed -e 's,.*/,,'` - -@@ -53,8 +50,7 @@ version="\ - GNU config.guess ($timestamp) - - Originally written by Per Bothner. --Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 --Free Software Foundation, Inc. -+Copyright 1992-2014 Free Software Foundation, Inc. - - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -@@ -66,11 +62,11 @@ Try \`$me --help' for more information." - while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) -- echo "$timestamp" ; exit 0 ;; -+ echo "$timestamp" ; exit ;; - --version | -v ) -- echo "$version" ; exit 0 ;; -+ echo "$version" ; exit ;; - --help | --h* | -h ) -- echo "$usage"; exit 0 ;; -+ echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. -@@ -104,7 +100,7 @@ set_cc_for_build=' - trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; - trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; - : ${TMPDIR=/tmp} ; -- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || -+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -@@ -123,7 +119,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; --esac ;' -+esac ; set_cc_for_build= ;' - - # This is needed to find uname on a Pyramid OSx when run in the BSD universe. - # (ghazi@noc.rutgers.edu 1994-08-24) -@@ -136,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown - UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown - UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -+case "${UNAME_SYSTEM}" in -+Linux|GNU|GNU/*) -+ # If the system lacks a compiler, then just pick glibc. -+ # We could probably try harder. -+ LIBC=gnu -+ -+ eval $set_cc_for_build -+ cat <<-EOF > $dummy.c -+ #include <features.h> -+ #if defined(__UCLIBC__) -+ LIBC=uclibc -+ #elif defined(__dietlibc__) -+ LIBC=dietlibc -+ #else -+ LIBC=gnu -+ #endif -+ EOF -+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` -+ ;; -+esac -+ - # Note: order is significant - the case branches are not exclusive. - - case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or -- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, -+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward -@@ -158,6 +175,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; -+ sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched -@@ -166,7 +184,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ -- | grep __ELF__ >/dev/null -+ | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? -@@ -176,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - fi - ;; - *) -- os=netbsd -+ os=netbsd - ;; - esac - # The OS release -@@ -196,71 +214,34 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" -- exit 0 ;; -- amd64:OpenBSD:*:*) -- echo x86_64-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- amiga:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- arc:OpenBSD:*:*) -- echo mipsel-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- cats:OpenBSD:*:*) -- echo arm-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- hp300:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mac68k:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- macppc:OpenBSD:*:*) -- echo powerpc-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mvme68k:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mvme88k:OpenBSD:*:*) -- echo m88k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mvmeppc:OpenBSD:*:*) -- echo powerpc-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- pegasos:OpenBSD:*:*) -- echo powerpc-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- pmax:OpenBSD:*:*) -- echo mipsel-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- sgi:OpenBSD:*:*) -- echo mipseb-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- sun3:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- wgrisc:OpenBSD:*:*) -- echo mipsel-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ *:Bitrig:*:*) -+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` -+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} -+ exit ;; - *:OpenBSD:*:*) -- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` -+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} -+ exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ *:SolidBSD:*:*) -+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} -+ exit ;; - macppc:MirBSD:*:*) -- echo powerppc-unknown-mirbsd${UNAME_RELEASE} -- exit 0 ;; -+ echo powerpc-unknown-mirbsd${UNAME_RELEASE} -+ exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) -- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` -+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on -@@ -306,40 +287,46 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` -- exit 0 ;; -- Alpha*:OpenVMS:*:*) -- echo alpha-hp-vms -- exit 0 ;; -+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code. -+ exitcode=$? -+ trap '' 0 -+ exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix -- exit 0 ;; -+ exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 -- exit 0 ;; -+ exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 -- exit 0;; -+ exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos -- exit 0 ;; -+ exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos -- exit 0 ;; -+ exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition -- exit 0 ;; -+ exit ;; -+ *:z/VM:*:*) -+ echo s390-ibm-zvmoe -+ exit ;; - *:OS400:*:*) -- echo powerpc-ibm-os400 -- exit 0 ;; -+ echo powerpc-ibm-os400 -+ exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} -- exit 0;; -+ exit ;; -+ arm*:riscos:*:*|arm*:RISCOS:*:*) -+ echo arm-unknown-riscos -+ exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp -- exit 0;; -+ exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then -@@ -347,32 +334,51 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - else - echo pyramid-pyramid-bsd - fi -- exit 0 ;; -+ exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 -- exit 0 ;; -+ exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 -- exit 0 ;; -- DRS?6000:UNIX_SV:4.2*:7*) -+ exit ;; -+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in -- sparc) echo sparc-icl-nx7 && exit 0 ;; -+ sparc) echo sparc-icl-nx7; exit ;; - esac ;; -+ s390x:SunOS:*:*) -+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -+ exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -- i86pc:SunOS:5.*:*) -- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; -+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) -+ echo i386-pc-auroraux${UNAME_RELEASE} -+ exit ;; -+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) -+ eval $set_cc_for_build -+ SUN_ARCH="i386" -+ # If there is a compiler, see if it is configured for 64-bit objects. -+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. -+ # This test works for both compilers. -+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then -+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ -+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ -+ grep IS_64BIT_ARCH >/dev/null -+ then -+ SUN_ARCH="x86_64" -+ fi -+ fi -+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -+ exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) -@@ -381,10 +387,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` -- exit 0 ;; -+ exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 -@@ -396,10 +402,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac -- exit 0 ;; -+ exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor -@@ -409,41 +415,41 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) -- echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-atari-mint${UNAME_RELEASE} -+ exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) -- echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-atari-mint${UNAME_RELEASE} -+ exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) -- echo m68k-milan-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-milan-mint${UNAME_RELEASE} -+ exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) -- echo m68k-hades-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-hades-mint${UNAME_RELEASE} -+ exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) -- echo m68k-unknown-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-unknown-mint${UNAME_RELEASE} -+ exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 -- exit 0 ;; -+ exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -@@ -467,35 +473,36 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - exit (-1); - } - EOF -- $CC_FOR_BUILD -o $dummy $dummy.c \ -- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ -- && exit 0 -+ $CC_FOR_BUILD -o $dummy $dummy.c && -+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && -+ SYSTEM_NAME=`$dummy $dummyarg` && -+ { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax -- exit 0 ;; -+ exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax -- exit 0 ;; -+ exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax -- exit 0 ;; -+ exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix -- exit 0 ;; -+ exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 -- exit 0 ;; -+ exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 -- exit 0 ;; -+ exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 -- exit 0 ;; -+ exit ;; - AViiON:dgux:*:*) -- # DG/UX returns AViiON for all architectures -- UNAME_PROCESSOR=`/usr/bin/uname -p` -+ # DG/UX returns AViiON for all architectures -+ UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ -@@ -508,29 +515,29 @@ EOF - else - echo i586-dg-dgux${UNAME_RELEASE} - fi -- exit 0 ;; -+ exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 -- exit 0 ;; -+ exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 -- exit 0 ;; -+ exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 -- exit 0 ;; -+ exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd -- exit 0 ;; -+ exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` -- exit 0 ;; -+ exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. -- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id -- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' -+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id -+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix -- exit 0 ;; -+ exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` -@@ -538,7 +545,7 @@ EOF - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} -- exit 0 ;; -+ exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build -@@ -553,15 +560,19 @@ EOF - exit(0); - } - EOF -- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 -- echo rs6000-ibm-aix3.2.5 -+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` -+ then -+ echo "$SYSTEM_NAME" -+ else -+ echo rs6000-ibm-aix3.2.5 -+ fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi -- exit 0 ;; -- *:AIX:*:[45]) -+ exit ;; -+ *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 -@@ -574,28 +585,28 @@ EOF - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} -- exit 0 ;; -+ exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix -- exit 0 ;; -+ exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 -- exit 0 ;; -+ exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to -- exit 0 ;; # report: romp-ibm BSD 4.3 -+ exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx -- exit 0 ;; -+ exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 -- exit 0 ;; -+ exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd -- exit 0 ;; -+ exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 -- exit 0 ;; -+ exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in -@@ -604,52 +615,52 @@ EOF - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` -- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` -- case "${sc_cpu_version}" in -- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 -- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 -- 532) # CPU_PA_RISC2_0 -- case "${sc_kernel_bits}" in -- 32) HP_ARCH="hppa2.0n" ;; -- 64) HP_ARCH="hppa2.0w" ;; -+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` -+ case "${sc_cpu_version}" in -+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 -+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 -+ 532) # CPU_PA_RISC2_0 -+ case "${sc_kernel_bits}" in -+ 32) HP_ARCH="hppa2.0n" ;; -+ 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 -- esac ;; -- esac -+ esac ;; -+ esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -+ sed 's/^ //' << EOF >$dummy.c - -- #define _HPUX_SOURCE -- #include <stdlib.h> -- #include <unistd.h> -+ #define _HPUX_SOURCE -+ #include <stdlib.h> -+ #include <unistd.h> - -- int main () -- { -- #if defined(_SC_KERNEL_BITS) -- long bits = sysconf(_SC_KERNEL_BITS); -- #endif -- long cpu = sysconf (_SC_CPU_VERSION); -+ int main () -+ { -+ #if defined(_SC_KERNEL_BITS) -+ long bits = sysconf(_SC_KERNEL_BITS); -+ #endif -+ long cpu = sysconf (_SC_CPU_VERSION); - -- switch (cpu) -- { -- case CPU_PA_RISC1_0: puts ("hppa1.0"); break; -- case CPU_PA_RISC1_1: puts ("hppa1.1"); break; -- case CPU_PA_RISC2_0: -- #if defined(_SC_KERNEL_BITS) -- switch (bits) -- { -- case 64: puts ("hppa2.0w"); break; -- case 32: puts ("hppa2.0n"); break; -- default: puts ("hppa2.0"); break; -- } break; -- #else /* !defined(_SC_KERNEL_BITS) */ -- puts ("hppa2.0"); break; -- #endif -- default: puts ("hppa1.0"); break; -- } -- exit (0); -- } -+ switch (cpu) -+ { -+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break; -+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break; -+ case CPU_PA_RISC2_0: -+ #if defined(_SC_KERNEL_BITS) -+ switch (bits) -+ { -+ case 64: puts ("hppa2.0w"); break; -+ case 32: puts ("hppa2.0n"); break; -+ default: puts ("hppa2.0"); break; -+ } break; -+ #else /* !defined(_SC_KERNEL_BITS) */ -+ puts ("hppa2.0"); break; -+ #endif -+ default: puts ("hppa1.0"); break; -+ } -+ exit (0); -+ } - EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa -@@ -657,9 +668,19 @@ EOF - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then -- # avoid double evaluation of $set_cc_for_build -- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build -- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null -+ eval $set_cc_for_build -+ -+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating -+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler -+ # generating 64-bit code. GNU and HP use different nomenclature: -+ # -+ # $ CC_FOR_BUILD=cc ./config.guess -+ # => hppa2.0w-hp-hpux11.23 -+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess -+ # => hppa64-hp-hpux11.23 -+ -+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | -+ grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else -@@ -667,11 +688,11 @@ EOF - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} -- exit 0 ;; -+ exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} -- exit 0 ;; -+ exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -@@ -699,340 +720,345 @@ EOF - exit (0); - } - EOF -- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 -+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && -+ { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 -- exit 0 ;; -+ exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd -- exit 0 ;; -+ exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd -- exit 0 ;; -+ exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix -- exit 0 ;; -+ exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf -- exit 0 ;; -+ exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf -- exit 0 ;; -+ exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi -- exit 0 ;; -+ exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites -- exit 0 ;; -+ exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd -- exit 0 ;; -+ exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi -- exit 0 ;; -+ exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd -- exit 0 ;; -+ exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd -- exit 0 ;; -+ exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd -- exit 0 ;; -+ exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - *:UNICOS/mp:*:*) -- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -+ exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` -- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` -- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -- exit 0 ;; -+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` -+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -+ exit ;; - 5000:UNIX_System_V:4.*:*) -- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` -- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -- exit 0 ;; -+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` -+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -+ exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:FreeBSD:*:*) -- # Determine whether the default compiler uses glibc. -- eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -- #include <features.h> -- #if __GLIBC__ >= 2 -- LIBC=gnu -- #else -- LIBC= -- #endif --EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` -- # GNU/KFreeBSD systems have a "k" prefix to indicate we are using -- # FreeBSD's kernel, but not the complete OS. -- case ${LIBC} in gnu) kernel_only='k' ;; esac -- echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} -- exit 0 ;; -+ UNAME_PROCESSOR=`/usr/bin/uname -p` -+ case ${UNAME_PROCESSOR} in -+ amd64) -+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ *) -+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ esac -+ exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin -- exit 0 ;; -- i*:MINGW*:*) -+ exit ;; -+ *:MINGW64*:*) -+ echo ${UNAME_MACHINE}-pc-mingw64 -+ exit ;; -+ *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 -- exit 0 ;; -+ exit ;; -+ *:MSYS*:*) -+ echo ${UNAME_MACHINE}-pc-msys -+ exit ;; -+ i*:windows32*:*) -+ # uname -m includes "-pc" on this system. -+ echo ${UNAME_MACHINE}-mingw32 -+ exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 -- exit 0 ;; -- x86:Interix*:[34]*) -- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' -- exit 0 ;; -+ exit ;; -+ *:Interix*:*) -+ case ${UNAME_MACHINE} in -+ x86) -+ echo i586-pc-interix${UNAME_RELEASE} -+ exit ;; -+ authenticamd | genuineintel | EM64T) -+ echo x86_64-unknown-interix${UNAME_RELEASE} -+ exit ;; -+ IA64) -+ echo ia64-unknown-interix${UNAME_RELEASE} -+ exit ;; -+ esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks -- exit 0 ;; -+ exit ;; -+ 8664:Windows_NT:*) -+ echo x86_64-pc-mks -+ exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix -- exit 0 ;; -+ exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin -- exit 0 ;; -+ exit ;; -+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) -+ echo x86_64-unknown-cygwin -+ exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin -- exit 0 ;; -+ exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - *:GNU:*:*) - # the GNU system -- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` -- exit 0 ;; -+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` -+ exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland -- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} -+ exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix -- exit 0 ;; -+ exit ;; -+ aarch64:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ aarch64_be:Linux:*:*) -+ UNAME_MACHINE=aarch64_be -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ alpha:Linux:*:*) -+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in -+ EV5) UNAME_MACHINE=alphaev5 ;; -+ EV56) UNAME_MACHINE=alphaev56 ;; -+ PCA56) UNAME_MACHINE=alphapca56 ;; -+ PCA57) UNAME_MACHINE=alphapca56 ;; -+ EV6) UNAME_MACHINE=alphaev6 ;; -+ EV67) UNAME_MACHINE=alphaev67 ;; -+ EV68*) UNAME_MACHINE=alphaev68 ;; -+ esac -+ objdump --private-headers /bin/sh | grep -q ld.so.1 -+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ arc:Linux:*:* | arceb:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - arm*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ eval $set_cc_for_build -+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ -+ | grep -q __ARM_EABI__ -+ then -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ else -+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ -+ | grep -q __ARM_PCS_VFP -+ then -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi -+ else -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf -+ fi -+ fi -+ exit ;; -+ avr32*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - cris:Linux:*:*) -- echo cris-axis-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-axis-linux-${LIBC} -+ exit ;; -+ crisv32:Linux:*:*) -+ echo ${UNAME_MACHINE}-axis-linux-${LIBC} -+ exit ;; -+ frv:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ hexagon:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ i*86:Linux:*:*) -+ echo ${UNAME_MACHINE}-pc-linux-${LIBC} -+ exit ;; - ia64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - m32r*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - m68*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -- mips:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU -- #undef mips -- #undef mipsel -+ #undef ${UNAME_MACHINE} -+ #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) -- CPU=mipsel -+ CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) -- CPU=mips -+ CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif - EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` -- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 -+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` -+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; -- mips64:Linux:*:*) -- eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -- #undef CPU -- #undef mips64 -- #undef mips64el -- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) -- CPU=mips64el -- #else -- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) -- CPU=mips64 -- #else -- CPU= -- #endif -- #endif --EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` -- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 -- ;; -- ppc:Linux:*:*) -- echo powerpc-unknown-linux-gnu -- exit 0 ;; -- ppc64:Linux:*:*) -- echo powerpc64-unknown-linux-gnu -- exit 0 ;; -- alpha:Linux:*:*) -- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in -- EV5) UNAME_MACHINE=alphaev5 ;; -- EV56) UNAME_MACHINE=alphaev56 ;; -- PCA56) UNAME_MACHINE=alphapca56 ;; -- PCA57) UNAME_MACHINE=alphapca56 ;; -- EV6) UNAME_MACHINE=alphaev6 ;; -- EV67) UNAME_MACHINE=alphaev67 ;; -- EV68*) UNAME_MACHINE=alphaev68 ;; -- esac -- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null -- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi -- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} -- exit 0 ;; -+ openrisc*:Linux:*:*) -+ echo or1k-unknown-linux-${LIBC} -+ exit ;; -+ or32:Linux:*:* | or1k*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ padre:Linux:*:*) -+ echo sparc-unknown-linux-${LIBC} -+ exit ;; -+ parisc64:Linux:*:* | hppa64:Linux:*:*) -+ echo hppa64-unknown-linux-${LIBC} -+ exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in -- PA7*) echo hppa1.1-unknown-linux-gnu ;; -- PA8*) echo hppa2.0-unknown-linux-gnu ;; -- *) echo hppa-unknown-linux-gnu ;; -+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; -+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; -+ *) echo hppa-unknown-linux-${LIBC} ;; - esac -- exit 0 ;; -- parisc64:Linux:*:* | hppa64:Linux:*:*) -- echo hppa64-unknown-linux-gnu -- exit 0 ;; -+ exit ;; -+ ppc64:Linux:*:*) -+ echo powerpc64-unknown-linux-${LIBC} -+ exit ;; -+ ppc:Linux:*:*) -+ echo powerpc-unknown-linux-${LIBC} -+ exit ;; -+ ppc64le:Linux:*:*) -+ echo powerpc64le-unknown-linux-${LIBC} -+ exit ;; -+ ppcle:Linux:*:*) -+ echo powerpcle-unknown-linux-${LIBC} -+ exit ;; - s390:Linux:*:* | s390x:Linux:*:*) -- echo ${UNAME_MACHINE}-ibm-linux -- exit 0 ;; -+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC} -+ exit ;; - sh64*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - sh*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ tile*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ vax:Linux:*:*) -+ echo ${UNAME_MACHINE}-dec-linux-${LIBC} -+ exit ;; - x86_64:Linux:*:*) -- echo x86_64-unknown-linux-gnu -- exit 0 ;; -- i*86:Linux:*:*) -- # The BFD linker knows what the default object file format is, so -- # first see if it will tell us. cd to the root directory to prevent -- # problems with other programs or directories called `ld' in the path. -- # Set LC_ALL=C to ensure ld outputs messages in English. -- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ -- | sed -ne '/supported targets:/!d -- s/[ ][ ]*/ /g -- s/.*supported targets: *// -- s/ .*// -- p'` -- case "$ld_supported_targets" in -- elf32-i386) -- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" -- ;; -- a.out-i386-linux) -- echo "${UNAME_MACHINE}-pc-linux-gnuaout" -- exit 0 ;; -- coff-i386) -- echo "${UNAME_MACHINE}-pc-linux-gnucoff" -- exit 0 ;; -- "") -- # Either a pre-BFD a.out linker (linux-gnuoldld) or -- # one that does not give us useful --help. -- echo "${UNAME_MACHINE}-pc-linux-gnuoldld" -- exit 0 ;; -- esac -- # Determine whether the default compiler is a.out or elf -- eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -- #include <features.h> -- #ifdef __ELF__ -- # ifdef __GLIBC__ -- # if __GLIBC__ >= 2 -- LIBC=gnu -- # else -- LIBC=gnulibc1 -- # endif -- # else -- LIBC=gnulibc1 -- # endif -- #else -- #ifdef __INTEL_COMPILER -- LIBC=gnu -- #else -- LIBC=gnuaout -- #endif -- #endif -- #ifdef __dietlibc__ -- LIBC=dietlibc -- #endif --EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` -- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 -- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 -- ;; -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; -+ xtensa*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} -+ exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 -- exit 0 ;; -+ exit ;; - i*86:UNIX_SV:4.2MP:2.*) -- # Unixware is an offshoot of SVR4, but it has its own version -- # number series starting with 2... -- # I am not positive that other SVR4 systems won't match this, -+ # Unixware is an offshoot of SVR4, but it has its own version -+ # number series starting with 2... -+ # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. -- # Use sysv4.2uw... so that sysv4* matches it. -+ # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} -- exit 0 ;; -+ exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx -- exit 0 ;; -+ exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop -- exit 0 ;; -+ exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos -- exit 0 ;; -- i*86:syllable:*:*) -+ exit ;; -+ i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable -- exit 0 ;; -- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) -+ exit ;; -+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp -- exit 0 ;; -+ exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then -@@ -1040,15 +1066,16 @@ EOF - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi -- exit 0 ;; -- i*86:*:5:[78]*) -+ exit ;; -+ i*86:*:5:[678]*) -+ # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} -- exit 0 ;; -+ exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` -@@ -1066,73 +1093,86 @@ EOF - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi -- exit 0 ;; -+ exit ;; - pc:*:*:*) - # Left here for compatibility: -- # uname -m prints for DJGPP always 'pc', but it prints nothing about -- # the processor, so we play safe by assuming i386. -- echo i386-pc-msdosdjgpp -- exit 0 ;; -+ # uname -m prints for DJGPP always 'pc', but it prints nothing about -+ # the processor, so we play safe by assuming i586. -+ # Note: whatever this is, it MUST be the same as what config.sub -+ # prints for the "djgpp" host, or else GDB configury will decide that -+ # this is a cross-build. -+ echo i586-pc-msdosdjgpp -+ exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 -- exit 0 ;; -+ exit ;; - paragon:*:*:*) - echo i860-intel-osf1 -- exit 0 ;; -+ exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi -- exit 0 ;; -+ exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv -- exit 0 ;; -+ exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv -- exit 0 ;; -+ exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix -- exit 0 ;; -- M68*:*:R3V[567]*:*) -- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; -- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) -+ exit ;; -+ M68*:*:R3V[5678]*:*) -+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; -+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -- && echo i486-ncr-sysv4.3${OS_REL} && exit 0 -+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ -- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; -+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) -- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -- && echo i486-ncr-sysv4 && exit 0 ;; -+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -+ && { echo i486-ncr-sysv4; exit; } ;; -+ NCR*:*:4.2:* | MPRAS*:*:4.2:*) -+ OS_REL='.3' -+ test -r /etc/.relid \ -+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` -+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } -+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ -+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } -+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ -+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 -- exit 0 ;; -+ exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) -+ exit ;; -+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 -- exit 0 ;; -+ exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 -- exit 0 ;; -+ exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` -@@ -1140,68 +1180,109 @@ EOF - else - echo ns32k-sni-sysv - fi -- exit 0 ;; -- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort -- # says <Richard.M.Bartel@ccMail.Census.GOV> -- echo i586-unisys-sysv4 -- exit 0 ;; -+ exit ;; -+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort -+ # says <Richard.M.Bartel@ccMail.Census.GOV> -+ echo i586-unisys-sysv4 -+ exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 -- exit 0 ;; -+ exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 -- exit 0 ;; -+ exit ;; -+ i*86:VOS:*:*) -+ # From Paul.Green@stratus.com. -+ echo ${UNAME_MACHINE}-stratus-vos -+ exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos -- exit 0 ;; -+ exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 -- exit 0 ;; -+ exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then -- echo mips-nec-sysv${UNAME_RELEASE} -+ echo mips-nec-sysv${UNAME_RELEASE} - else -- echo mips-unknown-sysv${UNAME_RELEASE} -+ echo mips-unknown-sysv${UNAME_RELEASE} - fi -- exit 0 ;; -+ exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos -- exit 0 ;; -+ exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos -- exit 0 ;; -+ exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos -- exit 0 ;; -+ exit ;; -+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. -+ echo i586-pc-haiku -+ exit ;; -+ x86_64:Haiku:*:*) -+ echo x86_64-unknown-haiku -+ exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ SX-7:SUPER-UX:*:*) -+ echo sx7-nec-superux${UNAME_RELEASE} -+ exit ;; -+ SX-8:SUPER-UX:*:*) -+ echo sx8-nec-superux${UNAME_RELEASE} -+ exit ;; -+ SX-8R:SUPER-UX:*:*) -+ echo sx8r-nec-superux${UNAME_RELEASE} -+ exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Darwin:*:*) -- case `uname -p` in -- *86) UNAME_PROCESSOR=i686 ;; -- powerpc) UNAME_PROCESSOR=powerpc ;; -- esac -+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown -+ eval $set_cc_for_build -+ if test "$UNAME_PROCESSOR" = unknown ; then -+ UNAME_PROCESSOR=powerpc -+ fi -+ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then -+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then -+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ -+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ -+ grep IS_64BIT_ARCH >/dev/null -+ then -+ case $UNAME_PROCESSOR in -+ i386) UNAME_PROCESSOR=x86_64 ;; -+ powerpc) UNAME_PROCESSOR=powerpc64 ;; -+ esac -+ fi -+ fi -+ elif test "$UNAME_PROCESSOR" = i386 ; then -+ # Avoid executing cc on OS X 10.9, as it ships with a stub -+ # that puts up a graphical alert prompting to install -+ # developer tools. Any system running Mac OS X 10.7 or -+ # later (Darwin 11 and later) is required to have a 64-bit -+ # processor. This is not true of the ARM version of Darwin -+ # that Apple uses in portable devices. -+ UNAME_PROCESSOR=x86_64 -+ fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then -@@ -1209,22 +1290,28 @@ EOF - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:QNX:*:4*) - echo i386-pc-qnx -- exit 0 ;; -+ exit ;; -+ NEO-?:NONSTOP_KERNEL:*:*) -+ echo neo-tandem-nsk${UNAME_RELEASE} -+ exit ;; -+ NSE-*:NONSTOP_KERNEL:*:*) -+ echo nse-tandem-nsk${UNAME_RELEASE} -+ exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux -- exit 0 ;; -+ exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv -- exit 0 ;; -+ exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 -@@ -1235,183 +1322,55 @@ EOF - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 -- exit 0 ;; -+ exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 -- exit 0 ;; -+ exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex -- exit 0 ;; -+ exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 -- exit 0 ;; -+ exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 -- exit 0 ;; -+ exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 -- exit 0 ;; -+ exit ;; - *:ITS:*:*) - echo pdp10-unknown-its -- exit 0 ;; -+ exit ;; - SEI:*:*:SEIUX) -- echo mips-sei-seiux${UNAME_RELEASE} -- exit 0 ;; -+ echo mips-sei-seiux${UNAME_RELEASE} -+ exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` -- exit 0 ;; -+ exit ;; -+ *:*VMS:*:*) -+ UNAME_MACHINE=`(uname -p) 2>/dev/null` -+ case "${UNAME_MACHINE}" in -+ A*) echo alpha-dec-vms ; exit ;; -+ I*) echo ia64-dec-vms ; exit ;; -+ V*) echo vax-dec-vms ; exit ;; -+ esac ;; -+ *:XENIX:*:SysV) -+ echo i386-pc-xenix -+ exit ;; -+ i*86:skyos:*:*) -+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' -+ exit ;; -+ i*86:rdos:*:*) -+ echo ${UNAME_MACHINE}-pc-rdos -+ exit ;; -+ i*86:AROS:*:*) -+ echo ${UNAME_MACHINE}-pc-aros -+ exit ;; -+ x86_64:VMkernel:*:*) -+ echo ${UNAME_MACHINE}-unknown-esx -+ exit ;; - esac - --#echo '(No uname command or uname output not recognized.)' 1>&2 --#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -- --eval $set_cc_for_build --cat >$dummy.c <<EOF --#ifdef _SEQUENT_ --# include <sys/types.h> --# include <sys/utsname.h> --#endif --main () --{ --#if defined (sony) --#if defined (MIPSEB) -- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, -- I don't know.... */ -- printf ("mips-sony-bsd\n"); exit (0); --#else --#include <sys/param.h> -- printf ("m68k-sony-newsos%s\n", --#ifdef NEWSOS4 -- "4" --#else -- "" --#endif -- ); exit (0); --#endif --#endif -- --#if defined (__arm) && defined (__acorn) && defined (__unix) -- printf ("arm-acorn-riscix"); exit (0); --#endif -- --#if defined (hp300) && !defined (hpux) -- printf ("m68k-hp-bsd\n"); exit (0); --#endif -- --#if defined (NeXT) --#if !defined (__ARCHITECTURE__) --#define __ARCHITECTURE__ "m68k" --#endif -- int version; -- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; -- if (version < 4) -- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); -- else -- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); -- exit (0); --#endif -- --#if defined (MULTIMAX) || defined (n16) --#if defined (UMAXV) -- printf ("ns32k-encore-sysv\n"); exit (0); --#else --#if defined (CMU) -- printf ("ns32k-encore-mach\n"); exit (0); --#else -- printf ("ns32k-encore-bsd\n"); exit (0); --#endif --#endif --#endif -- --#if defined (__386BSD__) -- printf ("i386-pc-bsd\n"); exit (0); --#endif -- --#if defined (sequent) --#if defined (i386) -- printf ("i386-sequent-dynix\n"); exit (0); --#endif --#if defined (ns32000) -- printf ("ns32k-sequent-dynix\n"); exit (0); --#endif --#endif -- --#if defined (_SEQUENT_) -- struct utsname un; -- -- uname(&un); -- -- if (strncmp(un.version, "V2", 2) == 0) { -- printf ("i386-sequent-ptx2\n"); exit (0); -- } -- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ -- printf ("i386-sequent-ptx1\n"); exit (0); -- } -- printf ("i386-sequent-ptx\n"); exit (0); -- --#endif -- --#if defined (vax) --# if !defined (ultrix) --# include <sys/param.h> --# if defined (BSD) --# if BSD == 43 -- printf ("vax-dec-bsd4.3\n"); exit (0); --# else --# if BSD == 199006 -- printf ("vax-dec-bsd4.3reno\n"); exit (0); --# else -- printf ("vax-dec-bsd\n"); exit (0); --# endif --# endif --# else -- printf ("vax-dec-bsd\n"); exit (0); --# endif --# else -- printf ("vax-dec-ultrix\n"); exit (0); --# endif --#endif -- --#if defined (alliant) && defined (i860) -- printf ("i860-alliant-bsd\n"); exit (0); --#endif -- -- exit (1); --} --EOF -- --$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 -- --# Apollos put the system type in the environment. -- --test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } -- --# Convex versions that predate uname can use getsysinfo(1) -- --if [ -x /usr/convex/getsysinfo ] --then -- case `getsysinfo -f cpu_type` in -- c1*) -- echo c1-convex-bsd -- exit 0 ;; -- c2*) -- if getsysinfo -f scalar_acc -- then echo c32-convex-bsd -- else echo c2-convex-bsd -- fi -- exit 0 ;; -- c34*) -- echo c34-convex-bsd -- exit 0 ;; -- c38*) -- echo c38-convex-bsd -- exit 0 ;; -- c4*) -- echo c4-convex-bsd -- exit 0 ;; -- esac --fi -- - cat >&2 <<EOF - $0: unable to guess system type - -@@ -1419,7 +1378,9 @@ This script, last modified $timestamp, has failed to recognize - the operating system you are using. It is advised that you - download the most up to date version of the config scripts from - -- ftp://ftp.gnu.org/pub/gnu/config/ -+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -+and -+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - - If the version you run ($0) is already up to date, please - send the following data and any information you think might be -diff --git a/config.sub b/config.sub -index ba33103..bba4efb 100755 ---- a/config.sub -+++ b/config.sub -@@ -1,42 +1,40 @@ - #! /bin/sh - # Configuration validation subroutine script. --# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, --# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -+# Copyright 1992-2014 Free Software Foundation, Inc. - --timestamp='2004-03-12' -+timestamp='2014-09-11' - --# This file is (in principle) common to ALL GNU software. --# The presence of a machine in this file suggests that SOME GNU software --# can handle that machine. It does not imply ALL GNU software can. --# --# This file 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; either version 2 of the License, or -+# This file 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; either version 3 of the License, or - # (at your option) any later version. - # --# This program is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. -+# This program is distributed in the hope that it will be useful, but -+# WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. - # - # You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place - Suite 330, --# Boston, MA 02111-1307, USA. -- -+# along with this program; if not, see <http://www.gnu.org/licenses/>. -+# - # As a special exception to the GNU General Public License, if you - # distribute this file as part of a program that contains a - # configuration script generated by Autoconf, you may include it under --# the same distribution terms that you use for the rest of that program. -+# the same distribution terms that you use for the rest of that -+# program. This Exception is an additional permission under section 7 -+# of the GNU General Public License, version 3 ("GPLv3"). - --# Please send patches to <config-patches@gnu.org>. Submit a context --# diff and a properly formatted ChangeLog entry. -+ -+# Please send patches with a ChangeLog entry to config-patches@gnu.org. - # - # Configuration subroutine to validate and canonicalize a configuration type. - # Supply the specified configuration type as an argument. - # If it is invalid, we print an error message on stderr and exit with code 1. - # Otherwise, we print the canonical config type on stdout and succeed. - -+# You can get the latest version of this script from: -+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD -+ - # This file is supposed to be the same for all GNU packages - # and recognize all the CPU types, system types and aliases - # that are meaningful with *any* GNU software. -@@ -70,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>." - version="\ - GNU config.sub ($timestamp) - --Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 --Free Software Foundation, Inc. -+Copyright 1992-2014 Free Software Foundation, Inc. - - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -@@ -83,11 +80,11 @@ Try \`$me --help' for more information." - while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) -- echo "$timestamp" ; exit 0 ;; -+ echo "$timestamp" ; exit ;; - --version | -v ) -- echo "$version" ; exit 0 ;; -+ echo "$version" ; exit ;; - --help | --h* | -h ) -- echo "$usage"; exit 0 ;; -+ echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. -@@ -99,7 +96,7 @@ while test $# -gt 0 ; do - *local*) - # First pass through any local machine types. - echo $1 -- exit 0;; -+ exit ;; - - * ) - break ;; -@@ -118,11 +115,18 @@ esac - # Here we must recognize all the valid KERNEL-OS combinations. - maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` - case $maybe_os in -- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ -- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) -+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ -+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ -+ knetbsd*-gnu* | netbsd*-gnu* | \ -+ kopensolaris*-gnu* | \ -+ storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; -+ android-linux) -+ os=-linux-android -+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown -+ ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] -@@ -145,10 +149,13 @@ case $os in - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -- -apple | -axis) -+ -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; -+ -bluegene*) -+ os=-cnk -+ ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 -@@ -163,13 +170,17 @@ case $os in - os=-chorusos - basic_machine=$1 - ;; -- -chorusrdb) -- os=-chorusrdb -+ -chorusrdb) -+ os=-chorusrdb - basic_machine=$1 -- ;; -+ ;; - -hiux*) - os=-hiuxwe2 - ;; -+ -sco6) -+ os=-sco5v6 -+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` -+ ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` -@@ -186,6 +197,10 @@ case $os in - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; -+ -sco5v6*) -+ # Don't forget version if it is 3.2v4 or newer. -+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` -+ ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` -@@ -203,6 +218,12 @@ case $os in - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; -+ -lynx*178) -+ os=-lynxos178 -+ ;; -+ -lynx*5) -+ os=-lynxos5 -+ ;; - -lynx*) - os=-lynxos - ;; -@@ -227,57 +248,109 @@ case $basic_machine in - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ -+ | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ -- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ -- | c4x | clipper \ -+ | arc | arceb \ -+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ -+ | avr | avr32 \ -+ | be32 | be64 \ -+ | bfin \ -+ | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ -- | fr30 | frv \ -+ | epiphany \ -+ | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ -+ | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ -- | m32r | m32rle | m68000 | m68k | m88k | mcore \ -+ | k1om \ -+ | le32 | le64 \ -+ | lm32 \ -+ | m32c | m32r | m32rle | m68000 | m68k | m88k \ -+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ -- | mips64vr | mips64vrel \ -+ | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ -+ | mips64r5900 | mips64r5900el \ -+ | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ -+ | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ -+ | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ -+ | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ -+ | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ -+ | moxie \ -+ | mt \ - | msp430 \ -+ | nds32 | nds32le | nds32be \ -+ | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ -- | openrisc | or32 \ -+ | open8 | or1k | or1knd | or32 \ - | pdp10 | pdp11 | pj | pjl \ -- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ -+ | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ -- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ -+ | riscv32 | riscv64 \ -+ | rl78 | rx \ -+ | score \ -+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ -- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ -- | strongarm \ -- | tahoe | thumb | tic4x | tic80 | tron \ -- | v850 | v850e \ -+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ -+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ -+ | spu \ -+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ -+ | ubicom32 \ -+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ -- | x86 | xscale | xstormy16 | xtensa \ -- | z8k) -+ | x86 | xc16x | xstormy16 | xtensa \ -+ | z8k | z80) - basic_machine=$basic_machine-unknown - ;; -- m6811 | m68hc11 | m6812 | m68hc12) -- # Motorola 68HC11/12. -+ c54x) -+ basic_machine=tic54x-unknown -+ ;; -+ c55x) -+ basic_machine=tic55x-unknown -+ ;; -+ c6x) -+ basic_machine=tic6x-unknown -+ ;; -+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; -+ ms1) -+ basic_machine=mt-unknown -+ ;; -+ -+ strongarm | thumb | xscale) -+ basic_machine=arm-unknown -+ ;; -+ xgate) -+ basic_machine=$basic_machine-unknown -+ os=-none -+ ;; -+ xscaleeb) -+ basic_machine=armeb-unknown -+ ;; -+ -+ xscaleel) -+ basic_machine=armel-unknown -+ ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and -@@ -293,59 +366,86 @@ case $basic_machine in - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ -+ | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ -- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ -+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ -- | avr-* \ -- | bs2000-* \ -- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ -- | clipper-* | cydra-* \ -+ | avr-* | avr32-* \ -+ | be32-* | be64-* \ -+ | bfin-* | bs2000-* \ -+ | c[123]* | c30-* | [cjt]90-* | c4x-* \ -+ | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ -- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ -+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ -+ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ -- | m32r-* | m32rle-* \ -+ | k1om-* \ -+ | le32-* | le64-* \ -+ | lm32-* \ -+ | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ -- | m88110-* | m88k-* | mcore-* \ -+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ -+ | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ -- | mips64vr-* | mips64vrel-* \ -+ | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ -+ | mips64r5900-* | mips64r5900el-* \ -+ | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ -+ | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ -+ | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ -+ | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ -+ | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ -+ | mmix-* \ -+ | mt-* \ - | msp430-* \ -- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ -+ | nds32-* | nds32le-* | nds32be-* \ -+ | nios-* | nios2-* | nios2eb-* | nios2el-* \ -+ | none-* | np1-* | ns16k-* | ns32k-* \ -+ | open8-* \ -+ | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ -- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ -+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ -- | romp-* | rs6000-* \ -- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ -+ | rl78-* | romp-* | rs6000-* | rx-* \ -+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ -- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ -- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ -- | tahoe-* | thumb-* \ -+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ -+ | sparclite-* \ -+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ -+ | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ -+ | tile*-* \ - | tron-* \ -- | v850-* | v850e-* | vax-* \ -+ | ubicom32-* \ -+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ -+ | vax-* \ - | we32k-* \ -- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ -- | xtensa-* \ -+ | x86-* | x86_64-* | xc16x-* | xps100-* \ -+ | xstormy16-* | xtensa*-* \ - | ymp-* \ -- | z8k-*) -+ | z8k-* | z80-*) -+ ;; -+ # Recognize the basic CPU types without company name, with glob match. -+ xtensa*) -+ basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. -@@ -363,7 +463,7 @@ case $basic_machine in - basic_machine=a29k-amd - os=-udi - ;; -- abacus) -+ abacus) - basic_machine=abacus-unknown - ;; - adobe68k) -@@ -409,6 +509,10 @@ case $basic_machine in - basic_machine=m68k-apollo - os=-bsd - ;; -+ aros) -+ basic_machine=i386-pc -+ os=-aros -+ ;; - aux) - basic_machine=m68k-apple - os=-aux -@@ -417,10 +521,35 @@ case $basic_machine in - basic_machine=ns32k-sequent - os=-dynix - ;; -+ blackfin) -+ basic_machine=bfin-unknown -+ os=-linux -+ ;; -+ blackfin-*) -+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` -+ os=-linux -+ ;; -+ bluegene*) -+ basic_machine=powerpc-ibm -+ os=-cnk -+ ;; -+ c54x-*) -+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ;; -+ c55x-*) -+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ;; -+ c6x-*) -+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; -+ cegcc) -+ basic_machine=arm-unknown -+ os=-cegcc -+ ;; - convex-c1) - basic_machine=c1-convex - os=-bsd -@@ -445,13 +574,20 @@ case $basic_machine in - basic_machine=j90-cray - os=-unicos - ;; -- cr16c) -- basic_machine=cr16c-unknown -+ craynv) -+ basic_machine=craynv-cray -+ os=-unicosmp -+ ;; -+ cr16 | cr16-*) -+ basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; -+ crisv32 | crisv32-* | etraxfs*) -+ basic_machine=crisv32-axis -+ ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; -@@ -481,6 +617,14 @@ case $basic_machine in - basic_machine=m88k-motorola - os=-sysv3 - ;; -+ dicos) -+ basic_machine=i686-pc -+ os=-dicos -+ ;; -+ djgpp) -+ basic_machine=i586-pc -+ os=-msdosdjgpp -+ ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx -@@ -592,7 +736,6 @@ case $basic_machine in - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; --# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 -@@ -631,6 +774,14 @@ case $basic_machine in - basic_machine=m68k-isi - os=-sysv - ;; -+ m68knommu) -+ basic_machine=m68k-unknown -+ os=-linux -+ ;; -+ m68knommu-*) -+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` -+ os=-linux -+ ;; - m88k-omron*) - basic_machine=m88k-omron - ;; -@@ -642,10 +793,21 @@ case $basic_machine in - basic_machine=ns32k-utek - os=-sysv - ;; -+ microblaze*) -+ basic_machine=microblaze-xilinx -+ ;; -+ mingw64) -+ basic_machine=x86_64-pc -+ os=-mingw64 -+ ;; - mingw32) -- basic_machine=i386-pc -+ basic_machine=i686-pc - os=-mingw32 - ;; -+ mingw32ce) -+ basic_machine=arm-unknown -+ os=-mingw32ce -+ ;; - miniframe) - basic_machine=m68000-convergent - ;; -@@ -659,10 +821,6 @@ case $basic_machine in - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; -- mmix*) -- basic_machine=mmix-knuth -- os=-mmixware -- ;; - monitor) - basic_machine=m68k-rom68k - os=-coff -@@ -671,14 +829,29 @@ case $basic_machine in - basic_machine=powerpc-unknown - os=-morphos - ;; -+ moxiebox) -+ basic_machine=moxie-unknown -+ os=-moxiebox -+ ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; -+ ms1-*) -+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` -+ ;; -+ msys) -+ basic_machine=i686-pc -+ os=-msys -+ ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; -+ nacl) -+ basic_machine=le32-unknown -+ os=-nacl -+ ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 -@@ -743,9 +916,11 @@ case $basic_machine in - np1) - basic_machine=np1-gould - ;; -- nv1) -- basic_machine=nv1-cray -- os=-unicosmp -+ neo-tandem) -+ basic_machine=neo-tandem -+ ;; -+ nse-tandem) -+ basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem -@@ -754,9 +929,8 @@ case $basic_machine in - basic_machine=hppa1.1-oki - os=-proelf - ;; -- or32 | or32-*) -+ openrisc | openrisc-*) - basic_machine=or32-unknown -- os=-coff - ;; - os400) - basic_machine=powerpc-ibm -@@ -778,6 +952,14 @@ case $basic_machine in - basic_machine=i860-intel - os=-osf - ;; -+ parisc) -+ basic_machine=hppa-unknown -+ os=-linux -+ ;; -+ parisc-*) -+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` -+ os=-linux -+ ;; - pbd) - basic_machine=sparc-tti - ;; -@@ -787,6 +969,12 @@ case $basic_machine in - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; -+ pc98) -+ basic_machine=i386-pc -+ ;; -+ pc98-*) -+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; -@@ -816,9 +1004,10 @@ case $basic_machine in - ;; - power) basic_machine=power-ibm - ;; -- ppc) basic_machine=powerpc-unknown -+ ppc | ppcbe) basic_machine=powerpc-unknown - ;; -- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ppc-* | ppcbe-*) -+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown -@@ -843,6 +1032,14 @@ case $basic_machine in - basic_machine=i586-unknown - os=-pw32 - ;; -+ rdos | rdos64) -+ basic_machine=x86_64-pc -+ os=-rdos -+ ;; -+ rdos32) -+ basic_machine=i386-pc -+ os=-rdos -+ ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff -@@ -869,6 +1066,10 @@ case $basic_machine in - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; -+ sde) -+ basic_machine=mipsisa32-sde -+ os=-elf -+ ;; - sei) - basic_machine=mips-sei - os=-seiux -@@ -880,6 +1081,9 @@ case $basic_machine in - basic_machine=sh-hitachi - os=-hms - ;; -+ sh5el) -+ basic_machine=sh5le-unknown -+ ;; - sh64) - basic_machine=sh64-unknown - ;; -@@ -901,6 +1105,9 @@ case $basic_machine in - basic_machine=i860-stratus - os=-sysv4 - ;; -+ strongarm-* | thumb-*) -+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` -+ ;; - sun2) - basic_machine=m68000-sun - ;; -@@ -957,17 +1164,9 @@ case $basic_machine in - basic_machine=t90-cray - os=-unicos - ;; -- tic54x | c54x*) -- basic_machine=tic54x-unknown -- os=-coff -- ;; -- tic55x | c55x*) -- basic_machine=tic55x-unknown -- os=-coff -- ;; -- tic6x | c6x*) -- basic_machine=tic6x-unknown -- os=-coff -+ tile*) -+ basic_machine=$basic_machine-unknown -+ os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown -@@ -1029,9 +1228,16 @@ case $basic_machine in - basic_machine=hppa1.1-winbond - os=-proelf - ;; -+ xbox) -+ basic_machine=i686-pc -+ os=-mingw32 -+ ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; -+ xscale-* | xscalee[bl]-*) -+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` -+ ;; - ymp) - basic_machine=ymp-cray - os=-unicos -@@ -1040,6 +1246,10 @@ case $basic_machine in - basic_machine=z8k-unknown - os=-sim - ;; -+ z80-*-coff) -+ basic_machine=z80-unknown -+ os=-sim -+ ;; - none) - basic_machine=none-none - os=-none -@@ -1059,6 +1269,9 @@ case $basic_machine in - romp) - basic_machine=romp-ibm - ;; -+ mmix) -+ basic_machine=mmix-knuth -+ ;; - rs6000) - basic_machine=rs6000-ibm - ;; -@@ -1075,13 +1288,10 @@ case $basic_machine in - we32k) - basic_machine=we32k-att - ;; -- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) -+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; -- sh64) -- basic_machine=sh64-unknown -- ;; -- sparc | sparcv8 | sparcv9 | sparcv9b) -+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) -@@ -1125,9 +1335,12 @@ esac - if [ x"$os" != x"" ] - then - case $os in -- # First match some system type aliases -- # that might get confused with valid system types. -+ # First match some system type aliases -+ # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. -+ -auroraux) -+ os=-auroraux -+ ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; -@@ -1148,26 +1361,31 @@ case $os in - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ -- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ -+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ -+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ -+ | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ -- | -aos* \ -+ | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ -- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ -+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ -+ | -bitrig* | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ -- | -chorusos* | -chorusrdb* \ -- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ -- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ -+ | -chorusos* | -chorusrdb* | -cegcc* \ -+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ -+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ -+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ -+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ -- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) -+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ -+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) -@@ -1185,7 +1403,7 @@ case $os in - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ -- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ -+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) -@@ -1206,7 +1424,7 @@ case $os in - -opened*) - os=-openedition - ;; -- -os400*) -+ -os400*) - os=-os400 - ;; - -wince*) -@@ -1255,7 +1473,7 @@ case $os in - -sinix*) - os=-sysv4 - ;; -- -tpf*) -+ -tpf*) - os=-tpf - ;; - -triton*) -@@ -1291,8 +1509,13 @@ case $os in - -aros*) - os=-aros - ;; -- -kaos*) -- os=-kaos -+ -zvmoe) -+ os=-zvmoe -+ ;; -+ -dicos*) -+ os=-dicos -+ ;; -+ -nacl*) - ;; - -none) - ;; -@@ -1316,6 +1539,12 @@ else - # system, and we'll never get to this point. - - case $basic_machine in -+ score-*) -+ os=-elf -+ ;; -+ spu-*) -+ os=-elf -+ ;; - *-acorn) - os=-riscix1.2 - ;; -@@ -1325,9 +1554,24 @@ case $basic_machine in - arm*-semi) - os=-aout - ;; -- c4x-* | tic4x-*) -- os=-coff -- ;; -+ c4x-* | tic4x-*) -+ os=-coff -+ ;; -+ c8051-*) -+ os=-elf -+ ;; -+ hexagon-*) -+ os=-elf -+ ;; -+ tic54x-*) -+ os=-coff -+ ;; -+ tic55x-*) -+ os=-coff -+ ;; -+ tic6x-*) -+ os=-coff -+ ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 -@@ -1346,13 +1590,13 @@ case $basic_machine in - ;; - m68000-sun) - os=-sunos3 -- # This also exists in the configure program, but was not the -- # default. -- # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; -+ mep-*) -+ os=-elf -+ ;; - mips*-cisco) - os=-elf - ;; -@@ -1371,9 +1615,15 @@ case $basic_machine in - *-be) - os=-beos - ;; -+ *-haiku) -+ os=-haiku -+ ;; - *-ibm) - os=-aix - ;; -+ *-knuth) -+ os=-mmixware -+ ;; - *-wec) - os=-proelf - ;; -@@ -1476,7 +1726,7 @@ case $basic_machine in - -sunos*) - vendor=sun - ;; -- -aix*) -+ -cnk*|-aix*) - vendor=ibm - ;; - -beos*) -@@ -1539,7 +1789,7 @@ case $basic_machine in - esac - - echo $basic_machine$os --exit 0 -+exit - - # Local variables: - # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/debian/patches/060_format-security.patch b/debian/patches/060_format-security.patch deleted file mode 100644 index 6ac0425..0000000 --- a/debian/patches/060_format-security.patch +++ /dev/null @@ -1,44 +0,0 @@ -Description: Appease gcc -Werror=format-security -Author: Colin Watson <cjwatson@ubuntu.com> -Forwarded: no -Last-Update: 2011-10-23 - -Index: b/acinclude.m4 -=================================================================== ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -866,7 +866,7 @@ - AC_TRY_COMPILE( - changequote(<<,>>)dnl - <<extern char *sys_errlist[];>>, --<<printf(sys_errlist[0]);>>, -+<<printf("%s", sys_errlist[0]);>>, - changequote([,])dnl - [have_sys_errlist="yes"; AC_DEFINE(HAVE_SYS_ERRLIST)], - [have_sys_errlist="no"]) -Index: b/configure -=================================================================== ---- a/configure -+++ b/configure -@@ -8986,7 +8986,7 @@ - int - main () - { --printf(sys_errlist[0]); -+printf("%s", sys_errlist[0]); - ; - return 0; - } -Index: b/w3mbookmark.c -=================================================================== ---- a/w3mbookmark.c -+++ b/w3mbookmark.c -@@ -99,7 +99,7 @@ - fprintf(f, "<body>\n<h1>Bookmarks</h1>\n"); - fprintf(f, "<h2>%s</h2>\n<ul>\n", section); - fprintf(f, "<li><a href=\"%s\">%s</a>\n", url, title); -- fprintf(f, end_section); -+ fprintf(f, "%s", end_section); - fprintf(f, "</ul>\n</body>\n</html>\n"); - fclose(f); - } diff --git a/debian/patches/070_glibc2.14.patch b/debian/patches/070_glibc2.14.patch deleted file mode 100644 index 25e480a..0000000 --- a/debian/patches/070_glibc2.14.patch +++ /dev/null @@ -1,63 +0,0 @@ -Description: Unbreak compilation with eglibc 2.14 -Author: Reinhard Tartler <siretart@tauware.de> -Origin: Ubuntu -Bug-Ubuntu: https://launchpad.net/bugs/935540 - ---- w3m-0.5.3.orig/istream.c -+++ w3m-0.5.3/istream.c -@@ -22,8 +22,8 @@ - static void basic_close(int *handle); - static int basic_read(int *handle, char *buf, int len); - --static void file_close(struct file_handle *handle); --static int file_read(struct file_handle *handle, char *buf, int len); -+static void file_close(struct io_file_handle *handle); -+static int file_read(struct io_file_handle *handle, char *buf, int len); - - static int str_read(Str handle, char *buf, int len); - -@@ -114,7 +114,7 @@ newFileStream(FILE * f, void (*closep) ( - stream = New(union input_stream); - init_base_stream(&stream->base, STREAM_BUF_SIZE); - stream->file.type = IST_FILE; -- stream->file.handle = New(struct file_handle); -+ stream->file.handle = New(struct io_file_handle); - stream->file.handle->f = f; - if (closep) - stream->file.handle->close = closep; -@@ -658,13 +658,13 @@ basic_read(int *handle, char *buf, int l - } - - static void --file_close(struct file_handle *handle) -+file_close(struct io_file_handle *handle) - { - handle->close(handle->f); - } - - static int --file_read(struct file_handle *handle, char *buf, int len) -+file_read(struct io_file_handle *handle, char *buf, int len) - { - return fread(buf, 1, len, handle->f); - } ---- w3m-0.5.3.orig/istream.h -+++ w3m-0.5.3/istream.h -@@ -20,7 +20,7 @@ struct stream_buffer { - - typedef struct stream_buffer *StreamBuffer; - --struct file_handle { -+struct io_file_handle { - FILE *f; - void (*close) (); - }; -@@ -53,7 +53,7 @@ struct base_stream { - - struct file_stream { - struct stream_buffer stream; -- struct file_handle *handle; -+ struct io_file_handle *handle; - char type; - char iseos; - int (*read) (); diff --git a/debian/patches/080_gc72.patch b/debian/patches/080_gc72.patch deleted file mode 100644 index 4642ce1..0000000 --- a/debian/patches/080_gc72.patch +++ /dev/null @@ -1,25 +0,0 @@ -Description: Support Boehm GC 7.2 -Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=080_gc72.patch;att=1;bug=758831 -From: Micah Cowan <micah@addictivecode.org> -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758831 -Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=555467 -Bug: http://sourceforge.net/p/w3m/patches/63/ -Bug: http://sourceforge.net/p/w3m/patches/59/ - -Index: w3m-0.5.3/main.c -=================================================================== ---- w3m-0.5.3.orig/main.c 2014-08-21 12:22:32.000000000 -0700 -+++ w3m-0.5.3/main.c 2014-08-21 12:22:52.419420062 -0700 -@@ -845,7 +845,12 @@ main(int argc, char **argv, char **envp) - mySignal(SIGPIPE, SigPipe); - #endif - -+#if GC_VERSION_MAJOR >= 7 && GC_VERSION_MINOR >= 2 -+ orig_GC_warn_proc = GC_get_warn_proc(); -+ GC_set_warn_proc(wrap_GC_warn_proc); -+#else - orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc); -+#endif - err_msg = Strnew(); - if (load_argc == 0) { - /* no URL specified */ diff --git a/debian/patches/090_parallel-make.patch b/debian/patches/090_parallel-make.patch deleted file mode 100644 index 01a333a..0000000 --- a/debian/patches/090_parallel-make.patch +++ /dev/null @@ -1,39 +0,0 @@ -Subject: Fix parallel make issue -From: Tatsuya Kinoshita <tats@debian.org> -Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726188 -Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=362249 -Bug: https://sourceforge.net/p/w3m/patches/64/ - - Depend on funcname.tab to fix parallel make issue of scripts - - Avoid prerequisite $(IMGOBJS) to fix parallel make issue of w3mimg - -diff --git a/Makefile.in b/Makefile.in -index 52a0aae..b283f29 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -250,7 +250,7 @@ install-po: - (cd $$subdir && $(MAKE) install); \ - done - --all-scripts: -+all-scripts: funcname.tab - for dir in $(SCRIPTSUBDIRS); \ - do \ - (cd $$dir && $(MAKE) $(MAKE_ARGS)); \ -diff --git a/w3mimg/Makefile.in b/w3mimg/Makefile.in -index dfc550c..8e2ad73 100644 ---- a/w3mimg/Makefile.in -+++ b/w3mimg/Makefile.in -@@ -16,9 +16,9 @@ IMGCFLAGS=@IMGX11CFLAGS@ @IMGFBCFLAGS@ @IMGWINCFLAGS@ - IMGOBJS=@IMGOBJS@ - - .PHONY: $(SUBDIRS) --all: @IMGTARGETS@ w3mimg.a -+all: w3mimg.a - --w3mimg.a: $(IMGOBJS) -+w3mimg.a: w3mimg.o @IMGTARGETS@ - $(AR) rv $@ $(IMGOBJS) - $(RANLIB) $@ - diff --git a/debian/patches/100_use-cppflags.patch b/debian/patches/100_use-cppflags.patch deleted file mode 100644 index 0b76fb2..0000000 --- a/debian/patches/100_use-cppflags.patch +++ /dev/null @@ -1,17 +0,0 @@ -Description: Use $(CPPFLAGS) with $(CPP) - Use CPPFLAGS from environment (dpkg-buildflags). - Necessary for hardening flags. -Author: Simon Ruderich <simon@ruderich.org> -Bug-Debian: http://bugs.debian.org/665491 - ---- w3m-0.5.3.orig/Makefile.in -+++ w3m-0.5.3/Makefile.in -@@ -150,7 +150,7 @@ parsetagx.o: html.c - - funcname.tab: $(DEFUNS) - (echo '#define DEFUN(x,y,z) x y';\ -- sed -ne '/^DEFUN/{p;n;/^[ ]/p;}' $(DEFUNS)) | $(CPP) - | \ -+ sed -ne '/^DEFUN/{p;n;/^[ ]/p;}' $(DEFUNS)) | $(CPP) $(CPPFLAGS) - | \ - awk '$$1 ~ /^[_A-Za-z]/ { \ - for (i=2;i<=NF;i++) { print $$i, $$1} \ - }' > $@.tmp diff --git a/debian/patches/110_form-input-text.patch b/debian/patches/110_form-input-text.patch deleted file mode 100644 index d5c09f3..0000000 --- a/debian/patches/110_form-input-text.patch +++ /dev/null @@ -1,15 +0,0 @@ -Description: Assume "text" if an input type is unknown -Author: Hilko Bengen <bengen@debian.org> -Bug-Debian: http://bugs.debian.org/615843 - ---- w3m-git.orig/form.c 2011-02-28 15:03:36.000000000 +0100 -+++ w3m-git/form.c 2011-02-28 15:32:33.000000000 +0100 -@@ -196,7 +196,7 @@ - if (!strcasecmp(typestr, _formtypetbl[i])) - return i; - } -- return FORM_UNKNOWN; -+ return FORM_INPUT_TEXT; - } - - void diff --git a/debian/patches/120_sgrmouse.patch b/debian/patches/120_sgrmouse.patch deleted file mode 100644 index 0cc9feb..0000000 --- a/debian/patches/120_sgrmouse.patch +++ /dev/null @@ -1,111 +0,0 @@ -Subject: Support SGR 1006 -From: Hayaki Saito <user@zuse.jp> -Date: Sun, 15 Jul 2012 20:14:16 +0900 -Origin: upstream, http://www.sic.med.tohoku.ac.jp/~satodai/w3m-dev/201207.month/4466.html - -Patch to support SGR 1006 mouse reporting, from [w3m-dev 04466] -on 2012-07-15, provided by Hayaki Saito. - -diff --git a/keybind.c b/keybind.c -index a490962..fec0c65 100644 ---- a/keybind.c -+++ b/keybind.c -@@ -91,7 +91,7 @@ unsigned char EscBKeymap[128] = { - /* 0 1 2 3 4 5 6 7 */ - nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, - /* 8 9 : ; < = > ? */ -- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, -+ nulcmd, nulcmd, nulcmd, nulcmd, sgrmouse, nulcmd, nulcmd, nulcmd, - /* @ A B C D E F G */ - nulcmd, movU, movD, movR, movL, nulcmd, goLineL, pgFore, - /* H I J K L M N O */ -diff --git a/main.c b/main.c -index b421943..35f2f39 100644 ---- a/main.c -+++ b/main.c -@@ -5398,6 +5398,58 @@ DEFUN(mouse, MOUSE, "mouse operation") - process_mouse(btn, x, y); - } - -+DEFUN(sgrmouse, SGRMOUSE, "SGR 1006 mouse operation") -+{ -+ int btn = 0, x = 0, y = 0; -+ unsigned char c; -+ -+ do { -+ c = getch(); -+ if (IS_DIGIT(c)) -+ btn = btn * 10 + c - '0'; -+ else if (c == ';') -+ break; -+ else -+ return; -+ } while (1); -+ -+#if defined(__CYGWIN__) && CYGWIN_VERSION_DLL_MAJOR < 1005 -+ if (cygwin_mouse_btn_swapped) { -+ if (btn == MOUSE_BTN2_DOWN) -+ btn = MOUSE_BTN3_DOWN; -+ else if (btn == MOUSE_BTN3_DOWN) -+ btn = MOUSE_BTN2_DOWN; -+ }; -+#endif -+ -+ do { -+ c = getch(); -+ if (IS_DIGIT(c)) -+ x = x * 10 + c - '0'; -+ else if (c == ';') -+ break; -+ else -+ return; -+ } while (1); -+ -+ do { -+ c = getch(); -+ if (IS_DIGIT(c)) -+ y = y * 10 + c - '0'; -+ else if (c == 'M') -+ break; -+ else if (c == 'm') { -+ btn |= 3; -+ break; -+ } else -+ return; -+ } while (1); -+ -+ if (x < 0 || x >= COLS || y < 0 || y > LASTLINE) -+ return; -+ process_mouse(btn, x, y); -+} -+ - #ifdef USE_GPM - int - gpm_process_mouse(Gpm_Event * event, void *data) -diff --git a/proto.h b/proto.h -index f8a7345..980d522 100644 ---- a/proto.h -+++ b/proto.h -@@ -683,6 +683,7 @@ extern void reMark(void); - - #ifdef USE_MOUSE - extern void mouse(void); -+extern void sgrmouse(void); - extern void mouse_init(void); - extern void mouse_end(void); - extern void mouse_active(void); -diff --git a/terms.c b/terms.c -index 7a3c987..8d928a2 100644 ---- a/terms.c -+++ b/terms.c -@@ -2027,8 +2027,8 @@ sleep_till_anykey(int sec, int purge) - - #ifdef USE_MOUSE - --#define XTERM_ON {fputs("\033[?1001s\033[?1000h",ttyf); flush_tty();} --#define XTERM_OFF {fputs("\033[?1000l\033[?1001r",ttyf); flush_tty();} -+#define XTERM_ON {fputs("\033[?1001s\033[?1000h\033[?1006h",ttyf); flush_tty();} -+#define XTERM_OFF {fputs("\033[?1006l\033[?1000l\033[?1001r",ttyf); flush_tty();} - #define CYGWIN_ON {fputs("\033[?1000h",ttyf); flush_tty();} - #define CYGWIN_OFF {fputs("\033[?1000l",ttyf); flush_tty();} - diff --git a/debian/patches/130_siteconf.patch b/debian/patches/130_siteconf.patch deleted file mode 100644 index 9f8124f..0000000 --- a/debian/patches/130_siteconf.patch +++ /dev/null @@ -1,2065 +0,0 @@ -Subject: New feature: siteconf -Origin: upstream, http://www.sic.med.tohoku.ac.jp/~satodai/w3m-dev/201206.month/4464.html - -Patch to support the siteconf feature, from [w3m-dev 04464] -on 2012-06-27, provided by AIDA Shinra. - -Updated to fix segfault of loadGeneralFile() by Tatsuya Kinoshita. - -diff --git a/anchor.c b/anchor.c -index 27bbd56..39f221d 100644 ---- a/anchor.c -+++ b/anchor.c -@@ -200,10 +200,11 @@ _put_anchor_news(Buffer *buf, char *p1, char *p2, int line, int pos) - if (*(p2 - 1) == '>') - p2--; - } -- tmp = wc_Str_conv_strict(Strnew_charp_n(p1, p2 - p1), InnerCharset, -- buf->document_charset); -- tmp = Sprintf("news:%s", file_quote(tmp->ptr)); -- return registerHref(buf, tmp->ptr, NULL, NO_REFERER, NULL, '\0', line, -+ tmp = Strnew_charp("news:"); -+ Strcat_charp_n(tmp, p1, p2 - p1); -+ return registerHref(buf, url_encode(tmp->ptr, baseURL(buf), -+ buf->document_charset), -+ NULL, NO_REFERER, NULL, '\0', line, - pos); - } - #endif /* USE_NNTP */ -@@ -213,9 +214,10 @@ _put_anchor_all(Buffer *buf, char *p1, char *p2, int line, int pos) - { - Str tmp; - -- tmp = wc_Str_conv_strict(Strnew_charp_n(p1, p2 - p1), InnerCharset, -- buf->document_charset); -- return registerHref(buf, url_quote(tmp->ptr), NULL, NO_REFERER, NULL, -+ tmp = Strnew_charp_n(p1, p2 - p1); -+ return registerHref(buf, url_encode(tmp->ptr, baseURL(buf), -+ buf->document_charset), -+ NULL, NO_REFERER, NULL, - '\0', line, pos); - } - -@@ -756,7 +758,7 @@ link_list_panel(Buffer *buf) - p = parsedURL2Str(&pu)->ptr; - u = html_quote(p); - if (DecodeURL) -- p = html_quote(url_unquote_conv(p, buf->document_charset)); -+ p = html_quote(url_decode2(p, buf)); - else - p = u; - } -@@ -787,7 +789,7 @@ link_list_panel(Buffer *buf) - p = parsedURL2Str(&pu)->ptr; - u = html_quote(p); - if (DecodeURL) -- p = html_quote(url_unquote_conv(p, buf->document_charset)); -+ p = html_quote(url_decode2(p, buf)); - else - p = u; - t = getAnchorText(buf, al, a); -@@ -809,16 +811,13 @@ link_list_panel(Buffer *buf) - p = parsedURL2Str(&pu)->ptr; - u = html_quote(p); - if (DecodeURL) -- p = html_quote(url_unquote_conv(p, buf->document_charset)); -+ p = html_quote(url_decode2(p, buf)); - else - p = u; - if (a->title && *a->title) - t = html_quote(a->title); -- else if (DecodeURL) -- t = html_quote(url_unquote_conv -- (a->url, buf->document_charset)); - else -- t = html_quote(a->url); -+ t = html_quote(url_decode2(a->url, buf)); - Strcat_m_charp(tmp, "<li><a href=\"", u, "\">", t, "</a><br>", p, - "\n", NULL); - a = retrieveAnchor(buf->formitem, a->start.line, a->start.pos); -@@ -842,19 +841,13 @@ link_list_panel(Buffer *buf) - p = parsedURL2Str(&pu)->ptr; - u = html_quote(p); - if (DecodeURL) -- p = html_quote(url_unquote_conv(p, -- buf-> -- document_charset)); -+ p = html_quote(url_decode2(p, buf)); - else - p = u; - if (m->alt && *m->alt) - t = html_quote(m->alt); -- else if (DecodeURL) -- t = html_quote(url_unquote_conv(m->url, -- buf-> -- document_charset)); - else -- t = html_quote(m->url); -+ t = html_quote(url_decode2(m->url, buf)); - Strcat_m_charp(tmp, "<li><a href=\"", u, "\">", t, - "</a><br>", p, "\n", NULL); - } -diff --git a/config.h.in b/config.h.in -index 2f41eed..59997b4 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -25,6 +25,7 @@ - - #define PASSWD_FILE RC_DIR "/passwd" - #define PRE_FORM_FILE RC_DIR "/pre_form" -+#define SITECONF_FILE RC_DIR "/siteconf" - #define USER_MAILCAP RC_DIR "/mailcap" - #define SYS_MAILCAP CONF_DIR "/mailcap" - #define USER_MIMETYPES "~/.mime.types" -diff --git a/display.c b/display.c -index e00eb0c..2fe1183 100644 ---- a/display.c -+++ b/display.c -@@ -257,7 +257,7 @@ make_lastline_link(Buffer *buf, char *title, char *url) - parseURL2(url, &pu, baseURL(buf)); - u = parsedURL2Str(&pu); - if (DecodeURL) -- u = Strnew_charp(url_unquote_conv(u->ptr, buf->document_charset)); -+ u = Strnew_charp(url_decode2(u->ptr, buf)); - #ifdef USE_M17N - u = checkType(u, &pr, NULL); - #endif -diff --git a/doc-jp/README.siteconf b/doc-jp/README.siteconf -new file mode 100644 -index 0000000..58b51c7 ---- /dev/null -+++ b/doc-jp/README.siteconf -@@ -0,0 +1,60 @@ -+siteconf: ̥ޥ -+ -+siteconf ϡ URL Υѥȡɳդ줿꤫ޤ -+siteconf Ȥȡʸɤꤷ "decode_url" -+νϤꡢ Google Υ쥯ǽ -+ץ饤Х夵ꤹ뤳ȤǤޤ -+ -+ǥեȤǤ siteconf ~/.w3m/siteconf ɤ߹ޤޤ -+ -+===== ʸ ===== -+ -+url <url>|/<re-url>/|m@<re-url>@i [exact] -+substitute_url "<destination-url>" -+url_charset <charset> -+no_referer_from on|off -+no_referer_to on|off -+ -+˽줿Τͥ褵ޤ -+ -+===== ===== -+ -+url "http://twitter.com/#!/" -+substitute_url "http://mobile.twitter.com/" -+ -+twitter.com Х륵Ȥžޤ -+ -+url "http://your.bookmark.net/" -+no_referer_from on -+ -+your.bookmark.net ĥäéݤˡ HTTP referer -+ʤ褦ˤޤ -+ -+url "http://www.google.com/url?" exact -+substitute_url "file:///cgi-bin/your-redirector.cgi?" -+ -+Google Υ쥯 local CGI žޤ -+ -+url /^http:\/\/[a-z]*\.wikipedia\.org\// -+url_charset utf-8 -+ -+Ʊ "decode_url" ץˤȡ Wikipedia ؤ -+ UTF-8 Ȥƥǥɤɽޤ -+ -+===== ɽˤĤ ===== -+ -+ɽϤƱ̣ɽޤ -+ -+/http:\/\/www\.example\.com\// -+m/http:\/\/www\.example\.com\// -+m@http://www\.example\.com/@ -+m!http://www\.example\.com/! -+ -+Ǹ 'i' Ҥդȡʸʸ̤˾ȹԤޤ -+㤨С m@^http://www\.example\.com/abc/@i ϰʲΤȤפޤ -+ -+http://www.example.com/abc/ -+http://www.example.com/Abc/ -+http://www.example.com/ABC/ -+ -+ۥ̾ʬϾ˾ʸѴƤӤޤ -diff --git a/doc/README.siteconf b/doc/README.siteconf -new file mode 100644 -index 0000000..f173087 ---- /dev/null -+++ b/doc/README.siteconf -@@ -0,0 +1,60 @@ -+The siteconf: Site-specific preferences -+ -+The siteconf consists of URL patterns and preferences associated to them. -+You can improve "decode_url" feature by giving charsets of URLs site by site, -+or bypass Google's redirector for performance and your privacy. -+ -+The siteconf is read from ~/.w3m/siteconf by default. -+ -+===== The syntax ===== -+ -+url <url>|/<re-url>/|m@<re-url>@i [exact] -+substitute_url "<destination-url>" -+url_charset <charset> -+no_referer_from on|off -+no_referer_to on|off -+ -+The last match wins. -+ -+===== Examples ===== -+ -+url "http://twitter.com/#!/" -+substitute_url "http://mobile.twitter.com/" -+ -+This forwards the twitter.com to its mobile site. -+ -+url "http://your.bookmark.net/" -+no_referer_from on -+ -+This prevents HTTP referers from being sent when you follow links -+at the your.bookmark.net. -+ -+url "http://www.google.com/url?" exact -+substitute_url "file:///cgi-bin/your-redirector.cgi?" -+ -+This forwards the Google's redirector to your local CGI. -+ -+url /^http:\/\/[a-z]*\.wikipedia\.org\// -+url_charset utf-8 -+ -+When combinated with "decode_url" option turned on, links to -+Wikipedia will be human-readable. -+ -+===== Regular expressions notes ===== -+ -+Following expressions are all equivalent: -+ -+/http:\/\/www\.example\.com\// -+m/http:\/\/www\.example\.com\// -+m@http://www\.example\.com/@ -+m!http://www\.example\.com/! -+ -+With a trailing 'i' modifier, you can specify a case-insensitive match. -+For example, m@^http://www\.example\.com/abc/@i matches to: -+ -+http://www.example.com/abc/ -+http://www.example.com/Abc/ -+http://www.example.com/ABC/ -+ -+Hostnames, however, are always converted to lowercases before compared. -+ -diff --git a/file.c b/file.c -index 567d41e..b342de0 100644 ---- a/file.c -+++ b/file.c -@@ -47,11 +47,11 @@ static JMP_BUF AbortLoading; - static struct table *tables[MAX_TABLE]; - static struct table_mode table_mode[MAX_TABLE]; - --#ifdef USE_IMAGE -+#if defined(USE_M17N) || defined(USE_IMAGE) - static ParsedURL *cur_baseURL = NULL; --#ifdef USE_M17N --static char cur_document_charset; - #endif -+#ifdef USE_M17N -+static wc_ces cur_document_charset = 0; - #endif - - static Str cur_title; -@@ -215,7 +215,6 @@ currentLn(Buffer *buf) - - static Buffer * - loadSomething(URLFile *f, -- char *path, - Buffer *(*loadproc) (URLFile *, Buffer *), Buffer *defaultbuf) - { - Buffer *buf; -@@ -223,17 +222,23 @@ loadSomething(URLFile *f, - if ((buf = loadproc(f, defaultbuf)) == NULL) - return NULL; - -- buf->filename = path; - if (buf->buffername == NULL || buf->buffername[0] == '\0') { - buf->buffername = checkHeader(buf, "Subject:"); -- if (buf->buffername == NULL) -- buf->buffername = conv_from_system(lastFileName(path)); -+ if (buf->buffername == NULL && buf->filename != NULL) -+ buf->buffername = conv_from_system(lastFileName(buf->filename)); - } - if (buf->currentURL.scheme == SCM_UNKNOWN) - buf->currentURL.scheme = f->scheme; -- buf->real_scheme = f->scheme; - if (f->scheme == SCM_LOCAL && buf->sourcefile == NULL) -- buf->sourcefile = path; -+ buf->sourcefile = buf->filename; -+ if (loadproc == loadHTMLBuffer -+#ifdef USE_IMAGE -+ || loadproc == loadImageBuffer -+#endif -+ ) -+ buf->type = "text/html"; -+ else -+ buf->type = "text/plain"; - return buf; - } - -@@ -484,28 +489,6 @@ convertLine0(URLFile *uf, Str line, int mode) - return line; - } - --/* -- * loadFile: load file to buffer -- */ --Buffer * --loadFile(char *path) --{ -- Buffer *buf; -- URLFile uf; -- init_stream(&uf, SCM_LOCAL, NULL); -- examineFile(path, &uf); -- if (uf.stream == NULL) -- return NULL; -- buf = newBuffer(INIT_BUFFER_WIDTH); -- current_content_length = 0; --#ifdef USE_M17N -- content_charset = 0; --#endif -- buf = loadSomething(&uf, path, loadBuffer, buf); -- UFclose(&uf); -- return buf; --} -- - int - matchattr(char *p, char *attr, int len, Str *value) - { -@@ -1697,13 +1680,15 @@ getLinkNumberStr(int correction) - /* - * loadGeneralFile: load file to buffer - */ -+#define DO_EXTERNAL ((Buffer *(*)(URLFile *, Buffer *))doExternal) - Buffer * - loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, - int flag, FormList *volatile request) - { - URLFile f, *volatile of = NULL; - ParsedURL pu; -- Buffer *b = NULL, *(*volatile proc)() = loadBuffer; -+ Buffer *b = NULL; -+ Buffer *(*volatile proc)(URLFile *, Buffer *) = loadBuffer; - char *volatile tpath; - char *volatile t = "text/plain", *p, *volatile real_type = NULL; - Buffer *volatile t_buf = NULL; -@@ -1730,7 +1715,22 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, - add_auth_cookie_flag = 0; - - checkRedirection(NULL); -+ - load_doc: -+ { -+ const char *sc_redirect; -+ parseURL2(tpath, &pu, current); -+ sc_redirect = query_SCONF_SUBSTITUTE_URL(&pu); -+ if (sc_redirect && *sc_redirect && checkRedirection(&pu)) { -+ tpath = (char *)sc_redirect; -+ request = NULL; -+ add_auth_cookie_flag = 0; -+ current = New(ParsedURL); -+ *current = pu; -+ status = HTST_NORMAL; -+ goto load_doc; -+ } -+ } - TRAP_OFF; - url_option.referer = referer; - url_option.flag = flag; -@@ -1863,7 +1863,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, - /* 302: Found */ - /* 303: See Other */ - /* 307: Temporary Redirect (HTTP/1.1) */ -- tpath = url_quote_conv(p, DocumentCharset); -+ tpath = url_encode(p, NULL, 0); - request = NULL; - UFclose(&f); - current = New(ParsedURL); -@@ -2022,7 +2022,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, - if (f.is_cgi && (p = checkHeader(t_buf, "Location:")) != NULL && - checkRedirection(&pu)) { - /* document moved */ -- tpath = url_quote_conv(remove_space(p), DocumentCharset); -+ tpath = url_encode(remove_space(p), NULL, 0); - request = NULL; - UFclose(&f); - add_auth_cookie_flag = 0; -@@ -2123,10 +2123,6 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, - if (real_type == NULL) - real_type = t; - proc = loadBuffer; --#ifdef USE_IMAGE -- cur_baseURL = New(ParsedURL); -- copyParsedURL(cur_baseURL, &pu); --#endif - - current_content_length = 0; - if ((p = checkHeader(t_buf, "Content-Length:")) != NULL) -@@ -2197,18 +2193,8 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, - #endif - else if (w3m_backend) ; - else if (!(w3m_dump & ~DUMP_FRAME) || is_dump_text_type(t)) { -- if (!do_download && doExternal(f, -- pu.real_file ? pu.real_file : pu.file, -- t, &b, t_buf)) { -- if (b && b != NO_BUFFER) { -- b->real_scheme = f.scheme; -- b->real_type = real_type; -- if (b->currentURL.host == NULL && b->currentURL.file == NULL) -- copyParsedURL(&b->currentURL, &pu); -- } -- UFclose(&f); -- TRAP_OFF; -- return b; -+ if (!do_download && searchExtViewer(t) != NULL) { -+ proc = DO_EXTERNAL; - } - else { - TRAP_OFF; -@@ -2232,36 +2218,30 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, - else if (w3m_dump & DUMP_FRAME) - return NULL; - -+ if (t_buf == NULL) -+ t_buf = newBuffer(INIT_BUFFER_WIDTH); -+ copyParsedURL(&t_buf->currentURL, &pu); -+ t_buf->filename = pu.real_file ? pu.real_file : -+ pu.file ? conv_to_system(pu.file) : NULL; - if (flag & RG_FRAME) { -- if (t_buf == NULL) -- t_buf = newBuffer(INIT_BUFFER_WIDTH); - t_buf->bufferprop |= BP_FRAME; - } - #ifdef USE_SSL -- if (t_buf) -- t_buf->ssl_certificate = f.ssl_certificate; -+ t_buf->ssl_certificate = f.ssl_certificate; - #endif - frame_source = flag & RG_FRAME_SRC; -- b = loadSomething(&f, pu.real_file ? pu.real_file : pu.file, proc, t_buf); -+ if (proc == DO_EXTERNAL) { -+ b = doExternal(f, t, t_buf); -+ } else { -+ b = loadSomething(&f, proc, t_buf); -+ } - UFclose(&f); - frame_source = 0; -- if (b) { -+ if (b && b != NO_BUFFER) { - b->real_scheme = f.scheme; - b->real_type = real_type; -- if (b->currentURL.host == NULL && b->currentURL.file == NULL) -- copyParsedURL(&b->currentURL, &pu); -- if (is_html_type(t)) -- b->type = "text/html"; -- else if (w3m_backend) { -- Str s = Strnew_charp(t); -- b->type = s->ptr; -- } --#ifdef USE_IMAGE -- else if (proc == loadImageBuffer) -- b->type = "text/html"; --#endif -- else -- b->type = "text/plain"; -+ if (w3m_backend) -+ b->type = allocStr(t, -1); - if (pu.label) { - if (proc == loadHTMLBuffer) { - Anchor *a; -@@ -2287,10 +2267,11 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, - if (header_string) - header_string = NULL; - #ifdef USE_NNTP -- if (f.scheme == SCM_NNTP || f.scheme == SCM_NEWS) -+ if (b && b != NO_BUFFER && (f.scheme == SCM_NNTP || f.scheme == SCM_NEWS)) - reAnchorNewsheader(b); - #endif -- preFormUpdateBuffer(b); -+ if (b && b != NO_BUFFER) -+ preFormUpdateBuffer(b); - TRAP_OFF; - return b; - } -@@ -3228,7 +3209,7 @@ process_img(struct parsed_tag *tag, int width) - - if (!parsedtag_get_value(tag, ATTR_SRC, &p)) - return tmp; -- p = remove_space(p); -+ p = url_encode(remove_space(p), cur_baseURL, cur_document_charset); - q = NULL; - parsedtag_get_value(tag, ATTR_ALT, &q); - if (!pseudoInlines && (q == NULL || (*q == '\0' && ignore_null_img_alt))) -@@ -3322,12 +3303,7 @@ process_img(struct parsed_tag *tag, int width) - Image image; - ParsedURL u; - --#ifdef USE_M17N -- parseURL2(wc_conv(p, InnerCharset, cur_document_charset)->ptr, &u, -- cur_baseURL); --#else - parseURL2(p, &u, cur_baseURL); --#endif - image.url = parsedURL2Str(&u)->ptr; - if (!uncompressed_file_type(u.file, &image.ext)) - image.ext = filename_extension(u.file, TRUE); -@@ -4084,6 +4060,7 @@ process_form_int(struct parsed_tag *tag, int fid) - parsedtag_get_value(tag, ATTR_METHOD, &p); - q = "!CURRENT_URL!"; - parsedtag_get_value(tag, ATTR_ACTION, &q); -+ q = url_encode(remove_space(q), cur_baseURL, cur_document_charset); - r = NULL; - #ifdef USE_M17N - if (parsedtag_get_value(tag, ATTR_ACCEPT_CHARSET, &r)) -@@ -5067,11 +5044,10 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) - } - return 1; - case HTML_BASE: --#ifdef USE_IMAGE -+#if defined(USE_M17N) || defined(USE_IMAGE) - p = NULL; - if (parsedtag_get_value(tag, ATTR_HREF, &p)) { -- if (!cur_baseURL) -- cur_baseURL = New(ParsedURL); -+ cur_baseURL = New(ParsedURL); - parseURL(p, cur_baseURL, NULL); - } - #endif -@@ -5329,6 +5305,13 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - #ifdef MENU_SELECT - Anchor **a_select = NULL; - #endif -+#if defined(USE_M17N) || defined(USE_IMAGE) -+ ParsedURL *base = baseURL(buf); -+#endif -+#ifdef USE_M17N -+ wc_ces name_charset = url_to_charset(NULL, &buf->currentURL, -+ buf->document_charset); -+#endif - - if (out_size == 0) { - out_size = LINELEN; -@@ -5523,16 +5506,17 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - hseq = 0; - id = NULL; - if (parsedtag_get_value(tag, ATTR_NAME, &id)) { -- id = url_quote_conv(id, buf->document_charset); -+ id = url_quote_conv(id, name_charset); - registerName(buf, id, currentLn(buf), pos); - } - if (parsedtag_get_value(tag, ATTR_HREF, &p)) -- p = url_quote_conv(remove_space(p), -- buf->document_charset); -+ p = url_encode(remove_space(p), base, -+ buf->document_charset); - if (parsedtag_get_value(tag, ATTR_TARGET, &q)) - q = url_quote_conv(q, buf->document_charset); - if (parsedtag_get_value(tag, ATTR_REFERER, &r)) -- r = url_quote_conv(r, buf->document_charset); -+ r = url_encode(r, base, -+ buf->document_charset); - parsedtag_get_value(tag, ATTR_TITLE, &s); - parsedtag_get_value(tag, ATTR_ACCESSKEY, &t); - parsedtag_get_value(tag, ATTR_HSEQ, &hseq); -@@ -5618,7 +5602,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - ParsedURL u; - Image *image; - -- parseURL2(a_img->url, &u, cur_baseURL); -+ parseURL2(a_img->url, &u, base); - a_img->image = image = New(Image); - image->url = parsedURL2Str(&u)->ptr; - if (!uncompressed_file_type(u.file, &image->ext)) -@@ -5639,7 +5623,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - image->map = q; - image->ismap = ismap; - image->touch = 0; -- image->cache = getImage(image, cur_baseURL, -+ image->cache = getImage(image, base, - IMG_FLAG_SKIP); - } - else if (iseq < 0) { -@@ -5761,8 +5745,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - break; - if (parsedtag_get_value(tag, ATTR_HREF, &p)) { - MapArea *a; -- p = url_quote_conv(remove_space(p), -- buf->document_charset); -+ p = url_encode(remove_space(p), base, -+ buf->document_charset); - t = NULL; - parsedtag_get_value(tag, ATTR_TARGET, &t); - q = ""; -@@ -5811,11 +5795,14 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - break; - case HTML_BASE: - if (parsedtag_get_value(tag, ATTR_HREF, &p)) { -- p = url_quote_conv(remove_space(p), -- buf->document_charset); -+ p = url_encode(remove_space(p), NULL, -+ buf->document_charset); - if (!buf->baseURL) - buf->baseURL = New(ParsedURL); - parseURL(p, buf->baseURL, NULL); -+#if defined(USE_M17N) || defined(USE_IMAGE) -+ base = buf->baseURL; -+#endif - } - if (parsedtag_get_value(tag, ATTR_TARGET, &p)) - buf->baseTarget = -@@ -5830,8 +5817,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - int refresh_interval = getMetaRefreshParam(q, &tmp); - #ifdef USE_ALARM - if (tmp) { -- p = url_quote_conv(remove_space(tmp->ptr), -- buf->document_charset); -+ p = url_encode(remove_space(tmp->ptr), base, -+ buf->document_charset); - buf->event = setAlarmEvent(buf->event, - refresh_interval, - AL_IMPLICIT_ONCE, -@@ -5844,8 +5831,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - FUNCNAME_reload, NULL); - #else - if (tmp && refresh_interval == 0) { -- p = url_quote_conv(remove_space(tmp->ptr), -- buf->document_charset); -+ p = url_encode(remove_space(tmp->ptr), base, -+ buf->document_charset); - pushEvent(FUNCNAME_gorURL, p); - } - #endif -@@ -5929,7 +5916,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) - #ifdef ID_EXT - id = NULL; - if (parsedtag_get_value(tag, ATTR_ID, &id)) { -- id = url_quote_conv(id, buf->document_charset); -+ id = url_quote_conv(id, name_charset); - registerName(buf, id, currentLn(buf), pos); - } - if (renderFrameSet && -@@ -5982,7 +5969,8 @@ addLink(Buffer *buf, struct parsed_tag *tag) - - parsedtag_get_value(tag, ATTR_HREF, &href); - if (href) -- href = url_quote_conv(remove_space(href), buf->document_charset); -+ href = url_encode(remove_space(href), baseURL(buf), -+ buf->document_charset); - parsedtag_get_value(tag, ATTR_TITLE, &title); - parsedtag_get_value(tag, ATTR_TYPE, &ctype); - parsedtag_get_value(tag, ATTR_REL, &rel); -@@ -6963,8 +6951,6 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) - image_flag = IMG_FLAG_AUTO; - else - image_flag = IMG_FLAG_SKIP; -- if (newBuf->currentURL.file) -- cur_baseURL = baseURL(newBuf); - #endif - - if (w3m_halfload) { -@@ -6987,6 +6973,9 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) - htmlenv1.f = stdout; - else - htmlenv1.buf = newTextLineList(); -+#if defined(USE_M17N) || defined(USE_IMAGE) -+ cur_baseURL = baseURL(newBuf); -+#endif - - if (SETJMP(AbortLoading) != 0) { - HTMLlineproc1("<br>Transfer Interrupted!<br>", &htmlenv1); -@@ -7048,7 +7037,7 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) - } - #endif - lineBuf2 = convertLine(f, lineBuf2, HTML_MODE, &charset, doc_charset); --#if defined(USE_M17N) && defined(USE_IMAGE) -+#ifdef USE_M17N - cur_document_charset = charset; - #endif - HTMLlineproc0(lineBuf2->ptr, &htmlenv1, internal); -@@ -7060,6 +7049,12 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) - obuf.status = R_ST_NORMAL; - completeHTMLstream(&htmlenv1, &obuf); - flushline(&htmlenv1, &obuf, 0, 2, htmlenv1.limit); -+#if defined(USE_M17N) || defined(USE_IMAGE) -+ cur_baseURL = NULL; -+#endif -+#ifdef USE_M17N -+ cur_document_charset = 0; -+#endif - if (htmlenv1.title) - newBuf->buffername = htmlenv1.title; - if (w3m_halfdump) { -@@ -7207,7 +7202,7 @@ loadGopherDir(URLFile *uf, ParsedURL *pu, wc_ces * charset) - q = Strnew_m_charp("gopher://", host->ptr, ":", port->ptr, - "/", file->ptr, NULL)->ptr; - Strcat_m_charp(tmp, "<a href=\"", -- html_quote(url_quote_conv(q, *charset)), -+ html_quote(url_encode(q, NULL, *charset)), - "\">", p, html_quote(name->ptr + 1), "</a>\n", NULL); - } - -@@ -7331,6 +7326,7 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) - URLFile f; - MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; - struct stat st; -+ const ParsedURL *pu = newBuf ? &newBuf->currentURL : NULL; - - loadImage(newBuf, IMG_FLAG_STOP); - image.url = uf->url; -@@ -7338,8 +7334,8 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) - image.width = -1; - image.height = -1; - image.cache = NULL; -- cache = getImage(&image, cur_baseURL, IMG_FLAG_AUTO); -- if (!cur_baseURL->is_nocache && cache->loaded & IMG_FLAG_LOADED && -+ cache = getImage(&image, (ParsedURL *)pu, IMG_FLAG_AUTO); -+ if (!(pu && pu->is_nocache) && cache->loaded & IMG_FLAG_LOADED && - !stat(cache->file, &st)) - goto image_buffer; - -@@ -7580,8 +7576,11 @@ openGeneralPagerBuffer(InputStream stream) - #ifdef USE_M17N - content_charset = 0; - #endif -+ t_buf = newBuffer(INIT_BUFFER_WIDTH); -+ copyParsedURL(&t_buf->currentURL, NULL); -+ t_buf->currentURL.scheme = SCM_LOCAL; -+ t_buf->currentURL.file = "-"; - if (SearchHeader) { -- t_buf = newBuffer(INIT_BUFFER_WIDTH); - readHeader(&uf, t_buf, TRUE, NULL); - t = checkContentType(t_buf); - if (t == NULL) -@@ -7609,14 +7608,13 @@ openGeneralPagerBuffer(InputStream stream) - #ifdef USE_IMAGE - else if (activeImage && displayImage && !useExtImageViewer && - !(w3m_dump & ~DUMP_FRAME) && !strncasecmp(t, "image/", 6)) { -- cur_baseURL = New(ParsedURL); -- parseURL("-", cur_baseURL, NULL); - buf = loadImageBuffer(&uf, t_buf); - buf->type = "text/html"; - } - #endif - else { -- if (doExternal(uf, "-", t, &buf, t_buf)) { -+ if (searchExtViewer(t)) { -+ buf = doExternal(uf, t, t_buf); - UFclose(&uf); - if (buf == NULL || buf == NO_BUFFER) - return buf; -@@ -7629,8 +7627,6 @@ openGeneralPagerBuffer(InputStream stream) - } - } - buf->real_type = t; -- buf->currentURL.scheme = SCM_LOCAL; -- buf->currentURL.file = "-"; - return buf; - } - -@@ -7823,9 +7819,8 @@ save2tmp(URLFile uf, char *tmpf) - return 0; - } - --int --doExternal(URLFile uf, char *path, char *type, Buffer **bufp, -- Buffer *defaultbuf) -+Buffer * -+doExternal(URLFile uf, char *type, Buffer *defaultbuf) - { - Str tmpf, command; - struct mailcap *mcap; -@@ -7834,7 +7829,7 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, - char *header, *src = NULL, *ext = uf.ext; - - if (!(mcap = searchExtViewer(type))) -- return 0; -+ return NULL; - - if (mcap->nametemplate) { - tmpf = unquote_mailcap(mcap->nametemplate, NULL, "", NULL, NULL); -@@ -7867,15 +7862,13 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, - UFclose(&uf); - myExec(command->ptr); - } -- *bufp = NO_BUFFER; -- return 1; -+ return NO_BUFFER; - } - else - #endif - { - if (save2tmp(uf, tmpf->ptr) < 0) { -- *bufp = NULL; -- return 1; -+ return NULL; - } - } - if (mcap->flags & (MAILCAP_HTMLOUTPUT | MAILCAP_COPIOUSOUTPUT)) { -@@ -7918,14 +7911,13 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, - buf = NO_BUFFER; - } - if (buf && buf != NO_BUFFER) { -- buf->filename = path; -- if (buf->buffername == NULL || buf->buffername[0] == '\0') -- buf->buffername = conv_from_system(lastFileName(path)); -+ if ((buf->buffername == NULL || buf->buffername[0] == '\0') && -+ buf->filename) -+ buf->buffername = conv_from_system(lastFileName(buf->filename)); - buf->edit = mcap->edit; - buf->mailcap = mcap; - } -- *bufp = buf; -- return 1; -+ return buf; - } - - static int -diff --git a/fm.h b/fm.h -index 8378939..0f56c31 100644 ---- a/fm.h -+++ b/fm.h -@@ -264,6 +264,18 @@ extern int REV_LB[]; - #define IMG_FLAG_ERROR 2 - #define IMG_FLAG_DONT_REMOVE 4 - -+#define IS_EMPTY_PARSED_URL(pu) ((pu)->scheme == SCM_UNKNOWN && !(pu)->file) -+#define SCONF_RESERVED 0 -+#define SCONF_SUBSTITUTE_URL 1 -+#define SCONF_URL_CHARSET 2 -+#define SCONF_NO_REFERER_FROM 3 -+#define SCONF_NO_REFERER_TO 4 -+#define SCONF_N_FIELD 5 -+#define query_SCONF_SUBSTITUTE_URL(pu) ((const char *)querySiteconf(pu, SCONF_SUBSTITUTE_URL)) -+#define query_SCONF_URL_CHARSET(pu) ((const wc_ces *)querySiteconf(pu, SCONF_URL_CHARSET)) -+#define query_SCONF_NO_REFERER_FROM(pu) ((const int *)querySiteconf(pu, SCONF_NO_REFERER_FROM)) -+#define query_SCONF_NO_REFERER_TO(pu) ((const int *)querySiteconf(pu, SCONF_NO_REFERER_TO)) -+ - /* - * Macros. - */ -@@ -972,6 +984,7 @@ global int BackgroundExtViewer init(TRUE); - global int disable_secret_security_check init(FALSE); - global char *passwd_file init(PASSWD_FILE); - global char *pre_form_file init(PRE_FORM_FILE); -+global char *siteconf_file init(SITECONF_FILE); - global char *ftppasswd init(NULL); - global int ftppass_hostnamegen init(TRUE); - global int do_download init(FALSE); -diff --git a/form.c b/form.c -index b7556ca..fa17be4 100644 ---- a/form.c -+++ b/form.c -@@ -787,7 +787,7 @@ struct pre_form { - static struct pre_form *PreForm = NULL; - - static struct pre_form * --add_pre_form(struct pre_form *prev, char *url, char *name, char *action) -+add_pre_form(struct pre_form *prev, char *url, Regex *re_url, char *name, char *action) - { - ParsedURL pu; - struct pre_form *new; -@@ -796,21 +796,13 @@ add_pre_form(struct pre_form *prev, char *url, char *name, char *action) - new = prev->next = New(struct pre_form); - else - new = PreForm = New(struct pre_form); -- if (url && *url == '/') { -- int l = strlen(url); -- if (l > 1 && url[l - 1] == '/') -- new->url = allocStr(url + 1, l - 2); -- else -- new->url = url + 1; -- new->re_url = newRegex(new->url, FALSE, NULL, NULL); -- if (!new->re_url) -- new->url = NULL; -- } -- else if (url) { -+ if (url && !re_url) { - parseURL2(url, &pu, NULL); - new->url = parsedURL2Str(&pu)->ptr; -- new->re_url = NULL; - } -+ else -+ new->url = url; -+ new->re_url = re_url; - new->name = (name && *name) ? name : NULL; - new->action = (action && *action) ? action : NULL; - new->item = NULL; -@@ -834,7 +826,7 @@ add_pre_form_item(struct pre_form *pf, struct pre_form_item *prev, int type, - new->name = name; - new->value = value; - if (checked && *checked && (!strcmp(checked, "0") || -- strcasecmp(checked, "off") -+ !strcasecmp(checked, "off") - || !strcasecmp(checked, "no"))) - new->checked = 0; - else -@@ -875,6 +867,7 @@ loadPreForm(void) - return; - while (1) { - char *p, *s, *arg; -+ Regex *re_arg; - - line = Strfgets(fp); - if (line->length == 0) -@@ -890,18 +883,20 @@ loadPreForm(void) - if (*p == '#' || *p == '\0') - continue; /* comment or empty line */ - s = getWord(&p); -- arg = getWord(&p); - - if (!strcmp(s, "url")) { -+ arg = getRegexWord((const char **)&p, &re_arg); - if (!arg || !*arg) - continue; - p = getQWord(&p); -- pf = add_pre_form(pf, arg, NULL, p); -+ pf = add_pre_form(pf, arg, re_arg, NULL, p); - pi = pf->item; - continue; - } - if (!pf) - continue; -+ -+ arg = getWord(&p); - if (!strcmp(s, "form")) { - if (!arg || !*arg) - continue; -@@ -913,7 +908,7 @@ loadPreForm(void) - } - if (pf->item) { - struct pre_form *prev = pf; -- pf = add_pre_form(prev, "", s, p); -+ pf = add_pre_form(prev, "", NULL, s, p); - /* copy previous URL */ - pf->url = prev->url; - pf->re_url = prev->re_url; -diff --git a/frame.c b/frame.c -index b431437..48c2d72 100644 ---- a/frame.c -+++ b/frame.c -@@ -91,7 +91,8 @@ newFrame(struct parsed_tag *tag, Buffer *buf) - body->baseURL = baseURL(buf); - if (tag) { - if (parsedtag_get_value(tag, ATTR_SRC, &p)) -- body->url = url_quote_conv(remove_space(p), buf->document_charset); -+ body->url = url_encode(remove_space(p), body->baseURL, -+ buf->document_charset); - if (parsedtag_get_value(tag, ATTR_NAME, &p) && *p != '_') - body->name = url_quote_conv(p, buf->document_charset); - } -@@ -639,7 +640,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level, - case HTML_BASE: - /* "BASE" is prohibit tag */ - if (parsedtag_get_value(tag, ATTR_HREF, &q)) { -- q = url_quote_conv(remove_space(q), charset); -+ q = url_encode(remove_space(q), NULL, charset); - parseURL(q, &base, NULL); - } - if (parsedtag_get_value(tag, ATTR_TARGET, &q)) { -@@ -768,8 +769,8 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level, - if (!tag->value[j]) - break; - tag->value[j] = -- url_quote_conv(remove_space(tag->value[j]), -- charset); -+ url_encode(remove_space(tag->value[j]), -+ &base, charset); - tag->need_reconstruct = TRUE; - parseURL2(tag->value[j], &url, &base); - if (url.scheme == SCM_UNKNOWN || -diff --git a/func.c b/func.c -index f389e00..8b5deac 100644 ---- a/func.c -+++ b/func.c -@@ -8,6 +8,7 @@ - #include "fm.h" - #include "func.h" - #include "myctype.h" -+#include "regex.h" - - #include "funcname.c" - #include "functable.c" -@@ -434,6 +435,93 @@ getQWord(char **str) - return tmp->ptr; - } - -+/* This extracts /regex/i or m@regex@i from the given string. -+ * Then advances *str to the end of regex. -+ * If the input does not seems to be a regex, this falls back to getQWord(). -+ * -+ * Returns a word (no matter whether regex or not) in the give string. -+ * If regex_ret is non-NULL, compiles the regex and stores there. -+ * -+ * XXX: Actually this is unrelated to func.c. -+ */ -+char * -+getRegexWord(const char **str, Regex **regex_ret) -+{ -+ char *word = NULL; -+ const char *p, *headp, *bodyp, *tailp; -+ char delimiter; -+ int esc; -+ int igncase = 0; -+ -+ p = *str; -+ SKIP_BLANKS(p); -+ headp = p; -+ -+ /* Get the opening delimiter */ -+ if (p[0] == 'm' && IS_PRINT(p[1]) && !IS_ALNUM(p[1]) && p[1] != '\\') { -+ delimiter = p[1]; -+ p += 2; -+ } -+ else if (p[0] == '/') { -+ delimiter = '/'; -+ p += 1; -+ } -+ else { -+ goto not_regex; -+ } -+ bodyp = p; -+ -+ /* Scan the end of the expression */ -+ for (esc = 0; *p; ++p) { -+ if (esc) { -+ esc = 0; -+ } else { -+ if (*p == delimiter) -+ break; -+ else if (*p == '\\') -+ esc = 1; -+ } -+ } -+ if (!*p && *headp == '/') -+ goto not_regex; -+ tailp = p; -+ -+ /* Check the modifiers */ -+ if (*p == delimiter) { -+ while (*++p && !IS_SPACE(*p)) { -+ switch (*p) { -+ case 'i': -+ igncase = 1; -+ break; -+ } -+ /* ignore unknown modifiers */ -+ } -+ } -+ -+ /* Save the expression */ -+ word = allocStr(headp, p - headp); -+ -+ /* Compile */ -+ if (regex_ret) { -+ if (*tailp == delimiter) -+ word[tailp - headp] = 0; -+ *regex_ret = newRegex(word + (bodyp - headp), igncase, NULL, NULL); -+ if (*tailp == delimiter) -+ word[tailp - headp] = delimiter; -+ } -+ goto last; -+ -+not_regex: -+ p = headp; -+ word = getQWord((char **)&p); -+ if (regex_ret) -+ *regex_ret = NULL; -+ -+last: -+ *str = p; -+ return word; -+} -+ - #ifdef USE_MOUSE - static MouseAction default_mouse_action = { - NULL, -diff --git a/history.c b/history.c -index 951ef83..e9be09b 100644 ---- a/history.c -+++ b/history.c -@@ -17,7 +17,7 @@ historyBuffer(Hist *hist) - for (item = hist->list->last; item; item = item->prev) { - q = html_quote((char *)item->ptr); - if (DecodeURL) -- p = html_quote(url_unquote_conv((char *)item->ptr, 0)); -+ p = html_quote(url_decode2((char *)item->ptr, NULL)); - else - p = q; - Strcat_charp(src, "<li><a href=\""); -diff --git a/indep.c b/indep.c -index 65b04aa..89e86c1 100644 ---- a/indep.c -+++ b/indep.c -@@ -357,6 +357,20 @@ strcasemstr(char *str, char *srch[], char **ret_ptr) - return -1; - } - -+int -+strmatchlen(const char *s1, const char *s2, int maxlen) -+{ -+ int i; -+ -+ /* To allow the maxlen to be negatie (infinity), -+ * compare by "!=" instead of "<=". */ -+ for (i = 0; i != maxlen; ++i) { -+ if (!s1[i] || !s2[i] || s1[i] != s2[i]) -+ break; -+ } -+ return i; -+} -+ - char * - remove_space(char *str) - { -diff --git a/indep.h b/indep.h -index b3819a3..cf566fe 100644 ---- a/indep.h -+++ b/indep.h -@@ -52,6 +52,7 @@ extern int strncasecmp(const char *s1, const char *s2, size_t n); - extern char *strcasestr(const char *s1, const char *s2); - #endif - extern int strcasemstr(char *str, char *srch[], char **ret_ptr); -+int strmatchlen(const char *s1, const char *s2, int maxlen); - extern char *remove_space(char *str); - extern int non_null(char *s); - extern void cleanup_line(Str s, int mode); -diff --git a/linein.c b/linein.c -index b7e81b6..572b015 100644 ---- a/linein.c -+++ b/linein.c -@@ -1026,7 +1026,7 @@ _prev(void) - strCurrentBuf = strBuf; - } - if (DecodeURL && (cm_mode & CPL_URL) ) -- p = url_unquote_conv(p, 0); -+ p = url_decode2(p, NULL); - strBuf = Strnew_charp(p); - CLen = CPos = setStrType(strBuf, strProp); - offset = 0; -@@ -1045,7 +1045,7 @@ _next(void) - p = nextHist(hist); - if (p) { - if (DecodeURL && (cm_mode & CPL_URL) ) -- p = url_unquote_conv(p, 0); -+ p = url_decode2(p, NULL); - strBuf = Strnew_charp(p); - } - else { -diff --git a/main.c b/main.c -index b421943..a414391 100644 ---- a/main.c -+++ b/main.c -@@ -894,12 +894,17 @@ main(int argc, char **argv, char **envp) - if (i >= 0) { - SearchHeader = search_header; - DefaultType = default_type; -+ char *url; -+ -+ url = load_argv[i]; -+ if (getURLScheme(&url) == SCM_MISSING && !ArgvIsURL) -+ url = file_to_url(load_argv[i]); -+ else -+ url = url_encode(conv_from_system(load_argv[i]), NULL, 0); - if (w3m_dump == DUMP_HEAD) { - request = New(FormList); - request->method = FORM_METHOD_HEAD; -- newbuf = -- loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, -- request); -+ newbuf = loadGeneralFile(url, NULL, NO_REFERER, 0, request); - } - else { - if (post_file && i == 0) { -@@ -928,9 +933,7 @@ main(int argc, char **argv, char **envp) - else { - request = NULL; - } -- newbuf = -- loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, -- request); -+ newbuf = loadGeneralFile(url, NULL, NO_REFERER, 0, request); - } - if (newbuf == NULL) { - /* FIXME: gettextize? */ -@@ -945,7 +948,7 @@ main(int argc, char **argv, char **envp) - break; - case SCM_LOCAL: - case SCM_LOCAL_CGI: -- unshiftHist(LoadHist, conv_from_system(load_argv[i])); -+ unshiftHist(LoadHist, url); - default: - pushHashHist(URLHist, parsedURL2Str(&newbuf->currentURL)->ptr); - break; -@@ -1269,15 +1272,12 @@ do_dump(Buffer *buf) - printf("\nReferences:\n\n"); - for (i = 0; i < buf->href->nanchor; i++) { - ParsedURL pu; -- static Str s = NULL; -+ char *url; - if (buf->href->anchors[i].slave) - continue; - parseURL2(buf->href->anchors[i].url, &pu, baseURL(buf)); -- s = parsedURL2Str(&pu); -- if (DecodeURL) -- s = Strnew_charp(url_unquote_conv -- (s->ptr, Currentbuf->document_charset)); -- printf("[%d] %s\n", buf->href->anchors[i].hseq + 1, s->ptr); -+ url = url_decode2(parsedURL2Str(&pu)->ptr, Currentbuf); -+ printf("[%d] %s\n", buf->href->anchors[i].hseq + 1, url); - } - } - } -@@ -2261,7 +2261,7 @@ DEFUN(movR1, MOVE_RIGHT1, - static wc_uint32 - getChar(char *p) - { -- return wc_any_to_ucs(wtf_parse1(&p)); -+ return wc_any_to_ucs(wtf_parse1((wc_uchar **)&p)); - } - - static int -@@ -2804,12 +2804,15 @@ loadLink(char *url, char *target, char *referer, FormList *request) - union frameset_element *f_element = NULL; - int flag = 0; - ParsedURL *base, pu; -+ const int *no_referer_ptr; - - message(Sprintf("loading %s", url)->ptr, 0, 0); - refresh(); - -+ no_referer_ptr = query_SCONF_NO_REFERER_FROM(&Currentbuf->currentURL); - base = baseURL(Currentbuf); -- if (base == NULL || -+ if ((no_referer_ptr && *no_referer_ptr) || -+ base == NULL || - base->scheme == SCM_LOCAL || base->scheme == SCM_LOCAL_CGI) - referer = NO_REFERER; - if (referer == NULL) -@@ -4055,6 +4058,7 @@ goURL0(char *prompt, int relative) - char *url, *referer; - ParsedURL p_url, *current; - Buffer *cur_buf = Currentbuf; -+ const int *no_referer_ptr; - - url = searchKeyData(); - if (url == NULL) { -@@ -4064,11 +4068,8 @@ goURL0(char *prompt, int relative) - current = baseURL(Currentbuf); - if (current) { - char *c_url = parsedURL2Str(current)->ptr; -- if (DefaultURLString == DEFAULT_URL_CURRENT) { -- url = c_url; -- if (DecodeURL) -- url = url_unquote_conv(url, 0); -- } -+ if (DefaultURLString == DEFAULT_URL_CURRENT) -+ url = url_decode2(c_url, NULL); - else - pushHist(hist, c_url); - } -@@ -4077,11 +4078,8 @@ goURL0(char *prompt, int relative) - char *a_url; - parseURL2(a->url, &p_url, current); - a_url = parsedURL2Str(&p_url)->ptr; -- if (DefaultURLString == DEFAULT_URL_LINK) { -- url = a_url; -- if (DecodeURL) -- url = url_unquote_conv(url, Currentbuf->document_charset); -- } -+ if (DefaultURLString == DEFAULT_URL_LINK) -+ url = url_decode2(a_url, Currentbuf); - else - pushHist(hist, a_url); - } -@@ -4089,15 +4087,22 @@ goURL0(char *prompt, int relative) - if (url != NULL) - SKIP_BLANKS(url); - } --#ifdef USE_M17N -- if (url != NULL) { -- if ((relative || *url == '#') && Currentbuf->document_charset) -- url = wc_conv_strict(url, InnerCharset, -- Currentbuf->document_charset)->ptr; -+ if (relative) { -+ no_referer_ptr = query_SCONF_NO_REFERER_FROM(&Currentbuf->currentURL); -+ current = baseURL(Currentbuf); -+ if ((no_referer_ptr && *no_referer_ptr) || -+ current == NULL || -+ current->scheme == SCM_LOCAL || current->scheme == SCM_LOCAL_CGI) -+ referer = NO_REFERER; - else -- url = conv_to_system(url); -+ referer = parsedURL2Str(&Currentbuf->currentURL)->ptr; -+ url = url_encode(url, current, Currentbuf->document_charset); -+ } -+ else { -+ current = NULL; -+ referer = NULL; -+ url = url_encode(url, NULL, 0); - } --#endif - if (url == NULL || *url == '\0') { - displayBuffer(Currentbuf, B_FORCE_REDRAW); - return; -@@ -4106,14 +4111,6 @@ goURL0(char *prompt, int relative) - gotoLabel(url + 1); - return; - } -- if (relative) { -- current = baseURL(Currentbuf); -- referer = parsedURL2Str(&Currentbuf->currentURL)->ptr; -- } -- else { -- current = NULL; -- referer = NULL; -- } - parseURL2(url, &p_url, current); - pushHashHist(URLHist, parsedURL2Str(&p_url)->ptr); - cmd_loadURL(url, current, referer, NULL); -@@ -4510,8 +4507,7 @@ _peekURL(int only_img) - s = parsedURL2Str(&pu); - } - if (DecodeURL) -- s = Strnew_charp(url_unquote_conv -- (s->ptr, Currentbuf->document_charset)); -+ s = Strnew_charp(url_decode2(s->ptr, Currentbuf)); - #ifdef USE_M17N - s = checkType(s, &pp, NULL); - p = NewAtom_N(Lineprop, s->length); -@@ -4570,7 +4566,7 @@ DEFUN(curURL, PEEK, "Peek current URL") - offset = 0; - s = currentURL(); - if (DecodeURL) -- s = Strnew_charp(url_unquote_conv(s->ptr, 0)); -+ s = Strnew_charp(url_decode2(s->ptr, NULL)); - #ifdef USE_M17N - s = checkType(s, &pp, NULL); - p = NewAtom_N(Lineprop, s->length); -diff --git a/map.c b/map.c -index 90aa35a..12701e7 100644 ---- a/map.c -+++ b/map.c -@@ -279,7 +279,7 @@ follow_map_panel(Buffer *buf, char *name) - p = parsedURL2Str(&pu)->ptr; - q = html_quote(p); - if (DecodeURL) -- p = html_quote(url_unquote_conv(p, buf->document_charset)); -+ p = html_quote(url_decode2(p, buf)); - else - p = q; - Strcat_m_charp(mappage, "<tr valign=top><td><a href=\"", q, "\">", -@@ -417,10 +417,7 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi) - continue; - parseURL2(a->url, &pu, baseURL(buf)); - q = html_quote(parsedURL2Str(&pu)->ptr); -- if (DecodeURL) -- p = html_quote(url_unquote_conv(a->url, buf->document_charset)); -- else -- p = html_quote(a->url); -+ p = html_quote(url_decode2(a->url, buf)); - Strcat_m_charp(tmp, "<tr valign=top><td> <td><a href=\"", - q, "\">", - html_quote(*a->alt ? a->alt : mybasename(a->url)), -@@ -457,10 +454,8 @@ append_link_info(Buffer *buf, Str html, LinkList * link) - Strcat_charp(html, "[Rev]"); - if (!l->url) - url = "(empty)"; -- else if (DecodeURL) -- url = html_quote(url_unquote_conv(l->url, buf->document_charset)); - else -- url = html_quote(l->url); -+ url = html_quote(url_decode2(l->url, buf)); - Strcat_m_charp(html, "<td>", url, NULL); - if (l->ctype) - Strcat_m_charp(html, " (", html_quote(l->ctype), ")", NULL); -@@ -498,8 +493,7 @@ append_frame_info(Buffer *buf, Str html, struct frameset *set, int level) - Strcat_charp(html, p); - } - if (DecodeURL) -- p = html_quote(url_unquote_conv(frame.body->url, -- buf->document_charset)); -+ p = html_quote(url_decode2(frame.body->url, buf)); - else - p = q; - Strcat_m_charp(html, " ", p, "</a></pre_int><br>\n", NULL); -@@ -550,9 +544,7 @@ page_info_panel(Buffer *buf) - #ifdef USE_M17N - Strcat_charp(tmp, "<form method=internal action=charset>"); - #endif -- p = parsedURL2Str(&buf->currentURL)->ptr; -- if (DecodeURL) -- p = url_unquote_conv(p, 0); -+ p = url_decode2(parsedURL2Str(&buf->currentURL)->ptr, NULL); - Strcat_m_charp(tmp, "<table cellpadding=0>", - "<tr valign=top><td nowrap>Title<td>", - html_quote(buf->buffername), -@@ -589,7 +581,7 @@ page_info_panel(Buffer *buf) - p = parsedURL2Str(&pu)->ptr; - q = html_quote(p); - if (DecodeURL) -- p = html_quote(url_unquote_conv(p, buf->document_charset)); -+ p = html_quote(url_decode2(p, buf)); - else - p = q; - Strcat_m_charp(tmp, -@@ -602,7 +594,7 @@ page_info_panel(Buffer *buf) - p = parsedURL2Str(&pu)->ptr; - q = html_quote(p); - if (DecodeURL) -- p = html_quote(url_unquote_conv(p, buf->document_charset)); -+ p = html_quote(url_decode2(p, buf)); - else - p = q; - Strcat_m_charp(tmp, -@@ -613,10 +605,7 @@ page_info_panel(Buffer *buf) - if (a != NULL) { - FormItemList *fi = (FormItemList *)a->url; - p = form2str(fi); -- if (DecodeURL) -- p = html_quote(url_unquote_conv(p, buf->document_charset)); -- else -- p = html_quote(p); -+ p = html_quote(url_decode2(p, buf)); - Strcat_m_charp(tmp, - "<tr valign=top><td nowrap>Method/type of current form <td>", - p, NULL); -diff --git a/menu.c b/menu.c -index 774b1bd..0f66583 100644 ---- a/menu.c -+++ b/menu.c -@@ -1365,9 +1365,7 @@ initSelectMenu(void) - break; - default: - Strcat_char(str, ' '); -- p = parsedURL2Str(&buf->currentURL)->ptr; -- if (DecodeURL) -- p = url_unquote_conv(p, 0); -+ p = url_decode2(parsedURL2Str(&buf->currentURL)->ptr, NULL); - Strcat_charp(str, p); - break; - } -@@ -1513,9 +1511,7 @@ initSelTabMenu(void) - case SCM_MISSING: - break; - default: -- p = parsedURL2Str(&buf->currentURL)->ptr; -- if (DecodeURL) -- p = url_unquote_conv(p, 0); -+ p = url_decode2(parsedURL2Str(&buf->currentURL)->ptr, NULL); - Strcat_charp(str, p); - break; - } -@@ -1845,10 +1841,8 @@ link_menu(Buffer *buf) - Strcat_charp(str, " "); - if (!l->url) - p = ""; -- else if (DecodeURL) -- p = url_unquote_conv(l->url, buf->document_charset); - else -- p = l->url; -+ p = url_decode2(l->url, buf); - Strcat_charp(str, p); - label[i] = str->ptr; - if (len < str->length) -diff --git a/po/ja.po b/po/ja.po -index d67c695..947191c 100644 ---- a/po/ja.po -+++ b/po/ja.po -@@ -407,6 +407,10 @@ msgid "File for setting form on loading" - msgstr "文書読込時のフォーム設定用ファイル" - - #: rc.c:149 -+msgid "File for preferences for each site" -+msgstr "サイト別設定のファイル" -+ -+#: rc.c:149 - msgid "Password for anonymous FTP (your mail address)" - msgstr "FTPのパスワード(普通は自分のmail addressを使う)" - -diff --git a/proto.h b/proto.h -index f8a7345..7b1a7a6 100644 ---- a/proto.h -+++ b/proto.h -@@ -162,6 +162,24 @@ extern Str searchURIMethods(ParsedURL *pu); - extern void chkExternalURIBuffer(Buffer *buf); - #endif - extern ParsedURL *schemeToProxy(int scheme); -+#ifdef USE_M17N -+extern wc_ces url_to_charset(const char *url, const ParsedURL *base, -+ wc_ces doc_charset); -+extern char *url_encode(const char *url, const ParsedURL *base, -+ wc_ces doc_charset); -+#if 0 -+extern char *url_decode(const char *url, const ParsedURL *base, -+ wc_ces doc_charset); -+#endif -+extern char *url_decode2(const char *url, const Buffer *buf); -+#else /* !defined(USE_M17N) */ -+#define url_encode(url, base, cs) url_quote(url) -+extern char *url_decode0(const char *url); -+#if 0 -+#define url_decode(url, base, cs) url_decode0(url) -+#endif -+#define url_decode2(url, buf) url_decode0(url) -+#endif /* !defined(USE_M17N) */ - extern void examineFile(char *path, URLFile *uf); - extern char *acceptableEncoding(); - extern int dir_exist(char *path); -@@ -180,7 +198,6 @@ extern void push_symbol(Str str, char symbol, int width, int n); - #ifdef USE_UNICODE - extern void update_utf8_symbol(void); - #endif --extern Buffer *loadFile(char *path); - extern Buffer *loadGeneralFile(char *path, ParsedURL *current, char *referer, - int flag, FormList *request); - extern int is_boundary(unsigned char *, unsigned char *); -@@ -249,8 +266,7 @@ extern Buffer *openPagerBuffer(InputStream stream, Buffer *buf); - extern Buffer *openGeneralPagerBuffer(InputStream stream); - extern Line *getNextPage(Buffer *buf, int plen); - extern int save2tmp(URLFile uf, char *tmpf); --extern int doExternal(URLFile uf, char *path, char *type, Buffer **bufp, -- Buffer *defaultbuf); -+extern Buffer *doExternal(URLFile uf, char *type, Buffer *defaultbuf); - extern int _doFileCopy(char *tmpf, char *defstr, int download); - #define doFileCopy(tmpf, defstr) _doFileCopy(tmpf, defstr, FALSE); - extern int doFileMove(char *tmpf, char *defstr); -@@ -507,7 +523,7 @@ extern ParsedURL *baseURL(Buffer *buf); - extern int openSocket(char *hostname, char *remoteport_name, - unsigned short remoteport_num); - extern void parseURL(char *url, ParsedURL *p_url, ParsedURL *current); --extern void copyParsedURL(ParsedURL *p, ParsedURL *q); -+extern void copyParsedURL(ParsedURL *p, const ParsedURL *q); - extern void parseURL2(char *url, ParsedURL *pu, ParsedURL *current); - extern Str parsedURL2Str(ParsedURL *pu); - extern int getURLScheme(char **url); -@@ -611,6 +627,7 @@ extern char *confFile(char *base); - extern char *auxbinFile(char *base); - extern char *libFile(char *base); - extern char *helpFile(char *base); -+extern const void *querySiteconf(const ParsedURL *query_pu, int field); - extern Str localCookie(void); - extern Str loadLocalDir(char *dirname); - extern void set_environ(char *var, char *value); -@@ -723,6 +740,8 @@ extern int getKey(char *s); - extern char *getKeyData(int key); - extern char *getWord(char **str); - extern char *getQWord(char **str); -+struct regex; -+extern char *getRegexWord(const char **str, struct regex **regex_ret); - #ifdef USE_MOUSE - extern void initMouseAction(void); - #endif -diff --git a/rc.c b/rc.c -index 8441a39..3bf6cea 100644 ---- a/rc.c -+++ b/rc.c -@@ -9,7 +9,9 @@ - #include <errno.h> - #include "parsetag.h" - #include "local.h" -+#include "regex.h" - #include <stdlib.h> -+#include <stddef.h> - - struct param_ptr { - char *name; -@@ -146,6 +148,7 @@ static int OptionEncode = FALSE; - #define CMT_DISABLE_SECRET_SECURITY_CHECK N_("Disable secret file security check") - #define CMT_PASSWDFILE N_("Password file") - #define CMT_PRE_FORM_FILE N_("File for setting form on loading") -+#define CMT_SITECONF_FILE N_("File for preferences for each site") - #define CMT_FTPPASS N_("Password for anonymous FTP (your mail address)") - #define CMT_FTPPASS_HOSTNAMEGEN N_("Generate domain part of password for FTP") - #define CMT_USERAGENT N_("User-Agent identification string") -@@ -619,6 +622,8 @@ struct param_ptr params9[] = { - CMT_FTPPASS_HOSTNAMEGEN, NULL}, - {"pre_form_file", P_STRING, PI_TEXT, (void *)&pre_form_file, - CMT_PRE_FORM_FILE, NULL}, -+ {"siteconf_file", P_STRING, PI_TEXT, (void *)&siteconf_file, -+ CMT_SITECONF_FILE, NULL}, - {"user_agent", P_STRING, PI_TEXT, (void *)&UserAgent, CMT_USERAGENT, NULL}, - {"no_referer", P_INT, PI_ONOFF, (void *)&NoSendReferer, CMT_NOSENDREFERER, - NULL}, -@@ -1173,6 +1178,8 @@ do_mkdir(const char *dir, long mode) - #endif /* not __MINW32_VERSION */ - #endif /* not __EMX__ */ - -+static void loadSiteconf(void); -+ - void - sync_with_option(void) - { -@@ -1199,6 +1206,7 @@ sync_with_option(void) - #endif - loadPasswd(); - loadPreForm(); -+ loadSiteconf(); - - if (AcceptLang == NULL || *AcceptLang == '\0') { - /* TRANSLATORS: -@@ -1556,3 +1564,217 @@ helpFile(char *base) - return expandPath(Strnew_m_charp(w3m_help_dir(), "/", base, NULL)->ptr); - } - #endif -+ -+/* siteconf */ -+/* -+ * url "<url>"|/<re-url>/|m@<re-url>@i [exact] -+ * substitute_url "<destination-url>" -+ * url_charset <charset> -+ * no_referer_from on|off -+ * no_referer_to on|off -+ * -+ * The last match wins. -+ */ -+ -+struct siteconf_rec { -+ struct siteconf_rec *next; -+ char *url; -+ Regex *re_url; -+ int url_exact; -+ unsigned char mask[(SCONF_N_FIELD + 7) >> 3]; -+ -+ char *substitute_url; -+#ifdef USE_M17N -+ wc_ces url_charset; -+#endif -+ int no_referer_from; -+ int no_referer_to; -+}; -+#define SCONF_TEST(ent, f) ((ent)->mask[(f)>>3] & (1U<<((f)&7))) -+#define SCONF_SET(ent, f) ((ent)->mask[(f)>>3] |= (1U<<((f)&7))) -+#define SCONF_CLEAR(ent, f) ((ent)->mask[(f)>>3] &= ~(1U<<((f)&7))) -+ -+static struct siteconf_rec *siteconf_head = NULL; -+static struct siteconf_rec *newSiteconfRec(void); -+ -+static struct siteconf_rec * -+newSiteconfRec(void) -+{ -+ struct siteconf_rec *ent; -+ -+ ent = New(struct siteconf_rec); -+ ent->next = NULL; -+ ent->url = NULL; -+ ent->re_url = NULL; -+ ent->url_exact = FALSE; -+ memset(ent->mask, 0, sizeof(ent->mask)); -+ -+ ent->substitute_url = NULL; -+#ifdef USE_M17N -+ ent->url_charset = 0; -+#endif -+ return ent; -+} -+ -+static void -+loadSiteconf(void) -+{ -+ char *efname; -+ FILE *fp; -+ Str line; -+ struct siteconf_rec *ent = NULL; -+ -+ siteconf_head = NULL; -+ if (!siteconf_file) -+ return; -+ if ((efname = expandPath(siteconf_file)) == NULL) -+ return; -+ fp = fopen(efname, "r"); -+ if (fp == NULL) -+ return; -+ while (line = Strfgets(fp), line->length > 0) { -+ char *p, *s; -+ -+ Strchop(line); -+ p = line->ptr; -+ SKIP_BLANKS(p); -+ if (*p == '#' || *p == '\0') -+ continue; -+ s = getWord(&p); -+ -+ /* The "url" begins a new record. */ -+ if (strcmp(s, "url") == 0) { -+ char *url, *opt; -+ struct siteconf_rec *newent; -+ -+ /* First, register the current record. */ -+ if (ent) { -+ ent->next = siteconf_head; -+ siteconf_head = ent; -+ ent = NULL; -+ } -+ -+ /* Second, create a new record. */ -+ newent = newSiteconfRec(); -+ url = getRegexWord((const char **)&p, &newent->re_url); -+ opt = getWord(&p); -+ SKIP_BLANKS(p); -+ if (!newent->re_url) { -+ ParsedURL pu; -+ if (!url || !*url) -+ continue; -+ parseURL2(url, &pu, NULL); -+ newent->url = parsedURL2Str(&pu)->ptr; -+ } -+ /* If we have an extra or unknown option, ignore this record -+ * for future extensions. */ -+ if (strcmp(opt, "exact") == 0) { -+ newent->url_exact = TRUE; -+ } -+ else if (*opt != 0) -+ continue; -+ if (*p) -+ continue; -+ ent = newent; -+ continue; -+ } -+ -+ /* If the current record is broken, skip to the next "url". */ -+ if (!ent) -+ continue; -+ -+ /* Fill the new record. */ -+ if (strcmp(s, "substitute_url") == 0) { -+ ent->substitute_url = getQWord(&p); -+ SCONF_SET(ent, SCONF_SUBSTITUTE_URL); -+ } -+#ifdef USE_M17N -+ else if (strcmp(s, "url_charset") == 0) { -+ char *charset = getWord(&p); -+ ent->url_charset = (charset && *charset) ? -+ wc_charset_to_ces(charset) : 0; -+ SCONF_SET(ent, SCONF_URL_CHARSET); -+ } -+#endif /* USE_M17N */ -+ else if (strcmp(s, "no_referer_from") == 0) { -+ ent->no_referer_from = str_to_bool(getWord(&p), 0); -+ SCONF_SET(ent, SCONF_NO_REFERER_FROM); -+ } -+ else if (strcmp(s, "no_referer_to") == 0) { -+ ent->no_referer_to = str_to_bool(getWord(&p), 0); -+ SCONF_SET(ent, SCONF_NO_REFERER_TO); -+ } -+ } -+ if (ent) { -+ ent->next = siteconf_head; -+ siteconf_head = ent; -+ ent = NULL; -+ } -+ fclose(fp); -+} -+ -+const void * -+querySiteconf(const ParsedURL *query_pu, int field) -+{ -+ const struct siteconf_rec *ent; -+ Str u; -+ char *firstp, *lastp; -+ -+ if (field < 0 || field >= SCONF_N_FIELD) -+ return NULL; -+ if (!query_pu || IS_EMPTY_PARSED_URL(query_pu)) -+ return NULL; -+ u = parsedURL2Str((ParsedURL *)query_pu); -+ if (u->length == 0) -+ return NULL; -+ -+ for (ent = siteconf_head; ent; ent = ent->next) { -+ if (!SCONF_TEST(ent, field)) -+ continue; -+ if (ent->re_url) { -+ if (RegexMatch(ent->re_url, u->ptr, u->length, 1)) { -+ MatchedPosition(ent->re_url, &firstp, &lastp); -+ if (!ent->url_exact) -+ goto url_found; -+ if (firstp != u->ptr || lastp == firstp) -+ continue; -+ if (*lastp == 0 || *lastp == '?' || *(lastp - 1) == '?' || -+ *lastp == '#' || *(lastp - 1) == '#') -+ goto url_found; -+ } -+ } else { -+ int matchlen = strmatchlen(ent->url, u->ptr, u->length); -+ if (matchlen == 0 || ent->url[matchlen] != 0) -+ continue; -+ firstp = u->ptr; -+ lastp = u->ptr + matchlen; -+ if (*lastp == 0 || *lastp == '?' || *(lastp - 1) == '?' || -+ *lastp == '#' || *(lastp - 1) == '#') -+ goto url_found; -+ if (!ent->url_exact && (*lastp == '/' || *(lastp - 1) == '/')) -+ goto url_found; -+ } -+ } -+ return NULL; -+ -+url_found: -+ switch (field) { -+ case SCONF_SUBSTITUTE_URL: -+ if (ent->substitute_url && *ent->substitute_url) { -+ Str tmp = Strnew_charp_n(u->ptr, firstp - u->ptr); -+ Strcat_charp(tmp, ent->substitute_url); -+ Strcat_charp(tmp, lastp); -+ return tmp->ptr; -+ } -+ return NULL; -+#ifdef USE_M17N -+ case SCONF_URL_CHARSET: -+ return &ent->url_charset; -+#endif -+ case SCONF_NO_REFERER_FROM: -+ return &ent->no_referer_from; -+ case SCONF_NO_REFERER_TO: -+ return &ent->no_referer_to; -+ } -+ return NULL; -+} -diff --git a/url.c b/url.c -index ed6062e..cbb4aab 100644 ---- a/url.c -+++ b/url.c -@@ -444,6 +444,8 @@ baseURL(Buffer *buf) - /* <BASE> tag is defined in the document */ - return buf->baseURL; - } -+ else if (IS_EMPTY_PARSED_URL(&buf->currentURL)) -+ return NULL; - else - return &buf->currentURL; - } -@@ -638,16 +640,21 @@ openSocket(char *const hostname, - #define COPYPATH_SPC_ALLOW 0 - #define COPYPATH_SPC_IGNORE 1 - #define COPYPATH_SPC_REPLACE 2 -+#define COPYPATH_SPC_MASK 3 -+#define COPYPATH_LOWERCASE 4 - - static char * - copyPath(char *orgpath, int length, int option) - { - Str tmp = Strnew(); -- while (*orgpath && length != 0) { -- if (IS_SPACE(*orgpath)) { -- switch (option) { -+ char ch; -+ while ((ch = *orgpath) != 0 && length != 0) { -+ if (option & COPYPATH_LOWERCASE) -+ ch = TOLOWER(ch); -+ if (IS_SPACE(ch)) { -+ switch (option & COPYPATH_SPC_MASK) { - case COPYPATH_SPC_ALLOW: -- Strcat_char(tmp, *orgpath); -+ Strcat_char(tmp, ch); - break; - case COPYPATH_SPC_IGNORE: - /* do nothing */ -@@ -658,7 +665,7 @@ copyPath(char *orgpath, int length, int option) - } - } - else -- Strcat_char(tmp, *orgpath); -+ Strcat_char(tmp, ch); - orgpath++; - length--; - } -@@ -668,22 +675,14 @@ copyPath(char *orgpath, int length, int option) - void - parseURL(char *url, ParsedURL *p_url, ParsedURL *current) - { -- char *p, *q; -+ char *p, *q, *qq; - Str tmp; - - url = url_quote(url); /* quote 0x01-0x20, 0x7F-0xFF */ - - p = url; -+ copyParsedURL(p_url, NULL); - p_url->scheme = SCM_MISSING; -- p_url->port = 0; -- p_url->user = NULL; -- p_url->pass = NULL; -- p_url->host = NULL; -- p_url->is_nocache = 0; -- p_url->file = NULL; -- p_url->real_file = NULL; -- p_url->query = NULL; -- p_url->label = NULL; - - /* RFC1808: Relative Uniform Resource Locators - * 4. Resolving Relative URLs -@@ -694,7 +693,7 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current) - goto do_label; - } - #if defined( __EMX__ ) || defined( __CYGWIN__ ) -- if (!strncmp(url, "file://localhost/", 17)) { -+ if (!strncasecmp(url, "file://localhost/", 17)) { - p_url->scheme = SCM_LOCAL; - p += 17 - 1; - url += 17 - 1; -@@ -802,19 +801,20 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current) - /* scheme://user:pass@host or - * scheme://host:port - */ -- p_url->host = copyPath(q, p - q, COPYPATH_SPC_IGNORE); -+ qq = q; - q = ++p; - while (*p && strchr("@/?#", *p) == NULL) - p++; - if (*p == '@') { - /* scheme://user:pass@... */ -+ p_url->user = copyPath(qq, q - 1 - qq, COPYPATH_SPC_IGNORE); - p_url->pass = copyPath(q, p - q, COPYPATH_SPC_ALLOW); - q = ++p; -- p_url->user = p_url->host; -- p_url->host = NULL; - goto analyze_url; - } - /* scheme://host:port/ */ -+ p_url->host = copyPath(qq, q - 1 - qq, -+ COPYPATH_SPC_IGNORE | COPYPATH_LOWERCASE); - tmp = Strnew_charp_n(q, p - q); - p_url->port = atoi(tmp->ptr); - /* *p is one of ['\0', '/', '?', '#'] */ -@@ -829,7 +829,8 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current) - case '/': - case '?': - case '#': -- p_url->host = copyPath(q, p - q, COPYPATH_SPC_IGNORE); -+ p_url->host = copyPath(q, p - q, -+ COPYPATH_SPC_IGNORE | COPYPATH_LOWERCASE); - p_url->port = DefaultPort[p_url->scheme]; - break; - } -@@ -956,12 +957,16 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current) - p_url->label = NULL; - } - --#define initParsedURL(p) bzero(p,sizeof(ParsedURL)) - #define ALLOC_STR(s) ((s)==NULL?NULL:allocStr(s,-1)) - - void --copyParsedURL(ParsedURL *p, ParsedURL *q) -+copyParsedURL(ParsedURL *p, const ParsedURL *q) - { -+ if (q == NULL) { -+ memset(p, 0, sizeof(ParsedURL)); -+ p->scheme = SCM_UNKNOWN; -+ return; -+ } - p->scheme = q->scheme; - p->port = q->port; - p->is_nocache = q->is_nocache; -@@ -1283,6 +1288,8 @@ static char * - otherinfo(ParsedURL *target, ParsedURL *current, char *referer) - { - Str s = Strnew(); -+ const int *no_referer_ptr; -+ int no_referer; - - Strcat_charp(s, "User-Agent: "); - if (UserAgent == NULL || *UserAgent == '\0') -@@ -1306,7 +1313,12 @@ otherinfo(ParsedURL *target, ParsedURL *current, char *referer) - Strcat_charp(s, "Pragma: no-cache\r\n"); - Strcat_charp(s, "Cache-control: no-cache\r\n"); - } -- if (!NoSendReferer) { -+ no_referer = NoSendReferer; -+ no_referer_ptr = query_SCONF_NO_REFERER_FROM(current); -+ no_referer = NoSendReferer || (no_referer_ptr && *no_referer_ptr); -+ no_referer_ptr = query_SCONF_NO_REFERER_TO(target); -+ no_referer = no_referer || (no_referer_ptr && *no_referer_ptr); -+ if (!no_referer) { - #ifdef USE_SSL - if (current && current->scheme == SCM_HTTPS && target->scheme != SCM_HTTPS) { - /* Don't send Referer: if https:// -> http:// */ -@@ -1314,6 +1326,7 @@ otherinfo(ParsedURL *target, ParsedURL *current, char *referer) - else - #endif - if (referer == NULL && current && current->scheme != SCM_LOCAL && -+ current->scheme != SCM_LOCAL_CGI && - (current->scheme != SCM_FTP || - (current->user == NULL && current->pass == NULL))) { - char *p = current->label; -@@ -2234,3 +2247,66 @@ schemeToProxy(int scheme) - } - return pu; - } -+ -+#ifdef USE_M17N -+wc_ces -+url_to_charset(const char *url, const ParsedURL *base, wc_ces doc_charset) -+{ -+ const ParsedURL *pu; -+ ParsedURL pu_buf; -+ const wc_ces *csptr; -+ -+ if (url && *url && *url != '#') { -+ parseURL2((char *)url, &pu_buf, (ParsedURL *)base); -+ pu = &pu_buf; -+ } else { -+ pu = base; -+ } -+ if (pu && (pu->scheme == SCM_LOCAL || pu->scheme == SCM_LOCAL_CGI)) -+ return SystemCharset; -+ csptr = query_SCONF_URL_CHARSET(pu); -+ return (csptr && *csptr) ? *csptr : -+ doc_charset ? doc_charset : DocumentCharset; -+} -+ -+char * -+url_encode(const char *url, const ParsedURL *base, wc_ces doc_charset) -+{ -+ return url_quote_conv((char *)url, -+ url_to_charset(url, base, doc_charset)); -+} -+ -+#if 0 /* unused */ -+char * -+url_decode(const char *url, const ParsedURL *base, wc_ces doc_charset) -+{ -+ if (!DecodeURL) -+ return (char *)url; -+ return url_unquote_conv((char *)url, -+ url_to_charset(url, base, doc_charset)); -+} -+#endif -+ -+char * -+url_decode2(const char *url, const Buffer *buf) -+{ -+ wc_ces url_charset; -+ -+ if (!DecodeURL) -+ return (char *)url; -+ url_charset = buf ? -+ url_to_charset(url, baseURL((Buffer *)buf), buf->document_charset) : -+ url_to_charset(url, NULL, 0); -+ return url_unquote_conv((char *)url, url_charset); -+} -+ -+#else /* !defined(USE_M17N) */ -+ -+char * -+url_decode0(const char *url) -+{ -+ if (!DecodeURL) -+ return (char *)url; -+ return url_unquote_conv((char *)url, 0); -+} -+#endif /* !defined(USE_M17N) */ diff --git a/debian/patches/140_sort-dump-links.patch b/debian/patches/140_sort-dump-links.patch deleted file mode 100644 index f290613..0000000 --- a/debian/patches/140_sort-dump-links.patch +++ /dev/null @@ -1,47 +0,0 @@ -Subject: Sort anchors by sequence number in -dump -Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657666 -From: "Conrad J.C. Hughes (for Debian package stuff)" <debbugs@xrad.org> - -Resolved merge conflicts by Tatsuya Kinoshita. - ---- a/main.c -+++ b/main.c -@@ -1269,6 +1269,12 @@ dump_extra(Buffer *buf) - #endif - } - -+static int -+cmp_anchor_hseq(const void *a, const void *b) -+{ -+ return (*((const Anchor **) a))->hseq - (*((const Anchor **) b))->hseq; -+} -+ - static void - do_dump(Buffer *buf) - { -@@ -1289,15 +1295,20 @@ do_dump(Buffer *buf) - int i; - saveBuffer(buf, stdout, FALSE); - if (displayLinkNumber && buf->href) { -+ int nanchor = buf->href->nanchor; - printf("\nReferences:\n\n"); -- for (i = 0; i < buf->href->nanchor; i++) { -- ParsedURL pu; -+ Anchor **in_order = New_N(Anchor *, buf->href->nanchor); -+ for (i = 0; i < nanchor; i++) -+ in_order[i] = buf->href->anchors + i; -+ qsort(in_order, nanchor, sizeof(Anchor *), cmp_anchor_hseq); -+ for (i = 0; i < nanchor; i++) { -+ ParsedURL pu; - char *url; -- if (buf->href->anchors[i].slave) -+ if (in_order[i]->slave) - continue; -- parseURL2(buf->href->anchors[i].url, &pu, baseURL(buf)); -+ parseURL2(in_order[i]->url, &pu, baseURL(buf)); - url = url_decode2(parsedURL2Str(&pu)->ptr, Currentbuf); -- printf("[%d] %s\n", buf->href->anchors[i].hseq + 1, url); -+ printf("[%d] %s\n", in_order[i]->hseq + 1, url); - } - } - } diff --git a/debian/patches/150_contact-list.patch b/debian/patches/150_contact-list.patch deleted file mode 100644 index 09c09c5..0000000 --- a/debian/patches/150_contact-list.patch +++ /dev/null @@ -1,32 +0,0 @@ -Subject: Update contact list in README -From: Tatsuya Kinoshita <tats@debian.org> -Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696209 - -diff --git a/doc-jp/README b/doc-jp/README -index 074766f..e5e59b1 100644 ---- a/doc-jp/README -+++ b/doc-jp/README -@@ -122,7 +122,6 @@ w3m - ± - satodai@w3m.jp - --ոۤMLޤǤ -- w3m-dev@sic.med.tohoku.ac.jp (ܸ) -- w3m-dev-en@sic.med.tohoku.ac.jp (Ѹ) -+ոۤ - http://w3m.sourceforge.net/ -+ https://sourceforge.net/projects/w3m/ -diff --git a/doc/README b/doc/README -index 324ea3e..60d6d19 100644 ---- a/doc/README -+++ b/doc/README -@@ -115,7 +115,6 @@ Current Maintainer - Tohoku University Hospital - satodai@w3m.jp - --Feel free to send your opinion to the w3m mailing-lists. -- w3m-dev@sic.med.tohoku.ac.jp (Japanese) -- w3m-dev-en@sic.med.tohoku.ac.jp (English) -+Feel free to send your opinion to: - http://w3m.sourceforge.net/ -+ https://sourceforge.net/projects/w3m/ diff --git a/debian/patches/160_ignore-shy.patch b/debian/patches/160_ignore-shy.patch deleted file mode 100644 index 2955881..0000000 --- a/debian/patches/160_ignore-shy.patch +++ /dev/null @@ -1,17 +0,0 @@ -Subject: Ignore ­ to prevent drawing hyphens everywhere -Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=441934 -From: Hilko Bengen <bengen@debian.org> - -diff --git a/entity.c b/entity.c -index fdd8f64..a7c9e99 100644 ---- a/entity.c -+++ b/entity.c -@@ -44,6 +44,8 @@ conv_entity(unsigned int c) - return " "; - if (c == 0xa0) - return NBSP; -+ if (c == 0xad) /* SOFT HYPHEN */ -+ return ""; - if (c < 0x100) { /* Latin1 (ISO 8859-1) */ - if (UseAltEntity) - return alt_latin1[c - 0xa0]; diff --git a/debian/patches/170_w3mman2html-utf8.patch b/debian/patches/170_w3mman2html-utf8.patch deleted file mode 100644 index 94c5f09..0000000 --- a/debian/patches/170_w3mman2html-utf8.patch +++ /dev/null @@ -1,53 +0,0 @@ -Subject: More UTF-8 support and fixes for w3mman2html.cgi -Author: Piotr P. Karwasz, Justin B Rye <justin.byam.rye@gmail.com> -Origin: https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/680202 -Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771004 - -diff --git a/scripts/w3mman/w3mman2html.cgi.in b/scripts/w3mman/w3mman2html.cgi.in -index f430307..2cd00f9 100644 ---- a/scripts/w3mman/w3mman2html.cgi.in -+++ b/scripts/w3mman/w3mman2html.cgi.in -@@ -34,7 +34,6 @@ Content-Type: text/html - EOF - $keyword =~ s:([^-\w\200-\377.,])::g; - open(F, "$MAN -k $keyword 2> /dev/null |"); -- @line = (); - while(<F>) { - chop; - $_ = &html_quote($_); -@@ -126,12 +125,14 @@ while(<F>) { - s/\&/\&/g; - s/\</\</g; - s/\>/\>/g; -+ # non ASCII UTF-8 codepoint -+ my $utf8="[\300-\337][\200-\277]|[\340-\357][\200-\277]{2}|[\360-\367][\200-\277]{3}|[\370-\373][\200-\277]{4}|[\374\375][\200-\277]{5}"; - -- s@([\200-\377].)(\010{1,2}\1)+@<b>$1</b>@g; -+ s@($utf8)(\010\1)+@<b>$1</b>@g; - s@(\&\w+;|.)(\010\1)+@<b>$1</b>@g; -- s@__\010{1,2}((\<b\>)?[\200-\377].(\</b\>)?)@<u>$1</u>@g; -+ s@_\010((\<b\>)?($utf8)(\</b\>)?)@<u>$1</u>@g; - s@_\010((\<b\>)?(\&\w+\;|.)(\</b\>)?)@<u>$1</u>@g; -- s@((\<b\>)?[\200-\377].(\</b\>)?)\010{1,2}__@<u>$1</u>@g; -+ s@((\<b\>)?($utf8)(\</b\>)?)\010_@<u>$1</u>@g; - s@((\<b\>)?(\&\w+\;|.)(\</b\>)?)\010_@<u>$1</u>@g; - s@.\010(.)@$1@g; - -@@ -156,7 +157,7 @@ EOF - } - - s@(http|ftp)://[\w.\-/~]+[\w/]@<a href="$&">$&</a>@g; -- s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1<a href="mailto:$3">$2$3</a>@g; -+ s@\b(mailto:|)(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@<a href="mailto:$2">$1$2</a>@g; - s@(\W)(\~?/[\w.][\w.\-/~]*)@$1 . &file_ref($2)@ge; - s@(include(<\/?[bu]\>|\s)*\<)([\w.\-/]+)@$1 . &include_ref($3)@ge; - if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\</[bu]\>)*(\([\dm]\w*\))@) { -@@ -220,7 +221,7 @@ sub is_command { - local($p); - - (! -d && -x) || return 0; -- if (! defined(%PATH)) { -+ if (! %PATH) { - for $p (split(":", $ENV{'PATH'})) { - $p =~ s@/+$@@; - $PATH{$p} = 1; diff --git a/debian/patches/180_execdict.patch b/debian/patches/180_execdict.patch deleted file mode 100644 index 1d3b8d6..0000000 --- a/debian/patches/180_execdict.patch +++ /dev/null @@ -1,14 +0,0 @@ -Subject: Fix potentially segfault of execdict() -From: Tatsuya Kinoshita <tats@debian.org> - ---- a/main.c -+++ b/main.c -@@ -5604,7 +5604,7 @@ execdict(char *word) - disp_message("Execution failed", TRUE); - return; - } -- else { -+ else if (buf != NO_BUFFER) { - buf->filename = w; - buf->buffername = Sprintf("%s %s", DICTBUFFERNAME, word)->ptr; - if (buf->type == NULL) diff --git a/debian/patches/190_Strchop.patch b/debian/patches/190_Strchop.patch deleted file mode 100644 index e27861f..0000000 --- a/debian/patches/190_Strchop.patch +++ /dev/null @@ -1,16 +0,0 @@ -Subject: Check length for Strchop() -From: Tatsuya Kinoshita <tats@debian.org> - ---- a/Str.c -+++ b/Str.c -@@ -278,8 +278,8 @@ void - Strchop(Str s) - { - STR_LENGTH_CHECK(s); -- while ((s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r') && -- s->length > 0) { -+ while (s->length > 0 && -+ (s->ptr[s->length - 1] == '\n' || s->ptr[s->length - 1] == '\r')) { - s->length--; - } - s->ptr[s->length] = '\0'; diff --git a/debian/patches/200_readme-img-typo.patch b/debian/patches/200_readme-img-typo.patch deleted file mode 100644 index e322d5b..0000000 --- a/debian/patches/200_readme-img-typo.patch +++ /dev/null @@ -1,26 +0,0 @@ -Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=725892 -Bug: https://sourceforge.net/p/w3m/patches/67/ -From: Rafael Laboissiere <rafael@laboissiere.net> -Date: Wed, 9 Oct 2013 13:43:31 -0300 -Subject: README.img: Fix typo - ---- - doc/README.img | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/doc/README.img b/doc/README.img -index 0c10114..f11362f 100644 ---- a/doc/README.img -+++ b/doc/README.img -@@ -41,7 +41,7 @@ Key functions - Specify the following keymaps in ~/.w3m/keymap. - keymap X DISPLAY_IMAGE - keymap C-c STOP_IMAGE -- keyamp t SET_OPTION display_image=toggle -+ keymap t SET_OPTION display_image=toggle - - Commandline options - --- -1.8.4.rc3 - diff --git a/debian/patches/210_vim-like.patch b/debian/patches/210_vim-like.patch deleted file mode 100644 index dcb598b..0000000 --- a/debian/patches/210_vim-like.patch +++ /dev/null @@ -1,87 +0,0 @@ -Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=724028 -Bug: https://sourceforge.net/p/w3m/patches/68/ -Subject: vim/-perator like handling -From: Laurence Richert <laurencerichert@yahoo.de> - - - half page scrolling - - jumping to elements numbered by getLinkNumberStr() from Karsten - Schoelzel - -diff --git a/main.c b/main.c -index b421943..4b40e8e 100644 ---- a/main.c -+++ b/main.c -@@ -1566,6 +1566,18 @@ DEFUN(pgBack, PREV_PAGE, "Move to previous page") - * (Currentbuf->LINES - 1)), prec_num ? B_SCROLL : B_NORMAL); - } - -+/* Move half page forward */ -+DEFUN(hpgFore, NEXT_HALF_PAGE, "Scroll down half page") -+{ -+ nscroll(searchKeyNum() * (Currentbuf->LINES / 2 - 1), B_NORMAL); -+} -+ -+/* Move half page backward */ -+DEFUN(hpgBack, PREV_HALF_PAGE, "Scroll up half page") -+{ -+ nscroll(-searchKeyNum() * (Currentbuf->LINES / 2 - 1), B_NORMAL); -+} -+ - /* 1 line up */ - DEFUN(lup1, UP, "Scroll up one line") - { -@@ -3568,6 +3580,33 @@ DEFUN(lastA, LINK_END, "Go to the last link") - displayBuffer(Currentbuf, B_NORMAL); - } - -+/* go to the nth anchor */ -+DEFUN(nthA, LINK_N, "Go to the nth link") -+{ -+ HmarkerList *hl = Currentbuf->hmarklist; -+ BufferPoint *po; -+ Anchor *an; -+ -+ int n = searchKeyNum(); -+ if (n < 0 || n > hl->nmark) return; -+ -+ if (Currentbuf->firstLine == NULL) -+ return; -+ if (!hl || hl->nmark == 0) -+ return; -+ -+ po = hl->marks + n-1; -+ an = retrieveAnchor(Currentbuf->href, po->line, po->pos); -+ if (an == NULL) -+ an = retrieveAnchor(Currentbuf->formitem, po->line, po->pos); -+ if (an == NULL) return; -+ -+ gotoLine(Currentbuf, po->line); -+ Currentbuf->pos = po->pos; -+ arrangeCursor(Currentbuf); -+ displayBuffer(Currentbuf, B_NORMAL); -+} -+ - /* go to the next anchor */ - DEFUN(nextA, NEXT_LINK, "Move to next link") - { -diff --git a/proto.h b/proto.h -index f8a7345..9d14a58 100644 ---- a/proto.h -+++ b/proto.h -@@ -11,6 +11,8 @@ extern void pushEvent(int cmd, void *data); - extern MySignalHandler intTrap(SIGNAL_ARG); - extern void pgFore(void); - extern void pgBack(void); -+extern void hpgFore(void); -+extern void hpgBack(void); - extern void lup1(void); - extern void ldown1(void); - extern void ctrCsrV(void); -@@ -61,6 +63,7 @@ extern void submitForm(void); - extern void followForm(void); - extern void topA(void); - extern void lastA(void); -+extern void nthA(void); - extern void onA(void); - - extern void nextA(void); diff --git a/debian/patches/220_maxcol.patch b/debian/patches/220_maxcol.patch deleted file mode 100644 index 432e09c..0000000 --- a/debian/patches/220_maxcol.patch +++ /dev/null @@ -1,17 +0,0 @@ -Subject: Bump MAXCOL to 256 -From: Tatsuya Kinoshita <tats@debian.org> -Bug: https://sourceforge.net/p/w3m/feature-requests/24/ - -diff --git a/table.h b/table.h -index 83b661f..fdcdef3 100644 ---- a/table.h -+++ b/table.h -@@ -17,7 +17,7 @@ - #define MAX_TABLE_N 20 /* maximum number of table in same level */ - - #define MAXROW 50 --#define MAXCOL 50 -+#define MAXCOL 256 - - #define MAX_WIDTH 80 - diff --git a/debian/patches/230_cygwin-lang.patch b/debian/patches/230_cygwin-lang.patch deleted file mode 100644 index 5a6671e..0000000 --- a/debian/patches/230_cygwin-lang.patch +++ /dev/null @@ -1,30 +0,0 @@ -Subject: Do not fail when LANG is not set on Cygwin -From: Tatsuya Kinoshita <tats@debian.org>, Jarek Czekalski <jarekczek@poczta.onet.pl> -Bug: https://sourceforge.net/p/w3m/patches/66/ - - Check whether the value of LC_ALL, LC_CTYPE or LANG is not NULL in - check_cygwin_console(). - -diff --git a/terms.c b/terms.c -index 7a3c987..399d117 100644 ---- a/terms.c -+++ b/terms.c -@@ -222,6 +222,7 @@ static void - check_cygwin_console(void) - { - char *term = getenv("TERM"); -+ char *ctype; - HANDLE hWnd; - - if (term == NULL) -@@ -236,7 +237,9 @@ check_cygwin_console(void) - isLocalConsole = 1; - } - } -- if (strncmp(getenv("LANG"), "ja", 2) == 0) { -+ if (((ctype = getenv("LC_ALL")) || -+ (ctype = getenv("LC_CTYPE")) || -+ (ctype = getenv("LANG"))) && strncmp(ctype, "ja", 2) == 0) { - isWinConsole = TERM_CYGWIN_RESERVE_IME; - } - #ifdef SUPPORT_WIN9X_CONSOLE_MBCS diff --git a/debian/patches/240_win64gc.patch b/debian/patches/240_win64gc.patch deleted file mode 100644 index 5005155..0000000 --- a/debian/patches/240_win64gc.patch +++ /dev/null @@ -1,1235 +0,0 @@ -Subject: Workaround of GC crash on Cygwin64 -From: AIDA Shinra <shinra@j10n.org> -Origin: http://www.j10n.org/files/w3m-cvs-1.1055-win64gc.patch - - Patch from [w3m-dev:04469] on 2013-10-14. - -diff --git a/config.h.in b/config.h.in -index 59997b4..a4110ea 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -210,6 +210,10 @@ typedef RETSIGTYPE MySignalHandler; - #define SUPPORT_WIN9X_CONSOLE_MBCS 1 - #endif - -+#if defined(__CYGWIN__) && defined(__x86_64__) -+#define DONT_CALL_GC_AFTER_FORK -+#endif -+ - #if defined(__DJGPP__) - #define DEFAULT_TERM "dosansi" - #else -diff --git a/file.c b/file.c -index 89c9152..6f4d5b8 100644 ---- a/file.c -+++ b/file.c -@@ -677,6 +677,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) - #endif - init_stream(&f, SCM_LOCAL, newStrStream(src)); - loadHTMLstream(&f, newBuf, NULL, TRUE); -+ UFclose(&f); - for (l = newBuf->lastLine; l && l->real_linenumber; - l = l->prev) - l->real_linenumber = 0; -@@ -7238,16 +7239,17 @@ loadHTMLString(Str page) - MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; - Buffer *newBuf; - -+ init_stream(&f, SCM_LOCAL, newStrStream(page)); -+ - newBuf = newBuffer(INIT_BUFFER_WIDTH); - if (SETJMP(AbortLoading) != 0) { - TRAP_OFF; - discardBuffer(newBuf); -+ UFclose(&f); - return NULL; - } - TRAP_ON; - -- init_stream(&f, SCM_LOCAL, newStrStream(page)); -- - #ifdef USE_M17N - newBuf->document_charset = InnerCharset; - #endif -@@ -7257,6 +7259,7 @@ loadHTMLString(Str page) - #endif - - TRAP_OFF; -+ UFclose(&f); - newBuf->topLine = newBuf->firstLine; - newBuf->lastLine = newBuf->currentLine; - newBuf->currentLine = newBuf->firstLine; -@@ -7486,15 +7489,13 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) - !stat(cache->file, &st)) - goto image_buffer; - -- TRAP_ON; - if (IStype(uf->stream) != IST_ENCODED) - uf->stream = newEncodedStream(uf->stream, uf->encoding); -+ TRAP_ON; - if (save2tmp(*uf, cache->file) < 0) { -- UFclose(uf); - TRAP_OFF; - return NULL; - } -- UFclose(uf); - TRAP_OFF; - - cache->loaded = IMG_FLAG_LOADED; -@@ -7514,6 +7515,7 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf) - - init_stream(&f, SCM_LOCAL, newStrStream(tmp)); - loadHTMLstream(&f, newBuf, src, TRUE); -+ UFclose(&f); - if (src) - fclose(src); - -@@ -7909,6 +7911,8 @@ save2tmp(URLFile uf, char *tmpf) - clen_t linelen = 0, trbyte = 0; - MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL; - static JMP_BUF env_bak; -+ volatile int retval = 0; -+ char *volatile buf = NULL; - - ff = fopen(tmpf, "wb"); - if (ff == NULL) { -@@ -7945,25 +7949,25 @@ save2tmp(URLFile uf, char *tmpf) - else - #endif /* USE_NNTP */ - { -- Str buf = Strnew_size(SAVE_BUF_SIZE); -- while (UFread(&uf, buf, SAVE_BUF_SIZE)) { -- if (Strfputs(buf, ff) != buf->length) { -- bcopy(env_bak, AbortLoading, sizeof(JMP_BUF)); -- TRAP_OFF; -- fclose(ff); -- current_content_length = 0; -- return -2; -+ int count; -+ -+ buf = NewWithoutGC_N(char, SAVE_BUF_SIZE); -+ while ((count = ISread_n(uf.stream, buf, SAVE_BUF_SIZE)) > 0) { -+ if (fwrite(buf, 1, count, ff) != count) { -+ retval = -2; -+ goto _end; - } -- linelen += buf->length; -+ linelen += count; - showProgress(&linelen, &trbyte); - } - } - _end: - bcopy(env_bak, AbortLoading, sizeof(JMP_BUF)); - TRAP_OFF; -+ xfree(buf); - fclose(ff); - current_content_length = 0; -- return 0; -+ return retval; - } - - Buffer * -@@ -8074,7 +8078,8 @@ _MoveFile(char *path1, char *path2) - FILE *f2; - int is_pipe; - clen_t linelen = 0, trbyte = 0; -- Str buf; -+ char *buf = NULL; -+ int count; - - f1 = openIS(path1); - if (f1 == NULL) -@@ -8092,12 +8097,13 @@ _MoveFile(char *path1, char *path2) - return -1; - } - current_content_length = 0; -- buf = Strnew_size(SAVE_BUF_SIZE); -- while (ISread(f1, buf, SAVE_BUF_SIZE)) { -- Strfputs(buf, f2); -- linelen += buf->length; -+ buf = NewWithoutGC_N(char, SAVE_BUF_SIZE); -+ while ((count = ISread_n(f1, buf, SAVE_BUF_SIZE)) > 0) { -+ fwrite(buf, 1, count, f2); -+ linelen += count; - showProgress(&linelen, &trbyte); - } -+ xfree(buf); - ISclose(f1); - if (is_pipe) - pclose(f2); -@@ -8456,21 +8462,23 @@ uncompress_stream(URLFile *uf, char **src) - } - if (pid2 == 0) { - /* child2 */ -- Str buf = Strnew_size(SAVE_BUF_SIZE); -+ char *buf = NewWithoutGC_N(char, SAVE_BUF_SIZE); -+ int count; - FILE *f = NULL; - - setup_child(TRUE, 2, UFfileno(uf)); - if (tmpf) - f = fopen(tmpf, "wb"); -- while (UFread(uf, buf, SAVE_BUF_SIZE)) { -- if (Strfputs(buf, stdout) < 0) -+ while ((count = ISread_n(uf->stream, buf, SAVE_BUF_SIZE)) > 0) { -+ if (fwrite(buf, 1, count, stdout) != count) -+ break; -+ if (f && fwrite(buf, 1, count, f) != count) - break; -- if (f) -- Strfputs(buf, f); - } - UFclose(uf); - if (f) - fclose(f); -+ xfree(buf); - exit(0); - } - /* child1 */ -diff --git a/fm.h b/fm.h -index acdab46..2216b06 100644 ---- a/fm.h -+++ b/fm.h -@@ -76,6 +76,7 @@ typedef int wc_ces; /* XXX: not used */ - #include "textlist.h" - #include "funcname1.h" - #include "terms.h" -+#include "istream.h" - - #ifndef HAVE_BCOPY - void bcopy(const void *, void *, int); -@@ -288,8 +289,6 @@ extern int REV_LB[]; - #define inputFilenameHist(p,d,h) inputLineHist(p,d,IN_FILENAME,h) - #define inputChar(p) inputLine(p,"",IN_CHAR) - --#define free(x) GC_free(x) /* let GC do it. */ -- - #ifdef __EMX__ - #define HAVE_STRCASECMP - #define strcasecmp stricmp -@@ -895,6 +894,9 @@ global char *index_file init(NULL); - - global char *CurrentDir; - global int CurrentPid; -+#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) -+global char *MyProgramName init("w3m"); -+#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ - /* - * global Buffer *Currentbuf; - * global Buffer *Firstbuf; -diff --git a/html.h b/html.h -index 4a2827b..b4b3df9 100644 ---- a/html.h -+++ b/html.h -@@ -1,19 +1,17 @@ - /* $Id: html.h,v 1.31 2010/08/14 01:29:40 htrb Exp $ */ - #ifndef _HTML_H - #define _HTML_H -+#include "config.h" - #ifdef USE_SSL - #include <openssl/bio.h> - #include <openssl/x509.h> - #include <openssl/ssl.h> - #endif /* USE_SSL */ - --#include "istream.h" -- - #define StrUFgets(f) StrISgets((f)->stream) - #define StrmyUFgets(f) StrmyISgets((f)->stream) - #define UFgetc(f) ISgetc((f)->stream) - #define UFundogetc(f) ISundogetc((f)->stream) --#define UFread(f,buf,len) ISread((f)->stream,buf,len) - #define UFclose(f) (void)(ISclose((f)->stream) == 0 && ((f)->stream = NULL)) - #define UFfileno(f) ISfileno((f)->stream) - -@@ -62,11 +60,12 @@ typedef struct _ParsedURL { - int is_nocache; - } ParsedURL; - -+union input_stream; - typedef struct { - unsigned char scheme; - char is_cgi; - char encoding; -- InputStream stream; -+ union input_stream *stream; - char *ext; - int compression; - int content_encoding; -diff --git a/image.c b/image.c -index 5f5991a..9d0e9b5 100644 ---- a/image.c -+++ b/image.c -@@ -90,17 +90,18 @@ termImage() - static int - openImgdisplay() - { -+ char *cmd; -+ -+ if (!strchr(Imgdisplay, '/')) -+ cmd = Strnew_m_charp(w3m_auxbin_dir(), "/", Imgdisplay, NULL)->ptr; -+ else -+ cmd = Imgdisplay; - Imgdisplay_pid = open_pipe_rw(&Imgdisplay_rf, &Imgdisplay_wf); - if (Imgdisplay_pid < 0) - goto err0; - if (Imgdisplay_pid == 0) { - /* child */ -- char *cmd; - setup_child(FALSE, 2, -1); -- if (!strchr(Imgdisplay, '/')) -- cmd = Strnew_m_charp(w3m_auxbin_dir(), "/", Imgdisplay, NULL)->ptr; -- else -- cmd = Imgdisplay; - myExec(cmd); - /* XXX: ifdef __EMX__, use start /f ? */ - } -@@ -333,6 +334,9 @@ loadImage(Buffer *buf, int flag) - struct stat st; - int i, draw = FALSE; - /* int wait_st; */ -+#ifdef DONT_CALL_GC_AFTER_FORK -+ char *loadargs[7]; -+#endif - - if (maxLoadImage > MAX_LOAD_IMAGE) - maxLoadImage = MAX_LOAD_IMAGE; -@@ -433,6 +437,24 @@ loadImage(Buffer *buf, int flag) - image_cache[i] = cache; - - flush_tty(); -+#ifdef DONT_CALL_GC_AFTER_FORK -+ loadargs[0] = MyProgramName; -+ loadargs[1] = "-$$getimage"; -+ loadargs[2] = conv_to_system(cache->url); -+ loadargs[3] = conv_to_system(parsedURL2Str(cache->current)->ptr); -+ loadargs[4] = cache->file; -+ loadargs[5] = cache->touch; -+ loadargs[6] = NULL; -+ if ((cache->pid = fork()) == 0) { -+ setup_child(FALSE, 0, -1); -+ execvp(MyProgramName, loadargs); -+ exit(1); -+ } -+ else if (cache->pid < 0) { -+ cache->pid = 0; -+ return; -+ } -+#else /* !DONT_CALL_GC_AFTER_FORK */ - if ((cache->pid = fork()) == 0) { - Buffer *b; - /* -@@ -458,6 +480,7 @@ loadImage(Buffer *buf, int flag) - cache->pid = 0; - return; - } -+#endif /* !DONT_CALL_GC_AFTER_FORK */ - } - } - -diff --git a/indep.c b/indep.c -index 89e86c1..5c5de06 100644 ---- a/indep.c -+++ b/indep.c -@@ -721,6 +721,111 @@ shell_quote(char *str) - return str; - } - -+void * -+xrealloc(void *ptr, size_t size) -+{ -+ void *newptr = realloc(ptr, size); -+ if (newptr == NULL) { -+ fprintf(stderr, "Out of memory\n"); -+ exit(-1); -+ } -+ return newptr; -+} -+ -+/* Define this as a separate function in case the free() has -+ * an incompatible prototype. */ -+void -+xfree(void *ptr) -+{ -+ free(ptr); -+} -+ -+void * -+w3m_GC_realloc_atomic(void *ptr, size_t size) -+{ -+ return ptr ? GC_REALLOC(ptr, size) : GC_MALLOC_ATOMIC(size); -+} -+ -+void -+w3m_GC_free(void *ptr) -+{ -+ GC_FREE(ptr); -+} -+ -+void -+growbuf_init(struct growbuf *gb) -+{ -+ gb->ptr = NULL; -+ gb->length = 0; -+ gb->area_size = 0; -+ gb->realloc_proc = &w3m_GC_realloc_atomic; -+ gb->free_proc = &w3m_GC_free; -+} -+ -+void -+growbuf_init_without_GC(struct growbuf *gb) -+{ -+ gb->ptr = NULL; -+ gb->length = 0; -+ gb->area_size = 0; -+ gb->realloc_proc = &xrealloc; -+ gb->free_proc = &xfree; -+} -+ -+void -+growbuf_clear(struct growbuf *gb) -+{ -+ (*gb->free_proc) (gb->ptr); -+ gb->ptr = NULL; -+ gb->length = 0; -+ gb->area_size = 0; -+} -+ -+Str -+growbuf_to_Str(struct growbuf *gb) -+{ -+ Str s; -+ -+ if (gb->free_proc == &w3m_GC_free) { -+ growbuf_reserve(gb, gb->length + 1); -+ gb->ptr[gb->length] = '\0'; -+ s = New(struct _Str); -+ s->ptr = gb->ptr; -+ s->length = gb->length; -+ s->area_size = gb->area_size; -+ } else { -+ s = Strnew_charp_n(gb->ptr, gb->length); -+ (*gb->free_proc) (gb->ptr); -+ } -+ gb->ptr = NULL; -+ gb->length = 0; -+ gb->area_size = 0; -+ return s; -+} -+ -+void -+growbuf_reserve(struct growbuf *gb, int leastarea) -+{ -+ int newarea; -+ -+ if (gb->area_size < leastarea) { -+ newarea = gb->area_size * 3 / 2; -+ if (newarea < leastarea) -+ newarea = leastarea; -+ newarea += 16; -+ gb->ptr = (*gb->realloc_proc) (gb->ptr, newarea); -+ gb->area_size = newarea; -+ } -+} -+ -+void -+growbuf_append(struct growbuf *gb, const char *src, int len) -+{ -+ growbuf_reserve(gb, gb->length + len); -+ memcpy(&gb->ptr[gb->length], src, len); -+ gb->length += len; -+} -+ - static char * - w3m_dir(const char *name, char *dft) - { -diff --git a/indep.h b/indep.h -index cf566fe..84416ed 100644 ---- a/indep.h -+++ b/indep.h -@@ -12,6 +12,14 @@ - #define FALSE 0 - #endif /* FALSE */ - -+struct growbuf { -+ char *ptr; -+ int length; -+ int area_size; -+ void *(*realloc_proc) (void *, size_t); -+ void (*free_proc) (void *); -+}; -+ - #define RAW_MODE 0 - #define PAGER_MODE 1 - #define HTML_MODE 2 -@@ -65,6 +73,18 @@ extern Str Str_url_unquote(Str x, int is_form, int safe); - extern Str Str_form_quote(Str x); - #define Str_form_unquote(x) Str_url_unquote((x), TRUE, FALSE) - extern char *shell_quote(char *str); -+#define xmalloc(s) xrealloc(NULL, s) -+extern void *xrealloc(void *ptr, size_t size); -+extern void xfree(void *ptr); -+extern void *w3m_GC_realloc_atomic(void *ptr, size_t size); -+extern void w3m_GC_free(void *ptr); -+extern void growbuf_init(struct growbuf *gb); -+extern void growbuf_init_without_GC(struct growbuf *gb); -+extern void growbuf_clear(struct growbuf *gb); -+extern Str growbuf_to_Str(struct growbuf *gb); -+extern void growbuf_reserve(struct growbuf *gb, int leastarea); -+extern void growbuf_append(struct growbuf *gb, const char *src, int len); -+#define GROWBUF_ADD_CHAR(gb,ch) ((((gb)->length>=(gb)->area_size)?growbuf_reserve(gb,(gb)->length+1):(void)0),(void)((gb)->ptr[(gb)->length++] = (ch))) - - extern char *w3m_auxbin_dir(); - extern char *w3m_lib_dir(); -@@ -77,5 +97,8 @@ extern char *w3m_help_dir(); - #define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) - #define NewAtom_N(type,n) ((type*)GC_MALLOC_ATOMIC((n)*sizeof(type))) - #define New_Reuse(type,ptr,n) ((type*)GC_REALLOC((ptr),(n)*sizeof(type))) -+#define NewWithoutGC(type) ((type*)xmalloc(sizeof(type))) -+#define NewWithoutGC_N(type,n) ((type*)xmalloc((n)*sizeof(type))) -+#define NewWithoutGC_Reuse(type,ptr,n) ((type*)xrealloc(ptr,(n)*sizeof(type))) - - #endif /* INDEP_H */ -diff --git a/istream.c b/istream.c -index d8c8e45..3126142 100644 ---- a/istream.c -+++ b/istream.c -@@ -35,12 +35,14 @@ static int ssl_read(struct ssl_handle *handle, char *buf, int len); - static int ens_read(struct ens_handle *handle, char *buf, int len); - static void ens_close(struct ens_handle *handle); - -+static void memchop(char *p, int *len); -+ - static void - do_update(BaseStream base) - { - int len; - base->stream.cur = base->stream.next = 0; -- len = base->read(base->handle, base->stream.buf, base->stream.size); -+ len = (*base->read) (base->handle, base->stream.buf, base->stream.size); - if (len <= 0) - base->iseos = TRUE; - else -@@ -66,12 +68,12 @@ init_buffer(BaseStream base, char *buf, int bufsize) - StreamBuffer sb = &base->stream; - sb->size = bufsize; - sb->cur = 0; -+ sb->buf = NewWithoutGC_N(uchar, bufsize); - if (buf) { -- sb->buf = (uchar *) buf; -+ memcpy(sb->buf, buf, bufsize); - sb->next = bufsize; - } - else { -- sb->buf = NewAtom_N(uchar, bufsize); - sb->next = 0; - } - base->iseos = FALSE; -@@ -95,10 +97,10 @@ newInputStream(int des) - InputStream stream; - if (des < 0) - return NULL; -- stream = New(union input_stream); -+ stream = NewWithoutGC(union input_stream); - init_base_stream(&stream->base, STREAM_BUF_SIZE); - stream->base.type = IST_BASIC; -- stream->base.handle = New(int); -+ stream->base.handle = NewWithoutGC(int); - *(int *)stream->base.handle = des; - stream->base.read = (int (*)())basic_read; - stream->base.close = (void (*)())basic_close; -@@ -111,10 +113,10 @@ newFileStream(FILE * f, void (*closep) ()) - InputStream stream; - if (f == NULL) - return NULL; -- stream = New(union input_stream); -+ stream = NewWithoutGC(union input_stream); - init_base_stream(&stream->base, STREAM_BUF_SIZE); - stream->file.type = IST_FILE; -- stream->file.handle = New(struct io_file_handle); -+ stream->file.handle = NewWithoutGC(struct io_file_handle); - stream->file.handle->f = f; - if (closep) - stream->file.handle->close = closep; -@@ -131,10 +133,10 @@ newStrStream(Str s) - InputStream stream; - if (s == NULL) - return NULL; -- stream = New(union input_stream); -+ stream = NewWithoutGC(union input_stream); - init_str_stream(&stream->base, s); - stream->str.type = IST_STR; -- stream->str.handle = s; -+ stream->str.handle = NULL; - stream->str.read = (int (*)())str_read; - stream->str.close = NULL; - return stream; -@@ -147,10 +149,10 @@ newSSLStream(SSL * ssl, int sock) - InputStream stream; - if (sock < 0) - return NULL; -- stream = New(union input_stream); -+ stream = NewWithoutGC(union input_stream); - init_base_stream(&stream->base, SSL_BUF_SIZE); - stream->ssl.type = IST_SSL; -- stream->ssl.handle = New(struct ssl_handle); -+ stream->ssl.handle = NewWithoutGC(struct ssl_handle); - stream->ssl.handle->ssl = ssl; - stream->ssl.handle->sock = sock; - stream->ssl.read = (int (*)())ssl_read; -@@ -166,14 +168,14 @@ newEncodedStream(InputStream is, char encoding) - if (is == NULL || (encoding != ENC_QUOTE && encoding != ENC_BASE64 && - encoding != ENC_UUENCODE)) - return is; -- stream = New(union input_stream); -+ stream = NewWithoutGC(union input_stream); - init_base_stream(&stream->base, STREAM_BUF_SIZE); - stream->ens.type = IST_ENCODED; -- stream->ens.handle = New(struct ens_handle); -+ stream->ens.handle = NewWithoutGC(struct ens_handle); - stream->ens.handle->is = is; - stream->ens.handle->pos = 0; - stream->ens.handle->encoding = encoding; -- stream->ens.handle->s = NULL; -+ growbuf_init_without_GC(&stream->ens.handle->gb); - stream->ens.read = (int (*)())ens_read; - stream->ens.close = (void (*)())ens_close; - return stream; -@@ -187,8 +189,10 @@ ISclose(InputStream stream) - stream->base.type & IST_UNCLOSE) - return -1; - prevtrap = mySignal(SIGINT, SIG_IGN); -- stream->base.close(stream->base.handle); -+ stream->base.close (stream->base.handle); - mySignal(SIGINT, prevtrap); -+ xfree(stream->base.stream.buf); -+ xfree(stream); - return 0; - } - -@@ -218,122 +222,97 @@ ISundogetc(InputStream stream) - return -1; - } - --#define MARGIN_STR_SIZE 10 - Str --StrISgets(InputStream stream) -+StrISgets2(InputStream stream, char crnl) - { -- BaseStream base; -- StreamBuffer sb; -- Str s = NULL; -- uchar *p; -- int len; -+ struct growbuf gb; - - if (stream == NULL) -- return '\0'; -- base = &stream->base; -- sb = &base->stream; -- -- while (!base->iseos) { -- if (MUST_BE_UPDATED(base)) { -- do_update(base); -- } -- else { -- if ((p = memchr(&sb->buf[sb->cur], '\n', sb->next - sb->cur))) { -- len = p - &sb->buf[sb->cur] + 1; -- if (s == NULL) -- s = Strnew_size(len); -- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], len); -- sb->cur += len; -- return s; -- } -- else { -- if (s == NULL) -- s = Strnew_size(sb->next - sb->cur + MARGIN_STR_SIZE); -- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], -- sb->next - sb->cur); -- sb->cur = sb->next; -- } -- } -- } -- -- if (s == NULL) -- return Strnew(); -- return s; -+ return NULL; -+ growbuf_init(&gb); -+ ISgets_to_growbuf(stream, &gb, crnl); -+ return growbuf_to_Str(&gb); - } - --Str --StrmyISgets(InputStream stream) -+void -+ISgets_to_growbuf(InputStream stream, struct growbuf *gb, char crnl) - { -- BaseStream base; -- StreamBuffer sb; -- Str s = NULL; -- int i, len; -+ BaseStream base = &stream->base; -+ StreamBuffer sb = &base->stream; -+ int i; - -- if (stream == NULL) -- return '\0'; -- base = &stream->base; -- sb = &base->stream; -+ gb->length = 0; - - while (!base->iseos) { - if (MUST_BE_UPDATED(base)) { - do_update(base); -+ continue; - } -- else { -- if (s && Strlastchar(s) == '\r') { -- if (sb->buf[sb->cur] == '\n') -- Strcat_char(s, (char)sb->buf[sb->cur++]); -- return s; -+ if (crnl && gb->length > 0 && gb->ptr[gb->length - 1] == '\r') { -+ if (sb->buf[sb->cur] == '\n') { -+ GROWBUF_ADD_CHAR(gb, '\n'); -+ ++sb->cur; - } -- for (i = sb->cur; -- i < sb->next && sb->buf[i] != '\n' && sb->buf[i] != '\r'; -- i++) ; -- if (i < sb->next) { -- len = i - sb->cur + 1; -- if (s == NULL) -- s = Strnew_size(len + MARGIN_STR_SIZE); -- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], len); -- sb->cur = i + 1; -- if (sb->buf[i] == '\n') -- return s; -- } -- else { -- if (s == NULL) -- s = Strnew_size(sb->next - sb->cur + MARGIN_STR_SIZE); -- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], -- sb->next - sb->cur); -- sb->cur = sb->next; -+ break; -+ } -+ for (i = sb->cur; i < sb->next; ++i) { -+ if (sb->buf[i] == '\n' || (crnl && sb->buf[i] == '\r')) { -+ ++i; -+ break; - } - } -+ growbuf_append(gb, &sb->buf[sb->cur], i - sb->cur); -+ sb->cur = i; -+ if (gb->length > 0 && gb->ptr[gb->length - 1] == '\n') -+ break; - } - -- if (s == NULL) -- return Strnew(); -- return s; -+ growbuf_reserve(gb, gb->length + 1); -+ gb->ptr[gb->length] = '\0'; -+ return; - } - -+#ifdef unused - int - ISread(InputStream stream, Str buf, int count) - { -- int rest, len; -+ int len; -+ -+ if (count + 1 > buf->area_size) { -+ char *newptr = GC_MALLOC_ATOMIC(count + 1); -+ memcpy(newptr, buf->ptr, buf->length); -+ newptr[buf->length] = '\0'; -+ buf->ptr = newptr; -+ buf->area_size = count + 1; -+ } -+ len = ISread_n(stream, buf->ptr, count); -+ buf->length = (len > 0) ? len : 0; -+ buf->ptr[buf->length] = '\0'; -+ return (len > 0) ? 1 : 0; -+} -+#endif -+ -+int -+ISread_n(InputStream stream, char *dst, int count) -+{ -+ int len, l; - BaseStream base; - -- if (stream == NULL || (base = &stream->base)->iseos) -+ if (stream == NULL || count <= 0) -+ return -1; -+ if ((base = &stream->base)->iseos) - return 0; - -- len = buffer_read(&base->stream, buf->ptr, count); -- rest = count - len; -+ len = buffer_read(&base->stream, dst, count); - if (MUST_BE_UPDATED(base)) { -- len = base->read(base->handle, &buf->ptr[len], rest); -- if (len <= 0) { -+ l = (*base->read) (base->handle, &dst[len], count - len); -+ if (l <= 0) { - base->iseos = TRUE; -- len = 0; -+ } else { -+ len += l; - } -- rest -= len; - } -- Strtruncate(buf, count - rest); -- if (buf->length > 0) -- return 1; -- return 0; -+ return len; - } - - int -@@ -645,6 +624,7 @@ basic_close(int *handle) - #else - close(*(int *)handle); - #endif -+ xfree(handle); - } - - static int -@@ -661,6 +641,7 @@ static void - file_close(struct io_file_handle *handle) - { - handle->close(handle->f); -+ xfree(handle); - } - - static int -@@ -682,6 +663,7 @@ ssl_close(struct ssl_handle *handle) - close(handle->sock); - if (handle->ssl) - SSL_free(handle->ssl); -+ xfree(handle); - } - - static int -@@ -717,38 +699,60 @@ static void - ens_close(struct ens_handle *handle) - { - ISclose(handle->is); -+ growbuf_clear(&handle->gb); -+ xfree(handle); - } - - static int - ens_read(struct ens_handle *handle, char *buf, int len) - { -- if (handle->s == NULL || handle->pos == handle->s->length) { -+ if (handle->pos == handle->gb.length) { - char *p; -- handle->s = StrmyISgets(handle->is); -- if (handle->s->length == 0) -+ struct growbuf gbtmp; -+ -+ ISgets_to_growbuf(handle->is, &handle->gb, TRUE); -+ if (handle->gb.length == 0) - return 0; -- cleanup_line(handle->s, PAGER_MODE); - if (handle->encoding == ENC_BASE64) -- Strchop(handle->s); -+ memchop(handle->gb.ptr, &handle->gb.length); - else if (handle->encoding == ENC_UUENCODE) { -- if (!strncmp(handle->s->ptr, "begin", 5)) -- handle->s = StrmyISgets(handle->is); -- Strchop(handle->s); -+ if (handle->gb.length >= 5 && -+ !strncmp(handle->gb.ptr, "begin", 5)) -+ ISgets_to_growbuf(handle->is, &handle->gb, TRUE); -+ memchop(handle->gb.ptr, &handle->gb.length); - } -- p = handle->s->ptr; -+ growbuf_init_without_GC(&gbtmp); -+ p = handle->gb.ptr; - if (handle->encoding == ENC_QUOTE) -- handle->s = decodeQP(&p); -+ decodeQP_to_growbuf(&gbtmp, &p); - else if (handle->encoding == ENC_BASE64) -- handle->s = decodeB(&p); -+ decodeB_to_growbuf(&gbtmp, &p); - else if (handle->encoding == ENC_UUENCODE) -- handle->s = decodeU(&p); -+ decodeU_to_growbuf(&gbtmp, &p); -+ growbuf_clear(&handle->gb); -+ handle->gb = gbtmp; - handle->pos = 0; - } - -- if (len > handle->s->length - handle->pos) -- len = handle->s->length - handle->pos; -+ if (len > handle->gb.length - handle->pos) -+ len = handle->gb.length - handle->pos; - -- bcopy(&handle->s->ptr[handle->pos], buf, len); -+ memcpy(buf, &handle->gb.ptr[handle->pos], len); - handle->pos += len; - return len; - } -+ -+static void -+memchop(char *p, int *len) -+{ -+ char *q; -+ -+ for (q = p + *len; q > p; --q) { -+ if (q[-1] != '\n' && q[-1] != '\r') -+ break; -+ } -+ if (q != p + *len) -+ *q = '\0'; -+ *len = q - p; -+ return; -+} -diff --git a/istream.h b/istream.h -index e710e78..5a04be0 100644 ---- a/istream.h -+++ b/istream.h -@@ -2,13 +2,13 @@ - #ifndef IO_STREAM_H - #define IO_STREAM_H - -+#include "indep.h" - #include <stdio.h> - #ifdef USE_SSL - #include <openssl/bio.h> - #include <openssl/x509.h> - #include <openssl/ssl.h> - #endif --#include "Str.h" - #include <sys/types.h> - #include <sys/stat.h> - #include <fcntl.h> -@@ -36,7 +36,7 @@ union input_stream; - - struct ens_handle { - union input_stream *is; -- Str s; -+ struct growbuf gb; - int pos; - char encoding; - }; -@@ -119,9 +119,14 @@ extern InputStream newEncodedStream(InputStream is, char encoding); - extern int ISclose(InputStream stream); - extern int ISgetc(InputStream stream); - extern int ISundogetc(InputStream stream); --extern Str StrISgets(InputStream stream); --extern Str StrmyISgets(InputStream stream); -+extern Str StrISgets2(InputStream stream, char crnl); -+#define StrISgets(stream) StrISgets2(stream, FALSE) -+#define StrmyISgets(stream) StrISgets2(stream, TRUE) -+void ISgets_to_growbuf(InputStream stream, struct growbuf *gb, char crnl); -+#ifdef unused - extern int ISread(InputStream stream, Str buf, int count); -+#endif -+int ISread_n(InputStream stream, char *dst, int bufsize); - extern int ISfileno(InputStream stream); - extern int ISeos(InputStream stream); - #ifdef USE_SSL -diff --git a/local.c b/local.c -index f5a73a2..959bd66 100644 ---- a/local.c -+++ b/local.c -@@ -359,6 +359,10 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) - int status; - pid_t pid; - char *file = uri, *name = uri, *path_info = NULL, *tmpf = NULL; -+#ifdef HAVE_CHDIR -+ char *cgi_dir; -+#endif -+ char *cgi_basename; - - #ifdef __MINGW32_VERSION - return NULL; -@@ -373,7 +377,14 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) - if (!fw) - return NULL; - } -+ if (qstr) -+ uri = Strnew_m_charp(uri, "?", qstr, NULL)->ptr; -+#ifdef HAVE_CHDIR -+ cgi_dir = mydirname(file); -+#endif -+ cgi_basename = mybasename(file); - pid = open_pipe_rw(&fr, NULL); -+ /* Don't invoke gc after here, or the program might crash in some platforms */ - if (pid < 0) - return NULL; - else if (pid) { -@@ -383,8 +394,6 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) - } - setup_child(TRUE, 2, fw ? fileno(fw) : -1); - -- if (qstr) -- uri = Strnew_m_charp(uri, "?", qstr, NULL)->ptr; - set_cgi_environ(name, file, uri); - if (path_info) - set_environ("PATH_INFO", path_info); -@@ -415,11 +424,11 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) - } - - #ifdef HAVE_CHDIR /* ifndef __EMX__ ? */ -- chdir(mydirname(file)); -+ chdir(cgi_dir); - #endif -- execl(file, mybasename(file), NULL); -+ execl(file, cgi_basename, NULL); - fprintf(stderr, "execl(\"%s\", \"%s\", NULL): %s\n", -- file, mybasename(file), strerror(errno)); -+ file, cgi_basename, strerror(errno)); - exit(1); - return NULL; - #endif -diff --git a/main.c b/main.c -index c49985d..ec77085 100644 ---- a/main.c -+++ b/main.c -@@ -11,6 +11,9 @@ - #include <sys/wait.h> - #endif - #include <time.h> -+#if defined(__CYGWIN__) && defined(USE_BINMODE_STREAM) -+#include <io.h> -+#endif - #include "terms.h" - #include "myctype.h" - #include "regex.h" -@@ -407,6 +410,10 @@ main(int argc, char **argv, char **envp) - wc_ces CodePage; - #endif - #endif -+#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) -+ char **getimage_args = NULL; -+#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ -+ - GC_INIT(); - #if defined(ENABLE_NLS) || (defined(USE_M17N) && defined(HAVE_LANGINFO_CODESET)) - setlocale(LC_ALL, ""); -@@ -428,6 +435,10 @@ main(int argc, char **argv, char **envp) - - CurrentDir = currentdir(); - CurrentPid = (int)getpid(); -+#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) -+ if (argv[0] && *argv[0]) -+ MyProgramName = argv[0]; -+#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ - BookmarkFile = NULL; - config_file = NULL; - -@@ -751,6 +762,15 @@ main(int argc, char **argv, char **envp) - else if (!strcmp("-reqlog",argv[i])) { - w3m_reqlog=rcFile("request.log"); - } -+#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) -+ else if (!strcmp("-$$getimage", argv[i])) { -+ ++i; -+ getimage_args = argv + i; -+ i += 4; -+ if (i > argc) -+ usage(); -+ } -+#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ - else { - usage(); - } -@@ -839,6 +859,30 @@ main(int argc, char **argv, char **envp) - - if (w3m_backend) - backend(); -+#if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) -+ if (getimage_args) { -+ char *image_url = conv_from_system(getimage_args[0]); -+ char *base_url = conv_from_system(getimage_args[1]); -+ ParsedURL base_pu; -+ -+ parseURL2(base_url, &base_pu, NULL); -+ image_source = getimage_args[2]; -+ newbuf = loadGeneralFile(image_url, &base_pu, NULL, 0, NULL); -+ if (!newbuf || !newbuf->real_type || -+ strncasecmp(newbuf->real_type, "image/", 6)) -+ unlink(getimage_args[2]); -+#if defined(HAVE_SYMLINK) && defined(HAVE_LSTAT) -+ symlink(getimage_args[2], getimage_args[3]); -+#else -+ { -+ FILE *f = fopen(getimage_args[3], "w"); -+ if (f) -+ fclose(f); -+ } -+#endif -+ w3m_exit(0); -+ } -+#endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ - - if (w3m_dump) - mySignal(SIGINT, SIG_IGN); -diff --git a/mimehead.c b/mimehead.c -index 78997e0..d16270c 100644 ---- a/mimehead.c -+++ b/mimehead.c -@@ -64,12 +64,22 @@ ha2d(char x, char y) - Str - decodeB(char **ww) - { -+ struct growbuf gb; -+ -+ growbuf_init(&gb); -+ decodeB_to_growbuf(&gb, ww); -+ return growbuf_to_Str(&gb); -+} -+ -+void -+decodeB_to_growbuf(struct growbuf *gb, char **ww) -+{ - unsigned char c[4]; - char *wp = *ww; - char d[3]; - int i, n_pad; -- Str ap = Strnew_size(strlen(wp)); - -+ growbuf_reserve(gb, strlen(wp) + 1); - n_pad = 0; - while (1) { - for (i = 0; i < 4; i++) { -@@ -93,39 +103,50 @@ decodeB(char **ww) - for (i = 0; i < 4; i++) { - c[i] = c2e(c[i]); - if (c[i] == BAD_BASE64) { -- *ww = wp; -- return ap; -+ goto last; - } - } - d[0] = ((c[0] << 2) | (c[1] >> 4)); - d[1] = ((c[1] << 4) | (c[2] >> 2)); - d[2] = ((c[2] << 6) | c[3]); - for (i = 0; i < 3 - n_pad; i++) { -- Strcat_char(ap, d[i]); -+ GROWBUF_ADD_CHAR(gb, d[i]); - } - if (n_pad || *wp == '\0' || *wp == '?') - break; - } -+last: -+ growbuf_reserve(gb, gb->length + 1); -+ gb->ptr[gb->length] = '\0'; - *ww = wp; -- return ap; -+ return; - } - - Str - decodeU(char **ww) - { -+ struct growbuf gb; -+ -+ growbuf_init(&gb); -+ decodeU_to_growbuf(&gb, ww); -+ return growbuf_to_Str(&gb); -+} -+ -+void -+decodeU_to_growbuf(struct growbuf *gb, char **ww) -+{ - unsigned char c1, c2; - char *w = *ww; - int n, i; -- Str a; - - if (*w <= 0x20 || *w >= 0x60) -- return Strnew_size(0); -+ return; - n = *w - 0x20; -- a = Strnew_size(n); -+ growbuf_reserve(gb, n + 1); - for (w++, i = 2; *w != '\0' && n; n--) { - c1 = (w[0] - 0x20) % 0x40; - c2 = (w[1] - 0x20) % 0x40; -- Strcat_char(a, (c1 << i) | (c2 >> (6 - i))); -+ gb->ptr[gb->length++] = (c1 << i) | (c2 >> (6 - i)); - if (i == 6) { - w += 2; - i = 2; -@@ -135,7 +156,8 @@ decodeU(char **ww) - i += 2; - } - } -- return a; -+ gb->ptr[gb->length] = '\0'; -+ return; - } - - /* RFC2047 (4.2. The "Q" encoding) */ -@@ -165,9 +187,19 @@ decodeQ(char **ww) - Str - decodeQP(char **ww) - { -+ struct growbuf gb; -+ -+ growbuf_init(&gb); -+ decodeQP_to_growbuf(&gb, ww); -+ return growbuf_to_Str(&gb); -+} -+ -+void -+decodeQP_to_growbuf(struct growbuf *gb, char **ww) -+{ - char *w = *ww; -- Str a = Strnew_size(strlen(w)); - -+ growbuf_reserve(gb, strlen(w) + 1); - for (; *w != '\0'; w++) { - if (*w == '=') { - w++; -@@ -180,15 +212,16 @@ decodeQP(char **ww) - else { - if (*w == '\0' || *(w + 1) == '\0') - break; -- Strcat_char(a, ha2d(*w, *(w + 1))); -+ gb->ptr[gb->length++] = ha2d(*w, *(w + 1)); - w++; - } - } - else -- Strcat_char(a, *w); -+ gb->ptr[gb->length++] = *w; - } -+ gb->ptr[gb->length] = '\0'; - *ww = w; -- return a; -+ return; - } - - #ifdef USE_M17N -diff --git a/proto.h b/proto.h -index 7248ee5..0d8beb5 100644 ---- a/proto.h -+++ b/proto.h -@@ -607,9 +607,12 @@ extern char *getAnchorText(Buffer *buf, AnchorList *al, Anchor *a); - extern Buffer *link_list_panel(Buffer *buf); - - extern Str decodeB(char **ww); -+extern void decodeB_to_growbuf(struct growbuf *gb, char **ww); - extern Str decodeQ(char **ww); - extern Str decodeQP(char **ww); -+extern void decodeQP_to_growbuf(struct growbuf *gb, char **ww); - extern Str decodeU(char **ww); -+extern void decodeU_to_growbuf(struct growbuf *gb, char **ww); - #ifdef USE_M17N - extern Str decodeWord(char **ow, wc_ces * charset); - extern Str decodeMIME(Str orgstr, wc_ces * charset); -@@ -811,5 +814,3 @@ extern void dispVer(void); - void srand48(long); - long lrand48(void); - #endif -- --#include "indep.h" diff --git a/debian/patches/250_schemebug.patch b/debian/patches/250_schemebug.patch deleted file mode 100644 index fc740ca..0000000 --- a/debian/patches/250_schemebug.patch +++ /dev/null @@ -1,97 +0,0 @@ -Subject: Define schemeNumToName() to fix scheme bug -From: AIDA Shinra <shinra@j10n.org> -Origin: http://www.j10n.org/files/w3m-cvs-1.1055-schemebug.patch -Bug: http://sourceforge.net/p/w3m/patches/60/ -Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650747 - - Patch from [w3m-dev:04470] on 2013-10-14. - -diff --git a/url.c b/url.c -index cbb4aab..d7b1d6e 100644 ---- a/url.c -+++ b/url.c -@@ -121,6 +121,7 @@ static struct table2 DefaultGuess[] = { - }; - - static void add_index_file(ParsedURL *pu, URLFile *uf); -+static char * schemeNumToName(int scheme); - - /* #define HTTP_DEFAULT_FILE "/index.html" */ - -@@ -1285,6 +1286,18 @@ getURLScheme(char **url) - } - - static char * -+schemeNumToName(int scheme) -+{ -+ int i; -+ -+ for (i = 0; schemetable[i].cmdname != NULL; i++) { -+ if (schemetable[i].cmd == scheme) -+ return schemetable[i].cmdname; -+ } -+ return NULL; -+} -+ -+static char * - otherinfo(ParsedURL *target, ParsedURL *current, char *referer) - { - Str s = Strnew(); -@@ -1616,7 +1629,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, - pu->host != NULL && !check_no_proxy(pu->host)) { - hr->flag |= HR_FLAG_PROXY; - sock = openSocket(FTP_proxy_parsed.host, -- schemetable[FTP_proxy_parsed.scheme].cmdname, -+ schemeNumToName(FTP_proxy_parsed.scheme), - FTP_proxy_parsed.port); - if (sock < 0) - return uf; -@@ -1658,15 +1671,15 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, - } - else if (pu->scheme == SCM_HTTPS) { - sock = openSocket(HTTPS_proxy_parsed.host, -- schemetable[HTTPS_proxy_parsed.scheme]. -- cmdname, HTTPS_proxy_parsed.port); -+ schemeNumToName(HTTPS_proxy_parsed.scheme), -+ HTTPS_proxy_parsed.port); - sslh = NULL; - } - else { - #endif /* USE_SSL */ - sock = openSocket(HTTP_proxy_parsed.host, -- schemetable[HTTP_proxy_parsed.scheme]. -- cmdname, HTTP_proxy_parsed.port); -+ schemeNumToName(HTTP_proxy_parsed.scheme), -+ HTTP_proxy_parsed.port); - #ifdef USE_SSL - sslh = NULL; - } -@@ -1698,8 +1711,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, - } - } - else { -- sock = openSocket(pu->host, -- schemetable[pu->scheme].cmdname, pu->port); -+ sock = openSocket(pu->host, schemeNumToName(pu->scheme), pu->port); - if (sock < 0) { - *status = HTST_MISSING; - return uf; -@@ -1763,7 +1775,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, - pu->host != NULL && !check_no_proxy(pu->host)) { - hr->flag |= HR_FLAG_PROXY; - sock = openSocket(GOPHER_proxy_parsed.host, -- schemetable[GOPHER_proxy_parsed.scheme].cmdname, -+ schemeNumToName(GOPHER_proxy_parsed.scheme), - GOPHER_proxy_parsed.port); - if (sock < 0) - return uf; -@@ -1771,8 +1783,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, - tmp = HTTPrequest(pu, current, hr, extra_header); - } - else { -- sock = openSocket(pu->host, -- schemetable[pu->scheme].cmdname, pu->port); -+ sock = openSocket(pu->host, schemeNumToName(pu->scheme), pu->port); - if (sock < 0) - return uf; - if (pu->file == NULL) diff --git a/debian/patches/260_openssl.patch b/debian/patches/260_openssl.patch deleted file mode 100644 index 85c32c8..0000000 --- a/debian/patches/260_openssl.patch +++ /dev/null @@ -1,29 +0,0 @@ -Subject: OpenSSL issues -Author: Cristian Rodriguez <crrodriguez@opensuse.org> -Origin: https://build.opensuse.org/request/show/141054 -Bug-Debian: https://security-tracker.debian.org/tracker/CVE-2012-4929 - - Mon Nov 12 18:26:45 UTC 2012 - crrodriguez@opensuse.org - - Due to the "CRIME attack" (CVE-2012-4929) HTTPS clients - that negotiate TLS-level compression can be abused for - MITM attacks. (w3m-openssl.patch) - - Use SSL_MODE_RELEASE_BUFFERS if available . - ---- w3m.orig/url.c -+++ w3m/url.c -@@ -337,7 +337,15 @@ openSSLHandle(int sock, char *hostname, - if (strchr(ssl_forbid_method, 'T')) - option |= SSL_OP_NO_TLSv1; - } -+#ifdef SSL_OP_NO_COMPRESSION -+ option |= SSL_OP_NO_COMPRESSION; -+#endif - SSL_CTX_set_options(ssl_ctx, option); -+ -+#ifdef SSL_MODE_RELEASE_BUFFERS -+ SSL_CTX_set_mode (ssl_ctx, SSL_MODE_RELEASE_BUFFERS); -+#endif -+ - #ifdef USE_SSL_VERIFY - /* derived from openssl-0.9.5/apps/s_{client,cb}.c */ - #if 1 /* use SSL_get_verify_result() to verify cert */ diff --git a/debian/patches/270_refresh-url.patch b/debian/patches/270_refresh-url.patch deleted file mode 100644 index 5d2d5a5..0000000 --- a/debian/patches/270_refresh-url.patch +++ /dev/null @@ -1,25 +0,0 @@ -Subject: Add support for single quoted meta refresh URL -From: Paul Boekholt <p.boekholt@gmail.com> -Bug: https://sourceforge.net/p/w3m/patches/53/ - ---- w3m.orig/file.c 2007-05-23 17:06:05.000000000 +0200 -+++ w3m/file.c 2008-09-06 08:46:00.000000000 +0200 -@@ -4240,15 +4240,15 @@ getMetaRefreshParam(char *q, Str *refres - while (*q) { - if (!strncasecmp(q, "url=", 4)) { - q += 4; -- if (*q == '\"') /* " */ -+ if (*q == '\"' || *q == '\'') /* " or ' */ - q++; - r = q; - while (*r && !IS_SPACE(*r) && *r != ';') - r++; - s_tmp = Strnew_charp_n(q, r - q); - -- if (s_tmp->ptr[s_tmp->length - 1] == '\"') { /* " -- */ -+ if (s_tmp->ptr[s_tmp->length - 1] == '\"' /* " */ -+ || s_tmp->ptr[s_tmp->length - 1] == '\'') { /* ' */ - s_tmp->length--; - s_tmp->ptr[s_tmp->length] = '\0'; - } diff --git a/debian/patches/280_search-next.patch b/debian/patches/280_search-next.patch deleted file mode 100644 index c66254b..0000000 --- a/debian/patches/280_search-next.patch +++ /dev/null @@ -1,19 +0,0 @@ -Subject: Fix crash after SEARCH_NEXT -From: AIDA Shinra <shinra@j10n.org> -Origin: http://www.j10n.org/files/w3m-cvs-1.1055-search-next.patch - - Patch from [w3m-dev:04473] on 2013-12-07. - ---- w3m.orig/main.c Mon Oct 14 02:20:37 2013 -+++ w3m/main.c Sat Dec 7 00:33:36 2013 -@@ -1928,6 +1928,10 @@ - result = srchcore(SearchString, routine[reverse]); - if (result & SR_FOUND) - clear_mark(Currentbuf->currentLine); -+ else { -+ if (reverse == 0) -+ Currentbuf->pos -= 1; -+ } - displayBuffer(Currentbuf, B_NORMAL); - disp_srchresult(result, (reverse ? "Backward: " : "Forward: "), - SearchString); diff --git a/debian/patches/290_closedir.patch b/debian/patches/290_closedir.patch deleted file mode 100644 index 04fafdf..0000000 --- a/debian/patches/290_closedir.patch +++ /dev/null @@ -1,19 +0,0 @@ -Subject: Fix a directory descriptor leak in loadLocalDir -Author: Reinhard Max <max@suse.de> -Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-closedir.patch -Bug-Novell: https://bugzilla.novell.com/show_bug.cgi?id=531675 - - Mon Sep 7 16:49:56 CEST 2009 - max@suse.de - - Added w3m-closedir.patch to fix a directory descriptor leak in - loadLocalDir (bnc#531675). - ---- w3m.orig/local.c -+++ w3m/local.c -@@ -109,6 +109,7 @@ loadLocalDir(char *dname) - n++; - } - } -+ closedir(d); - - if (multicolList) { - l = COLS / (maxlen + 2); diff --git a/debian/patches/300_manual-links.patch b/debian/patches/300_manual-links.patch deleted file mode 100644 index 5c46065..0000000 --- a/debian/patches/300_manual-links.patch +++ /dev/null @@ -1,32 +0,0 @@ -Subject: Cleanup unusable links in MANUAL.html -From: Tatsuya Kinoshita <tats@debian.org> -Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=517315 - -diff --git a/doc-jp/MANUAL.html b/doc-jp/MANUAL.html -index 41d70f1..c9d0d5b 100644 ---- a/doc-jp/MANUAL.html -+++ b/doc-jp/MANUAL.html -@@ -489,8 +489,7 @@ w3m - w3mȤСHTTPФʤCGIץȤư뤳ȤǤޤ - ΤȤw3mФΤդƥץȤưνϤ - ɤߤɽ櫓Ǥ --<a href="file:///$LIB/w3mbookmark?mode=panel&bmark=~/.w3m/bookmark.html&url=MANUAL.html&title=w3m+manual">֥åޡϿ</a> --<a href="file:///$LIB/w3mhelperpanel?mode=panel">ӥ塼Խ</a> -+֥åޡϿȳӥ塼Խ - ϡlocal CGIΥץȤȤƼ¸Ƥޤ - local CGIȤСw3mѤΥեϥեȤ - ȤȤǤޤ -diff --git a/doc/MANUAL.html b/doc/MANUAL.html -index aff0189..04800d8 100644 ---- a/doc/MANUAL.html -+++ b/doc/MANUAL.html -@@ -468,8 +468,7 @@ and <a href="keymap.lynx">keymap.lynx</a>) as examples. - You can run CGI scripts using w3m, without any HTTP server. - It means that w3m behaves like an HTTP server and activates CGI script, - then w3m reads the output of the script and display it. The --<a href="file:///$LIB/w3mbookmark?mode=panel&bmark=~/.w3m/bookmark.html&url=MANUAL.html&title=w3m+manual">bookmark registration</a> --and <a href="file:///$LIB/w3mhelperpanel?mode=panel">helper-app editor</a> -+bookmark registration and helper-app editor - are realized as local CGI scripts. - Using local CGI, w3m can be used as a general purpose form interface. - <P> diff --git a/debian/patches/310_doc-ascii.patch b/debian/patches/310_doc-ascii.patch deleted file mode 100644 index 88ad60b..0000000 --- a/debian/patches/310_doc-ascii.patch +++ /dev/null @@ -1,79 +0,0 @@ -Subject: Prefer US-ASCII rathar than Japanese encodings in English documents -From: Tatsuya Kinoshita <tats@debian.org> - -diff --git a/doc/HISTORY b/doc/HISTORY -index b8f5b94..7f7ae2b 100644 ---- a/doc/HISTORY -+++ b/doc/HISTORY -@@ -588,7 +588,7 @@ From: Okabe Katsuya <okabek@guitar.ocn.ne.jp> - * space characters in a buffer are mapped into 0x80-0x9f. - * unprintable characters (0x80-0xa0) are displayed as \xxx. - --From: Tsutomu Okada ($B2,ED(B $BJY(B) <okada@furuno.co.jp> -+From: Tsutomu Okada <okada@furuno.co.jp> - Subject: [w3m-dev 01354] minimize when #undef USE_GOPHER or USE_NNTP - - 2000/11/16 -@@ -1422,7 +1422,7 @@ HTML4.0 ID attribute support. - - From: Okabe Katsuya <okabe@fphy.hep.okayama-u.ac.jp> - table get weird when it contains <input type=hidden>. --$B=$@5!%(B -+Fixed. - - 2000.2.12 - From: Rogue Metal - Jake Moorman <roguemtl@stampede.org> -@@ -1649,15 +1649,15 @@ From: patakuti - If an <input type=button> tag has no `name' attribute, - w3m adds it an inappropriate name attribute. - --From: $B$d$^(B -+From: Yama - Now w3m can handle a frameset that has both ROWS and COLS. - - From: aito - Now bookmarking is done by a separate command w3mbookmark. - --C-s $B$G2hLLI=<($,;_$^$C$F$$$?%P%0$N=$@5!%(B -+Bug fix that C-s hangs. - --$BJ8;zF~NO;~$K(B C-g $B$GCf;_$G$-$k$h$&$K$7$?!%(B -+Enable C-g to quit for keyboard input. - - From: hovav@cs.stanford.edu - When downloading a file, an attempt to save it to a non-exist -@@ -1699,7 +1699,7 @@ Menu behavior is changed. - * Clicking outside the menu causes cancellation of sub-menu. - * <, >, +, - abandoned - --From: $B$*$+$@(B <okada@furuno.co.jp> -+From: Okada <okada@furuno.co.jp> - Now C-a/C-e are bound to 'jump to the first/last item in menu.' - - From: "OMAE, jun" <jun-o@osb.att.ne.jp> -diff --git a/doc/README.cookie b/doc/README.cookie -index 56cca50..da16947 100644 ---- a/doc/README.cookie -+++ b/doc/README.cookie -@@ -37,7 +37,7 @@ cookie support of w3m - (HDN: host domain name) - - -- If the number of "." in domain name is lesser than 2, it is -+ * If the number of "." in domain name is lesser than 2, it is - assumed as invalid cookie (cf. RFC 2109 4.3.2), however, you can - use cookie_avoid_wrong_number_of_dots to avoid this - restriction. You can set this in "Domains to avoid [wrong number -diff --git a/doc/README.m17n b/doc/README.m17n -index c064d76..da5408b 100644 ---- a/doc/README.m17n -+++ b/doc/README.m17n -@@ -49,7 +49,7 @@ Supported encoding schemes (character set) - * Thai - TIS-620 (ISO-8859-11), CP874 - * Other -- US_ASCII, ISO-8859-1 10, 13 15, -+ US_ASCII, ISO-8859-1 - 10, 13 - 15, - KOI8-R, KOI8-U, NeXT, CP437, CP737, CP775, CP850, CP852, CP855, CP856, - CP857, CP860, CP861, CP862, CP863, CP864, CP865, CP866, CP869, CP1006, - CP1250, CP1251, CP1252, CP1253, CP1254, CP1255, CP1256, CP1257 diff --git a/debian/patches/320_imlib2-config.patch b/debian/patches/320_imlib2-config.patch deleted file mode 100644 index 1c27468..0000000 --- a/debian/patches/320_imlib2-config.patch +++ /dev/null @@ -1,67 +0,0 @@ -Subject: Use pkg-config to build with imlib2 1.4.6 -From: Tatsuya Kinoshita <tats@debian.org> - -diff --git a/acinclude.m4 b/acinclude.m4 -index e4ccc3d..56d6338 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -649,6 +649,9 @@ AC_DEFUN([AC_W3M_IMAGE], - fi;; - imlib2) - with_imlib2="yes" -+ if test x"$PKG_CONFIG" = x; then -+ PKG_CONFIG=pkg-config -+ fi - if test x"$IMLIB2_CONFIG" = x; then - IMLIB2_CONFIG=imlib2-config - fi;; -@@ -728,7 +731,7 @@ AC_DEFUN([AC_W3M_IMAGE], - IMGTARGETS="x11" - AC_DEFINE(USE_IMLIB2) - IMGX11CFLAGS="`${IMLIB2_CONFIG} --cflags`" -- IMGX11LDFLAGS="`${IMLIB2_CONFIG} --libs`" -+ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs imlib2`" - else - AC_MSG_WARN([unable to build w3mimgdisplay with X11 support]) - fi -@@ -756,7 +759,7 @@ AC_DEFUN([AC_W3M_IMAGE], - AC_DEFINE(USE_IMLIB2) - IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o" - IMGFBCFLAGS="`${IMLIB2_CONFIG} --cflags`" -- IMGFBLDFLAGS="`${IMLIB2_CONFIG} --libs`" -+ IMGFBLDFLAGS="`${PKG_CONFIG} --libs imlib2`" - else - AC_MSG_WARN([unable to build w3mimgdisplay with FB support]) - fi -diff --git a/configure b/configure -index 4c1bc06..01153c1 100755 ---- a/configure -+++ b/configure -@@ -6811,6 +6811,9 @@ $as_echo "$with_imagelib" >&6; } - fi;; - imlib2) - with_imlib2="yes" -+ if test x"$PKG_CONFIG" = x; then -+ PKG_CONFIG=pkg-config -+ fi - if test x"$IMLIB2_CONFIG" = x; then - IMLIB2_CONFIG=imlib2-config - fi;; -@@ -6955,7 +6958,7 @@ $as_echo "$as_me: WARNING: Imlib2 is not installed. Install Imlib2 (version >= - $as_echo "#define USE_IMLIB2 1" >>confdefs.h - - IMGX11CFLAGS="`${IMLIB2_CONFIG} --cflags`" -- IMGX11LDFLAGS="`${IMLIB2_CONFIG} --libs`" -+ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs imlib2`" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to build w3mimgdisplay with X11 support" >&5 - $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with X11 support" >&2;} -@@ -6991,7 +6994,7 @@ $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with X11 support" >&2;} - - IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o" - IMGFBCFLAGS="`${IMLIB2_CONFIG} --cflags`" -- IMGFBLDFLAGS="`${IMLIB2_CONFIG} --libs`" -+ IMGFBLDFLAGS="`${PKG_CONFIG} --libs imlib2`" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to build w3mimgdisplay with FB support" >&5 - $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with FB support" >&2;} diff --git a/debian/patches/330_Disable-weak-ciphers.patch b/debian/patches/330_Disable-weak-ciphers.patch deleted file mode 100644 index a243c61..0000000 --- a/debian/patches/330_Disable-weak-ciphers.patch +++ /dev/null @@ -1,16 +0,0 @@ -Subject: Disable ciphers that use keys smaller than 128 bits -From: Tatsuya Kinoshita <tats@debian.org> -Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/1325674 - -diff --git a/url.c b/url.c -index ed6062e..e6b51c8 100644 ---- a/url.c -+++ b/url.c -@@ -326,6 +326,7 @@ openSSLHandle(int sock, char *hostname, char **p_cert) - SSL_load_error_strings(); - if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method()))) - goto eend; -+ SSL_CTX_set_cipher_list(ssl_ctx, "DEFAULT:!LOW:!EXP"); - option = SSL_OP_ALL; - if (ssl_forbid_method) { - if (strchr(ssl_forbid_method, '2')) diff --git a/debian/patches/340_ssl-init.patch b/debian/patches/340_ssl-init.patch deleted file mode 100644 index b47bbb6..0000000 --- a/debian/patches/340_ssl-init.patch +++ /dev/null @@ -1,50 +0,0 @@ -Subject: Force ssl_verify_server on, and disable SSLv2 and SSLv3 -Author: Ludwig Nussel <ludwig.nussel@suse.de>, Tatsuya Kinoshita <tats@debian.org> -Origin: http://www.openwall.com/lists/oss-security/2010/06/14/4 - - Update README.SSL to follow default values - - Disable SSLv3 by default [CVE-2014-3566] - cf. https://blog.mozilla.org/security/2014/10/14/the-poodle-attack-and-the-end-of-ssl-3-0/ - - Force ssl_verify_server on and disable SSLv2 support - Origin: http://www.openwall.com/lists/oss-security/2010/06/14/4 - -diff --git a/doc-jp/README.SSL b/doc-jp/README.SSL -index 4aedfde..670ed5f 100644 ---- a/doc-jp/README.SSL -+++ b/doc-jp/README.SSL -@@ -25,9 +25,9 @@ SSL - - ssl_forbid_method - ȤʤSSLåɤΥꥹ(2: SSLv2, 3: SSLv3, t: TLSv1) -- (ǥեȤ<NULL>). -+ (ǥեȤ2, 3). - ssl_verify_server ON/OFF -- SSLΥǧڤԤ(ǥեȤOFF). -+ SSLΥǧڤԤ(ǥեȤON). - ssl_cert_file ե̾ - SSLΥ饤PEMե(ǥեȤ<NULL>). - ssl_key_file ե̾ -diff --git a/fm.h b/fm.h -index 8378939..ddcd4fc 100644 ---- a/fm.h -+++ b/fm.h -@@ -1135,7 +1135,7 @@ global int view_unseenobject init(TRUE); - #endif - - #if defined(USE_SSL) && defined(USE_SSL_VERIFY) --global int ssl_verify_server init(FALSE); -+global int ssl_verify_server init(TRUE); - global char *ssl_cert_file init(NULL); - global char *ssl_key_file init(NULL); - global char *ssl_ca_path init(NULL); -@@ -1144,7 +1144,7 @@ global int ssl_path_modified init(FALSE); - #endif /* defined(USE_SSL) && - * defined(USE_SSL_VERIFY) */ - #ifdef USE_SSL --global char *ssl_forbid_method init(NULL); -+global char *ssl_forbid_method init("2, 3"); - #endif - - global int is_redisplay init(FALSE); diff --git a/debian/patches/350_ambwidth.patch b/debian/patches/350_ambwidth.patch deleted file mode 100644 index 4c2f926..0000000 --- a/debian/patches/350_ambwidth.patch +++ /dev/null @@ -1,239 +0,0 @@ -Subject: Fix incorrect generation of ucs_ambwidth_map -Author: Tatsuya Kinoshita <tats@debian.org> - -diff --git a/libwc/ambwidth_map.awk b/libwc/ambwidth_map.awk -index 8544f58..1d9d25f 100644 ---- a/libwc/ambwidth_map.awk -+++ b/libwc/ambwidth_map.awk -@@ -3,9 +3,15 @@ BEGIN { - i = 0; - } - $2 == "A" { -- code = sprintf("0x%s", $1); -- if (strtonum(code) < 0x10000) { -- map[i] = code -+ code = code2 = strtonum(sprintf("0x%s", $1)) -+ if (match($1, /[.]+[0-9A-Fa-f]+/)) { -+ s = substr($1, RSTART, RLENGTH) -+ sub(/[.]+/, "0x", s) -+ code2 = strtonum(s) -+ } -+ for (; code <= code2; code++) { -+ if (code >= 0x10000) { break } -+ map[i] = sprintf("0x%04X", code) - i++; - } - } -@@ -15,28 +21,14 @@ END { - prev = strtonum(map[0]); - for (j = 1; j < i; j++) { - cur = strtonum(map[j]); -- if (match(map[j], "[.]+")) { -+ if (cur - prev > 1) { - map2[n] = sprintf("%s, %s", start, map[j - 1]); - n++; -- gsub("[.]+", ", 0x", map[j]) -- map2[n] = map[j]; -- n++; -- start = map[j + 1]; -- cur = strtonum(start); -- } else { -- if (cur - prev > 2) { -- map2[n] = sprintf("%s, %s", start, map[j - 1]); -- start = map[j]; -- n++; -- } -- -- if (j == i - 1) { -- map2[n] = sprintf("%s, %s", start, map[j]); -- n++; -- } -+ start = map[j]; - } - prev = cur; - } -+ if (i > 0) { map2[n] = sprintf("%s, %s", start, map[i - 1]); n++ } - - printf("static wc_map ucs_ambwidth_map[] = {\n"); - for (j = 0; j < n; j++) { -diff --git a/libwc/map/ucs_ambwidth.map b/libwc/map/ucs_ambwidth.map -index 6f03ba8..35ceedb 100644 ---- a/libwc/map/ucs_ambwidth.map -+++ b/libwc/map/ucs_ambwidth.map -@@ -1,50 +1,82 @@ - static wc_map ucs_ambwidth_map[] = { - { 0x00A1, 0x00A1 }, - { 0x00A4, 0x00A4 }, -- { 0x00A7, 0x00AA }, -- { 0x00AD, 0x00BF }, -+ { 0x00A7, 0x00A8 }, -+ { 0x00AA, 0x00AA }, -+ { 0x00AD, 0x00AE }, -+ { 0x00B0, 0x00B4 }, -+ { 0x00B6, 0x00BA }, -+ { 0x00BC, 0x00BF }, - { 0x00C6, 0x00C6 }, - { 0x00D0, 0x00D0 }, - { 0x00D7, 0x00D8 }, - { 0x00DE, 0x00E1 }, -- { 0x00E6, 0x00ED }, -- { 0x00F0, 0x00F3 }, -- { 0x00F7, 0x00FE }, -+ { 0x00E6, 0x00E6 }, -+ { 0x00E8, 0x00EA }, -+ { 0x00EC, 0x00ED }, -+ { 0x00F0, 0x00F0 }, -+ { 0x00F2, 0x00F3 }, -+ { 0x00F7, 0x00FA }, -+ { 0x00FC, 0x00FC }, -+ { 0x00FE, 0x00FE }, - { 0x0101, 0x0101 }, -- { 0x0111, 0x0113 }, -+ { 0x0111, 0x0111 }, -+ { 0x0113, 0x0113 }, - { 0x011B, 0x011B }, - { 0x0126, 0x0127 }, - { 0x012B, 0x012B }, - { 0x0131, 0x0133 }, - { 0x0138, 0x0138 }, -- { 0x013F, 0x0144 }, -- { 0x0148, 0x014D }, -+ { 0x013F, 0x0142 }, -+ { 0x0144, 0x0144 }, -+ { 0x0148, 0x014B }, -+ { 0x014D, 0x014D }, - { 0x0152, 0x0153 }, - { 0x0166, 0x0167 }, - { 0x016B, 0x016B }, -- { 0x01CE, 0x01DC }, -+ { 0x01CE, 0x01CE }, -+ { 0x01D0, 0x01D0 }, -+ { 0x01D2, 0x01D2 }, -+ { 0x01D4, 0x01D4 }, -+ { 0x01D6, 0x01D6 }, -+ { 0x01D8, 0x01D8 }, -+ { 0x01DA, 0x01DA }, -+ { 0x01DC, 0x01DC }, - { 0x0251, 0x0251 }, - { 0x0261, 0x0261 }, - { 0x02C4, 0x02C4 }, -- { 0x02C7, 0x02CD }, -+ { 0x02C7, 0x02C7 }, -+ { 0x02C9, 0x02CB }, -+ { 0x02CD, 0x02CD }, - { 0x02D0, 0x02D0 }, -- { 0x02D8, 0x02DF }, -+ { 0x02D8, 0x02DB }, -+ { 0x02DD, 0x02DD }, -+ { 0x02DF, 0x02DF }, - { 0x0300, 0x036F }, -- { 0x0391, 0x03A9 }, -- { 0x03B1, 0x03C9 }, -+ { 0x0391, 0x03A1 }, -+ { 0x03A3, 0x03A9 }, -+ { 0x03B1, 0x03C1 }, -+ { 0x03C3, 0x03C9 }, - { 0x0401, 0x0401 }, -- { 0x0410, 0x0451 }, -+ { 0x0410, 0x044F }, -+ { 0x0451, 0x0451 }, - { 0x2010, 0x2010 }, -- { 0x2013, 0x2019 }, -+ { 0x2013, 0x2016 }, -+ { 0x2018, 0x2019 }, - { 0x201C, 0x201D }, -- { 0x2020, 0x2027 }, -- { 0x2030, 0x2035 }, -+ { 0x2020, 0x2022 }, -+ { 0x2024, 0x2027 }, -+ { 0x2030, 0x2030 }, -+ { 0x2032, 0x2033 }, -+ { 0x2035, 0x2035 }, - { 0x203B, 0x203B }, - { 0x203E, 0x203E }, - { 0x2074, 0x2074 }, -- { 0x207F, 0x2084 }, -+ { 0x207F, 0x207F }, -+ { 0x2081, 0x2084 }, - { 0x20AC, 0x20AC }, -- { 0x2103, 0x2105 }, -+ { 0x2103, 0x2103 }, -+ { 0x2105, 0x2105 }, - { 0x2109, 0x2109 }, - { 0x2113, 0x2113 }, - { 0x2116, 0x2116 }, -@@ -52,21 +84,28 @@ static wc_map ucs_ambwidth_map[] = { - { 0x2126, 0x2126 }, - { 0x212B, 0x212B }, - { 0x2153, 0x2154 }, -- { 0x215B, 0x216B }, -+ { 0x215B, 0x215E }, -+ { 0x2160, 0x216B }, - { 0x2170, 0x2179 }, - { 0x2189, 0x2189 }, - { 0x2190, 0x2199 }, - { 0x21B8, 0x21B9 }, -- { 0x21D2, 0x21D4 }, -+ { 0x21D2, 0x21D2 }, -+ { 0x21D4, 0x21D4 }, - { 0x21E7, 0x21E7 }, -- { 0x2200, 0x2203 }, -+ { 0x2200, 0x2200 }, -+ { 0x2202, 0x2203 }, - { 0x2207, 0x2208 }, - { 0x220B, 0x220B }, -- { 0x220F, 0x2211 }, -+ { 0x220F, 0x220F }, -+ { 0x2211, 0x2211 }, - { 0x2215, 0x2215 }, - { 0x221A, 0x221A }, - { 0x221D, 0x2220 }, -- { 0x2223, 0x222E }, -+ { 0x2223, 0x2223 }, -+ { 0x2225, 0x2225 }, -+ { 0x2227, 0x222C }, -+ { 0x222E, 0x222E }, - { 0x2234, 0x2237 }, - { 0x223C, 0x223D }, - { 0x2248, 0x2248 }, -@@ -83,11 +122,13 @@ static wc_map ucs_ambwidth_map[] = { - { 0x22A5, 0x22A5 }, - { 0x22BF, 0x22BF }, - { 0x2312, 0x2312 }, -- { 0x2460, 0x254B }, -+ { 0x2460, 0x24E9 }, -+ { 0x24EB, 0x254B }, - { 0x2550, 0x2573 }, - { 0x2580, 0x258F }, - { 0x2592, 0x2595 }, -- { 0x25A0, 0x25A9 }, -+ { 0x25A0, 0x25A1 }, -+ { 0x25A3, 0x25A9 }, - { 0x25B2, 0x25B3 }, - { 0x25B6, 0x25B7 }, - { 0x25BC, 0x25BD }, -@@ -101,12 +142,20 @@ static wc_map ucs_ambwidth_map[] = { - { 0x2609, 0x2609 }, - { 0x260E, 0x260F }, - { 0x2614, 0x2615 }, -- { 0x261C, 0x261E }, -- { 0x2640, 0x2642 }, -- { 0x2660, 0x266F }, -+ { 0x261C, 0x261C }, -+ { 0x261E, 0x261E }, -+ { 0x2640, 0x2640 }, -+ { 0x2642, 0x2642 }, -+ { 0x2660, 0x2661 }, -+ { 0x2663, 0x2665 }, -+ { 0x2667, 0x266A }, -+ { 0x266C, 0x266D }, -+ { 0x266F, 0x266F }, - { 0x269E, 0x269F }, - { 0x26BE, 0x26BF }, -- { 0x26C4, 0x26E3 }, -+ { 0x26C4, 0x26CD }, -+ { 0x26CF, 0x26E1 }, -+ { 0x26E3, 0x26E3 }, - { 0x26E8, 0x26FF }, - { 0x273D, 0x273D }, - { 0x2757, 0x2757 }, diff --git a/debian/patches/360_libressl.patch b/debian/patches/360_libressl.patch deleted file mode 100644 index 15d36f5..0000000 --- a/debian/patches/360_libressl.patch +++ /dev/null @@ -1,19 +0,0 @@ -Subject: Disable USE_EGD for LibreSSL -Author: Vsevolod Stakhov <vsevolod@FreeBSD.org> -Origin: https://bz-attachments.freebsd.org/attachment.cgi?id=144635 -Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191852 -Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191956 - -diff --git a/config.h.in b/config.h.in -index a4110ea..3b575e4 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -85,7 +85,7 @@ - #undef INET6 - #undef HAVE_SOCKLEN_T - #undef HAVE_OLD_SS_FAMILY --#define USE_EGD -+#undef USE_EGD - #define ENABLE_REMOVE_TRAILINGSPACES - #undef MENU_THIN_FRAME - #undef USE_RAW_SCROLL diff --git a/debian/patches/370_gtk2-pkg-config.patch b/debian/patches/370_gtk2-pkg-config.patch deleted file mode 100644 index 5714fc5..0000000 --- a/debian/patches/370_gtk2-pkg-config.patch +++ /dev/null @@ -1,31 +0,0 @@ -Subject: Assume defined PKG_CONFIG points right location when gtk2 -Author: OBATA Akio <obache@netbsd.org> -Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/w3m/patches/patch-aa?rev=1.13&content-type=text/x-cvsweb-markup -Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/w3m/patches/patch-ak?rev=1.1&content-type=text/x-cvsweb-markup - -diff --git a/acinclude.m4 b/acinclude.m4 -index c1d112b..d768476 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -664,8 +664,6 @@ AC_DEFUN([AC_W3M_IMAGE], - with_gtk2="yes" - if test x"$PKG_CONFIG" = x; then - PKG_CONFIG=pkg-config -- else -- PKG_CONFIG=: - fi;; - esac - done -diff --git a/configure b/configure -index ec7f11e..b5adbb5 100755 ---- a/configure -+++ b/configure -@@ -6826,8 +6826,6 @@ $as_echo "$with_imagelib" >&6; } - with_gtk2="yes" - if test x"$PKG_CONFIG" = x; then - PKG_CONFIG=pkg-config -- else -- PKG_CONFIG=: - fi;; - esac - done diff --git a/debian/patches/380_tinfo.patch b/debian/patches/380_tinfo.patch deleted file mode 100644 index 7eb1a24..0000000 --- a/debian/patches/380_tinfo.patch +++ /dev/null @@ -1,44 +0,0 @@ -Subject: Add tinfo to with_termlib -Author: Jeroen Roovers <jer@gentoo.org> -Origin: https://504588.bugs.gentoo.org/attachment.cgi?id=372650 -Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=504588 - -diff --git a/acinclude.m4 b/acinclude.m4 -index d768476..94fcbb5 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -400,10 +400,10 @@ AC_DEFUN([AC_W3M_TERMLIB], - AC_ARG_WITH(termlib, - [ --with-termlib[=LIBS] terminal library - LIBS is space separated list of: -- terminfo mytinfo termcap ncurses curses],, -+ terminfo mytinfo termcap tinfo ncurses curses],, - [with_termlib="yes"]) - AC_MSG_RESULT($with_termlib) -- test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap ncurses curses" -+ test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap tinfo ncurses curses" - for lib in $with_termlib; do - AC_CHECK_LIB($lib, tgetent, [W3M_LIBS="$W3M_LIBS -l$lib"; break]) - done -diff --git a/configure b/configure -index b5adbb5..fd916fc 100755 ---- a/configure -+++ b/configure -@@ -1490,7 +1490,7 @@ Optional Packages: - --with-ssl=PREFIX support https protocol - --with-termlib=LIBS terminal library - LIBS is space separated list of: -- terminfo mytinfo termcap ncurses curses -+ terminfo mytinfo termcap tinfo ncurses curses - --with-gc=PREFIX libgc PREFIX - - Some influential environment variables: -@@ -7978,7 +7978,7 @@ fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_termlib" >&5 - $as_echo "$with_termlib" >&6; } -- test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap ncurses curses" -+ test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap tinfo ncurses curses" - for lib in $with_termlib; do - as_ac_Lib=`$as_echo "ac_cv_lib_$lib''_tgetent" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -l$lib" >&5 diff --git a/debian/patches/390_gdk-pixbuf.patch b/debian/patches/390_gdk-pixbuf.patch deleted file mode 100644 index eb6149f..0000000 --- a/debian/patches/390_gdk-pixbuf.patch +++ /dev/null @@ -1,82 +0,0 @@ -Subject: Depend on gdk-pixbuf instead of gtk when gtk2 -Author: Naohiro Aota <naota@gentoo.org> -Origin: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/w3m/files/w3m-0.5.3-gdk-pixbuf.patch?revision=1.1 - -diff --git a/acinclude.m4 b/acinclude.m4 -index 94fcbb5..ec91797 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -706,8 +706,8 @@ AC_DEFUN([AC_W3M_IMAGE], - IMGTARGETS="x11" - AC_DEFINE(USE_GDKPIXBUF) - AC_DEFINE(USE_GTK2) -- IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" -- IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" -+ IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0`" -+ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0`" - elif test x"$have_gdkpixbuf" = xyes; then - AC_DEFINE(USE_W3MIMG_X11) - IMGOBJS="$IMGOBJS x11/x11_w3mimg.o" -@@ -741,8 +741,8 @@ AC_DEFUN([AC_W3M_IMAGE], - IMGTARGETS="${IMGTARGETS} fb" - AC_DEFINE(USE_GDKPIXBUF) - AC_DEFINE(USE_GTK2) -- IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gtk+-2.0`" -- IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gtk+-2.0`" -+ IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0`" -+ IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0`" - elif test x"$have_gdkpixbuf" = xyes; then - AC_DEFINE(USE_W3MIMG_FB) - IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o" -diff --git a/configure b/configure -index fd916fc..4fdcd8e 100755 ---- a/configure -+++ b/configure -@@ -6927,8 +6927,8 @@ $as_echo "$as_me: WARNING: Imlib2 is not installed. Install Imlib2 (version >= - - $as_echo "#define USE_GTK2 1" >>confdefs.h - -- IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" -- IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`" -+ IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0`" -+ IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0`" - elif test x"$have_gdkpixbuf" = xyes; then - $as_echo "#define USE_W3MIMG_X11 1" >>confdefs.h - -@@ -6972,8 +6972,8 @@ $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with X11 support" >&2;} - - $as_echo "#define USE_GTK2 1" >>confdefs.h - -- IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gtk+-2.0`" -- IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gtk+-2.0`" -+ IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0`" -+ IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0`" - elif test x"$have_gdkpixbuf" = xyes; then - $as_echo "#define USE_W3MIMG_FB 1" >>confdefs.h - -diff --git a/w3mimg/fb/fb_gdkpixbuf.c b/w3mimg/fb/fb_gdkpixbuf.c -index 36e3b62..f1e8d97 100644 ---- a/w3mimg/fb/fb_gdkpixbuf.c -+++ b/w3mimg/fb/fb_gdkpixbuf.c -@@ -6,7 +6,7 @@ - #include "config.h" - #if defined(USE_GTK2) - #include <glib-object.h> --#include <gdk/gdk.h> -+#include <gdk-pixbuf/gdk-pixbuf.h> - #endif - #include <gdk-pixbuf/gdk-pixbuf.h> - #include "fb.h" -diff --git a/w3mimg/x11/x11_w3mimg.c b/w3mimg/x11/x11_w3mimg.c -index f5be4a8..cef72e2 100644 ---- a/w3mimg/x11/x11_w3mimg.c -+++ b/w3mimg/x11/x11_w3mimg.c -@@ -14,7 +14,7 @@ - #elif defined(USE_GDKPIXBUF) - #if defined(USE_GTK2) - #include <glib-object.h> --#include <gdk/gdk.h> -+#include <gdk-pixbuf/gdk-pixbuf.h> - #include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h> - #else - #include <gdk-pixbuf/gdk-pixbuf-xlib.h> diff --git a/debian/patches/400_w3m-img-freebsd.patch b/debian/patches/400_w3m-img-freebsd.patch deleted file mode 100644 index b6f0677..0000000 --- a/debian/patches/400_w3m-img-freebsd.patch +++ /dev/null @@ -1,831 +0,0 @@ -Subject: Support FreeBSD framebuffer -Author: Yusuke Baba <babayaga1@y8.dion.ne.jp> -Origin: http://www.ac.auone-net.jp/~baba/w3m-img/index.html -Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=122673 - -diff --git a/acinclude.m4 b/acinclude.m4 -index ec91797..675cabe 100644 ---- a/acinclude.m4 -+++ b/acinclude.m4 -@@ -600,7 +600,7 @@ AC_DEFUN([AC_W3M_IMAGE], - if test x"$enable_image" = xyes; then - enable_image=x11 - case "`uname -s`" in -- Linux|linux|LINUX) -+ Linux|linux|LINUX|FreeBSD|freebsd|FREEBSD) - if test -c /dev/fb0; then - enable_image=x11,fb - fi;; -diff --git a/configure b/configure -index 4fdcd8e..2ba82d5 100755 ---- a/configure -+++ b/configure -@@ -6755,7 +6755,7 @@ $as_echo "$enable_image" >&6; } - if test x"$enable_image" = xyes; then - enable_image=x11 - case "`uname -s`" in -- Linux|linux|LINUX) -+ Linux|linux|LINUX|FreeBSD|freebsd|FREEBSD) - if test -c /dev/fb0; then - enable_image=x11,fb - fi;; -diff --git a/w3mimg/fb/fb.c b/w3mimg/fb/fb.c -index cd11128..7b6f23b 100644 ---- a/w3mimg/fb/fb.c -+++ b/w3mimg/fb/fb.c -@@ -12,12 +12,24 @@ - #include <errno.h> - #include <sys/ioctl.h> - #include <sys/mman.h> -+#if defined(__linux__) - #include <linux/fb.h> -+#elif defined(__FreeBSD__) -+#include <sys/fbio.h> -+#endif -+#if defined(__FreeBSD__) -+#include <sys/types.h> -+#include <machine/param.h> -+#endif - - #include "fb.h" - - #define FB_ENV "FRAMEBUFFER" -+#if defined(__linux__) - #define FB_DEFDEV "/dev/fb0" -+#elif defined(__FreeBSD__) -+#define FB_DEFDEV "/dev/ttyv0" -+#endif - - #define MONO_OFFSET_8BIT 0x40 - #define COLORS_MONO_8BIT 0x40 -@@ -38,22 +50,65 @@ - - #define IMAGE_SIZE_MAX 10000 - -+#if defined(__linux__) - static struct fb_cmap *fb_cmap_create(struct fb_fix_screeninfo *, - struct fb_var_screeninfo *); -+#elif defined(__FreeBSD__) -+static video_color_palette_t *fb_cmap_create(video_info_t *video_info, -+ video_adapter_info_t *video_adapter_info); -+#endif -+#if defined(__linux__) - static void fb_cmap_destroy(struct fb_cmap *cmap); -+#elif defined(__FreeBSD__) -+static void fb_cmap_destroy(video_color_palette_t *cmap); -+#endif -+#if defined(__linux__) - static int fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo); -+#endif -+#if defined(__linux__) - static void *fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo); -+#elif defined(__FreeBSD__) -+static void *fb_mmap(int fbfp, video_adapter_info_t *video_adapter_info); -+#endif -+#if defined(__linux__) - static int fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo); -+#elif defined(__FreeBSD__) -+static int fb_munmap(void *buf, video_adapter_info_t *video_adapter_info); -+#endif -+#if defined(__linux__) - static int fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo); -+#endif -+#if defined(__linux__) - static int fb_cmap_set(int fbfp, struct fb_cmap *cmap); -+#elif defined(__FreeBSD__) -+static int fb_cmap_set(int fbfp, video_color_palette_t *cmap); -+#endif -+#if defined(__linux__) - static int fb_cmap_get(int fbfp, struct fb_cmap *cmap); -+#elif defined(__FreeBSD__) -+static int fb_cmap_get(int fbfp, video_color_palette_t *cmap); -+#endif - static int fb_cmap_init(void); - static int fb_get_cmap_index(int r, int g, int b); - static unsigned long fb_get_packed_color(int r, int g, int b); -+#if defined(__FreeBSD__) -+static int fb_video_mode_get(int fbfp, int *video_mode); -+static int fb_video_info_get(int fbfp, video_info_t *video_info); -+static int fb_video_adapter_info_get(int fbfp, video_adapter_info_t *video_adapter_info); -+#endif - -+#if defined(__linux__) - static struct fb_fix_screeninfo fscinfo; - static struct fb_var_screeninfo vscinfo; -+#elif defined(__FreeBSD__) -+static video_info_t video_info; -+static video_adapter_info_t video_adapter_info; -+#endif -+#if defined(__linux__) - static struct fb_cmap *cmap = NULL, *cmap_org = NULL; -+#elif defined(__FreeBSD__) -+static video_color_palette_t *cmap = NULL, *cmap_org = NULL; -+#endif - static int is_open = FALSE; - static int fbfp = -1; - static size_t pixel_size = 0; -@@ -63,6 +118,9 @@ int - fb_open(void) - { - char *fbdev = { FB_DEFDEV }; -+#if defined(__FreeBSD__) -+ int video_mode; -+#endif - - if (is_open == TRUE) - return 1; -@@ -76,6 +134,7 @@ fb_open(void) - goto ERR_END; - } - -+#if defined(__linux__) - if (fb_fscrn_get(fbfp, &fscinfo)) { - goto ERR_END; - } -@@ -83,22 +142,67 @@ fb_open(void) - if (fb_vscrn_get(fbfp, &vscinfo)) { - goto ERR_END; - } -+#elif defined(__FreeBSD__) -+ if (fb_video_mode_get(fbfp, &video_mode)) { -+ goto ERR_END; -+ } -+ video_info.vi_mode = video_mode; -+ -+ if (fb_video_info_get(fbfp, &video_info)) { -+ goto ERR_END; -+ } - -+ if (fb_video_adapter_info_get(fbfp, &video_adapter_info)) { -+ goto ERR_END; -+ } -+ if (!(video_info.vi_flags & V_INFO_GRAPHICS) || -+ !(video_info.vi_flags & V_INFO_LINEAR)) { -+ goto ERR_END; -+ } -+#endif -+ -+#if defined(__linux__) - if ((cmap = fb_cmap_create(&fscinfo, &vscinfo)) == (struct fb_cmap *)-1) { - goto ERR_END; - } -+#elif defined(__FreeBSD__) -+ if ((cmap = fb_cmap_create(&video_info, &video_adapter_info)) == (video_color_palette_t *)-1) { -+ goto ERR_END; -+ } -+#endif - -+#if defined(__linux__) - if (!(buf = fb_mmap(fbfp, &fscinfo))) { - fprintf(stderr, "Can't allocate memory.\n"); - goto ERR_END; - } -+#elif defined(__FreeBSD__) -+ if (!(buf = fb_mmap(fbfp, &video_adapter_info))) { -+ fprintf(stderr, "Can't allocate memory.\n"); -+ goto ERR_END; -+ } -+#endif - -+#if defined(__linux__) - if (fscinfo.type != FB_TYPE_PACKED_PIXELS) { - fprintf(stderr, "This type of framebuffer is not supported.\n"); - goto ERR_END; - } -+#elif defined(__FreeBSD__) -+ if (!(video_info.vi_mem_model == V_INFO_MM_PACKED || -+ video_info.vi_mem_model == V_INFO_MM_DIRECT)) { -+ fprintf(stderr, "This type of framebuffer is not supported.\n"); -+ goto ERR_END; -+ } -+#endif - -+#if defined(__linux__) - if (fscinfo.visual == FB_VISUAL_PSEUDOCOLOR && vscinfo.bits_per_pixel == 8) { -+#elif defined(__FreeBSD__) -+ if (video_adapter_info.va_flags & V_ADP_PALETTE && -+ video_info.vi_mem_model == V_INFO_MM_PACKED && -+ video_info.vi_depth == 8) { -+#endif - if (fb_cmap_get(fbfp, cmap)) { - fprintf(stderr, "Can't get color map.\n"); - fb_cmap_destroy(cmap); -@@ -111,12 +215,20 @@ fb_open(void) - - pixel_size = 1; - } -+#if defined(__linux__) - else if ((fscinfo.visual == FB_VISUAL_TRUECOLOR || - fscinfo.visual == FB_VISUAL_DIRECTCOLOR) && - (vscinfo.bits_per_pixel == 15 || - vscinfo.bits_per_pixel == 16 || - vscinfo.bits_per_pixel == 24 || vscinfo.bits_per_pixel == 32)) { - pixel_size = (vscinfo.bits_per_pixel + 7) / CHAR_BIT; -+#elif defined(__FreeBSD__) -+ else if (video_info.vi_mem_model == V_INFO_MM_DIRECT && -+ (video_info.vi_depth == 15 || -+ video_info.vi_depth == 16 || -+ video_info.vi_depth == 24 || video_info.vi_depth == 32)) { -+ pixel_size = (video_info.vi_depth + 7) / CHAR_BIT; -+#endif - } - else { - fprintf(stderr, "This type of framebuffer is not supported.\n"); -@@ -147,7 +259,11 @@ fb_close(void) - cmap = NULL; - } - if (buf != NULL) { -+#if defined(__linux__) - fb_munmap(buf, &fscinfo); -+#elif defined(__FreeBSD__) -+ fb_munmap(buf, &video_adapter_info); -+#endif - buf = NULL; - } - -@@ -259,11 +375,19 @@ fb_image_draw(FB_IMAGE * image, int x, int y, int sx, int sy, int width, - if (y + height > fb_height()) - height = fb_height() - y; - -+#if defined(__linux__) - offset_fb = fscinfo.line_length * y + pixel_size * x; -+#elif defined(__FreeBSD__) -+ offset_fb = video_adapter_info.va_line_width * y + pixel_size * x; -+#endif - offset_img = image->rowstride * sy + pixel_size * sx; - for (i = 0; i < height; i++) { - memcpy(buf + offset_fb, image->data + offset_img, pixel_size * width); -+#if defined(__linux__) - offset_fb += fscinfo.line_length; -+#elif defined(__FreeBSD__) -+ offset_fb += video_adapter_info.va_line_width; -+#endif - offset_img += image->rowstride; - } - -@@ -336,7 +460,11 @@ fb_width(void) - if (is_open != TRUE) - return 0; - -+#if defined(__linux__) - return vscinfo.xres; -+#elif defined(__FreeBSD__) -+ return video_info.vi_width; -+#endif - } - - int -@@ -345,7 +473,11 @@ fb_height(void) - if (is_open != TRUE) - return 0; - -+#if defined(__linux__) - return vscinfo.yres; -+#elif defined(__FreeBSD__) -+ return video_info.vi_height; -+#endif - } - - int -@@ -369,7 +501,11 @@ fb_clear(int x, int y, int w, int h, int r, int g, int b) - h = fb_height() - y; - - if (tmp == NULL) { -+#if defined(__linux__) - tmp = malloc(fscinfo.line_length); -+#elif defined(__FreeBSD__) -+ tmp = malloc(video_adapter_info.va_line_width); -+#endif - if (tmp == NULL) - return 1; - } -@@ -384,10 +520,18 @@ fb_clear(int x, int y, int w, int h, int r, int g, int b) - gg = g; - bb = b; - } -+#if defined(__linux__) - offset_fb = fscinfo.line_length * y + pixel_size * x; -+#elif defined(__FreeBSD__) -+ offset_fb = video_adapter_info.va_line_width * y + pixel_size * x; -+#endif - for (i = 0; i < h; i++) { - memcpy(buf + offset_fb, tmp, pixel_size * w); -+#if defined(__linux__) - offset_fb += fscinfo.line_length; -+#elif defined(__FreeBSD__) -+ offset_fb += video_adapter_info.va_line_width; -+#endif - } - return 0; - } -@@ -400,11 +544,21 @@ fb_get_packed_color(int r, int g, int b) - return fb_get_cmap_index(r, g, b); - } - else { -+#if defined(__linux__) - return - ((r >> (CHAR_BIT - vscinfo.red.length)) << vscinfo.red.offset) + - ((g >> (CHAR_BIT - vscinfo.green.length)) << vscinfo.green. - offset) + - ((b >> (CHAR_BIT - vscinfo.blue.length)) << vscinfo.blue.offset); -+#elif defined(__FreeBSD__) -+ return -+ ((r >> (CHAR_BIT - video_info.vi_pixel_fsizes[0])) << -+ video_info.vi_pixel_fields[0]) + -+ ((g >> (CHAR_BIT - video_info.vi_pixel_fsizes[1])) << -+ video_info.vi_pixel_fields[1]) + -+ ((b >> (CHAR_BIT - video_info.vi_pixel_fsizes[2])) << -+ video_info.vi_pixel_fields[2]); -+#endif - } - } - -@@ -433,16 +587,31 @@ fb_cmap_init(void) - if (cmap == NULL) - return 1; - -+#if defined(__linux__) - if (cmap->len < COLOR_OFFSET_8BIT + COLORS_8BIT) { - fprintf(stderr, "Can't allocate enough color.\n"); - return 1; - } -+#elif defined(__FreeBSD__) -+ if (cmap->count < COLOR_OFFSET_8BIT + COLORS_8BIT) { -+ fprintf(stderr, "Can't allocate enough color.\n"); -+ return 1; -+ } -+#endif - - if (cmap_org == NULL) { -+#if defined(__linux__) - if ((cmap_org = - fb_cmap_create(&fscinfo, &vscinfo)) == (struct fb_cmap *)-1) { - return 1; - } -+#elif defined(__FreeBSD__) -+ if ((cmap_org = -+ fb_cmap_create(&video_info, &video_adapter_info)) == -+ (video_color_palette_t *)-1) { -+ return 1; -+ } -+#endif - - if (fb_cmap_get(fbfp, cmap_org)) { - fprintf(stderr, "Can't get color map.\n"); -@@ -452,8 +621,13 @@ fb_cmap_init(void) - } - } - -+#if defined(__linux__) - cmap->start = MONO_OFFSET_8BIT; - cmap->len = COLORS_8BIT + COLORS_MONO_8BIT; -+#elif defined(__FreeBSD__) -+ cmap->index = MONO_OFFSET_8BIT; -+ cmap->count = COLORS_8BIT + COLORS_MONO_8BIT; -+#endif - - for (lp = 0; lp < COLORS_MONO_8BIT; lp++) { - int c; -@@ -506,73 +680,213 @@ fb_cmap_init(void) - - #define LUT_MAX (256) - -+#if defined(__linux__) - static struct fb_cmap * - fb_cmap_create(struct fb_fix_screeninfo *fscinfo, - struct fb_var_screeninfo *vscinfo) -+#elif defined(__FreeBSD__) -+static video_color_palette_t * -+fb_cmap_create(video_info_t *video_info, -+ video_adapter_info_t *video_adapter_info) -+#endif - { -+#if defined(__linux__) - struct fb_cmap *cmap; -+#elif defined(__FreeBSD__) -+ video_color_palette_t *cmap; -+#endif - int cmaplen = LUT_MAX; - - /* check the existence of colormap */ -+#if defined(__linux__) - if (fscinfo->visual == FB_VISUAL_MONO01 || - fscinfo->visual == FB_VISUAL_MONO10 || - fscinfo->visual == FB_VISUAL_TRUECOLOR) - return NULL; -+#elif defined(__FreeBSD__) -+ if (!(video_adapter_info->va_flags & V_ADP_PALETTE)) -+ return NULL; -+#endif - -+#if defined(__linux__) - cmap = (struct fb_cmap *)malloc(sizeof(struct fb_cmap)); -+#elif defined(__FreeBSD__) -+ cmap = (video_color_palette_t *)malloc(sizeof(video_color_palette_t)); -+#endif - if (!cmap) { - perror("cmap malloc error\n"); -+#if defined(__linux__) - return (struct fb_cmap *)-1; -+#elif defined(__FreeBSD__) -+ return (video_color_palette_t *)-1; -+#endif - } -+#if defined(__linux__) - memset(cmap, 0, sizeof(struct fb_cmap)); -+#elif defined(__FreeBSD__) -+ memset(cmap, 0, sizeof(video_color_palette_t)); -+#endif -+ -+#if defined(__FreeBSD__) -+ if (video_info->vi_mem_model == V_INFO_MM_PACKED) { -+ cmap->red = (u_char *) malloc(sizeof(u_char) * cmaplen); -+ if (!cmap->red) { -+ perror("red lut malloc error\n"); -+ return (video_color_palette_t *)-1; -+ } -+ cmap->green = (u_char *) malloc(sizeof(u_char) * cmaplen); -+ if (!cmap->green) { -+ perror("green lut malloc error\n"); -+ free(cmap->red); -+ return (video_color_palette_t *)-1; -+ } -+ cmap->blue = (u_char *) malloc(sizeof(u_char) * cmaplen); -+ if (!cmap->blue) { -+ perror("blue lut malloc error\n"); -+ free(cmap->red); -+ free(cmap->green); -+ return (video_color_palette_t *)-1; -+ } -+ cmap->transparent = (u_char *) malloc(sizeof(u_char) * cmaplen); -+ if (!cmap->transparent) { -+ perror("transparent lut malloc error\n"); -+ free(cmap->red); -+ free(cmap->green); -+ free(cmap->blue); -+ return (video_color_palette_t *)-1; -+ } -+ cmap->count = cmaplen; -+ return cmap; -+ } -+#endif - - /* Allocates memory for a colormap */ -+#if defined(__linux__) - if (vscinfo->red.length) { - cmap->red = (__u16 *) malloc(sizeof(__u16) * cmaplen); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[0]) { -+ cmap->red = (u_char *) malloc(sizeof(u_char) * cmaplen); -+#endif - if (!cmap->red) { - perror("red lut malloc error\n"); -+#if defined(__linux__) - return (struct fb_cmap *)-1; -+#elif defined(__FreeBSD__) -+ return (video_color_palette_t *)-1; -+#endif - } - } -+#if defined(__linux__) - if (vscinfo->green.length) { - cmap->green = (__u16 *) malloc(sizeof(__u16) * cmaplen); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[1]) { -+ cmap->green = (u_char *) malloc(sizeof(u_char) * cmaplen); -+#endif - if (!cmap->green) { -+#if defined(__linux__) - if (vscinfo->red.length) - free(cmap->red); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[0]) -+ free(cmap->red); -+#endif - perror("green lut malloc error\n"); -+#if defined(__linux__) - return (struct fb_cmap *)-1; -+#elif defined(__FreeBSD__) -+ return (video_color_palette_t *)-1; -+#endif - } - } -+#if defined(__linux__) - if (vscinfo->blue.length) { - cmap->blue = (__u16 *) malloc(sizeof(__u16) * cmaplen); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[2]) { -+ cmap->blue = (u_char *) malloc(sizeof(u_char) * cmaplen); -+#endif - if (!cmap->blue) { -+#if defined(__linux__) - if (vscinfo->red.length) - free(cmap->red); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[0]) -+ free(cmap->red); -+#endif -+#if defined(__linux__) - if (vscinfo->green.length) - free(cmap->green); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[1]) -+ free(cmap->green); -+#endif - perror("blue lut malloc error\n"); -+#if defined(__linux__) - return (struct fb_cmap *)-1; -+#elif defined(__FreeBSD__) -+ return (video_color_palette_t *)-1; -+#endif - } - } -+#if defined(__linux__) - if (vscinfo->transp.length) { - cmap->transp = (__u16 *) malloc(sizeof(__u16) * cmaplen); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[3]) { -+ cmap->transparent = (u_char *) malloc(sizeof(u_char) * cmaplen); -+#endif -+#if defined(__linux__) - if (!cmap->transp) { -+#elif defined(__FreeBSD__) -+ if (!cmap->transparent) { -+#endif -+#if defined(__linux__) - if (vscinfo->red.length) - free(cmap->red); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[0]) -+ free(cmap->red); -+#endif -+#if defined(__linux__) - if (vscinfo->green.length) - free(cmap->green); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[1]) -+ free(cmap->green); -+#endif -+#if defined(__linux__) - if (vscinfo->blue.length) - free(cmap->blue); - perror("transp lut malloc error\n"); -+#elif defined(__FreeBSD__) -+ if (video_info->vi_pixel_fsizes[2]) -+ free(cmap->blue); -+ perror("transparent lut malloc error\n"); -+#endif -+#if defined(__linux__) - return (struct fb_cmap *)-1; -+#elif defined(__FreeBSD__) -+ return (video_color_palette_t *)-1; -+#endif - } - } -+#if defined(__linux__) - cmap->len = cmaplen; -+#elif defined(__FreeBSD__) -+ cmap->count = cmaplen; -+#endif - return cmap; - } - -+#if defined(__linux__) - static void - fb_cmap_destroy(struct fb_cmap *cmap) -+#elif defined(__FreeBSD__) -+static void -+fb_cmap_destroy(video_color_palette_t *cmap) -+#endif - { - if (cmap->red) - free(cmap->red); -@@ -580,28 +894,57 @@ fb_cmap_destroy(struct fb_cmap *cmap) - free(cmap->green); - if (cmap->blue) - free(cmap->blue); -+#if defined(__linux__) - if (cmap->transp) - free(cmap->transp); -+#elif defined(__FreeBSD__) -+ if (cmap->transparent) -+ free(cmap->transparent); -+#endif - free(cmap); - } - -+#if defined(__linux__) - static int - fb_cmap_get(int fbfp, struct fb_cmap *cmap) -+#elif defined(__FreeBSD__) -+static int -+fb_cmap_get(int fbfp, video_color_palette_t *cmap) -+#endif - { -+#if defined(__linux__) - if (ioctl(fbfp, FBIOGETCMAP, cmap)) { - perror("ioctl FBIOGETCMAP error\n"); - return -1; - } -+#elif defined(__FreeBSD__) -+ if (ioctl(fbfp, FBIO_GETPALETTE, cmap) == -1) { -+ perror("ioctl FBIO_GETPALETTE error\n"); -+ return -1; -+ } -+#endif - return 0; - } - -+#if defined(__linux__) - static int - fb_cmap_set(int fbfp, struct fb_cmap *cmap) -+#elif defined(__FreeBSD__) -+static int -+fb_cmap_set(int fbfp, video_color_palette_t *cmap) -+#endif - { -+#if defined(__linux__) - if (ioctl(fbfp, FBIOPUTCMAP, cmap)) { - perror("ioctl FBIOPUTCMAP error\n"); - return -1; - } -+#elif defined(__FreeBSD__) -+ if (ioctl(fbfp, FBIO_SETPALETTE, cmap) == -1) { -+ perror("ioctl FBIO_SETPALETTE error\n"); -+ return -1; -+ } -+#endif - return 0; - } - -@@ -612,10 +955,16 @@ fb_cmap_set(int fbfp, struct fb_cmap *cmap) - * fb_munmap() deletes the mappings - */ - -+#if defined(__linux__) - static void * - fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo) -+#elif defined(__FreeBSD__) -+static void * -+fb_mmap(int fbfp, video_adapter_info_t *video_adapter_info) -+#endif - { - void *buf; -+#if defined(__linux__) - if ((buf = (unsigned char *) - mmap(NULL, scinfo->smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbfp, - (off_t) 0)) -@@ -623,13 +972,41 @@ fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo) - perror("mmap error"); - return NULL; - } -+#elif defined(__FreeBSD__) -+ size_t mmap_offset; -+ size_t mmap_length; -+ mmap_offset = (size_t)(video_adapter_info->va_window) & (PAGE_MASK); -+ mmap_length = (size_t)(video_adapter_info->va_window_size + -+ mmap_offset + PAGE_MASK) & (~PAGE_MASK); -+ if ((buf = (unsigned char *) -+ mmap(NULL, mmap_length, PROT_READ | PROT_WRITE, MAP_SHARED, fbfp, -+ (off_t) 0)) -+ == MAP_FAILED) { -+ perror("mmap error"); -+ return NULL; -+ } -+#endif - return buf; - } - -+#if defined(__linux__) - static int - fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo) -+#elif defined(__FreeBSD__) -+static int -+fb_munmap(void *buf, video_adapter_info_t *video_adapter_info) -+#endif - { -+#if defined(__linux__) - return munmap(buf, scinfo->smem_len); -+#elif defined(__FreeBSD__) -+ size_t mmap_offset; -+ size_t mmap_length; -+ mmap_offset = (size_t)(video_adapter_info->va_window) & (PAGE_MASK); -+ mmap_length = (size_t)(video_adapter_info->va_window_size + -+ mmap_offset + PAGE_MASK) & (~PAGE_MASK); -+ return munmap((void *)((u_long)buf & (~PAGE_MASK)), mmap_length); -+#endif - } - - /* -@@ -637,6 +1014,7 @@ fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo) - * - * fb_fscrn_get() get information - */ -+#if defined(__linux__) - static int - fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo) - { -@@ -646,12 +1024,14 @@ fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo) - } - return 0; - } -+#endif - - /* - * (struct fb_var_screeninfo) device independent variable information - * - * fb_vscrn_get() get information - */ -+#if defined(__linux__) - static int - fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo) - { -@@ -661,3 +1041,41 @@ fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo) - } - return 0; - } -+#endif -+ -+#if defined(__FreeBSD__) -+static int -+fb_video_mode_get(int fbfp, int *video_mode) -+{ -+ if (ioctl(fbfp, FBIO_GETMODE, video_mode) == -1) { -+ perror("ioctl FBIO_GETMODE error\n"); -+ return -1; -+ } -+ return 0; -+} -+#endif -+ -+#if defined(__FreeBSD__) -+static int -+fb_video_info_get(int fbfp, video_info_t *video_info) -+{ -+ if (ioctl(fbfp, FBIO_MODEINFO, video_info) == -1) { -+ perror("ioctl FBIO_MODEINFO error\n"); -+ return -1; -+ } -+ return 0; -+} -+#endif -+ -+#if defined(__FreeBSD__) -+static int -+fb_video_adapter_info_get(int fbfp, video_adapter_info_t *video_adapter_info) -+{ -+ if (ioctl(fbfp, FBIO_ADPINFO, video_adapter_info) == -1) { -+ perror("ioctl FBIO_ADPINFO error\n"); -+ return -1; -+ } -+ return 0; -+} -+#endif -+ -diff --git a/w3mimg/fb/fb.h b/w3mimg/fb/fb.h -index 1138bb0..5d86454 100644 ---- a/w3mimg/fb/fb.h -+++ b/w3mimg/fb/fb.h -@@ -1,7 +1,11 @@ - /* $Id: fb.h,v 1.7 2003/07/07 15:48:17 ukai Exp $ */ - #ifndef fb_header - #define fb_header -+#if defined(__linux__) - #include <linux/fb.h> -+#elif defined(__FreeBSD__) -+#include <sys/fbio.h> -+#endif - - typedef struct { - int num; -diff --git a/w3mimg/fb/fb_w3mimg.c b/w3mimg/fb/fb_w3mimg.c -index d3ae5a9..fb323f5 100644 ---- a/w3mimg/fb/fb_w3mimg.c -+++ b/w3mimg/fb/fb_w3mimg.c -@@ -153,10 +153,15 @@ check_tty_console(char *tty) - return 0; - if (strncmp(tty, "/dev/", 5) == 0) - tty += 5; -+#if defined(__linux__) - if (strncmp(tty, "tty", 3) == 0 && isdigit(*(tty + 3))) - return 1; - if (strncmp(tty, "vc/", 3) == 0 && isdigit(*(tty + 3))) - return 1; -+#elif defined(__FreeBSD__) -+ if (strncmp(tty, "ttyv", 4) == 0 && isxdigit(*(tty + 4))) -+ return 1; -+#endif - return 0; - } - #else -@@ -172,7 +177,9 @@ w3mimg_fbopen() - return NULL; - memset(wop, 0, sizeof(w3mimg_op)); - -- if (!check_tty_console(getenv("W3M_TTY")) && strcmp("jfbterm", getenv("TERM")) != 0) { -+ if (!check_tty_console(getenv("W3M_TTY")) && -+ strcmp("jfbterm", getenv("TERM")) != 0 && -+ strncmp("jfbterm-", getenv("TERM"), 8) != 0) { - fprintf(stderr, "w3mimgdisplay/fb: tty is not console\n"); - goto error; - } diff --git a/debian/patches/410_textarea-segfault.patch b/debian/patches/410_textarea-segfault.patch deleted file mode 100644 index 5322c75..0000000 --- a/debian/patches/410_textarea-segfault.patch +++ /dev/null @@ -1,22 +0,0 @@ -Subject: Prevent segfault when editing a textarea field with vi -Author: Peter Poeml <poeml@suse.de> -Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-0.4.1-textarea-segfault.dif?expand=1 - - add fix for segfault that can occur when editing a textarea field - with vi, and returning to w3m (it seems to happen if the terminal - is not writable, as when using w3m after 'su - some_user') - -diff --git a/terms.c b/terms.c -index ca81d28..672262c 100644 ---- a/terms.c -+++ b/terms.c -@@ -637,7 +637,8 @@ reset_tty(void) - writestr(T_se); /* reset terminal */ - flush_tty(); - TerminalSet(tty, &d_ioval); -- close_tty(); -+ if (tty != 2) -+ close_tty(); - } - - static MySignalHandler diff --git a/debian/patches/420_uninitialized.patch b/debian/patches/420_uninitialized.patch deleted file mode 100644 index d1ee41d..0000000 --- a/debian/patches/420_uninitialized.patch +++ /dev/null @@ -1,54 +0,0 @@ -Subject: Fix a few harmless uninitialized variables -Author: Olaf Hering <olh@suse.de> -Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-uninitialized.patch?expand=1 - -diff --git a/anchor.c b/anchor.c -index 39f221d..a353bb9 100644 ---- a/anchor.c -+++ b/anchor.c -@@ -11,7 +11,7 @@ putAnchor(AnchorList *al, char *url, char *target, Anchor **anchor_return, - { - int n, i, j; - Anchor *a; -- BufferPoint bp; -+ BufferPoint bp = { 0 }; - if (al == NULL) { - al = New(AnchorList); - al->anchors = NULL; -diff --git a/libwc/gb18030.c b/libwc/gb18030.c -index c195d49..d5c9018 100644 ---- a/libwc/gb18030.c -+++ b/libwc/gb18030.c -@@ -151,6 +151,7 @@ wc_ucs_to_gb18030(wc_uint32 ucs) - return cc; - } - cc.ccs = WC_CCS_UNKNOWN; -+ cc.code = 0; - return cc; - } - #endif -diff --git a/libwc/ucs.c b/libwc/ucs.c -index d7b6948..5e78b4e 100644 ---- a/libwc/ucs.c -+++ b/libwc/ucs.c -@@ -100,6 +100,7 @@ wc_ucs_to_any(wc_uint32 ucs, wc_table *t) - return t->conv(t->ccs, map->code2); - } - cc.ccs = WC_CCS_UNKNOWN; -+ cc.code = 0; - return cc; - } - -diff --git a/regex.c b/regex.c -index 5bee4b2..5675d09 100644 ---- a/regex.c -+++ b/regex.c -@@ -77,7 +77,7 @@ static longchar - set_longchar(char *str) - { - unsigned char *p = (unsigned char *)str; -- longchar r; -+ longchar r = { }; - - #ifdef USE_M17N - if (*p & 0x80) { diff --git a/debian/patches/430_no-ascii-default.patch b/debian/patches/430_no-ascii-default.patch deleted file mode 100644 index 83d196f..0000000 --- a/debian/patches/430_no-ascii-default.patch +++ /dev/null @@ -1,21 +0,0 @@ -Subject: Change the default to alt_entity=0 -Author: Olaf Dabrunz <od@suse.de> -Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-0.5.1-no-ASCII-equivalents-by-default.patch?expand=1 -Bug-Novell: https://bugzilla.novell.com/show_bug.cgi?id=247397 - - change the default for the option "Use ASCII equivalents to - display entities" from YES to NO. - -diff --git a/fm.h b/fm.h -index 149a02f..49af0e4 100644 ---- a/fm.h -+++ b/fm.h -@@ -1089,7 +1089,7 @@ global char SimplePreserveSpace init(FALSE); - #define wc_Str_conv(x,charset0,charset1) (x) - #define wc_Str_conv_strict(x,charset0,charset1) (x) - #endif --global char UseAltEntity init(TRUE); -+global char UseAltEntity init(FALSE); - #define GRAPHIC_CHAR_ASCII 2 - #define GRAPHIC_CHAR_DEC 1 - #define GRAPHIC_CHAR_CHARSET 0 diff --git a/debian/patches/440_parsetagx-crash.patch b/debian/patches/440_parsetagx-crash.patch deleted file mode 100644 index 08c570e..0000000 --- a/debian/patches/440_parsetagx-crash.patch +++ /dev/null @@ -1,16 +0,0 @@ -Subject: Fix crash in parse_tag() during every start -Author: Olaf Hering <olh@suse.de> -Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-parsetagx-crash.patch?expand=1 - -diff --git a/parsetagx.c b/parsetagx.c -index 6b627d2..3435f9f 100644 ---- a/parsetagx.c -+++ b/parsetagx.c -@@ -221,6 +221,7 @@ parse_tag(char **s, int internal) - int j, hidden=FALSE; - for (j=0; j<i; j++) { - if (tag->attrid[j] == ATTR_TYPE && -+ tag->value[j] && - strcmp("hidden",tag->value[j]) == 0) { - hidden=TRUE; - break; diff --git a/debian/patches/450_remoteimg.patch b/debian/patches/450_remoteimg.patch deleted file mode 100644 index 0298e46..0000000 --- a/debian/patches/450_remoteimg.patch +++ /dev/null @@ -1,936 +0,0 @@ -Subject: Support OSC 5379 remote imaging and sixel graphics -Author: Araki Ken <arakiken@users.sf.net> -Origin: https://bitbucket.org/arakiken/w3m/branch/remoteimg - -diff --git a/display.c b/display.c -index 2fe1183..d4f336a 100644 ---- a/display.c -+++ b/display.c -@@ -487,7 +487,7 @@ displayBuffer(Buffer *buf, int mode) - term_title(conv_to_system(buf->buffername)); - refresh(); - #ifdef USE_IMAGE -- if (activeImage && displayImage && buf->img) { -+ if (activeImage && displayImage && buf->img && buf->image_loaded) { - drawImage(); - } - #endif -@@ -521,7 +521,15 @@ drawAnchorCursor0(Buffer *buf, AnchorList *al, int hseq, int prevhseq, - break; - } - if (hseq >= 0 && an->hseq == hseq) { -+ int start_pos = an->start.pos; -+ int end_pos = an->end.pos; - for (i = an->start.pos; i < an->end.pos; i++) { -+ if (enable_inline_image && (l->propBuf[i] & PE_IMAGE)) { -+ if (start_pos == i) -+ start_pos = i + 1; -+ else if (end_pos == an->end.pos) -+ end_pos = i - 1; -+ } - if (l->propBuf[i] & (PE_IMAGE | PE_ANCHOR | PE_FORM)) { - if (active) - l->propBuf[i] |= PE_ACTIVE; -@@ -529,9 +537,9 @@ drawAnchorCursor0(Buffer *buf, AnchorList *al, int hseq, int prevhseq, - l->propBuf[i] &= ~PE_ACTIVE; - } - } -- if (active) -+ if (active && start_pos < end_pos) - redrawLineRegion(buf, l, l->linenumber - tline + buf->rootY, -- an->start.pos, an->end.pos); -+ start_pos, end_pos); - } - else if (prevhseq >= 0 && an->hseq == prevhseq) { - if (active) -@@ -855,14 +863,16 @@ redrawLineImage(Buffer *buf, Line *l, int i) - y = (int)(i * pixel_per_line); - sx = (int)((rcol - COLPOS(l, a->start.pos)) * pixel_per_char); - sy = (int)((l->linenumber - image->y) * pixel_per_line); -- if (sx == 0 && x + image->xoffset >= 0) -- x += image->xoffset; -- else -- sx -= image->xoffset; -- if (sy == 0 && y + image->yoffset >= 0) -- y += image->yoffset; -- else -- sy -= image->yoffset; -+ if (! enable_inline_image) { -+ if (sx == 0 && x + image->xoffset >= 0) -+ x += image->xoffset; -+ else -+ sx -= image->xoffset; -+ if (sy == 0 && y + image->yoffset >= 0) -+ y += image->yoffset; -+ else -+ sy -= image->yoffset; -+ } - if (image->width > 0) - w = image->width - sx; - else -diff --git a/doc/README.sixel b/doc/README.sixel -new file mode 100644 -index 0000000..588afc4 ---- /dev/null -+++ b/doc/README.sixel -@@ -0,0 +1,27 @@ -+Sixel support of w3m -+ 2014/11/05 -+ K. Araki -+ -+Introduction -+ -+ This is the extension for w3m to show inline images by sixel graphics. -+ -+Requirements -+ -+ Install 'img2sixel' command provided by libsixel project. -+ (https://github.com/saitoha/libsixel) -+ -+Build -+ -+ $ ./configure --enable-image ... -+ $ make -+ $ make install -+ -+Usage -+ -+ $ w3m -sixel http://... -+ -+ You can specify options of 'img2sixel' command by "W3M_IMG2SIXEL" -+ environmental variable. -+ -+ $ W3M_IMG2SIXEL="img2sixel -d atkinson" w3m -sixel http://... -diff --git a/etc.c b/etc.c -index 8fe1215..dcc6edd 100644 ---- a/etc.c -+++ b/etc.c -@@ -1365,7 +1365,13 @@ setup_child(int child, int i, int f) - if (!child) - SETPGRP(); - #endif /* __MINGW32_VERSION */ -+ /* -+ * I don't know why but close_tty() sometimes interrupts loadGeneralFile() in loadImage() -+ * and corrupt image data can be cached in ~/.w3m. -+ */ -+#if 0 - close_tty(); -+#endif - close_all_fds_except(i, f); - QuietMessage = TRUE; - fmInitialized = FALSE; -diff --git a/file.c b/file.c -index 1e363d0..709a0c1 100644 ---- a/file.c -+++ b/file.c -@@ -3345,8 +3345,14 @@ process_img(struct parsed_tag *tag, int width) - if (i < 0) - i = pixel_per_line; - } -- nw = (w > 3) ? (int)((w - 3) / pixel_per_char + 1) : 1; -- ni = (i > 3) ? (int)((i - 3) / pixel_per_line + 1) : 1; -+ if (enable_inline_image) { -+ nw = (w > 1) ? ((w - 1) / pixel_per_char_i + 1) : 1 ; -+ ni = (i > 1) ? ((i - 1) / pixel_per_line_i + 1) : 1 ; -+ } -+ else { -+ nw = (w > 3) ? (int)((w - 3) / pixel_per_char + 1) : 1; -+ ni = (i > 3) ? (int)((i - 3) / pixel_per_line + 1) : 1; -+ } - Strcat(tmp, - Sprintf("<pre_int><img_alt hseq=\"%d\" src=\"", cur_iseq++)); - pre_int = TRUE; -@@ -3377,19 +3383,21 @@ process_img(struct parsed_tag *tag, int width) - if (i0 >= 0) - Strcat(tmp, Sprintf(" height=%d", i0)); - switch (align) { -+ case ALIGN_MIDDLE: -+ if (!enable_inline_image) { -+ top = ni / 2; -+ bottom = top; -+ if (top * 2 == ni) -+ yoffset = (int)(((ni + 1) * pixel_per_line - i) / 2); -+ else -+ yoffset = (int)((ni * pixel_per_line - i) / 2); -+ break; -+ } - case ALIGN_TOP: - top = 0; - bottom = ni - 1; - yoffset = 0; - break; -- case ALIGN_MIDDLE: -- top = ni / 2; -- bottom = top; -- if (top * 2 == ni) -- yoffset = (int)(((ni + 1) * pixel_per_line - i) / 2); -- else -- yoffset = (int)((ni * pixel_per_line - i) / 2); -- break; - case ALIGN_BOTTOM: - top = ni - 1; - bottom = 0; -@@ -3407,7 +3415,12 @@ process_img(struct parsed_tag *tag, int width) - } - break; - } -- xoffset = (int)((nw * pixel_per_char - w) / 2); -+ -+ if (enable_inline_image) -+ xoffset = 0; -+ else -+ xoffset = (int)((nw * pixel_per_char - w) / 2); -+ - if (xoffset) - Strcat(tmp, Sprintf(" xoffset=%d", xoffset)); - if (yoffset) -diff --git a/fm.h b/fm.h -index 49af0e4..8f594dc 100644 ---- a/fm.h -+++ b/fm.h -@@ -373,6 +373,8 @@ typedef struct _imageCache { - int index; - short width; - short height; -+ short a_width; -+ short a_height; - } ImageCache; - - typedef struct _image { -@@ -919,6 +921,7 @@ global char *CurrentKeyData; - global char *CurrentCmdData; - global char *w3m_reqlog; - extern char *w3m_version; -+extern int enable_inline_image; - - #define DUMP_BUFFER 0x01 - #define DUMP_HEAD 0x02 -@@ -1174,9 +1177,11 @@ global char *ssl_forbid_method init("2, 3"); - global int is_redisplay init(FALSE); - global int clear_buffer init(TRUE); - global double pixel_per_char init(DEFAULT_PIXEL_PER_CHAR); -+global int pixel_per_char_i init(DEFAULT_PIXEL_PER_CHAR); - global int set_pixel_per_char init(FALSE); - #ifdef USE_IMAGE - global double pixel_per_line init(DEFAULT_PIXEL_PER_LINE); -+global int pixel_per_line_i init(DEFAULT_PIXEL_PER_LINE); - global int set_pixel_per_line init(FALSE); - global double image_scale init(100); - #endif -diff --git a/image.c b/image.c -index 9d0e9b5..91034ee 100644 ---- a/image.c -+++ b/image.c -@@ -44,6 +44,8 @@ initImage() - activeImage = TRUE; - } - -+int get_pixel_per_cell(int *ppc, int *ppl); -+ - int - getCharSize() - { -@@ -52,6 +54,24 @@ getCharSize() - int w = 0, h = 0; - - set_environ("W3M_TTY", ttyname_tty()); -+ -+ if (enable_inline_image) { -+ int ppc, ppl; -+ -+ if (get_pixel_per_cell(&ppc,&ppl)) { -+ pixel_per_char_i = ppc ; -+ pixel_per_line_i = ppl ; -+ pixel_per_char = (double)ppc; -+ pixel_per_line = (double)ppl; -+ } -+ else { -+ pixel_per_char_i = (int)pixel_per_char; -+ pixel_per_line_i = (int)pixel_per_line; -+ } -+ -+ return TRUE; -+ } -+ - tmp = Strnew(); - if (!strchr(Imgdisplay, '/')) - Strcat_m_charp(tmp, w3m_auxbin_dir(), "/", NULL); -@@ -156,6 +176,10 @@ addImage(ImageCache * cache, int x, int y, int sx, int sy, int w, int h) - static void - syncImage(void) - { -+ if (enable_inline_image) { -+ return; -+ } -+ - fputs("3;\n", Imgdisplay_wf); /* XSync() */ - fputs("4;\n", Imgdisplay_wf); /* put '\n' */ - while (fflush(Imgdisplay_wf) != 0) { -@@ -171,12 +195,16 @@ syncImage(void) - n_terminal_image = 0; - } - -+void put_image_osc5379(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh, int n_terminal_image); -+void put_image_sixel(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh, int n_terminal_image); -+ - void - drawImage() - { - static char buf[64]; - int j, draw = FALSE; - TerminalImage *i; -+ struct stat st ; - - if (!activeImage) - return; -@@ -184,6 +212,47 @@ drawImage() - return; - for (j = 0; j < n_terminal_image; j++) { - i = &terminal_image[j]; -+ -+ if (enable_inline_image) { -+ #if 0 -+ fprintf(stderr,"file %s x %d y %d w %d h %d sx %d sy %d sw %d sh %d (ppc %d ppl %d)\n", -+ ((enable_inline_image == 2 || getenv("WINDOWID")) && -+ i->cache->touch) ? i->cache->file : i->cache->url, -+ i->x, i->y, -+ i->cache->width > 0 ? i->cache->width : 0, -+ i->cache->height > 0 ? i->cache->height : 0, -+ i->sx, i->sy, i->width, i->height, -+ pixel_per_char_i, pixel_per_line_i); -+ #endif -+ (enable_inline_image == 2 ? put_image_sixel : put_image_osc5379)( -+ ((enable_inline_image == 2 /* sixel */ || getenv("WINDOWID")) && -+ /* XXX I don't know why but sometimes i->cache->file doesn't exist. */ -+ i->cache->touch && stat(i->cache->file,&st) == 0) ? -+ /* local */ i->cache->file : /* remote */ i->cache->url, -+ i->x / pixel_per_char_i, -+ i->y / pixel_per_line_i, -+ #if 1 -+ i->cache->a_width > 0 ? -+ (i->cache->width + i->x % pixel_per_char_i + pixel_per_char_i - 1) / -+ pixel_per_char_i : -+ #endif -+ 0, -+ -+ #if 1 -+ i->cache->a_height > 0 ? -+ (i->cache->height + i->y % pixel_per_line_i + pixel_per_line_i - 1) / -+ pixel_per_line_i : -+ #endif -+ 0, -+ i->sx / pixel_per_char_i, -+ i->sy / pixel_per_line_i, -+ (i->width + i->sx % pixel_per_char_i + pixel_per_char_i - 1) / pixel_per_char_i, -+ (i->height + i->sy % pixel_per_line_i + pixel_per_line_i - 1) / pixel_per_line_i, -+ n_terminal_image); -+ -+ continue ; -+ } -+ - if (!(i->cache->loaded & IMG_FLAG_LOADED && - i->width > 0 && i->height > 0)) - continue; -@@ -207,9 +276,15 @@ drawImage() - fputs("\n", Imgdisplay_wf); - draw = TRUE; - } -- if (!draw) -- return; -- syncImage(); -+ -+ if (!enable_inline_image) { -+ if (!draw) -+ return; -+ syncImage(); -+ } -+ else -+ n_terminal_image = 0; -+ - touch_cursor(); - refresh(); - } -@@ -321,6 +396,8 @@ showImageProgress(Buffer *buf) - } - } - if (n) { -+ if (enable_inline_image && n == l) -+ drawImage(); - message(Sprintf("%d/%d images loaded", l, n)->ptr, - buf->cursorX + buf->rootX, buf->cursorY + buf->rootY); - refresh(); -@@ -350,7 +427,7 @@ loadImage(Buffer *buf, int flag) - } - for (i = 0; i < n_load_image; i++) { - cache = image_cache[i]; -- if (!cache) -+ if (!cache || !cache->touch) - continue; - if (lstat(cache->touch, &st)) - continue; -@@ -381,7 +458,7 @@ loadImage(Buffer *buf, int flag) - - for (i = (buf != image_buffer) ? 0 : maxLoadImage; i < n_load_image; i++) { - cache = image_cache[i]; -- if (!cache) -+ if (!cache || !cache->touch) - continue; - if (cache->pid) { - kill(cache->pid, SIGKILL); -@@ -407,7 +484,8 @@ loadImage(Buffer *buf, int flag) - } - - if (draw && image_buffer) { -- drawImage(); -+ if (!enable_inline_image) -+ drawImage(); - showImageProgress(image_buffer); - } - -@@ -435,6 +513,9 @@ loadImage(Buffer *buf, int flag) - break; - } - image_cache[i] = cache; -+ if (!cache->touch) { -+ continue; -+ } - - flush_tty(); - #ifdef DONT_CALL_GC_AFTER_FORK -@@ -515,12 +596,30 @@ getImage(Image * image, ParsedURL *current, int flag) - cache->url = image->url; - cache->current = current; - cache->file = tmpfname(TMPF_DFL, image->ext)->ptr; -- cache->touch = tmpfname(TMPF_DFL, NULL)->ptr; - cache->pid = 0; - cache->index = 0; - cache->loaded = IMG_FLAG_UNLOADED; -- cache->width = image->width; -- cache->height = image->height; -+ if (enable_inline_image == 1) { -+ if (image->width > 0 && image->width % pixel_per_char_i > 0) -+ image->width += (pixel_per_char_i - image->width % pixel_per_char_i); -+ -+ if (image->height > 0 && image->height % pixel_per_line_i > 0) -+ image->height += (pixel_per_line_i - image->height % pixel_per_line_i); -+ if (image->height > 0 && image->width > 0) { -+ cache->loaded = IMG_FLAG_LOADED; -+ } -+ } -+ if (cache->loaded == IMG_FLAG_UNLOADED) { -+ cache->touch = tmpfname(TMPF_DFL, NULL)->ptr; -+ } -+ else { -+ cache->touch = NULL; -+ } -+ -+ cache->width = image->width ; -+ cache->height = image->height ; -+ cache->a_width = image->width; -+ cache->a_height = image->height; - putHash_sv(image_hash, key->ptr, (void *)cache); - } - if (flag != IMG_FLAG_SKIP) { -@@ -542,6 +641,78 @@ getImage(Image * image, ParsedURL *current, int flag) - return cache; - } - -+static int -+parseImageHeader(char *path, u_int *width, u_int *height) -+{ -+ FILE *fp; -+ u_char buf[8]; -+ -+ if (!(fp = fopen(path, "r"))) return FALSE; -+ -+ if (fread(buf, 1, 2, fp) != 2) goto error; -+ -+ if (memcmp(buf, "\xff\xd8", 2) == 0) { -+ /* JPEG */ -+ if (fseek(fp, 2, SEEK_CUR) < 0) goto error; /* 0xffe0 */ -+ while (fread(buf, 1, 2, fp) == 2) { -+ size_t len = ((buf[0] << 8) | buf[1]) - 2; -+ if (fseek(fp, len, SEEK_CUR) < 0) goto error; -+ if (fread(buf, 1, 2, fp) == 2 && -+ /* SOF0 or SOF2 */ -+ (memcmp(buf, "\xff\xc0", 2) == 0 || memcmp(buf, "\xff\xc2", 2) == 0)) { -+ fseek(fp, 3, SEEK_CUR); -+ if (fread(buf, 1, 2, fp) == 2) { -+ *height = (buf[0] << 8) | buf[1]; -+ if (fread(buf, 1, 2, fp) == 2) { -+ *width = (buf[0] << 8) | buf[1]; -+ goto success; -+ } -+ } -+ break; -+ } -+ } -+ goto error; -+ } -+ -+ if (fread(buf + 2, 1, 1, fp) != 1) goto error; -+ -+ if (memcmp(buf, "GIF", 3) == 0) { -+ /* GIF */ -+ if (fseek(fp, 3, SEEK_CUR) < 0) goto error; -+ if (fread(buf, 1, 2, fp) == 2) { -+ *width = (buf[1] << 8) | buf[0]; -+ if (fread(buf, 1, 2, fp) == 2) { -+ *height = (buf[1] << 8) | buf[0]; -+ goto success; -+ } -+ } -+ goto error; -+ } -+ -+ if (fread(buf + 3, 1, 5, fp) != 5) goto error; -+ -+ if (memcmp(buf, "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8) == 0) { -+ /* PNG */ -+ if (fseek(fp, 8, SEEK_CUR) < 0) goto error; -+ if (fread(buf, 1, 4, fp) == 4) { -+ *width = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; -+ if (fread(buf, 1, 4, fp) == 4) { -+ *height = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; -+ goto success; -+ } -+ } -+ goto error; -+ } -+ -+error: -+ fclose(fp); -+ return FALSE; -+ -+success: -+ fclose(fp); -+ return TRUE; -+} -+ - int - getImageSize(ImageCache * cache) - { -@@ -554,6 +725,10 @@ getImageSize(ImageCache * cache) - if (!cache || !(cache->loaded & IMG_FLAG_LOADED) || - (cache->width > 0 && cache->height > 0)) - return FALSE; -+ -+ if (parseImageHeader(cache->file, &w, &h)) -+ goto got_image_size; -+ - tmp = Strnew(); - if (!strchr(Imgdisplay, '/')) - Strcat_m_charp(tmp, w3m_auxbin_dir(), "/", NULL); -@@ -569,6 +744,8 @@ getImageSize(ImageCache * cache) - - if (!(w > 0 && h > 0)) - return FALSE; -+ -+got_image_size: - w = (int)(w * image_scale / 100 + 0.5); - if (w == 0) - w = 1; -@@ -581,11 +758,11 @@ getImageSize(ImageCache * cache) - } - else if (cache->width < 0) { - int tmp = (int)((double)cache->height * w / h + 0.5); -- cache->width = (tmp > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : tmp; -+ cache->a_width = cache->width = (tmp > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : tmp; - } - else if (cache->height < 0) { - int tmp = (int)((double)cache->width * h / w + 0.5); -- cache->height = (tmp > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : tmp; -+ cache->a_height = cache->height = (tmp > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE : tmp; - } - if (cache->width == 0) - cache->width = 1; -diff --git a/main.c b/main.c -index c8f1e82..32f4da2 100644 ---- a/main.c -+++ b/main.c -@@ -122,6 +122,8 @@ static int searchKeyNum(void); - #define help() fusage(stdout, 0) - #define usage() fusage(stderr, 1) - -+int enable_inline_image; /* 1 == mlterm OSC 5379, 2 == sixel */ -+ - static void - fversion(FILE * f) - { -@@ -409,7 +411,6 @@ main(int argc, char **argv, char **envp) - #if defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) - char **getimage_args = NULL; - #endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ -- - GC_INIT(); - #if defined(ENABLE_NLS) || (defined(USE_M17N) && defined(HAVE_LANGINFO_CODESET)) - setlocale(LC_ALL, ""); -@@ -679,6 +680,12 @@ main(int argc, char **argv, char **envp) - } - } - #endif -+ else if (!strcmp("-ri", argv[i])) { -+ enable_inline_image = 1; -+ } -+ else if (!strcmp("-sixel", argv[i])) { -+ enable_inline_image = 2; -+ } - else if (!strcmp("-num", argv[i])) - showLineNum = TRUE; - else if (!strcmp("-no-proxy", argv[i])) -@@ -5910,8 +5917,14 @@ deleteFiles() - Firstbuf = buf; - } - } -- while ((f = popText(fileToDelete)) != NULL) -+ while ((f = popText(fileToDelete)) != NULL) { - unlink(f); -+ if (enable_inline_image == 2 && strcmp(f+strlen(f)-4, ".gif") == 0) { -+ Str firstframe = Strnew_charp(f); -+ Strcat_charp(firstframe, "-1"); -+ unlink(firstframe->ptr); -+ } -+ } - } - - void -diff --git a/terms.c b/terms.c -index 672262c..79996f1 100644 ---- a/terms.c -+++ b/terms.c -@@ -12,6 +12,7 @@ - #include <unistd.h> - #include "config.h" - #include <string.h> -+#include <sys/wait.h> - #ifdef HAVE_SYS_SELECT_H - #include <sys/select.h> - #endif -@@ -466,6 +467,260 @@ writestr(char *s) - - #define MOVE(line,column) writestr(tgoto(T_cm,column,line)); - -+void -+put_image_osc5379(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh, int n_terminal_image) -+{ -+ Str buf; -+ char *size ; -+ -+ if (w > 0 && h > 0) -+ size = Sprintf("%dx%d",w,h)->ptr; -+ else -+ size = ""; -+ -+ MOVE(y,x); -+ buf = Sprintf("\x1b]5379;show_picture %s %s %dx%d+%d+%d\x07",url,size,sw,sh,sx,sy); -+ writestr(buf->ptr); -+ MOVE(Currentbuf->cursorY,Currentbuf->cursorX); -+} -+ -+static void -+save_gif(const char *path, u_char *header, size_t header_size, u_char *body, size_t body_size) -+{ -+ int fd; -+ -+ if ((fd = open(path, O_WRONLY|O_CREAT, 0600)) >= 0) { -+ write(fd, header, header_size) ; -+ write(fd, body, body_size) ; -+ write(fd, "\x3b" , 1) ; -+ close(fd) ; -+ } -+} -+ -+static u_char * -+skip_gif_header(u_char *p) -+{ -+ /* Header */ -+ p += 10; -+ -+ if (*(p) & 0x80) { -+ p += (3 * (2 << ((*p) & 0x7))); -+ } -+ p += 3; -+ -+ return p; -+} -+ -+static Str -+save_first_animation_frame(const char *path) -+{ -+ int fd; -+ struct stat st; -+ u_char *header; -+ size_t header_size; -+ u_char *body; -+ u_char *p; -+ ssize_t len; -+ Str new_path; -+ -+ new_path = Strnew_charp(path); -+ Strcat_charp(new_path, "-1"); -+ if (stat(new_path->ptr, &st) == 0) { -+ return new_path; -+ } -+ -+ if ((fd = open( path, O_RDONLY)) < 0) { -+ return NULL; -+ } -+ -+ if (fstat( fd, &st) != 0 || ! (header = GC_malloc( st.st_size))){ -+ close( fd); -+ return NULL; -+ } -+ -+ len = read(fd, header, st.st_size); -+ close(fd); -+ -+ /* Header */ -+ -+ if (len != st.st_size || strncmp(header, "GIF89a", 6) != 0) { -+ return NULL; -+ } -+ -+ p = skip_gif_header(header); -+ header_size = p - header; -+ -+ /* Application Extension */ -+ if (p[0] == 0x21 && p[1] == 0xff) { -+ p += 19; -+ } -+ -+ /* Other blocks */ -+ body = NULL; -+ while (p + 2 < header + st.st_size) { -+ if (*(p++) == 0x21 && *(p++) == 0xf9 && *(p++) == 0x04) { -+ if( body) { -+ /* Graphic Control Extension */ -+ save_gif(new_path->ptr, header, header_size, body, p - 3 - body); -+ return new_path; -+ } -+ else { -+ /* skip the first frame. */ -+ } -+ body = p - 3; -+ } -+ } -+ -+ return NULL; -+} -+ -+void ttymode_set(int mode, int imode); -+void ttymode_reset(int mode, int imode); -+ -+void -+put_image_sixel(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh, int n_terminal_image) -+{ -+ pid_t pid; -+ int do_anim; -+ MySignalHandler(*volatile previntr) (SIGNAL_ARG); -+ MySignalHandler(*volatile prevquit) (SIGNAL_ARG); -+ MySignalHandler(*volatile prevstop) (SIGNAL_ARG); -+ -+ MOVE(y,x); -+ flush_tty(); -+ -+ do_anim = (n_terminal_image == 1 && x == 0 && y == 0 && sx == 0 && sy == 0); -+ -+ previntr = mySignal(SIGINT, SIG_IGN); -+ prevquit = mySignal(SIGQUIT, SIG_IGN); -+ prevstop = mySignal(SIGTSTP, SIG_IGN); -+ -+ if ((pid = fork()) == 0) { -+ char *env; -+ int n = 0; -+ char *argv[20]; -+ char digit[2][11+1]; -+ char clip[44+3+1]; -+ Str str_url; -+ -+ close(STDERR_FILENO); /* Don't output error message. */ -+ if (do_anim) { -+ writestr("\x1b[?80h"); -+ } -+ else if (!strstr(url, "://") && strcmp(url+strlen(url)-4, ".gif") == 0 && -+ (str_url = save_first_animation_frame(url))) { -+ url = str_url->ptr; -+ } -+ ttymode_set(ISIG, 0); -+ -+ if ((env = getenv("W3M_IMG2SIXEL"))) { -+ char *p; -+ env = Strnew_charp(env)->ptr; -+ while (n < 8 && (p = strchr(env, ' '))) { -+ *p = '\0'; -+ if (*env != '\0') { -+ argv[n++] = env; -+ } -+ env = p+1; -+ } -+ if (*env != '\0') { -+ argv[n++] = env; -+ } -+ } -+ else { -+ argv[n++] = "img2sixel"; -+ } -+ argv[n++] = "-l"; -+ argv[n++] = do_anim ? "auto" : "disable"; -+ argv[n++] = "-w"; -+ sprintf(digit[0], "%d", w*pixel_per_char_i); -+ argv[n++] = digit[0]; -+ argv[n++] = "-h"; -+ sprintf(digit[1], "%d", h*pixel_per_line_i); -+ argv[n++] = digit[1]; -+ argv[n++] = "-c"; -+ sprintf(clip, "%dx%d+%d+%d", sw*pixel_per_char_i, sh*pixel_per_line_i, -+ sx*pixel_per_char_i, sy*pixel_per_line_i); -+ argv[n++] = clip; -+ argv[n++] = url; -+ if (getenv("TERM") && strcmp(getenv("TERM"), "screen") == 0 && -+ (!getenv("SCREEN_VARIANT") || strcmp(getenv("SCREEN_VARIANT"), "sixel") != 0)) { -+ argv[n++] = "-P"; -+ } -+ argv[n++] = NULL; -+ execvp(argv[0],argv); -+ exit(0); -+ } -+ else if (pid > 0) { -+ int status; -+ waitpid(pid, &status, 0); -+ ttymode_reset(ISIG, 0); -+ mySignal(SIGINT, previntr); -+ mySignal(SIGQUIT, prevquit); -+ mySignal(SIGTSTP, prevstop); -+ if (do_anim) { -+ writestr("\x1b[?80l"); -+ } -+ } -+ -+ MOVE(Currentbuf->cursorY,Currentbuf->cursorX); -+} -+ -+int -+get_pixel_per_cell(int *ppc, int *ppl) -+{ -+ fd_set rfd; -+ struct timeval tval; -+ char buf[100]; -+ char *p; -+ ssize_t len; -+ ssize_t left; -+ int wp,hp,wc,hc; -+ int i; -+ -+#ifdef TIOCGWINSZ -+ struct winsize ws; -+ if (ioctl(tty, TIOCGWINSZ, &ws) == 0 && ws.ws_ypixel > 0 && ws.ws_row > 0 && -+ ws.ws_xpixel > 0 && ws.ws_col > 0) { -+ *ppc = ws.ws_xpixel / ws.ws_col; -+ *ppl = ws.ws_ypixel / ws.ws_row; -+ return 1; -+ } -+#endif -+ -+ fputs("\x1b[14t\x1b[18t",ttyf); flush_tty(); -+ -+ p = buf; -+ left = sizeof(buf) - 1; -+ for (i = 0; i < 10; i++) { -+ tval.tv_usec = 200000; /* 0.2 sec * 10 */ -+ tval.tv_sec = 0; -+ FD_ZERO(&rfd); -+ FD_SET(tty,&rfd); -+ if (select(tty+1,&rfd,NULL,NULL,&tval) <= 0 || ! FD_ISSET(tty,&rfd)) -+ continue; -+ -+ if ((len = read(tty,p,left)) <= 0) -+ continue; -+ p[len] = '\0'; -+ -+ if (sscanf(buf,"\x1b[4;%d;%dt\x1b[8;%d;%dt",&hp,&wp,&hc,&wc) == 4) { -+ if (wp > 0 && wc > 0 && hp > 0 && hc > 0) { -+ *ppc = wp / wc; -+ *ppl = hp / hc; -+ return 1; -+ } -+ else { -+ return 0; -+ } -+ } -+ p += len; -+ left -= len; -+ } -+ -+ return 0; -+} -+ - #ifdef USE_MOUSE - #define W3M_TERM_INFO(name, title, mouse) name, title, mouse - #define NEED_XTERM_ON (1) -diff --git a/w3mimg/x11/x11_w3mimg.c b/w3mimg/x11/x11_w3mimg.c -index cef72e2..bc8d0aa 100644 ---- a/w3mimg/x11/x11_w3mimg.c -+++ b/w3mimg/x11/x11_w3mimg.c -@@ -121,16 +121,21 @@ x11_init(w3mimg_op * self) - if (self == NULL) - return 0; - xi = (struct x11_info *)self->priv; -+#if defined(USE_IMLIB) - if (xi == NULL) - return 0; --#if defined(USE_IMLIB) - if (!xi->id) { - xi->id = Imlib_init(xi->display); - if (!xi->id) - return 0; - } - #elif defined(USE_GDKPIXBUF) -- if (!xi->init_flag) { -+ if (!xi) { -+#if defined(USE_GTK2) -+ g_type_init(); -+#endif -+ } -+ else if (!xi->init_flag) { - #if defined(USE_GTK2) - g_type_init(); - #endif -@@ -138,7 +143,7 @@ x11_init(w3mimg_op * self) - xi->init_flag = TRUE; - } - #endif -- if (!xi->imageGC) { -+ if (xi && !xi->imageGC) { - xi->imageGC = XCreateGC(xi->display, xi->parent, 0, NULL); - if (!xi->imageGC) - return 0; -@@ -653,9 +658,11 @@ x11_get_image_size(w3mimg_op * self, W3MImage * img, char *fname, int *w, - - if (self == NULL) - return 0; -+#if defined(USE_IMLIB) && defined(USE_IMLIB2) - xi = (struct x11_info *)self->priv; - if (xi == NULL) - return 0; -+#endif - - #if defined(USE_IMLIB) - im = Imlib_load_image(xi->id, fname); -@@ -755,6 +762,9 @@ w3mimg_x11open() - return NULL; - memset(wop, 0, sizeof(w3mimg_op)); - -+ if (getenv("W3M_USE_REMOTE_IMAGE")) -+ goto end; -+ - xi = (struct x11_info *)malloc(sizeof(struct x11_info)); - if (xi == NULL) - goto error; -@@ -807,6 +817,7 @@ w3mimg_x11open() - - wop->priv = xi; - -+ end: - wop->init = x11_init; - wop->finish = x11_finish; - wop->active = x11_active; diff --git a/debian/patches/460_printf.patch b/debian/patches/460_printf.patch deleted file mode 100644 index 96a2dc7..0000000 --- a/debian/patches/460_printf.patch +++ /dev/null @@ -1,52 +0,0 @@ -Subject: Correct printf arguments (still support <C99) -From: Scarlett <scarlett@xavin.net>, Tatsuya Kinoshita <tats@debian.org> -Origin: http://marc.info/?l=openbsd-ports&m=142090828929750&w=2 - -diff --git a/cookie.c b/cookie.c -index 8020f6d..c11649c 100644 ---- a/cookie.c -+++ b/cookie.c -@@ -247,7 +247,7 @@ find_cookie(ParsedURL *pu) - Strcat(tmp, Sprintf("; $Domain=\"%s\"", p1->domain->ptr)); - if (p1->portl) - Strcat(tmp, -- Sprintf("; $Port=\"%s\"", portlist2str(p1->portl))); -+ Sprintf("; $Port=\"%s\"", portlist2str(p1->portl)->ptr)); - } - } - return tmp; -@@ -463,7 +463,7 @@ save_cookies(void) - continue; - fprintf(fp, "%s\t%s\t%s\t%ld\t%s\t%s\t%d\t%d\t%s\t%s\t%s\n", - parsedURL2Str(&p->url)->ptr, -- p->name->ptr, p->value->ptr, p->expires, -+ p->name->ptr, p->value->ptr, (long)p->expires, - p->domain->ptr, p->path->ptr, p->flag, - p->version, str2charp(p->comment), - (p->portl) ? portlist2str(p->portl)->ptr : "", -diff --git a/main.c b/main.c -index 32f4da2..76256d6 100644 ---- a/main.c -+++ b/main.c -@@ -5841,7 +5841,7 @@ set_buffer_environ(Buffer *buf) - set_environ("W3M_CURRENT_FORM", form2str((FormItemList *)a->url)); - else - set_environ("W3M_CURRENT_FORM", ""); -- set_environ("W3M_CURRENT_LINE", Sprintf("%d", -+ set_environ("W3M_CURRENT_LINE", Sprintf("%ld", - l->real_linenumber)->ptr); - set_environ("W3M_CURRENT_COLUMN", Sprintf("%d", - buf->currentColumn + -diff --git a/map.c b/map.c -index 12701e7..bb240ea 100644 ---- a/map.c -+++ b/map.c -@@ -573,7 +573,7 @@ page_info_panel(Buffer *buf) - "<tr valign=top><td nowrap>Number of lines<td>", - Sprintf("%d", all)->ptr, - "<tr valign=top><td nowrap>Transferred bytes<td>", -- Sprintf("%d", buf->trbyte)->ptr, NULL); -+ Sprintf("%lu", (unsigned long)buf->trbyte)->ptr, NULL); - - a = retrieveCurrentAnchor(buf); - if (a != NULL) { diff --git a/debian/patches/470_alloc.patch b/debian/patches/470_alloc.patch deleted file mode 100644 index b7cae1a..0000000 --- a/debian/patches/470_alloc.patch +++ /dev/null @@ -1,151 +0,0 @@ -Subject: Add overflow detection (still support <C99) -From: Scarlett <scarlett@xavin.net>, Tatsuya Kinoshita <tats@debian.org> -Origin: http://marc.info/?l=openbsd-ports&m=142090828929750&w=2 - -diff --git a/alloc.h b/alloc.h -new file mode 100644 -index 0000000..fa0d391 ---- /dev/null -+++ b/alloc.h -@@ -0,0 +1,39 @@ -+/* -+ * by Scarlett. public domain. -+ * replacements for w3m's allocation macros which add overflow -+ * detection and concentrate the macros in one file -+ */ -+#ifndef W3_ALLOC_H -+#define W3_ALLOC_H -+#include <gc.h> -+#include <stdlib.h> -+#include <stdio.h> -+#include <limits.h> -+ -+static inline size_t -+z_mult_no_oflow_(size_t n, size_t size) -+{ -+ if (size != 0 && n > ULONG_MAX / size) { -+ fprintf(stderr, -+ "w3m: overflow in malloc, %lu*%lu\n", (unsigned long)n, (unsigned long)size); -+ exit(1); -+ } -+ return n * size; -+} -+ -+#define New(type) \ -+ (GC_MALLOC(sizeof(type))) -+ -+#define NewAtom(type) \ -+ (GC_MALLOC_ATOMIC(sizeof(type))) -+ -+#define New_N(type, n) \ -+ (GC_MALLOC(z_mult_no_oflow_((n), sizeof(type)))) -+ -+#define NewAtom_N(type, n) \ -+ (GC_MALLOC_ATOMIC(z_mult_no_oflow_((n), sizeof(type)))) -+ -+#define New_Reuse(type, ptr, n) \ -+ (GC_REALLOC((ptr), z_mult_no_oflow_((n), sizeof(type)))) -+ -+#endif /* W3_ALLOC_H */ -diff --git a/indep.h b/indep.h -index 84416ed..2809832 100644 ---- a/indep.h -+++ b/indep.h -@@ -1,7 +1,7 @@ - /* $Id: indep.h,v 1.16 2003/09/22 21:02:19 ukai Exp $ */ - #ifndef INDEP_H - #define INDEP_H --#include <gc.h> -+#include "alloc.h" - #include "Str.h" - #include "config.h" - -@@ -92,11 +92,6 @@ extern char *w3m_etc_dir(); - extern char *w3m_conf_dir(); - extern char *w3m_help_dir(); - --#define New(type) ((type*)GC_MALLOC(sizeof(type))) --#define NewAtom(type) ((type*)GC_MALLOC_ATOMIC(sizeof(type))) --#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) --#define NewAtom_N(type,n) ((type*)GC_MALLOC_ATOMIC((n)*sizeof(type))) --#define New_Reuse(type,ptr,n) ((type*)GC_REALLOC((ptr),(n)*sizeof(type))) - #define NewWithoutGC(type) ((type*)xmalloc(sizeof(type))) - #define NewWithoutGC_N(type,n) ((type*)xmalloc((n)*sizeof(type))) - #define NewWithoutGC_Reuse(type,ptr,n) ((type*)xrealloc(ptr,(n)*sizeof(type))) -diff --git a/libwc/charset.c b/libwc/charset.c -index 3f0b74d..ea79b1c 100644 ---- a/libwc/charset.c -+++ b/libwc/charset.c -@@ -1,8 +1,7 @@ - - #include <stdlib.h> - #include <ctype.h> --#include <gc.h> --#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) -+#include "../alloc.h" - - #include "wc.h" - -diff --git a/libwc/status.c b/libwc/status.c -index d25c924..4a2ebf8 100644 ---- a/libwc/status.c -+++ b/libwc/status.c -@@ -1,7 +1,6 @@ - - #include <string.h> --#include <gc.h> --#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) -+#include "../alloc.h" - - #include "wc.h" - #ifdef USE_UNICODE -diff --git a/main.c b/main.c -index 76256d6..d37b243 100644 ---- a/main.c -+++ b/main.c -@@ -383,6 +383,13 @@ make_optional_header_string(char *s) - return hs; - } - -+static void * -+die_oom(size_t bytes) -+{ -+ fprintf(stderr, "Out of memory: %lu bytes unavailable!\n", (unsigned long)bytes); -+ exit(1); -+} -+ - int - main(int argc, char **argv, char **envp) - { -@@ -412,6 +419,7 @@ main(int argc, char **argv, char **envp) - char **getimage_args = NULL; - #endif /* defined(DONT_CALL_GC_AFTER_FORK) && defined(USE_IMAGE) */ - GC_INIT(); -+ GC_set_oom_fn(die_oom); - #if defined(ENABLE_NLS) || (defined(USE_M17N) && defined(HAVE_LANGINFO_CODESET)) - setlocale(LC_ALL, ""); - #endif -diff --git a/matrix.c b/matrix.c -index 64fd0ad..bc7a5be 100644 ---- a/matrix.c -+++ b/matrix.c -@@ -34,18 +34,12 @@ - - #include "config.h" - #include "matrix.h" --#include <gc.h> -+#include "alloc.h" - - /* - * Macros from "fm.h". - */ - --#define New(type) ((type*)GC_MALLOC(sizeof(type))) --#define NewAtom(type) ((type*)GC_MALLOC_ATOMIC(sizeof(type))) --#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type))) --#define NewAtom_N(type,n) ((type*)GC_MALLOC_ATOMIC((n)*sizeof(type))) --#define Renew_N(type,ptr,n) ((type*)GC_REALLOC((ptr),(n)*sizeof(type))) -- - #define SWAPD(a,b) { double tmp = a; a = b; b = tmp; } - #define SWAPI(a,b) { int tmp = a; a = b; b = tmp; } - diff --git a/debian/patches/800_lang-en.patch b/debian/patches/800_lang-en.patch deleted file mode 100644 index d008cca..0000000 --- a/debian/patches/800_lang-en.patch +++ /dev/null @@ -1,535 +0,0 @@ -Subject: Improve English documents -Author: Markus Hiereth <post@hiereth.de>, Justin B Rye <justin.byam.rye@gmail.com> -Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550 -Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771003 - -diff --git a/doc/w3m.1 b/doc/w3m.1 -index 58a8965..0762f51 100644 ---- a/doc/w3m.1 -+++ b/doc/w3m.1 -@@ -1,13 +1,11 @@ - .nr N -1 - .nr D 5 --.TH W3M 1 Local -+.TH W3M 1 "2014-11-29" - .UC 4 - .SH NAME --w3m \- a text based Web browser and pager -+w3m \- a text based web browser and pager - .SH SYNOPSIS --.B w3m --[options] [URL or filename] --.PP -+w3m [OPTION]... [ \fIfile\fP | \fIURL\fP ]... - .SH DESCRIPTION - .\" This defines appropriate quote strings for nroff and troff - .ds lq \&" -@@ -17,234 +15,285 @@ w3m \- a text based Web browser and pager - .\" Just in case these number registers aren't set yet... - .if \nN==0 .nr N 10 - .if \nD==0 .nr D 5 --.I --w3m --is a World Wide Web (WWW) text based client. It has English and --Japanese help files and an option menu and can be configured to --use either language. It will display hypertext markup language --(HTML) documents containing links to files residing on the local --system, as well as files residing on remote systems. It can --display HTML tables and frames. --In addition, it can be used as a "pager" in much the same manner --as "more" or "less". --Current versions of --.I --w3m --run on --Unix (Solaris, SunOS, HP-UX, Linux, FreeBSD, and EWS4800) --and on --Microsoft Windows 9x/NT. --.PP -+ -+\fIw3m\fP is a text based browser which can display local or remote -+web pages as well as other documents. It is able to process HTML -+tables and frames but it ignores JavaScript and Cascading Style -+Sheets. \fIw3m\fP can also serve as a pager for text files named as -+arguments or passed on standard input, and as a general purpose -+directory browser. -+ -+\fIw3m\fP organizes its content in buffers or tabs, allowing easy -+navigation between them. With the w3m-img extension installed, \fIw3m\fP can -+display inline graphics in web pages. And whenever \fIw3m\fP's HTML -+rendering capabilities do not meet your needs, the target URL can be -+handed over to a graphical browser with a single command. -+ -+For help with runtime options, press \(lqH\(rq while running \fIw3m\fP. -+ -+.SH ARGUMENTS -+ -+When given one or more command line arguments, \fIw3m\fP will handle -+targets according to content type. For web, \fIw3m\fP gets this -+information from HTTP headers; for relative or absolute file system -+paths, it relies on filenames. -+ -+With no argument, \fIw3m\fP expects data from standard input and -+assumes \(lqtext/plain\(rq unless another MIME type is given by the user. -+ -+If provided with no target and no fallback target (see for instance -+option \fB\-v\fP below), \fIw3m\fP will exit with usage information. - .SH OPTIONS --At start up, \fIw3m\fR will load any local --file or remote URL specified at the command --line. For help with runtime options, press \fB"H"\fR --while running \fIw3m\fR. --Command line options are: --.PP -+Command line options are introduced with a single \(lq\-\(rq character and -+may take an argument. -+.SS General options: - .TP --.B -t tab --set tab width -+\fB\-B\fP -+with no other target defined, use the bookmark page for startup - .TP --.B -r --ignore backspace effect --.TP --.B -l line --# of preserved line (default 10000) --.TP --.B -I charset --document charset --.TP --.B -O charset --display/output charset -+\fB\-M\fP -+monochrome display - .TP --.B -B --load bookmark -+\fB\-no-mouse\fP -+deactivate mouse support - .TP --.B -bookmark file --specify bookmark file -+\fB\-num\fP -+display each line's number - .TP --.B -T type --specify content-type -+\fB\-N\fP -+distribute multiple command line arguments to tabs. By default, a -+stack of buffers is used -+.TP -+\fB\-ppc \fInum\fR -+width of \fInum\fR pixels per character. Range of 4.0 to 32.0, default 8.0. -+Larger values will make tables narrower. (Implementation not verified) - .TP --.B -m --internet message mode -+\fB\-ppl \fInum\fR -+height of \fInum\fR pixels per line. Range of 4.0 to 64.0. (Implementation not verified) - .TP --.B -v --visual startup mode -+\fB\-title\fP, \fB\-title=TERM\fP -+use the buffer name as terminal title string. With specified TERM, -+this sets the title configuration style accordingly - .TP --.B -M --monochrome display -+\fB\-v\fP -+with no other target defined, welcome users with a built-in page - .TP --.B -N --open URL of command line on each new tab -+\fB\-W\fP -+toggle wrapping in searches - .TP --.B -F --automatically render frame -+\fB\-X\fP -+do not initialize/deinitialize the terminal - .TP --.B -dump --dump formatted page into stdout -+\fB+\fInum\fR -+go to line \fInum\fR; only effective for \fInum\fR larger than the number of lines in the terminal -+.SS Browser options: - .TP --.B -cols width --specify column width (used with -dump) -+\fB\-cols \fInum\fR -+with stdout as destination; HTML is rendered to lines of \fInum\fR characters - .TP --.B -ppc count --specify the number of pixels per character (4.0...32.0). --Larger values will make tables narrower. [default 8.0] -+\fB\-cookie\fP, \fB\-no-cookie\fP -+use stored cookies and accept new ones, or do neither - .TP --.B -ppl count --specify the number of pixels per line (4.0...64.0) -+\fB\-F\fP -+render frames - .TP --.B -dump_source --dump page source into stdout -+\fB\-graph\fP, \fB\-no-graph\fP -+use or do not use graphic characters for drawing HTML table and frame borders - .TP --.B -dump_head --dump response of HEAD request into stdout -+\fB\-header \fIstring\fR -+append \fIstring\fR to the HTTP(S) request. Expected to match the header syntax \f(CW Variable: Value\fP - .TP --.B -dump_both --dump HEAD and source into stdout -+\fB\-m\fP -+Render the body of Usenet messages according to the header \(lqContent-type\(rq - .TP --.B -dump_extra --dump HEAD, source, and extra information into stdout -+\fB\-no-proxy\fP -+do not use proxy - .TP --.B -post file --use POST method with file content -+\fB\-post \fIfile\fR -+use POST method to upload data defined in \fIfile\fR. The syntax to be used -+is \f(CWvar1=value1[&var2=value2]...\fP - .TP --.B -header string --insert string as a header -+\fB\-4\fP -+IPv4 only. Corresponds to dns_order=4 in configuration files - .TP --.B +<num> --goto <num> line -+\fB\-6\fP -+IPv6 only. Corresponds to dns_order=6 in configuration files -+.SS Text pager options: - .TP --.B -num --show line number -+\fB\-l \fInum\fR -+number of lines preserved internally when receiving plain text from -+stdin (default 10,000) - .TP --.B -no-proxy --don't use proxy -+\fB\-r\fP -+use caret notation to display special escape characters (such -+as ANSI escapes or nroff-style backspaces for bold and underlined -+characters) instead of processing them - .TP --.B -4 --IPv4 only (-o dns_order=4) -+\fB\-s\fP -+squeeze multiple blank lines into one - .TP --.B -6 --IPv6 only (-o dns_order=6) -+\fB\-t\fP \fInum\fP -+set tab width to \fInum\fR columns. No effect on stdout -+.SS Data type/encoding options: - .TP --.B -no-mouse --don't use mouse -+\fB\-I \fIcharset\fR -+user defined character encoding of input data - .TP --.B -cookie --use cookie. -+\fB\-O \fIcharset\fR -+user defined character encoding of output data - .TP --.B -no-cookie --don't use cookie -+\fB\-T \fItype\fR -+explicit characterization of input data by MIME type -+.SS Options for data output, followed by immediate exit: - .TP --.B -graph --use graphic character -+\fB\-dump\fP -+dump rendered page into stdout. Set implicitly when output is directed -+to a file or pipe - .TP --.B -no-graph --don't use graphic character -+\fB\-dump_source\fP -+dump the page's source code into stdout - .TP --.B -s --squeeze multiple blank lines -+\fB\-dump_head\fP -+dump response of a HEAD request for a URL into stdout - .TP --.B -W --toggle wrap search mode -+\fB\-dump_both\fP -+dump HEAD, and source code for a URL into stdout - .TP --.B -X --don't use termcap init/deinit -+\fB\-dump_extra\fP -+dump HEAD, source code, and extra information for a URL into stdout - .TP --.B -title [=TERM] --set buffer name to terminal title string. --If TERM is specified, use the TERM style title configuration. -+\fB\-help\fP -+show a summary of compiled-in features and command line options - .TP --.B -o opt=value --assign value to config option -+\fB\-show-option\fP -+show all available config options - .TP --.B -show-option --show all available config option -+\fB\-version\fP -+show the version of \fIw3m\fP -+.SS Options for overriding default settings and resources: - .TP --.B -config file --specify config file -+\fB\-bookmark \fIfile\fR -+use \fIfile\fR instead of the default bookmark.html file - .TP --.B -help --show usage -+\fB\-config \fIfile\fR -+use \fIfile\fR instead of the default config file - .TP --.B -version --show w3m version -+\fB\-debug\fP -+DO NOT USE - .TP --.B -reqlog --write request logfile -+\fB\-o \fIoption=value\fR -+modify one configuration item with an explicitly given value; without \fIoption=value\fR, equivalent to -show-option - .TP --.B -debug --DO NOT USE -+\fB\-reqlog\fP -+log headers of HTTP communication in file \f(CW~/.w3m/request.log\fP - .SH EXAMPLES -+.SS Pager-like usage -+.TP -+Combine snippets of HTML code and preview the page -+.EX -+$ cat header.html footer.html | w3m -T text/html -+.EE -+.TP -+Compare two files using tabs -+.EX -+$ w3m -N config.old config -+.EE -+.SS Browser-like usage -+.TP -+Display web content in monochrome terminal -+.EX -+$ w3m -M http://w3m.sourceforge.net -+.EE -+.TP -+Display embedded graphics -+.EX -+$ w3m -o auto_image=TRUE http://w3m.sourceforge.net -+.EE -+.TP -+Display content from Usenet -+.EX -+$ w3m -m nntp://news.aioe.org/comp.os.linux.networking -+.EE -+.TP -+Upload data for a URL using the POST method -+.EX -+$ w3m -post - http://example.com/form.php <<<'a=0&b=1' -+.EE -+.SS Filter-like usage -+.TP -+Convert an HTML file to plain text with a defined line length -+.EX -+$ w3m -cols 40 foo.html > foo.txt -+.EE -+.TP -+Output the bookmarks page as text with an appended list of links -+.EX -+$ w3m -B -o display_link_number=1 > out.txt -+.EE -+.TP -+Conversion of file format and character encoding -+.EX -+$ w3m -T text/html -I EUC-JP -O UTF-8 < foo.html > foo.txt -+.EE -+.SS Start with no input -+.TP -+Welcome users with a built-in page -+.EX -+$ w3m -v -+.EE -+.\".SH Errors -+.SH ENVIRONMENT -+\fIw3m\fP recognises the environment variable WWW_HOME as defining a -+fallback target for use if it is invoked without one. -+.SH FILES - .TP --To use w3m as a pager: --.br --$ ls | w3m --.br --.TP --To use w3m to translate HTML files: --.br --$ cat foo.html | w3m -T text/html -+\f(CW~/.w3m/bookmark.html\fP -+default bookmark file - .TP --or --.br --$ cat foo.html | w3m -dump -T text/html >foo.txt --.SH FILES -+\f(CW~/.w3m/config\fP -+user defined configuration file; overrides \f(CW/etc/w3m/config\fP - .TP --.I ${HOME}/.w3m/config --configuration file -+\f(CW~/.w3m/cookie\fP -+cookie jar; written on exit, read on launch - .TP --.I ${HOME}/.w3m/keymap --key binding configuration file --.\" .TP --.\" .I ${HOME}/.w3m/menu --.\" ??? -+\f(CW~/.w3m/history\fP -+browser history - visited files and URLs - .TP --.I ${HOME}/.w3m/mouse --mouse configuration file -+\f(CW~/.w3m/keymap\fP -+user defined key bindings; overrides default key bindings - .TP --.I ${HOME}/.w3m/cookie --cookie file -+\f(CW~/.w3m/mailcap\fP -+external viewer configuration file - .TP --.I ${HOME}/.w3m/history --history file -+\f(CW~/.w3m/menu\fP -+user defined menu; overrides default menu - .TP --.I ${HOME}/.w3m/passwd --passowrd and username file -+\f(CW~/.w3m/mime.types\fP -+MIME types file - .TP --.I ${HOME}/.w3m/pre_form --form parameters file -+\f(CW~/.w3m/mouse\fP -+user defined mouse settings - .TP --.I ${HOME}/.w3m/mailcap --external viewer configuration file -+\f(CW~/.w3m/passwd\fP -+password and username file - .TP --.I ${HOME}/.w3m/mime.types --MIME types file -+\f(CW~/.w3m/pre_form\fP -+contains predefined values to fill recurrent HTML forms - .\" .TP --.\" .I ${HOME}/.w3m/urimethodmap -+.\" .I $~/.w3m/urimethodmap - .\" ??? - .SH NOTES --This is the --.I --w3m --0.5.3 Release. --.PP --Please see the MANUAL.html file distributed with w3m for --more detailed documentation. -- --Additional information about --.I --w3m --may be found on its Japanese language Web site located at: -- http://w3m.sourceforge.net/index.ja.html --.br --or on its English version of the site at: -- http://w3m.sourceforge.net/index.en.html -+This is the \fIw3m\fP 0.5.3 Release. -+.SH SEE ALSO -+README and example files are to be found in the doc directory of your \fIw3m\fP installation. Recent information about \fIw3m\fP may be found on -+.UR http://w3m.sourceforge.net -+the project's web pages at -+.UE - .SH ACKNOWLEDGMENTS --.I --w3m --has incorporated code from several sources. -+\fIw3m\fP has incorporated code from several sources. - Users have contributed patches and suggestions over time. - .SH AUTHOR --Akinori ITO <aito@fw.ipsj.or.jp> -+.UR aito@fw.ipsj.or.jp -+Akinori ITO -+.UE -+ -diff --git a/scripts/w3mman/w3mman.1.in b/scripts/w3mman/w3mman.1.in -index 1c0361d..1b1d990 100644 ---- a/scripts/w3mman/w3mman.1.in -+++ b/scripts/w3mman/w3mman.1.in -@@ -1,4 +1,4 @@ --.TH W3MMAN 1 "Nov 5, 2005" -+.TH W3MMAN 1 "Nov 23, 2014" - .\" Please adjust this date whenever revising the manpage. - .\" - .\" Some roff macros, for reference: -@@ -12,19 +12,19 @@ - .\" .sp <n> insert n+1 empty lines - .\" for manpage-specific macros, see man(7) - .SH NAME --w3mman \- an interface to the on-line reference manuals by w3m(1) -+w3mman \- an interface to the on-line reference manuals via w3m(1) - .SH SYNOPSIS - .B w3mman --.RI "[-M " path ] " " [ section ] " page" -+.RI "[\-M " path ] " " [ section ] " page" - .br - .B w3mman --.RI "[-M " path "] -k " keyword -+.RI "[\-M " path "] \-k " keyword - .br - .B w3mman --.RI -l " file -+.RI \-l " file - .SH DESCRIPTION - .B w3mman --is the system's manual pager by -+is a pager for manual pages, using - .BR w3m (1). - .SH OPTIONS - A summary of options is included below. -@@ -42,6 +42,7 @@ Specify - Specify a - .I file. - .SH ENVIRONMENT -+Two variables are available for debugging. - .TP - .B W3MMAN_W3M - If W3MMAN_W3M is set, its value is used instead of @W3M@. -@@ -51,7 +52,7 @@ If W3MMAN_MAN is set, its value is used instead of @MAN@. - .SH FILES - .TP - .I @libexecdir@/@PACKAGE@/cgi-bin/w3mman2html.cgi --convert manual page to html. -+manual page to HTML convertor. - .SH SEE ALSO - .BR man (1), - .BR w3m (1). diff --git a/debian/patches/810_lang-de.patch b/debian/patches/810_lang-de.patch deleted file mode 100644 index 831d85b..0000000 --- a/debian/patches/810_lang-de.patch +++ /dev/null @@ -1,921 +0,0 @@ -Subject: Add German translation -Author: Markus Hiereth <markus.hiereth@freenet.de> -Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763964 - -diff --git a/po/LINGUAS b/po/LINGUAS -index 1489115..ade7ca2 100644 ---- a/po/LINGUAS -+++ b/po/LINGUAS -@@ -1,2 +1,2 @@ - # Set of available languages. --ja -+ja de -diff --git a/po/de.po b/po/de.po -new file mode 100644 -index 0000000..5e84022 ---- /dev/null -+++ b/po/de.po -@@ -0,0 +1,903 @@ -+# German translation of w3m -+# Copyright (C) 2014 Fumitoshi UKAI -+# This file is distributed under the same license as the w3m package. -+# Markus Hiereth <markus.hiereth@freenet.de>, 2014. -+msgid "" -+msgstr "" -+"Project-Id-Version: w3m 0.5.3\n" -+"Report-Msgid-Bugs-To: satodai@w3m.jp\n" -+"POT-Creation-Date: 2010-08-20 18:44+0900\n" -+"PO-Revision-Date: 2014-10-19 11:15+0200\n" -+"Last-Translator: Markus Hiereth <markus.hiereth@freenet.de>\n" -+"Language-Team: German <debian-l10n-german@lists.debian.org>\n" -+"Language: de\n" -+"MIME-Version: 1.0\n" -+"Content-Type: text/plain; charset=UTF-8\n" -+"Content-Transfer-Encoding: 8bit\n" -+"Plural-Forms: nplurals=2; plural=(n != 1);\n" -+"X-Generator: Virtaal 0.7.1\n" -+ -+#: menu.c:267 -+msgid " Back (b) " -+msgstr " Zurück (b) " -+ -+#: menu.c:268 -+msgid " Select Buffer(s) " -+msgstr " Puffer auswählen (s) " -+ -+#: menu.c:270 -+msgid " Select Tab (t) " -+msgstr " Reiter auswählen (t) " -+ -+#: menu.c:272 -+msgid " View Source (v) " -+msgstr " Codeansicht (v) " -+ -+#: menu.c:273 -+msgid " Edit Source (e) " -+msgstr " Code bearbeiten (e) " -+ -+#: menu.c:274 -+msgid " Save Source (S) " -+msgstr " Code speichern (S) " -+ -+#: menu.c:275 -+msgid " Reload (r) " -+msgstr " Erneut laden (r) " -+ -+#: menu.c:276 menu.c:283 menu.c:287 -+msgid " ---------------- " -+msgstr " ---------------------- " -+ -+#: menu.c:277 -+msgid " Go Link (a) " -+msgstr " Ziel öffnen.. (a) " -+ -+#: menu.c:278 -+msgid " on New Tab (n) " -+msgstr " ..in neuem Reiter (n) " -+ -+#: menu.c:279 -+msgid " Save Link (A) " -+msgstr " Ziel speichern (A) " -+ -+#: menu.c:280 -+msgid " View Image (i) " -+msgstr " Bild anzeigen (i) " -+ -+#: menu.c:281 -+msgid " Save Image (I) " -+msgstr " Bild speichern (I) " -+ -+#: menu.c:282 -+msgid " View Frame (f) " -+msgstr " Frames zeigen (f) " -+ -+#: menu.c:284 -+msgid " Bookmark (B) " -+msgstr " Lesezeichen (B) " -+ -+#: menu.c:285 -+msgid " Help (h) " -+msgstr " Hilfe (h) " -+ -+#: menu.c:286 -+msgid " Option (o) " -+msgstr " Einstellungen (o) " -+ -+#: menu.c:288 -+msgid " Quit (q) " -+msgstr " Programm verlassen (q) " -+ -+#: rc.c:60 -+msgid "External Viewer Setup" -+msgstr "Konfiguration für externe Anzeigeprogramme" -+ -+#: rc.c:61 -+msgid "Tab width in characters" -+msgstr "Tabulatorbreite in Zeichen" -+ -+#: rc.c:62 -+msgid "Indent for HTML rendering" -+msgstr "Einzug bei HTML-Darstellung" -+ -+#: rc.c:63 -+msgid "Number of pixels per character (4.0...32.0)" -+msgstr "Anzahl von Pixeln pro Zeichen (4.0 bis 32.0)" -+ -+#: rc.c:64 -+msgid "Number of pixels per line (4.0...64.0)" -+msgstr "Anzahl von Pixeln pro Zeile (4.0 bis 64.0)" -+ -+#: rc.c:65 -+#entsprechend Bescheibung aus MANUAL.html, mh 14.10.2014 -+msgid "Number of remembered lines when used as a pager" -+msgstr "Anzahl gemerkter, über die Standardeingabe erhaltener Zeilen" -+ -+#: rc.c:66 -+msgid "Use URL history" -+msgstr "URL-Chronik verwenden" -+ -+#: rc.c:67 -+msgid "Number of remembered URL" -+msgstr "Anzahl von URLs in Chronik" -+ -+#: rc.c:68 -+msgid "Save URL history" -+msgstr "URL-Chronik speichern" -+ -+#: rc.c:69 -+msgid "Render frames automatically" -+msgstr "Frames selbstständig darstellen" -+ -+#: rc.c:70 -+msgid "Treat argument without scheme as URL" -+msgstr "Eingabe ohne Protokoll-Präfix als URL auffassen" -+ -+#: rc.c:71 -+msgid "Use _self as default target" -+msgstr "_self als Standard-Zielfenster verwenden" -+ -+#: rc.c:72 -+msgid "Open link on new tab if target is _blank or _new" -+msgstr "Link in neuem Reiter öffnen, falls für Zielfenster _blank oder _new definiert ist" -+ -+#: rc.c:73 -+msgid "Open download list panel on new tab" -+msgstr "Downloadliste in neuem Reiter öffnen" -+ -+#: rc.c:74 -+msgid "Display link URL automatically" -+msgstr "URL der Links selbstständig anzeigen" -+ -+#: rc.c:75 -+msgid "Display link numbers" -+msgstr "Linknummern anzeigen" -+ -+#: rc.c:76 -+msgid "Display decoded URL" -+msgstr "URL entschlüsselt anzeigen" -+ -+#: rc.c:77 -+msgid "Display current line number" -+msgstr "Aktuelle Zeilennummer anzeigen" -+ -+#: rc.c:78 -+msgid "Display inline images" -+msgstr "Eingebettete Bilder anzeigen" -+ -+#: rc.c:79 -+msgid "Display pseudo-ALTs for inline images with no ALT or TITLE string" -+msgstr "Pseudo-ALTs zu eingebetteten Bildern ohne ALT oder TITLE anzeigen" -+ -+#: rc.c:81 -+msgid "Load inline images automatically" -+msgstr "Eingebettete Bilder selbstständig laden" -+ -+#: rc.c:82 -+msgid "Maximum processes for parallel image loading" -+msgstr "Anzahl zulässiger Prozesse zum gleichzeitigen Laden von Bildern" -+ -+#: rc.c:83 -+msgid "Use external image viewer" -+msgstr "Externen Bildbetrachter verwenden" -+ -+#: rc.c:84 -+msgid "Scale of image (%)" -+msgstr "Bilder prozentual skalieren" -+ -+#: rc.c:85 -+msgid "External command to display image" -+msgstr "Befehl für externen Bildbetrachter" -+ -+#: rc.c:86 -+msgid "Use link list of image map" -+msgstr "Bei Grafiken mit eingebetteten Links Ziele auflisten" -+ -+#: rc.c:88 -+msgid "Display file names in multi-column format" -+msgstr "Dateinamen auf Spalten verteilt anzeigen" -+ -+#: rc.c:89 -+msgid "Use ASCII equivalents to display entities" -+msgstr "ASCII-Ersatz für in HTML benannte Zeichen verwenden" -+ -+#: rc.c:90 -+msgid "Character type for border of table and menu" -+msgstr "Zeichen zum Einrahmen von Tabellen und Menüs" -+ -+#: rc.c:91 -+msgid "Fold lines in TEXTAREA" -+msgstr "In Eingabefeldern vom Typ TEXTAREA Texte umbrechen" -+ -+#: rc.c:92 -+msgid "Display INS, DEL, S and STRIKE element" -+msgstr "Umsetzung der Elemente INS, DEL, S und STRIKE" -+ -+#: rc.c:93 -+msgid "Display with color" -+msgstr "In Farbe anzeigen" -+ -+#: rc.c:94 -+msgid "Color of normal character" -+msgstr "Farbe für normalen Text" -+ -+#: rc.c:95 -+msgid "Color of anchor" -+msgstr "Farbe für Links / Element A" -+ -+#: rc.c:96 -+msgid "Color of image link" -+msgstr "Farbe für Bilder / Element IMG" -+ -+#: rc.c:97 -+msgid "Color of form" -+msgstr "Farbe für Eingaben / Element INPUT" -+ -+#: rc.c:98 -+msgid "Enable coloring of active link" -+msgstr "Aktiven Link farblich hervorheben" -+ -+#: rc.c:99 -+msgid "Color of currently active link" -+msgstr "Farbe des derzeit aktiven Links " -+ -+#: rc.c:100 -+msgid "Use visited link color" -+msgstr "Besuchte Links farblich hervorheben" -+ -+#: rc.c:101 -+msgid "Color of visited link" -+msgstr "Farbe für besuchte Links" -+ -+#: rc.c:102 -+msgid "Color of background" -+msgstr "Hintergrundfarbe" -+ -+#: rc.c:103 -+msgid "Color of mark" -+msgstr "Farbe für Textmarken" -+#msgstr "Farbe für Textmarkierungen" -+ -+#: rc.c:104 -+msgid "Use proxy" -+msgstr "Proxy verwenden" -+ -+#: rc.c:105 -+msgid "URL of HTTP proxy host" -+msgstr "URL des HTTP-Proxy-Hosts" -+ -+#: rc.c:107 -+msgid "URL of HTTPS proxy host" -+msgstr "URL des HTTPS-Proxy-Hosts" -+ -+#: rc.c:110 -+msgid "URL of GOPHER proxy host" -+msgstr "URL des GOPHER-Proxy-Hosts" -+ -+#: rc.c:112 -+msgid "URL of FTP proxy host" -+msgstr "URL des FTP-Proxy-Hosts" -+ -+#: rc.c:113 -+msgid "Domains to be accessed directly (no proxy)" -+msgstr "Ohne Proxy, direkt zu kontaktierende Domains" -+ -+#: rc.c:114 -+msgid "Check noproxy by network address" -+msgstr "Direkten Datentransfer ohne Proxy mittels Netzwerkadresse sicherstellen" -+ -+#: rc.c:115 -+msgid "Disable cache" -+msgstr "Zwischenspeicherung deaktivieren" -+ -+#: rc.c:117 -+msgid "News server" -+msgstr "News-Server" -+ -+#: rc.c:118 -+msgid "Mode of news server" -+msgstr "Modus des News-Servers" -+ -+#: rc.c:119 -+msgid "Number of news messages" -+msgstr "News-Anzahl" -+ -+#: rc.c:121 -+msgid "Order of name resolution" -+msgstr "Reihenfolge der Namens-Auflösung" -+ -+#: rc.c:122 -+msgid "Directory corresponding to / (document root)" -+msgstr "Wurzelverzeichnis für Dokumente (/)" -+ -+#: rc.c:123 -+msgid "Directory corresponding to /~user" -+msgstr "Pfad zum Benutzerverzeichnis (~)" -+ -+#: rc.c:124 -+msgid "Directory corresponding to /cgi-bin" -+msgstr "Verzeichnis für ausführbare Skripte (cgi-bin)" -+ -+#: rc.c:125 -+msgid "Confirm when quitting with q" -+msgstr "Das Programm erst nach Bestätigung verlassen" -+ -+#: rc.c:126 -+msgid "Close tab if buffer is last when back" -+msgstr "Reiter mit nur einem Puffer auf Zurück-Befehl hin schließen" -+ -+#: rc.c:128 -+msgid "Enable mark operations" -+msgstr "Arbeit mit Textmarken ermöglichen" -+#msgstr "Arbeit mit Textmarkierungen ermöglichen" -+ -+#: rc.c:130 -+msgid "Enable Emacs-style line editing" -+msgstr "Zeilen wie in Emacs bearbeiten" -+ -+#: rc.c:131 -+msgid "Enable vi-like numeric prefix" -+msgstr "Vorangestellte Zahlen wie in vi aktivieren" -+ -+#: rc.c:132 -+msgid "Move cursor to top line when going to label" -+msgstr "Labels nach Aufsuchen immer oben positionieren" -+ -+#: rc.c:133 -+msgid "Move cursor to top line when moving to next page" -+msgstr "Beim Umblättern Eingabemarke nach oben setzen" -+ -+#: rc.c:134 -+msgid "Fold lines of plain text file" -+msgstr "Zeilen in Textdateien umbrechen" -+ -+#: rc.c:135 -+msgid "Show line numbers" -+msgstr "Zeilennummern anzeigen" -+ -+#: rc.c:136 -+msgid "Show search string" -+msgstr "Suchbegriff anzeigen" -+ -+#: rc.c:137 -+msgid "List of mime.types files" -+msgstr "Liste der mime.types-Dateien" -+ -+#: rc.c:138 -+msgid "List of mailcap files" -+msgstr "Liste der mailcap-Dateien" -+ -+#: rc.c:139 -+msgid "List of urimethodmap files" -+msgstr "Liste von Dateien mit URI-Methode-Zuordnungen" -+ -+#: rc.c:140 -+msgid "Editor" -+msgstr "Editor" -+ -+#: rc.c:141 -+msgid "Mailer" -+msgstr "Mail-Programm" -+ -+#: rc.c:142 -+# korrespondiert mit Pulldown-Menü, daher verkürzt. mh 09.10.2014 -+msgid "How to call Mailer for mailto URLs with options" -+msgstr "Umgang mit mailto-URLs" -+ -+#: rc.c:143 -+msgid "External Browser" -+msgstr "Externer Browser" -+ -+#: rc.c:144 -+msgid "Second External Browser" -+msgstr "Zweiter externer Browser" -+ -+#: rc.c:145 -+msgid "Third External Browser" -+msgstr "Dritter externer Browser" -+ -+#: rc.c:146 -+# entsprechend file:///usr/share/doc/w3m/README.passwd -+# Prüfung beanstandete auch passwd_file mit Zugriffbytes 600, mh, 05.10.2014 -+msgid "Disable secret file security check" -+msgstr "Keine Prüfung der Sicherheit bei Dateien mit geheimem Inhalt" -+ -+#: rc.c:147 -+msgid "Password file" -+msgstr "Passwort-Datei" -+ -+#: rc.c:148 -+msgid "File for setting form on loading" -+msgstr "Datei mit vordefinierten Eingaben für Formulare" -+ -+#: rc.c:149 -+msgid "Password for anonymous FTP (your mail address)" -+msgstr "Passwort für anonyme FTP-Anmeldung (Ihre Mailadresse)" -+ -+#: rc.c:150 -+msgid "Generate domain part of password for FTP" -+msgstr "Domain-Teil des FTP-Passwortes erzeugen" -+ -+#: rc.c:151 -+msgid "User-Agent identification string" -+msgstr "Browserkennung übermitteln" -+ -+#: rc.c:152 -+msgid "Accept-Encoding header" -+msgstr "Accept-Encoding-Kopfzeile" -+ -+#: rc.c:153 -+msgid "Accept header" -+msgstr "Accept-Kopfzeile" -+ -+#: rc.c:154 -+msgid "Accept-Language header" -+msgstr "Accept-Language-Kopfzeile" -+ -+#: rc.c:155 -+msgid "Treat URL-like strings as links in all pages" -+msgstr "URL-artige Zeichenketten auf allen Seiten als Links auffassen" -+ -+#: rc.c:156 -+msgid "Wrap search" -+msgstr "Im Dokument umlaufend suchen" -+ -+#: rc.c:157 -+msgid "Display unseen objects (e.g. bgimage tag)" -+msgstr "Nicht gezeigte Objekte melden (z.B. Hintergrundbild)" -+ -+#: rc.c:158 -+msgid "Uncompress compressed data automatically when downloading" -+msgstr "Komprimierte Daten beim Download selbstständig dekomprimieren" -+ -+#: rc.c:160 -+# String nicht in Optionen-Menü gefunden. mh, 05.10.2014 -+msgid "Run external viewer in a separate session" -+msgstr "Externe Anzeigeprogramme in eigener Sitzung laufen lassen" -+ -+#: rc.c:162 -+msgid "Run external viewer in the background" -+msgstr "Externe Anzeigeprogramme im Hintergrund laufen lassen" -+ -+#: rc.c:164 -+msgid "Use external program for directory listing" -+msgstr "Externes Programm zum Auflisten von Verzeichnissen verwenden" -+ -+#: rc.c:165 -+msgid "URL of directory listing command" -+msgstr "URL des Befehls zum Auflisten von Verzeichnissen" -+ -+#: rc.c:167 -+msgid "Enable dictionary lookup through CGI" -+msgstr "Wörterbuchabfrage mittels CGI aktivieren" -+ -+#: rc.c:168 -+msgid "URL of dictionary lookup command" -+msgstr "URL des Befehls zur Wörterbuch-Abfrage" -+ -+#: rc.c:170 -+msgid "Display link name for images lacking ALT" -+msgstr "Bei Bildern ohne ALT-Angabe Linkziel anzeigen" -+ -+#: rc.c:171 -+msgid "Index file for directories" -+msgstr "Indexdatei für Verzeichnisse" -+ -+#: rc.c:172 -+msgid "Prepend http:// to URL automatically" -+msgstr "Ziel-Eingaben gegebenenfalls http:// voranstellen" -+ -+#: rc.c:173 -+msgid "Default value for open-URL command" -+msgstr "Vorgabewert bei der Adresseneingabe" -+ -+#: rc.c:174 -+msgid "Decode Content-Transfer-Encoding when saving" -+msgstr "Beim Speichern entsprechend Content-Transfer-Encoding entschlüsseln" -+ -+#: rc.c:175 -+msgid "Preserve timestamp when saving" -+msgstr "Zeitstempel beim Speichern erhalten" -+ -+#: rc.c:177 -+msgid "Enable mouse" -+msgstr "Maus aktivieren" -+ -+#: rc.c:178 -+msgid "Scroll in reverse direction of mouse drag" -+msgstr "Mausbewegungen entgegengesetzt scrollen" -+ -+#: rc.c:179 -+msgid "Behavior of wheel scroll speed" -+msgstr "Umsetzung der Mausradbewegung" -+ -+#: rc.c:180 -+msgid "(A only)Scroll by # (%) of screen" -+msgstr "(nur A) Um # % des Fensters scrollen" -+ -+#: rc.c:181 -+msgid "(B only)Scroll by # lines" -+msgstr "(nur B) Um # Zeilen scrollen" -+ -+#: rc.c:183 -+msgid "Free memory of undisplayed buffers" -+msgstr "Speicherplatz nicht angezeigter Puffer freigeben" -+ -+#: rc.c:184 -+msgid "Suppress `Referer:' header" -+msgstr "Referer-Kopfzeile unterdrücken" -+ -+#: rc.c:185 -+msgid "Search case-insensitively" -+msgstr "Groß- und Kleinschreibung beim Suchen ignorieren" -+ -+#: rc.c:186 -+msgid "Use LESSOPEN" -+msgstr "LESSOPEN verwenden" -+ -+#: rc.c:189 -+msgid "Perform SSL server verification" -+msgstr "SSL-Server-Verifizierung durchführen" -+ -+#: rc.c:190 -+msgid "PEM encoded certificate file of client" -+msgstr "PEM-kodierte Zertifikatsdatei des Clients" -+ -+#: rc.c:191 -+msgid "PEM encoded private key file of client" -+msgstr "PEM-kodierte private Schlüsseldatei des Clients" -+ -+#: rc.c:192 -+msgid "Path to directory for PEM encoded certificates of CAs" -+msgstr "Pfad zum Verzeichnis für PEM-kodierte Zertifikate von CAs" -+ -+#: rc.c:193 -+msgid "File consisting of PEM encoded certificates of CAs" -+msgstr "Datei mit PEM-kodierten Zertifikaten von CAs" -+ -+#: rc.c:195 -+msgid "List of forbidden SSL methods (2: SSLv2, 3: SSLv3, t:TLSv1)" -+msgstr "Liste unzulässiger SSL-Verfahren (2: SSLv2, 3: SSLv3, t: TLSv1)" -+ -+#: rc.c:198 -+msgid "Enable cookie processing" -+msgstr "Cookie-Verarbeitung aktivieren" -+ -+#: rc.c:199 -+msgid "Print a message when receiving a cookie" -+msgstr "Den Empfang von Cookies melden" -+ -+#: rc.c:200 -+msgid "Accept cookies" -+msgstr "Cookies akzeptieren" -+ -+#: rc.c:201 -+msgid "Action to be taken on invalid cookie" -+msgstr "Reaktion auf ungültiges Cookie" -+ -+#: rc.c:202 -+msgid "Domains to reject cookies from" -+msgstr "Domains, deren Cookies abzulehnen sind" -+ -+#: rc.c:203 -+msgid "Domains to accept cookies from" -+msgstr "Domains, deren Cookies akzeptiert werden" -+ -+#: rc.c:204 -+# Variable vom Typ String im Abschnitt Cookies-Einstellungen, mh 10.10.2014 -+#, fuzzy -+msgid "Domains to avoid [wrong number of dots]" -+msgstr "Zu meidende Domains (falsche Anzahl von Punkten)" -+ -+#: rc.c:206 -+msgid "Number of redirections to follow" -+msgstr "Anzahl zu akzeptierender Umleitungen" -+ -+# Konfigurationsvariable vom Typ string, mh, 05.10.2014 -+#: rc.c:207 -+msgid "Enable processing of meta-refresh tag" -+msgstr "Meta-Refresh-Element verarbeiten" -+ -+#: rc.c:210 -+msgid "Enable Migemo (Roma-ji search)" -+msgstr "Romaji-Suche mittels Migemo aktivieren" -+ -+#: rc.c:211 -+msgid "Migemo command" -+msgstr "Migemo-Befehl" -+ -+#: rc.c:215 -+msgid "Display charset" -+msgstr "Zeichenkodierung der Anzeige" -+ -+#: rc.c:216 -+msgid "Default document charset" -+msgstr "Zeichenkodierungs-Vorgabe für Dokumente" -+ -+#: rc.c:217 -+msgid "Automatic charset detect when loading" -+msgstr "Selbstständige Erkennung der Zeichenkodierung beim Laden" -+ -+#: rc.c:218 -+msgid "System charset" -+msgstr "Zeichenkodierung des Systems" -+ -+#: rc.c:219 -+msgid "System charset follows locale(LC_CTYPE)" -+msgstr "Zeichenkodierung des Systems entsprechend Locale (LC_CTYPE)" -+ -+#: rc.c:220 -+# war zuvor -+# msgstr "Halfdump mit der zur Anzeige benutzten Zeichenkodierung exportieren" -+msgid "Output halfdump with display charset" -+msgstr "Halfdump in der zur Anzeige benutzten Kodierung" -+ -+#: rc.c:221 -+# Konfigurationsvariable vom Typ boolean, mh, 05.10.2014 -+#, fuzzy -+msgid "Use multi column characters" -+msgstr "Spaltenübergreifende Zeichen verwenden" -+ -+#: rc.c:222 -+msgid "Use combining characters" -+msgstr "Kombinationszeichen verwenden" -+ -+#: rc.c:223 -+msgid "Use double width for some Unicode characters" -+msgstr "Einzelnen Unicode-Zeichen zwei Spalten einräumen" -+ -+#: rc.c:224 -+msgid "Use Unicode language tags" -+msgstr "Unicode-Sprach-Tags verwenden" -+ -+#: rc.c:225 -+msgid "Charset conversion using Unicode map" -+msgstr "Zeichen in Unicode kodieren" -+ -+#: rc.c:226 -+msgid "Charset conversion when loading" -+msgstr "Zeichenkodierung beim Laden anpassen" -+ -+#: rc.c:227 -+msgid "Adjust search string for document charset" -+msgstr "Zu suchende Zeichenkette der Kodierung des Dokumentes anpassen" -+ -+#: rc.c:228 -+msgid "Fix character width when conversion" -+msgstr "Bei Umwandlung an der Breite von Zeichen festhalten" -+ -+#: rc.c:229 -+msgid "Use GB 12345 Unicode map instead of GB 2312's" -+msgstr "GB-12345-Unicode statt GB 2312 verwenden" -+ -+#: rc.c:230 -+msgid "Use JIS X 0201 Roman for ISO-2022-JP" -+msgstr "JIS X 0201 Roman statt ISO-2022-JP verwenden" -+ -+#: rc.c:231 -+msgid "Use JIS C 6226:1978 for ISO-2022-JP" -+msgstr "JIS C 6226:1978 statt ISO-2022-JP verwenden" -+ -+#: rc.c:232 -+msgid "Use JIS X 0201 Katakana" -+msgstr "JIS X 0201 Katakana verwenden" -+ -+#: rc.c:233 -+msgid "Use JIS X 0212:1990 (Supplemental Kanji)" -+msgstr "JIS X 0212:1990 verwenden (ergänzendes Kanji)" -+ -+#: rc.c:234 -+msgid "Use JIS X 0213:2000 (2000JIS)" -+msgstr "JIS X 0213:2000 verwenden (2000JIS)" -+ -+#: rc.c:235 -+msgid "Strict ISO-2022-JP/KR/CN" -+msgstr "Striktes ISO-2022-JP/KR/CN" -+ -+#: rc.c:236 -+msgid "Treat 4 bytes char. of GB18030 as Unicode" -+msgstr "4-Byte-Zeichen von GB 18030 als Unicode auffassen" -+ -+#: rc.c:237 -+msgid "Simple Preserve space" -+msgstr "Einfache Platzerhaltung" -+ -+#: rc.c:240 -+msgid "keymap file" -+msgstr "Tastaturbelegungs-Datei" -+ -+#: rc.c:257 -+msgid "black" -+msgstr "schwarz" -+ -+#: rc.c:258 -+msgid "red" -+msgstr "rot" -+ -+#: rc.c:259 -+msgid "green" -+msgstr "grün" -+ -+#: rc.c:260 -+msgid "yellow" -+msgstr "gelb" -+ -+#: rc.c:261 -+msgid "blue" -+msgstr "blau" -+ -+#: rc.c:262 -+msgid "magenta" -+msgstr "magenta" -+ -+#: rc.c:263 -+msgid "cyan" -+msgstr "cyan" -+ -+#: rc.c:264 -+msgid "white" -+msgstr "weiß" -+ -+#: rc.c:265 -+msgid "terminal" -+msgstr "wie Terminal" -+ -+#: rc.c:284 -+msgid "none" -+msgstr "keiner" -+ -+#: rc.c:285 -+msgid "current URL" -+msgstr "aktuelle URL" -+ -+#: rc.c:286 -+msgid "link URL" -+msgstr "Link-URL" -+ -+#: rc.c:291 -+msgid "simple" -+msgstr "einfach" -+ -+#: rc.c:292 -+msgid "use tag" -+msgstr "durch Tags" -+ -+#: rc.c:293 -+msgid "fontify" -+msgstr "hervorgehoben" -+ -+#: rc.c:299 -+msgid "A:relative to screen height" -+msgstr "A: relativ zu Fensterhöhe" -+ -+#: rc.c:300 -+msgid "B:fixed speed" -+msgstr "B: feste Geschwindigkeit" -+ -+#: rc.c:307 -+msgid "unspecified" -+msgstr "nicht spezifiziert" -+ -+#: rc.c:308 -+msgid "inet inet6" -+msgstr "inet inet6" -+ -+#: rc.c:309 -+msgid "inet6 inet" -+msgstr "inet6 inet" -+ -+#: rc.c:310 -+msgid "inet only" -+msgstr "nur inet" -+ -+#: rc.c:311 -+msgid "inet6 only" -+msgstr "nur inet6" -+ -+#: rc.c:318 -+msgid "discard" -+msgstr "verwerfen" -+ -+#: rc.c:320 -+msgid "accept" -+msgstr "annehmen" -+ -+#: rc.c:322 -+msgid "ask" -+msgstr "nachfragen" -+ -+#: rc.c:329 -+# gehört zu rc.c:142 -+# erscheint in Pulldown-Menü, daher verkürzt. mh 09.10.2014 -+msgid "use internal mailer instead" -+msgstr "Mail intern erstellen" -+ -+#: rc.c:331 -+# gehört zu rc.c:142 -+# erscheint in Pulldown-Menü, daher verkürzt. mh 09.10.2014 -+msgid "ignore options and use only the address" -+msgstr "Optionen ignorieren" -+ -+#: rc.c:332 -+# gehört zu rc.c:142 -+# erscheint in Pulldown-Menü, daher verkürzt. mh 09.10.2014 -+msgid "use full mailto URL" -+msgstr "komplett verwenden" -+ -+#: rc.c:341 -+msgid "OFF" -+msgstr "AUS" -+ -+#: rc.c:342 -+msgid "Only ISO 2022" -+msgstr "Nur ISO-2022" -+ -+#: rc.c:343 -+msgid "ON" -+msgstr "AN" -+ -+#: rc.c:349 -+# Wert aus einem Set zur Wiedergabe von Rändern, mh, 05.10.2014 -+msgid "ASCII" -+msgstr "ASCII" -+ -+#: rc.c:350 -+# Wert aus einem Set zur Wiedergabe von Rändern, mh, 05.10.2014 -+# hier ist "Zeichensatz" akzeptabel mh, 09.10.2014 -+msgid "charset specific" -+msgstr "zeichensatzspezifisch" -+ -+#: rc.c:351 -+# Wert aus einem Set zur Wiedergabe von Rändern, mh, 05.10.2014 -+msgid "DEC special graphics" -+msgstr "mit DEC-Grafiken" -+ -+#: rc.c:714 -+msgid "Display Settings" -+msgstr "Einstellungen zur Anzeige" -+ -+#: rc.c:716 -+msgid "Color Settings" -+msgstr "Farbeinstellungen" -+ -+#: rc.c:718 -+msgid "Miscellaneous Settings" -+msgstr "Weitere Einstellungen" -+ -+#: rc.c:719 -+msgid "Directory Settings" -+msgstr "Verzeichnis-Einstellungen" -+ -+#: rc.c:720 -+msgid "External Program Settings" -+msgstr "Einstellungen für externe Programme" -+ -+#: rc.c:721 -+msgid "Network Settings" -+msgstr "Netzwerk-Einstellungen" -+ -+#: rc.c:722 -+msgid "Proxy Settings" -+msgstr "Proxy-Einstellungen" -+ -+#: rc.c:724 -+msgid "SSL Settings" -+msgstr "SSL-Einstellungen" -+ -+#: rc.c:727 -+msgid "Cookie Settings" -+msgstr "Cookie-Einstellungen" -+ -+#: rc.c:730 -+msgid "Charset Settings" -+msgstr "Zeichenkodierungs-Einstellungen" -+ -+#. TRANSLATORS: -+#. * AcceptLang default: this is used in Accept-Language: HTTP request -+#. * header. For example, ja.po should translate it as -+#. * "ja;q=1.0, en;q=0.5" like that. -+#. -+#: rc.c:1209 -+msgid "en;q=1.0" -+msgstr "de;q=1.0, en;q=0.5" diff --git a/debian/patches/820_lang-ja.patch b/debian/patches/820_lang-ja.patch deleted file mode 100644 index 12324d0..0000000 --- a/debian/patches/820_lang-ja.patch +++ /dev/null @@ -1,18 +0,0 @@ -Subject: Set Language tag properly for Japanese translation -Author: zimous <zimous@matfyz.cz> -Origin: https://512722.bugs.gentoo.org/attachment.cgi?id=378452 -Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=512722 - -diff --git a/po/ja.po b/po/ja.po -index 947191c..c16557a 100644 ---- a/po/ja.po -+++ b/po/ja.po -@@ -12,7 +12,7 @@ msgstr "" - "PO-Revision-Date: 2010-08-20 18:45+0900\n" - "Last-Translator: Fumitoshi UKAI <ukai@debian.or.jp>\n" - "Language-Team: Japanese\n" --"Language: \n" -+"Language: ja\n" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" diff --git a/debian/patches/900_ChangeLog.patch b/debian/patches/900_ChangeLog.patch deleted file mode 100644 index 3482292..0000000 --- a/debian/patches/900_ChangeLog.patch +++ /dev/null @@ -1,613 +0,0 @@ -Subject: Update ChangeLog -From: Tatsuya Kinoshita <tats@debian.org> - -diff --git a/ChangeLog b/ChangeLog -index 88358ef..7629962 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,605 @@ -+2015-01-24 Tatsuya Kinoshita <tats@debian.org> -+ -+ * acinclude.m4, configure, version.c.in: -+ Update to 0.5.3+gitYYYYMMDD (generate from ChangeLog). -+ -+2015-01-15 Tatsuya Kinoshita <tats@debian.org> -+ -+ * alloc.h, main.c: Drop C99 features. -+ -+2015-01-15 Scarlett <scarlett@xavin.net> -+ -+ Add overflow detection. -+ Origin: http://marc.info/?l=openbsd-ports&m=142090828929750&w=2 -+ * main.c: Call exit(1) when out of memory to avoid dereferencing null -+ pointers when gc's malloc fails. -+ * alloc.h: Replacements for w3m's allocation macros which add -+ overflow detection and concentrate the macros in one file. -+ * indep.h, libwc/charset.c, libwc/status.c, matrix.c: Use the -+ overflow-detecting allocation macros from alloc.h. -+ -+2015-01-15 Tatsuya Kinoshita <tats@debian.org> -+ -+ * Str.c, cookie.c, map.c: -+ Do not use C99 printf format specifiers and asprintf. -+ -+2015-01-15 Scarlett <scarlett@xavin.net> -+ -+ Correct printf arguments and use asprintf. -+ Origin: http://marc.info/?l=openbsd-ports&m=142090828929750&w=2 -+ * Str.c: Use asprintf() instead of rolling our own printf string -+ length detection. -+ * cookie.c: Pass the char pointer in the string struct to printf %s -+ instead of the string struct itself. -+ Print time_t using %lld instead of %ld to allow for 64-bit time_t. -+ * main.c: Print a long int using the correct format specifier. -+ * map.c: Print size_t using the correct format specifier. -+ -+2014-12-06 Araki Ken <arakiken@users.sf.net> -+ -+ Support OSC 5379 remote imaging and sixel graphics. -+ Origin: https://bitbucket.org/arakiken/w3m/branch/remoteimg (2014-11-16) -+ -+ * doc/README.sixel, terms.c: Add README.sixel. W3M_IMG2SIXEL -+ environmental variable enables to specify options of img2sixel. -+ -+ * image.c, terms.c: -+ Add n_terminal_image argument to put_image_{sixel|osc5379}(). -+ Use struct winsize to calculate ppc and ppl. -+ -+ * terms.c: If SCREEN_VARIANT=sixel on GNU screen, exec img2sixel -+ without -P option. -+ -+ * terms.c: ttymode_set() -> ttymode_reset(). -+ -+ * terms.c: Fix. -+ -+ * terms.c: Support GNU screen. -+ -+ * terms.c: Show GIF (except animation GIF) correctly. -+ -+ * main.c, terms.c: img2sixel exits by Ctrl+C. Enable GIF Animation if -+ 'I' is pressed to show it. -+ -+ * image.c: Add declaration of get_pixel_per_cell(). -+ -+ * terms.c: Show the first frame of animation gif files. -+ -+ * terms.c: system() -> fork()&execvp() -+ -+ * display.c: Draw underline on anchor which contains cboth text and -+ images. -+ -+ * etc.c: Remove close_tty() from setup_child() because close_tty() -+ sometimes interrupts loadGeneralFile() in loadImage() and corrupt -+ image data can be cached in ~/.w3m. -+ -+ * image.c: Minor fix. -+ -+ * image.c: Cache image files if at all possible and convert them to -+ sixel when -sixel option is specified. -+ -+ * image.c: Init pixel_per_{char|line}_i if get_pixel_per_cell() fails. -+ -+ * display.c, file.c, fm.h, image.c, main.c, terms.c: -+ Add -sixel option which supports image processing by img2sixel. -+ -+ * image.c: Don't download image files whose size is specified in -+ <img> tag. -+ -+ * image.c: Minor fixes of parseImageHeader(). -+ -+ * image.c: Determine the format of an image file by its header data -+ not by its file name suffix. -+ -+ * image.c: Read width and height from jpeg, png and gif files directly -+ instead of executing w3mimgdisplay -size. -+ -+ * display.c: display.c: Draw underline on anchor text which is not -+ overlapped with any image. -+ -+ * terms.c: Clear fd_set by FD_ZERO() before select(). -+ -+ * file.c: nw and ni are rounded up instead of rounded off to show -+ every corner of images. -+ -+ * terms.c: Change time to wait for the response of "\x1b[14t\x1b[18t" -+ from 0.1 sec to 0.5 sec. -+ -+ * image.c: -+ - clearImage() works. -+ - Use cached image files created by w3m in getImage(). -+ -+ * file.c: Hack for alignment. -+ -+ * fm.h, image.c, terms.c: -+ - Adjust the image size to the terminal cell size. -+ - If the image size is specified in html source, skip to load the image. -+ -+ * display.c, fm.h, image.c, main.c, terms.c, w3mimg/x11/x11_w3mimg.c: -+ Support remote image by OSC 5379 show_picture sequence. -+ -+2014-12-06 Olaf Hering <olh@suse.de> -+ -+ * parsetagx.c: Fix crash in parse_tag() during every start. -+ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-parsetagx-crash.patch?expand=1 -+ -+ * fm.h: Change the default to alt_entity=0. -+ Change the default for the option "Use ASCII equivalents to -+ display entities" from YES to NO. -+ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-0.5.1-no-ASCII-equivalents-by-default.patch?expand=1 -+ Bug-Novell: https://bugzilla.novell.com/show_bug.cgi?id=247397 -+ -+ * anchor.c, libwc/gb18030.c, libwc/ucs.c, regex.c: -+ Fix a few harmless uninitialized variables. -+ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-uninitialized.patch?expand=1 -+ -+2014-12-06 Peter Poeml <poeml@suse.de> -+ -+ * terms.c: Prevent segfault when editing a textarea field with vi. -+ Add fix for segfault that can occur when editing a textarea field -+ with vi, and returning to w3m (it seems to happen if the terminal -+ is not writable, as when using w3m after 'su - some_user') -+ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-0.4.1-textarea-segfault.dif?expand=1 -+ -+2014-12-04 Tatsuya Kinoshita <tats@debian.org> -+ -+ * acinclude.m4: Follow updated configure. -+ -+2014-12-03 Yusuke Baba <babayaga1@y8.dion.ne.jp> -+ -+ * configure, w3mimg/fb/fb.c, w3mimg/fb/fb.h, w3mimg/fb/fb_w3mimg.c: -+ Support FreeBSD framebuffer. -+ Origin: http://www.ac.auone-net.jp/~baba/w3m-img/index.html -+ Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=122673 -+ -+2014-12-02 Naohiro Aota <naota@gentoo.org> -+ -+ * acinclude.m4, configure, w3mimg/fb/fb_gdkpixbuf.c: -+ * w3mimg/x11/x11_w3mimg.c: -+ Depend on gdk-pixbuf instead of gtk when gtk2. -+ Origin: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/w3m/files/w3m-0.5.3-gdk-pixbuf.patch?revision=1.1 -+ -+2014-12-02 Jeroen Roovers <jer@gentoo.org> -+ -+ * acinclude.m4, configure: Add tinfo to with_termlib. -+ Fix building against sys-libs/ncurses[tinfo]. -+ Origin: https://504588.bugs.gentoo.org/attachment.cgi?id=372650 -+ Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=504588 -+ -+2014-12-01 OBATA Akio <obache@netbsd.org> -+ -+ * acinclude.m4, configure: -+ Assume defined PKG_CONFIG points right location when gtk2. -+ Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/w3m/patches/patch-aa?rev=1.13&content-type=text/x-cvsweb-markup -+ Origin: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/www/w3m/patches/patch-ak?rev=1.1&content-type=text/x-cvsweb-markup -+ -+2014-12-01 Vsevolod Stakhov <vsevolod@FreeBSD.org> -+ -+ * config.h.in: Disable USE_EGD for LibreSSL. -+ Disable use of RAND_egd as it is absent in FreeBSD. -+ This also fixes build error with LibreSSL. -+ Origin: https://bz-attachments.freebsd.org/attachment.cgi?id=144635 -+ Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191852 -+ Bug-FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191956 -+ -+2014-12-01 zimous <zimous@matfyz.cz> -+ -+ * po/ja.po: Set Language tag properly for Japanese translation. -+ Origin: https://512722.bugs.gentoo.org/attachment.cgi?id=378452 -+ Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=512722 -+ -+2014-11-30 Tatsuya Kinoshita <tats@debian.org> -+ -+ * doc/w3m.1: Typo fix. -+ -+2014-11-30 Markus Hiereth <post@hiereth.de> -+ -+ * doc/w3m.1: Miscellaneous changes to improve English manpage. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 -+ -+2014-11-29 Markus Hiereth <post@hiereth.de> -+ -+ * doc/w3m.1: Improve FILES. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 -+ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=403634 -+ -+ * doc/w3m.1: Improve EXAMPLES. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 -+ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=380560 -+ -+ * doc/w3m.1: Improve explanation about option -N. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 -+ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=345084 -+ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530468 -+ -+ * doc/w3m.1: Note that -cols only affects when HTML is rendered. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 -+ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=285251 -+ -+ * doc/w3m.1: Add more info on configuration. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#30 -+ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=268211 -+ -+2014-11-29 Justin B Rye <justin.byam.rye@gmail.com> -+ -+ * scripts/w3mman/w3mman.1.in: Tweak for W3MMAN_W3M. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771003#5 -+ -+ * scripts/w3mman/w3mman.1.in: English fixes. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=766550#25 -+ -+2014-11-29 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-19+. -+ -+2014-11-29 Justin B Rye <justin.byam.rye@gmail.com> -+ -+ * scripts/w3mman/w3mman2html.cgi.in: Fix Perl warnings. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771004 -+ -+2014-10-21 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-19 -+ -+ * po/LINGUAS: Correct LINGUAS to a whitespace separated list -+ -+2014-10-21 Markus Hiereth <markus.hiereth@freenet.de> -+ -+ * po/LINGUAS, po/de.po: Add German translation -+ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763964 -+ -+2014-10-15 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-18 -+ -+ * doc-jp/README.SSL: Update README.SSL to follow default values -+ -+ * config.sub: Update config.sub with autotools-dev 20140911.1 -+ -+ * fm.h: Disable SSLv3 by default [CVE-2014-3566] -+ cf. https://blog.mozilla.org/security/2014/10/14/the-poodle-attack-and-the-end-of-ssl-3-0/ -+ -+2014-10-15 Ludwig Nussel <ludwig.nussel@suse.de> -+ -+ * fm.h: Force ssl_verify_server on and disable SSLv2 support -+ Origin: http://www.openwall.com/lists/oss-security/2010/06/14/4 -+ -+2014-10-13 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-17+ -+ -+2014-10-04 Tatsuya Kinoshita <tats@debian.org> -+ -+ * libwc/ambwidth_map.awk, libwc/map/ucs_ambwidth.map: -+ Fix incorrect generation of ucs_ambwidth_map -+ -+2014-08-22 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-17 -+ -+ * config.guess: -+ Update config.guess to 2014-03-23 with autotools-dev 20140510.1 -+ -+ * config.sub: -+ Update config.sub to 2014-05-01 with autotools-dev 20140510.1 -+ -+2014-08-22 Micah Cowan <micah@addictivecode.org> -+ -+ * main.c: Support Boehm GC 7.2 -+ Replace Gentoo's patch to prevent segfaults due to infinite recursion. -+ Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=080_gc72.patch;att=1;bug=758831 -+ Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758831 -+ Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=555467 -+ Bug: http://sourceforge.net/p/w3m/patches/63/ -+ Bug: http://sourceforge.net/p/w3m/patches/59/ -+ -+2014-08-22 Tatsuya Kinoshita <tats@debian.org> -+ -+ * main.c: -+ Revert "Support Boehm GC 7.2" (w3m-0.5.2-gc72.patch from Gentoo) -+ This reverts commit 4331db3e3e673ac4dbfe8e9f2b42a8e0478dc98a. -+ -+2014-06-23 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-16 -+ -+ * url.c: Disable ciphers that use keys smaller than 128 bits -+ Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/1325674 -+ -+2014-01-04 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-15 -+ -+2014-01-03 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-14 -+ -+ * acinclude.m4, configure: Use pkg-config to build with imlib2 1.4.6 -+ -+ * doc/HISTORY, doc/README.cookie, doc/README.m17n: -+ Prefer US-ASCII rathar than Japanese encodings in English documents -+ -+2013-12-27 Tatsuya Kinoshita <tats@debian.org> -+ -+ * doc-jp/MANUAL.html, doc/MANUAL.html: -+ Cleanup unusable links in MANUAL.html -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=517315 -+ -+ * version.c.in: Update to 0.5.3+debian-13+ -+ -+2013-12-17 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-13 -+ -+2013-12-14 Tatsuya Kinoshita <tats@debian.org> -+ -+ * config.guess: -+ Update config.guess to 2013-06-10 with autotools-dev 20130810.1 -+ -+ * config.sub: -+ Update config.sub to 2013-08-10 with autotools-dev 20130810.1 -+ -+2013-12-07 Reinhard Max <max@suse.de> -+ -+ * local.c: Fix a directory descriptor leak in loadLocalDir -+ Patch from openSUSE on 2009-09-07. -+ Origin: https://build.opensuse.org/package/view_file/openSUSE:Factory/w3m/w3m-closedir.patch -+ Bug-Novell: https://bugzilla.novell.com/show_bug.cgi?id=531675 -+ -+2013-12-07 AIDA Shinra <shinra@j10n.org> -+ -+ * main.c: Fix crash after SEARCH_NEXT -+ Patch from <http://www.j10n.org/files/w3m-cvs-1.1055-search-next.patch>, -+ [w3m-dev:04473] on 2013-12-07. -+ -+2013-11-11 Paul Boekholt <p.boekholt@gmail.com> -+ -+ * file.c: Add support for single quoted meta refresh URL -+ Bug: https://sourceforge.net/p/w3m/patches/53/ -+ -+2013-11-07 Cristian Rodriguez <crrodriguez@opensuse.org> -+ -+ * url.c: Use SSL_OP_NO_COMPRESSION if available -+ Due to the "CRIME attack" (CVE-2012-4929) HTTPS clients that -+ negotiate TLS-level compression can be abused for MITM attacks. -+ * url.c: Use SSL_MODE_RELEASE_BUFFERS if available -+ Patch from openSUSE on 2012-11-12: -+ https://build.opensuse.org/request/show/141054 -+ -+2013-10-15 Tatsuya Kinoshita <tats@debian.org> -+ -+ * Makefile.in: -+ Depend on funcname.tab to fix parallel make issue of scripts -+ Bug: https://sourceforge.net/p/w3m/patches/64/ -+ Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=362249 -+ -+ * w3mimg/Makefile.in: -+ Avoid prerequisite $(IMGOBJS) to fix parallel make issue of w3mimg -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726188 -+ -+ * acinclude.m4, configure: -+ Explicitly add -lX11 to IMGX11LDFLAGS only when gtk2 -+ Bug: https://sourceforge.net/p/w3m/patches/57/ -+ -+ * w3mimg/Makefile.in: Revert "Fix parallel make issue" -+ This reverts commit aa6f871c6dcc108118142bcc786e4a6ac3d46867. -+ -+ * Makefile.in: -+ Revert "Explicitly link w3mimgdisplay with -lX11 to build with gcc 4.5" -+ This reverts commit 7410954066d68ac2ad6aea638801714447321fec. -+ -+2013-10-14 AIDA Shinra <shinra@j10n.org> -+ -+ * url.c: Define schemeNumToName() to fix scheme bug -+ Patch from <http://www.j10n.org/files/w3m-cvs-1.1055-schemebug.patch>, -+ [w3m-dev:04470] on 2013-10-14. -+ Bug: https://sourceforge.net/p/w3m/patches/60/ -+ -+ * config.h.in, file.c, fm.h, html.h, image.c, indep.c, indep.h: -+ * istream.c, istream.h, local.c, main.c, mimehead.c, proto.h: -+ Workaround of GC crash on Cygwin64 -+ Patch from <http://www.j10n.org/files/w3m-cvs-1.1055-win64gc.patch>, -+ [w3m-dev:04469] on 2013-10-14. -+ -+2013-10-14 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-12+ -+ -+2013-10-14 Jarek Czekalski <jarekczek@poczta.onet.pl> -+ -+ * terms.c: Fix paren in check_cygwin_console() -+ Bug: https://sourceforge.net/p/w3m/patches/66/ -+ -+2013-10-13 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-12 -+ -+ * doc-jp/MANUAL.html, doc-jp/w3m.1, doc/MANUAL.html, doc/w3m.1: -+ Update document for the -s option change -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=75527 -+ -+ * terms.c: Do not fail when LANG is not set -+ Check whether the value of LC_ALL, LC_CTYPE or LANG is not NULL in -+ check_cygwin_console(). -+ Bug: https://sourceforge.net/p/w3m/patches/66/ -+ -+2013-10-12 Tatsuya Kinoshita <tats@debian.org> -+ -+ * table.h: Bump MAXCOL to 256 -+ Bug: https://sourceforge.net/p/w3m/feature-requests/24/ -+ -+2013-10-12 Laurence Richert <laurencerichert@yahoo.de> -+ -+ * main.c, proto.h: vim/-perator like handling -+ - half page scrolling -+ - jumping to elements numbered by getLinkNumberStr() from Karsten -+ Schoelzel -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=724028 -+ -+2013-10-12 Tatsuya Kinoshita <tats@debian.org> -+ -+ * doc-jp/README, doc/README: -+ Mention project page rather than unavailable mailing lists -+ -+2013-10-09 Rafael Laboissiere <rafael@laboissiere.net> -+ -+ * doc/README.img: Fix typo -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=725892 -+ -+2013-08-12 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-11+ -+ -+ * ChangeLog: Update ChangeLog to use contributor's name -+ -+2013-08-08 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-11 -+ -+2013-08-04 Tatsuya Kinoshita <tats@debian.org> -+ -+ * Str.c: Check length for Strchop() -+ -+ * main.c: Fix potentially segfault of execdict() -+ -+ * version.c.in: Update to 0.5.3+debian-10+ -+ -+ * file.c: Fix segfault of loadGeneralFile() -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718612 -+ -+2013-08-02 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-10 -+ -+2013-08-02 Piotr P. Karwasz <piotr.p@karwasz.org> -+ -+ * scripts/w3mman/w3mman2html.cgi.in: -+ Correct underline processing and more UTF-8 support for w3mman2html.cgi -+ Patch from <https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/680202> -+ on 2010-11-23. -+ -+2013-08-01 Hilko Bengen <bengen@debian.org> -+ -+ * entity.c: Ignore SOFT HYPHEN to prevent drawing hyphens everywhere -+ Patch from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=441934> -+ on 2011-03-01. -+ -+2013-08-01 Tatsuya Kinoshita <tats@debian.org> -+ -+ * doc-jp/README, doc/README: Update contact list in README -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696209 -+ -+2013-07-30 Tatsuya Kinoshita <tats@debian.org> -+ -+ * config.guess, config.sub: -+ Update config.guess and config.sub to supprot aarch64 -+ Updated with Debian autotools-dev version 20130515.1. -+ -+2013-07-30 Conrad J.C. Hughes <debbugs@xrad.org> -+ -+ * main.c: Sort anchors by sequence number in -dump -+ Patch from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657666> -+ on 2012-01-27. -+ -+2013-07-30 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update to 0.5.3+debian-9+ -+ -+2013-07-29 Tatsuya Kinoshita <tats@debian.org> -+ -+ * version.c.in: Update version to w3m/0.5.3+debian-9 -+ -+ * version.c.in: Set CURRENT_VERSION to debian version -+ -+2013-07-28 Tatsuya Kinoshita <tats@debian.org> -+ -+ * file.c: Fix segfault of process_button() -+ -+2013-04-08 AIDA Shinra <shinra@j10n.org> -+ -+ * file.c: One more patch for siteconf from [w3m-dev 04464] -+ -+ * anchor.c, config.h.in, display.c, doc-jp/README.siteconf: -+ * doc/README.siteconf, file.c, fm.h, form.c, frame.c, func.c: -+ * history.c, indep.c, indep.h, linein.c, main.c, map.c, menu.c: -+ * po/ja.po, proto.h, rc.c, url.c: Support the siteconf feature -+ Patch to support the siteconf feature, from [w3m-dev 04463] -+ on 2012-06-27. -+ -+2013-04-08 Hayaki Saito <user@zuse.jp> -+ -+ * keybind.c, main.c, proto.h, terms.c: -+ Support SGR 1006 mouse reporting -+ Patch to support SGR 1006 mouse reporting, from [w3m-dev 04466] -+ on 2012-07-15. -+ -+2012-05-19 Hilko Bengen <bengen@debian.org> -+ -+ * form.c: Assume "text" if an input type is unknown -+ Patch from <http://bugs.debian.org/615843> on 2011-03-01. -+ -+2012-05-19 Simon Ruderich <simon@ruderich.org> -+ -+ * Makefile.in: Use $(CPPFLAGS) with $(CPP) -+ Patch from <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=665491> -+ on 2012-03-24. -+ -+2012-05-03 Miroslav Šulc <fordfrog@gentoo.org> -+ -+ * w3mimg/Makefile.in: Fix parallel make issue -+ Patch from Gentoo -+ <http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/w3m/files/w3m-0.5.3-parallel-make.patch?revision=1.1&view=markup> -+ <https://bugs.gentoo.org/show_bug.cgi?id=353390> on 2011-02-01. -+ -+2012-05-03 MATSUU Takuto <matsuu@gentoo.org> -+ -+ * main.c: Support Boehm GC 7.2 -+ Patch from Gentoo -+ <http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/www-client/w3m/files/w3m-0.5.2-gc72.patch?revision=1.1&view=markup> -+ on 2009-12-13. -+ -+2012-05-02 Reinhard Tartler <siretart@tauware.de> -+ -+ * istream.c, istream.h: -+ Fix that struct file_handle conflicts with glibc 2.14 -+ Patch from <https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/935540> -+ on 2012-02-19. -+ -+2011-10-30 Colin Watson <cjwatson@ubuntu.com> -+ -+ * acinclude.m4, configure, w3mbookmark.c: -+ Appease gcc -Werror=format-security. -+ Patch from 0.5.3-3ubuntu1 on 2011-10-23. -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646321 -+ -+2011-06-19 Martin Pitt <martin.pitt@ubuntu.com> -+ -+ * Makefile.in: -+ Explicitly link w3mimgdisplay with -lX11 to build with gcc 4.5 -+ Patch from 0.5.2-10ubuntu1 on 2010-12-03. -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605761 -+ -+2011-06-19 Fumitoshi UKAI <ukai@debian.or.jp> -+ -+ * main.c: -+ Change the -s option to "squeeze multiple blank lines" for pager -+ Change the -s option from "display charset Shift_JIS" to "squeeze -+ multiple blank lines" to work as /usr/bin/pager. In addition, the -+ options -j and -e are disabled. To specify the display charset, -+ use -O{s|j|e} instead. -+ Patch from [w3m-dev 01275] on 2000-10-26. -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=75527 -+ -+2011-06-19 Hiroyuki Ito <ZXB01226@nifty.com> -+ -+ * file.c, fm.h, html.c, html.h, proto.h, table.c, tagtable.tab: -+ Support the button element as defined in HTML 4.01 -+ Patch from upstream, [w3m-dev 04411] on 2010-09-17, to support the -+ button element. It is discussed upstream and incomplete, but enough -+ to login Launchpad. -+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=136810 -+ - 2012-05-22 Tatsuya Kinoshita <tats@vega.ocn.ne.jp> - - * [w3m-dev 04451] w3m/entity.h should be removed when `make clean' diff --git a/debian/patches/series b/debian/patches/series index 1f5a350..4c59f00 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,52 +1,2 @@ 010_upstream.patch -015_debian-version.patch -020_button.patch -030_pager-s-option.patch -040_link-gtk2.patch -#050_autotools-config.patch -060_format-security.patch -070_glibc2.14.patch -080_gc72.patch -090_parallel-make.patch -100_use-cppflags.patch -110_form-input-text.patch -120_sgrmouse.patch -130_siteconf.patch -140_sort-dump-links.patch -150_contact-list.patch -160_ignore-shy.patch -170_w3mman2html-utf8.patch -180_execdict.patch -190_Strchop.patch -200_readme-img-typo.patch -210_vim-like.patch -220_maxcol.patch -230_cygwin-lang.patch -240_win64gc.patch -250_schemebug.patch -260_openssl.patch -270_refresh-url.patch -280_search-next.patch -290_closedir.patch -300_manual-links.patch -310_doc-ascii.patch -320_imlib2-config.patch -330_Disable-weak-ciphers.patch -340_ssl-init.patch -350_ambwidth.patch -360_libressl.patch -370_gtk2-pkg-config.patch -380_tinfo.patch -390_gdk-pixbuf.patch -400_w3m-img-freebsd.patch -410_textarea-segfault.patch -420_uninitialized.patch -430_no-ascii-default.patch -440_parsetagx-crash.patch -450_remoteimg.patch -460_printf.patch -470_alloc.patch -800_lang-en.patch -810_lang-de.patch -820_lang-ja.patch -900_ChangeLog.patch +020_debian.patch |