summaryrefslogtreecommitdiff
path: root/www/w3m/files/patch-av
diff options
context:
space:
mode:
Diffstat (limited to 'www/w3m/files/patch-av')
-rw-r--r--www/w3m/files/patch-av156
1 files changed, 156 insertions, 0 deletions
diff --git a/www/w3m/files/patch-av b/www/w3m/files/patch-av
new file mode 100644
index 000000000000..624e49717155
--- /dev/null
+++ b/www/w3m/files/patch-av
@@ -0,0 +1,156 @@
+diff -u file.c.orig file.c
+--- file.c.orig Thu Dec 7 22:41:39 2000
++++ file.c Thu Dec 7 23:04:23 2000
+@@ -71,6 +71,10 @@
+ #ifdef JP_CHARSET
+ static char content_charset = '\0';
+ static char guess_charset(char *p);
++#ifdef NEW_FORM
++static char check_charset(char *p);
++static char check_accept_charset(char *p);
++#endif
+ char DocumentCode = '\0';
+ #endif
+
+@@ -2545,61 +2549,68 @@
+ }
+
+ #ifdef NEW_FORM
+-char *
+-process_accept_charset(char *ac)
+-{
+- static Str temp = NULL;
+- char *s = ac, *e;
+ #ifdef JP_CHARSET
+- char res[2] = { '\0', '\0' };
+-#endif
+-
+- while (*s) {
+- while (*s && (IS_SPACE(*s) || *s == ',')) ++s;
+- if (!*s) break;
+- for (e = s ; *e && !(IS_SPACE(*e) || *e == ',') ; ++e);
+-
+- if (temp)
+- Strclear(temp);
+- else
+- temp = Strnew();
+-
+- Strcat_charp_n(temp, s, e - s);
++char
++check_charset(char *s)
++{
++ switch (*s) {
++ case CODE_EUC:
++ case CODE_SJIS:
++ case CODE_JIS_n:
++ case CODE_JIS_m:
++ case CODE_JIS_N:
++ case CODE_JIS_j:
++ case CODE_JIS_J:
++ case CODE_INNER_EUC:
++ return *s;
++ }
++ return 0;
++}
+
+-#ifdef JP_CHARSET
+- if ((res[0] = guess_charset(temp->ptr)))
+- return Strnew_charp(res)->ptr;
+-#else
+- if (strcasecmp(temp->ptr, "us-ascii") ||
+- strcasecmp(temp->ptr, "iso-8859-1"))
+-#endif
+- return Strnew_charp(temp->ptr)->ptr;
++char
++check_accept_charset(char *s)
++{
++ char *e;
++ char c;
+
++ while (*s) {
++ while (*s && (IS_SPACE(*s) || *s == ','))
++ s++;
++ if (!*s)
++ break;
++ e = s;
++ while (*e && !(IS_SPACE(*e) || *e == ','))
++ e++;
++ c = guess_charset(Strnew_charp_n(s, e - s)->ptr);
++ if (c)
++ return c;
+ s = e;
+ }
+-
+- return NULL;
++ return 0;
+ }
++#endif
+
+ Str
+ process_form(struct parsed_tag *tag)
+ {
+- char *p, *q, *r, *s, *acs, *tg;
++ char *p, *q, *r, *s, *tg;
++ char cs = 0;
+
+ p = "get";
+ parsedtag_get_value(tag, ATTR_METHOD, &p);
+ q = "!CURRENT_URL!";
+ parsedtag_get_value(tag, ATTR_ACTION, &q);
+ r = NULL;
+- parsedtag_get_value(tag, ATTR_CHARSET, &r);
+- acs = NULL;
+- if (parsedtag_get_value(tag, ATTR_ACCEPT_CHARSET, &acs))
+- acs = process_accept_charset(acs);
++#ifdef JP_CHARSET
++ if (parsedtag_get_value(tag, ATTR_ACCEPT_CHARSET, &r))
++ cs = check_accept_charset(r);
++ if (! cs && parsedtag_get_value(tag, ATTR_CHARSET, &r))
++ cs = check_charset(r);
++#endif
+ s = NULL;
+ parsedtag_get_value(tag, ATTR_ENCTYPE, &s);
+ tg = NULL;
+ parsedtag_get_value(tag, ATTR_TARGET, &tg);
+- if (!r) r = acs;
+ form_max++;
+ form_sp++;
+ if (forms_size == 0) {
+@@ -2611,7 +2622,7 @@
+ forms = New_Reuse(FormList *, forms, forms_size);
+ }
+ forms[form_max] =
+- newFormList(q, p, r, s, tg, (form_max > 0) ? forms[form_max - 1] : NULL);
++ newFormList(q, p, &cs, s, tg, (form_max > 0) ? forms[form_max - 1] : NULL);
+ form_stack[form_sp] = form_max;
+
+ return NULL;
+@@ -3515,6 +3526,7 @@
+ Anchor *a_href = NULL, *a_img = NULL, *a_form = NULL;
+ char outc[LINELEN];
+ char *p, *q, *r, *str;
++ char cs;
+ Lineprop outp[LINELEN], mode, effect;
+ int pos;
+ int nlines;
+@@ -3731,13 +3743,16 @@
+ case HTML_FORM_INT:
+ p = "get";
+ q = "/";
+- r = NULL;
+ s = NULL;
++ cs = 0;
+ parsedtag_get_value(tag, ATTR_METHOD, &p);
+ parsedtag_get_value(tag, ATTR_ACTION, &q);
+- parsedtag_get_value(tag, ATTR_CHARSET, &r);
++#ifdef JP_CHARSET
++ if (parsedtag_get_value(tag, ATTR_CHARSET, &r))
++ cs = check_charset(r);
++#endif
+ parsedtag_get_value(tag, ATTR_ENCTYPE, &s);
+- buf->formlist = newFormList(q, p, r, s, buf->formlist);
++ buf->formlist = newFormList(q, p, &cs, s, buf->formlist);
+ form_sp++;
+ form_stack[form_sp] = buf->formlist;
+ break;
+