aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-11-16 23:10:22 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1998-11-16 23:10:22 -0500
commit2a2566112749f0e3f932004c1a9d8345a84b1fd0 (patch)
tree767c817721642a258f9e22802a4de5e981871780 /src
parentd3f9d5478df478427c2aa5db4507ddd0a38f0eb6 (diff)
downloadlynx-snapshots-2a2566112749f0e3f932004c1a9d8345a84b1fd0.tar.gz
snapshot of project "lynx", label v2-8-2dev_3
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c134
-rw-r--r--src/LYCharSets.c8
-rw-r--r--src/LYCharUtils.c38
-rw-r--r--src/LYCharVals.h24
-rw-r--r--src/LYCookie.c22
-rw-r--r--src/LYCookie.h2
-rw-r--r--src/LYMain.c40
-rw-r--r--src/LYMap.c26
-rw-r--r--src/LYOptions.c99
-rw-r--r--src/LYStrings.c9
-rw-r--r--src/LYStrings.h6
-rw-r--r--src/LYUtils.c8
-rw-r--r--src/LYUtils.h2
13 files changed, 257 insertions, 161 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 3b3b662d..7b4ee540 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -984,7 +984,7 @@ PRIVATE void display_title ARGS1(
TO_SJIS((unsigned char *)title, tmp);
} else {
for (i = 0, j = 0; title[i]; i++) {
- if (title[i] != '\033') {
+ if (title[i] != CH_ESC) { /* S/390 -- gil -- 1487 */
tmp[j++] = title[i];
}
}
@@ -2114,7 +2114,7 @@ PUBLIC void HText_appendCharacter ARGS2(
/*
* Make sure we don't hang on escape sequences.
*/
- if (ch == '\033' && HTCJK == NOCJK) /* decimal 27 */
+ if (ch == CH_ESC && HTCJK == NOCJK) /* decimal 27 S/390 -- gil -- 1504 */
return;
#ifndef USE_SLANG
/*
@@ -2125,10 +2125,12 @@ PUBLIC void HText_appendCharacter ARGS2(
* They should have been filtered out or translated by an earlier
* processing stage anyway. - kw
*/
+#ifndef EBCDIC /* S/390 -- gil -- 1514 */
if ((unsigned char)ch >= 128 && HTCJK == NOCJK &&
!text->T.transp && !text->T.output_utf8 &&
(unsigned char)ch < LYlowest_eightbit[current_char_set])
return;
+#endif /* EBCDIC */
#endif /* !USE_SLANG */
if ((unsigned char)ch == 155 && HTCJK == NOCJK) { /* octal 233 */
if (!HTPassHighCtrlRaw &&
@@ -2146,7 +2148,7 @@ PUBLIC void HText_appendCharacter ARGS2(
if (HTCJK != NOCJK) {
switch(text->state) {
case S_text:
- if (ch == '\033') {
+ if (ch == CH_ESC) { /* S/390 -- gil -- 1536 */
/*
** Setting up for CJK escape sequence handling (based on
** Takuya ASADA's (asada@three-a.co.jp) CJK Lynx). - FM
@@ -2225,7 +2227,7 @@ PUBLIC void HText_appendCharacter ARGS2(
/*
* Expecting CJK ESC after non-ASCII text.
*/
- if (ch == '\033') {
+ if (ch == CH_ESC) { /* S/390 -- gil -- 1553 */
text->state = S_esc;
text->kanji_buf = '\0';
return;
@@ -2238,7 +2240,7 @@ PUBLIC void HText_appendCharacter ARGS2(
* JIS X0201 Kana in JIS support. - by ASATAKU
*/
case S_jisx0201_text:
- if (ch == '\033') {
+ if (ch == CH_ESC) { /* S/390 -- gil -- 1570 */
text->state = S_esc;
text->kanji_buf = '\0';
return;
@@ -2276,7 +2278,7 @@ PUBLIC void HText_appendCharacter ARGS2(
} else {
goto check_IgnoreExcess;
}
- } else if (ch == '\033') {
+ } else if (ch == CH_ESC) { /* S/390 -- gil -- 1587 */
return;
}
@@ -2680,7 +2682,7 @@ PUBLIC int HText_beginAnchor ARGS3(
BOOL, underline,
HTChildAnchor *, anc)
{
- char marker[32];
+ char marker[32];
TextAnchor * a = (TextAnchor *) calloc(1, sizeof(*a));
@@ -5303,22 +5305,13 @@ PUBLIC void user_message ARGS2(
CONST char *, argument)
{
char *temp = NULL;
- char temp_arg[256];
if (message == NULL) {
mustshow = FALSE;
return;
}
- /*
- * Make sure we don't overrun any buffers.
- */
- LYstrncpy(temp_arg, ((argument == NULL) ? "" : argument), 255);
- temp_arg[255] = '\0';
- temp = (char *)malloc(strlen(message) + strlen(temp_arg) + 1);
- if (temp == NULL)
- outofmem(__FILE__, "user_message");
- sprintf(temp, message, temp_arg);
+ HTSprintf(&temp, message, (argument == 0) ? "" : argument);
statusline(temp);
@@ -6214,7 +6207,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7(
val_cs = current_char_set;
} else {
for (i = 0, j = 0; cp[i]; i++) {
- if (cp[i] != '\033') {
+ if (cp[i] != CH_ESC) { /* S/390 -- gil -- 1604 */
tmp[j++] = cp[i];
}
}
@@ -6436,7 +6429,7 @@ PUBLIC int HText_beginInput ARGS3(
I->value_cs = current_char_set;
} else {
for (i = 0, j = 0; IValue[i]; i++) {
- if (IValue[i] != '\033') {
+ if (IValue[i] != CH_ESC) { /* S/390 -- gil -- 1621 */
tmp[j++] = IValue[i];
}
}
@@ -6926,7 +6919,6 @@ PUBLIC void HText_SubmitForm ARGS4(
int form_number = submit_item->number;
FormInfo *form_ptr;
PerFormInfo *thisform;
- int len;
char *query = NULL;
char *escaped1 = NULL, *escaped2 = NULL;
int first_one = 1;
@@ -6951,6 +6943,7 @@ PUBLIC void HText_SubmitForm ARGS4(
char *copied_val_used = NULL;
char *copied_name_used = NULL;
+ CTRACE(tfp, "FIXME:SubmitForm\n");
if (!HTMainText)
return;
@@ -6974,11 +6967,6 @@ PUBLIC void HText_SubmitForm ARGS4(
HTAlert(BAD_FORM_MAILTO);
return;
}
-
- /*
- * Set length plus breathing room.
- */
- len = strlen(submit_item->submit_action) + 2048;
} else {
return;
}
@@ -7077,17 +7065,6 @@ PUBLIC void HText_SubmitForm ARGS4(
field_has_8bit = NO;
field_has_special = NO;
- len += (strlen(form_ptr->name) + (Boundary ? 100 : 10));
- /*
- * Calculate by the option submit value if present.
- */
- if (form_ptr->cp_submit_value != NULL) {
- len += (strlen(form_ptr->cp_submit_value) + 10);
- } else {
- len += (strlen(form_ptr->value) + 10);
- }
- len += 32; /* plus and ampersand + safety net */
-
for (p = val;
p && *p && !(field_has_8bit && field_has_special);
p++)
@@ -7173,15 +7150,9 @@ PUBLIC void HText_SubmitForm ARGS4(
target_csname = "us-ascii";
}
}
- /*
- * Get query ready.
- */
- query = (char *)calloc(1, len);
- if (query == NULL)
- outofmem(__FILE__, "HText_SubmitForm");
if (submit_item->submit_method == URL_GET_METHOD && Boundary == NULL) {
- strcpy (query, submit_item->submit_action);
+ StrAllocCopy(query, submit_item->submit_action);
/*
* Method is GET. Clip out any anchor in the current URL.
*/
@@ -7193,9 +7164,8 @@ PUBLIC void HText_SubmitForm ARGS4(
/*
* Add the lead question mark for the new URL.
*/
- strcat(query,"?");
+ StrAllocCat(query,"?");
} else {
- query[0] = '\0';
/*
* We are submitting POST content to a server,
* so load the post_content_type element. - FM
@@ -7527,20 +7497,18 @@ PUBLIC void HText_SubmitForm ARGS4(
int cdisp_name_startpos = 0;
if (first_one) {
if (Boundary) {
- sprintf(&query[strlen(query)],
- "--%s\r\n", Boundary);
+ HTSprintf(&query, "--%s\r\n", Boundary);
}
first_one=FALSE;
} else {
if (PlainText) {
- strcat(query, "\n");
+ StrAllocCat(query, "\n");
} else if (SemiColon) {
- strcat(query, ";");
+ StrAllocCat(query, ";");
} else if (Boundary) {
- sprintf(&query[strlen(query)],
- "\r\n--%s\r\n", Boundary);
+ HTSprintf(&query, "\r\n--%s\r\n", Boundary);
} else {
- strcat(query, "&");
+ StrAllocCat(query, "&");
}
}
@@ -7574,13 +7542,13 @@ PUBLIC void HText_SubmitForm ARGS4(
*/
if (Boundary) {
escaped1[cdisp_name_startpos] = '\0';
- sprintf(&query[strlen(query)],
- "%s.x\r\n\r\n0\r\n--%s\r\n%s.y\r\n\r\n0",
+ HTSprintf(&query,
+ "%s.x\r\n\r\n0\r\n--%s\r\n%s.y\r\n\r\n0",
escaped1,
Boundary,
escaped1);
} else {
- sprintf(&query[strlen(query)],
+ HTSprintf(&query,
"%s.x=0%s%s.y=0%s",
escaped1,
(PlainText ?
@@ -7595,7 +7563,7 @@ PUBLIC void HText_SubmitForm ARGS4(
* It's a standard submit button.
* Use the name=value pair. = FM
*/
- sprintf(&query[strlen(query)],
+ HTSprintf(&query,
"%s%s%s%s%s",
escaped1,
(Boundary ?
@@ -7621,20 +7589,19 @@ PUBLIC void HText_SubmitForm ARGS4(
if (form_ptr->num_value) {
if (first_one) {
if (Boundary) {
- sprintf(&query[strlen(query)],
+ HTSprintf(&query,
"--%s\r\n", Boundary);
}
first_one=FALSE;
} else {
if (PlainText) {
- strcat(query, "\n");
+ StrAllocCat(query, "\n");
} else if (SemiColon) {
- strcat(query, ";");
+ StrAllocCat(query, ";");
} else if (Boundary) {
- sprintf(&query[strlen(query)],
- "\r\n--%s\r\n", Boundary);
+ HTSprintf(&query, "\r\n--%s\r\n", Boundary);
} else {
- strcat(query, "&");
+ StrAllocCat(query, "&");
}
}
@@ -7659,7 +7626,7 @@ PUBLIC void HText_SubmitForm ARGS4(
escaped2 = HTEscapeSP(val_used, URL_XALPHAS);
}
- sprintf(&query[strlen(query)],
+ HTSprintf(&query,
"%s%s%s%s%s",
escaped1,
(Boundary ?
@@ -7700,20 +7667,18 @@ PUBLIC void HText_SubmitForm ARGS4(
}
if (first_one) {
if (Boundary) {
- sprintf(&query[strlen(query)],
- "--%s\r\n", Boundary);
+ HTSprintf(&query, "--%s\r\n", Boundary);
}
first_one=FALSE;
} else {
if (PlainText) {
- strcat(query, "\n");
+ StrAllocCat(query, "\n");
} else if (SemiColon) {
- strcat(query, ";");
+ StrAllocCat(query, ";");
} else if (Boundary) {
- sprintf(&query[strlen(query)],
- "\r\n--%s\r\n", Boundary);
+ HTSprintf(&query, "\r\n--%s\r\n", Boundary);
} else {
- strcat(query, "&");
+ StrAllocCat(query, "&");
}
}
if (PlainText) {
@@ -7728,7 +7693,7 @@ PUBLIC void HText_SubmitForm ARGS4(
} else {
escaped1 = HTEscapeSP(name_used, URL_XALPHAS);
}
- sprintf(&query[strlen(query)],
+ HTSprintf(&query,
"%s%s%s%s%s",
escaped1,
(Boundary ?
@@ -7747,18 +7712,15 @@ PUBLIC void HText_SubmitForm ARGS4(
*/
if (escaped2[0] != '\0') {
if (previous_blanks) {
- strcat(query, previous_blanks);
+ StrAllocCat(query, previous_blanks);
FREE(previous_blanks);
}
if (PlainText) {
- sprintf(&query[strlen(query)], "%s\n",
- escaped2);
+ HTSprintf(&query, "%s\n", escaped2);
} else if (Boundary) {
- sprintf(&query[strlen(query)], "%s\r\n",
- escaped2);
+ HTSprintf(&query, "%s\r\n", escaped2);
} else {
- sprintf(&query[strlen(query)], "%%0a%s",
- escaped2);
+ HTSprintf(&query, "%%0a%s", escaped2);
}
} else {
if (PlainText) {
@@ -7780,20 +7742,18 @@ PUBLIC void HText_SubmitForm ARGS4(
case F_HIDDEN_TYPE:
if (first_one) {
if (Boundary) {
- sprintf(&query[strlen(query)],
- "--%s\r\n", Boundary);
+ HTSprintf(&query, "--%s\r\n", Boundary);
}
first_one=FALSE;
} else {
if (PlainText) {
- strcat(query, "\n");
+ StrAllocCat(query, "\n");
} else if (SemiColon) {
- strcat(query, ";");
+ StrAllocCat(query, ";");
} else if (Boundary) {
- sprintf(&query[strlen(query)],
- "\r\n--%s\r\n", Boundary);
+ HTSprintf(&query, "\r\n--%s\r\n", Boundary);
} else {
- strcat(query, "&");
+ StrAllocCat(query, "&");
}
}
@@ -7818,7 +7778,7 @@ PUBLIC void HText_SubmitForm ARGS4(
escaped2 = HTEscapeSP(val_used, URL_XALPHAS);
}
- sprintf(&query[strlen(query)],
+ HTSprintf(&query,
"%s%s%s%s%s",
escaped1,
(Boundary ?
@@ -7846,7 +7806,7 @@ PUBLIC void HText_SubmitForm ARGS4(
}
FREE(copied_name_used);
if (Boundary) {
- sprintf(&query[strlen(query)], "\r\n--%s--\r\n", Boundary);
+ HTSprintf(&query, "\r\n--%s--\r\n", Boundary);
}
FREE(previous_blanks);
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index 7e1b263e..891b795f 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -919,6 +919,12 @@ PUBLIC UCode_t HTMLGetEntityUCValue ARGS1(
/*
* Try UC_entity_info unicode_entities[].
*/
+#ifdef NOT_ASCII /* S/390 -- gil -- 1656 */
+ for (i = 0; i < HTML_dtd.number_of_unicode_entities; i++ ) {
+ /*
+ ** Linear search for NOT_ASCII.
+ */
+#else /* NOT_ASCII */
for (low = 0, high = HTML_dtd.number_of_unicode_entities;
high > low;
diff < 0 ? (low = i+1) : (high = i)) {
@@ -926,12 +932,14 @@ PUBLIC UCode_t HTMLGetEntityUCValue ARGS1(
** Binary search.
*/
i = (low + (high-low)/2);
+#endif /* NOT_ASCII S/390 -- gil -- 1662 */
diff = strcmp(unicode_entities[i].name, name); /* Case sensitive! */
if (diff == 0) {
value = unicode_entities[i].code;
break;
}
}
+ /* } NOT_ASCII */
return(value);
}
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index dd62a239..6c872341 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -151,7 +151,7 @@ PUBLIC void LYTrimHead ARGS1(
if (!str || *str == '\0')
return;
- while (str[i] != '\0' && WHITE(str[i]) && (unsigned char)str[i] != 27)
+ while (str[i] != '\0' && WHITE(str[i]) && (unsigned char)str[i] != (unsigned char)CH_ESC) /* S/390 -- gil -- 1669 */
i++;
if (i > 0) {
for (j = 0; str[i] != '\0'; i++) {
@@ -272,7 +272,7 @@ PUBLIC char *LYFindEndOfComment ARGS1(
return cp;
if (*cp == '-') {
state = start1;
- } else if (!(WHITE(*cp) && (unsigned char)*cp != 27)) {
+ } else if (!(WHITE(*cp) && (unsigned char)*cp != (unsigned char)CH_ESC)) { /* S/390 -- gil -- 1686 */
/*
* Invalid comment, so return the first
* '>' from the start of the string. - FM
@@ -945,7 +945,7 @@ PUBLIC void LYExpandString ARGS2(
** Our input charset is UTF-8, so check
** for non-ASCII characters. - FM
*/
- if (c_unsign > 127) {
+ if (TOASCII(c_unsign) > 127) { /* S/390 -- gil -- 1703 */
/*
** We have an octet from a multibyte character. - FM
*/
@@ -1063,14 +1063,14 @@ PUBLIC void LYExpandString ARGS2(
c_unsign = (unsigned char)c;
}
}
- } else if (code < 32 && code != 0 &&
+ } else if (code < ' ' && code != 0 && /* S/390 -- gil -- 1720 */
me->T.trans_C0_to_uni) {
/*
** Quote from SGML.c:
** "This else if may be too ugly to keep. - KW"
*/
if (me->T.trans_from_uni &&
- (((code = UCTransToUni(c, me->inUCLYhndl)) >= 32) ||
+ (((code = UCTransToUni(c, me->inUCLYhndl)) >= ' ') || /* S/390 -- gil -- 1737 */
(me->T.transp &&
(code = UCTransToUni(c, me->inUCLYhndl)) > 0))) {
saved_char_in = c;
@@ -1115,7 +1115,7 @@ PUBLIC void LYExpandString ARGS2(
** if they sneaked through (should have been
** filtered by the parser). - FM
*/
- if (code < 32 &&
+ if (code < ' ' && /* S/390 -- gil -- 1754 */
c != 9 && c != 10 && c != 13) {
continue;
}
@@ -1124,7 +1124,7 @@ PUBLIC void LYExpandString ARGS2(
** and it sneaked through (should have been
** filtered by the parser). - FM
*/
- if (c == 127 &&
+ if (TOASCII(c) == 127 && /* S/390 -- gil -- 1771 */
!(me->T.transp ||
code >= LYlowest_eightbit[me->inUCLYhndl])) {
continue;
@@ -1134,7 +1134,7 @@ PUBLIC void LYExpandString ARGS2(
** have HTPassHighCtrlRaw set and they sneaked through
** (should have been filtered by the parser). - FM
*/
- if (code > 127 && code < 160 &&
+ if (TOASCII(code) > 127 && TOASCII(code) < 160 && /* S/390 -- gil -- 1788 */
!(me->T.transp ||
code >= LYlowest_eightbit[me->inUCLYhndl])) {
continue;
@@ -1144,7 +1144,7 @@ PUBLIC void LYExpandString ARGS2(
** (or a space if plain_space or hidden is set) if
** HTPassHighCtrlRaw is not set. - FM
*/
- if (code == 160) {
+ if (code == CH_NBSP) { /* S/390 -- gil -- 1805 */
if (!me->T.pass_160_173_raw) {
if (plain_space || hidden) {
HTChunkPutc(s, ' ');
@@ -1167,7 +1167,7 @@ PUBLIC void LYExpandString ARGS2(
** (or skip it if plain_space or hidden is set) if
** HTPassHighCtrlRaw is not set. - FM
*/
- if (code == 173) {
+ if (code == CH_SHY) { /* S/390 -- gil -- 1822 */
if (!me->T.pass_160_173_raw) {
if (!(plain_space || hidden)) {
HTChunkPutc(s, LY_SOFT_HYPHEN);
@@ -1220,7 +1220,7 @@ PUBLIC void LYExpandString ARGS2(
} else if (chk &&
(uck == -4 ||
(me->T.repl_translated_C0 &&
- uck > 0 && uck < 32)) &&
+ uck > 0 && uck < ' ')) && /* S/390 -- gil -- 1839 */
/*
** Not found; look for replacement string.
*/
@@ -1238,7 +1238,7 @@ PUBLIC void LYExpandString ARGS2(
** If we want raw UTF-8, output that now. - FM
*/
if (me->T.output_utf8 &&
- code > 127 && code <= 0x7fffffffL) {
+ TOASCII(code) > 127 && code <= 0x7fffffffL) { /* S/390 -- gil -- 1856 */
if (me->T.decode_utf8 && *utf_buf) {
HTChunkPuts(s, utf_buf);
utf_buf[0] == '\0';
@@ -1280,7 +1280,7 @@ PUBLIC void LYExpandString ARGS2(
/*
** If it's ASCII at this point, use it. - FM
*/
- if (code < 127 && code > 0) {
+ if (TOASCII(code) < 127 && code > 0) { /* S/390 -- gil -- 1873 */
HTChunkPutc(s, ((char)(code & 0xff)));
continue;
}
@@ -1343,7 +1343,7 @@ PUBLIC void LYExpandString ARGS2(
UCGetLYhndl_byMIME("us-ascii"))) &&
(uck = UCTransUniChar(code,
UCGetLYhndl_byMIME("us-ascii")))
- >= 32 && uck < 127) {
+ >= ' ' && TOASCII(uck) < 127) { /* S/390 -- gil -- 1890 */
/*
** Got an ASCII character (yippey). - FM
*/
@@ -1364,7 +1364,7 @@ PUBLIC void LYExpandString ARGS2(
/*
** Out of luck, so use the UHHH notation (ugh). - FM
*/
- sprintf(replace_buf, "U%.2lX", code);
+ sprintf(replace_buf, "U%.2lX", TOASCII(code)); /* S/390 -- gil -- 1907 */
HTChunkPuts(s, replace_buf);
continue;
}
@@ -2421,8 +2421,8 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9(
}
if (stype == st_URL &&
/* Not a full HTEscape, only for 8bit and ctrl chars */
- (code >= 127 ||
- (code < 32 && (code != 9 && code != 10)))) {
+ (TOASCII(code) >= 127 || /* S/390 -- gil -- 1925 */
+ (code < ' ' && (code != '\t' && code != '\n')))) {
state = S_put_urlchar;
break;
} else if (!hidden && code == 10 && *p == 10
@@ -2440,8 +2440,8 @@ PRIVATE char ** LYUCFullyTranslateString_1 ARGS9(
break;
case S_put_urlchar:
*q++ = '%';
- REPLACE_CHAR(hex[(code >> 4) & 15]);
- REPLACE_CHAR(hex[(code & 15)]);
+ REPLACE_CHAR(hex[(TOASCII(code) >> 4) & 15]); /* S/390 -- gil -- 1944 */
+ REPLACE_CHAR(hex[(TOASCII(code) & 15)]);
/* fall through */
case S_next_char:
p++; /* fall through */
diff --git a/src/LYCharVals.h b/src/LYCharVals.h
new file mode 100644
index 00000000..9b4d59e4
--- /dev/null
+++ b/src/LYCharVals.h
@@ -0,0 +1,24 @@
+#ifndef LYCHARVALS_H
+#define LYCHARVALS_H 1
+
+#include <HTUtils.h>
+
+#ifndef CH_ESC
+#ifdef EBCDIC
+#define CH_DEL '\x07'
+#define CH_ESC '\x27'
+#define CH_ESC_PAR '\x27'
+#define CH_HICTL '\x3f'
+#define CH_NBSP '\x41'
+#define CH_SHY '\xca'
+#else /* EBCDIC */
+#define CH_ESC '\033'
+#define CH_DEL '\177'
+#define CH_ESC_PAR '\233'
+#define CH_HICTL '\237'
+#define CH_NBSP '\240'
+#define CH_SHY '\255'
+#endif /* EBCDIC */
+#endif /* CH_ESC */
+
+#endif /* LYCHARVALS_H */
diff --git a/src/LYCookie.c b/src/LYCookie.c
index 3adc4995..9bcb6f0c 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -1156,7 +1156,14 @@ PRIVATE void LYProcessSetCookies ARGS6(
* new, unknown attribute which doesn't take a value, and
* ignore it. - FM
*/
- if (!known_attr && value_end > value_start) {
+ /* if (!known_attr && value_end > value_start) */
+
+ /* Is there any reason we don't want to accept cookies with
+ * no value? This seems to be needed for sites that reset a
+ * cookie by nulling out the value. If this causes problems,
+ * we can go back to the original behavior above. - BJP
+ */
+ if (!known_attr) {
/*
* If we've started a cookie, and it's not too big,
* save it in the CombinedCookies list. - FM
@@ -1622,7 +1629,14 @@ PRIVATE void LYProcessSetCookies ARGS6(
* new, unknown attribute which doesn't take a value, and
* ignore it. - FM
*/
- if (!known_attr && value_end > value_start) {
+ /* if (!known_attr && value_end > value_start) */
+
+ /* Is there any reason we don't want to accept cookies with
+ * no value? This seems to be needed for sites that reset a
+ * cookie by nulling out the value. If this causes problems,
+ * we can go back to the original behavior above. - BJP
+ */
+ if (!known_attr) {
/*
* If we've started a cookie, and it's not too big,
* save it in the CombinedCookies list. - FM
@@ -1875,7 +1889,7 @@ PUBLIC char * LYCookie ARGS4(
#ifdef EXP_PERSISTENT_COOKIES
/* rjp - experiment cookie loading */
PUBLIC void LYLoadCookies ARGS1 (
- CONST char *, cookie_file)
+ char *, cookie_file)
{
FILE *cookie_handle;
char buf[max_cookies_buffer+10]; /* should be long enough for a cookie line */
@@ -1909,7 +1923,7 @@ PUBLIC void LYLoadCookies ARGS1 (
j = fgets(buf, sizeof(buf)-1, cookie_handle);
- if((j == NULL) || (buf[0] == '\0' || buf[0] == '\n')) {
+ if((j == NULL) || (buf[0] == '\0' || buf[0] == '\n' || buf[0] == '#')) {
continue;
}
diff --git a/src/LYCookie.h b/src/LYCookie.h
index 2e4a3ecf..f54518bf 100644
--- a/src/LYCookie.h
+++ b/src/LYCookie.h
@@ -16,7 +16,7 @@ extern char *LYCookie PARAMS((
extern void LYStoreCookies PARAMS((
CONST char * cookie_file));
extern void LYLoadCookies PARAMS((
- CONST char * cookie_file));
+ char * cookie_file));
extern void cookie_add_acceptlist PARAMS((
char * acceptdomains));
extern void cookie_add_rejectlist PARAMS((
diff --git a/src/LYMain.c b/src/LYMain.c
index 4f961c07..f93d173a 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -534,6 +534,42 @@ PRIVATE void exit_immediately ARGS1(
exit(code);
}
+#ifdef EBCDIC /* S/390 -- gil -- 1958 */
+ char un_IBM1047[ 256 ] = "";
+unsigned char IBM1047[ 256 ] = /* ATOE OEMVS311 */
+{
+0x00,0x01,0x02,0x03,0x37,0x2d,0x2e,0x2f,0x16,0x05,0x15,0x0b,0x0c,0x0d,0x0e,0x0f,
+0x10,0x11,0x12,0x13,0x3c,0x3d,0x32,0x26,0x18,0x19,0x3f,0x27,0x1c,0x1d,0x1e,0x1f,
+0x40,0x5a,0x7f,0x7b,0x5b,0x6c,0x50,0x7d,0x4d,0x5d,0x5c,0x4e,0x6b,0x60,0x4b,0x61,
+0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0x7a,0x5e,0x4c,0x7e,0x6e,0x6f,
+0x7c,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,
+0xd7,0xd8,0xd9,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xad,0xe0,0xbd,0x5f,0x6d,
+0x79,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x91,0x92,0x93,0x94,0x95,0x96,
+0x97,0x98,0x99,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xc0,0x4f,0xd0,0xa1,0x07,
+0x20,0x21,0x22,0x23,0x24,0x25,0x06,0x17,0x28,0x29,0x2a,0x2b,0x2c,0x09,0x0a,0x1b,
+0x30,0x31,0x1a,0x33,0x34,0x35,0x36,0x08,0x38,0x39,0x3a,0x3b,0x04,0x14,0x3e,0xff,
+0x41,0xaa,0x4a,0xb1,0x9f,0xb2,0x6a,0xb5,0xbb,0xb4,0x9a,0x8a,0xb0,0xca,0xaf,0xbc,
+0x90,0x8f,0xea,0xfa,0xbe,0xa0,0xb6,0xb3,0x9d,0xda,0x9b,0x8b,0xb7,0xb8,0xb9,0xab,
+0x64,0x65,0x62,0x66,0x63,0x67,0x9e,0x68,0x74,0x71,0x72,0x73,0x78,0x75,0x76,0x77,
+0xac,0x69,0xed,0xee,0xeb,0xef,0xec,0xbf,0x80,0xfd,0xfe,0xfb,0xfc,0xba,0xae,0x59,
+0x44,0x45,0x42,0x46,0x43,0x47,0x9c,0x48,0x54,0x51,0x52,0x53,0x58,0x55,0x56,0x57,
+0x8c,0x49,0xcd,0xce,0xcb,0xcf,0xcc,0xe1,0x70,0xdd,0xde,0xdb,0xdc,0x8d,0x8e,0xdf
+} ;
+
+static void FixCharacters(void)
+{
+ int c;
+ int work[256];
+
+ for (c = 0; c < 256; c++) {
+ un_IBM1047[IBM1047[c]] = c;
+ work[c] = keymap[c+1];
+ }
+ for (c = 0; c < 256; c++)
+ keymap[IBM1047[c]+1] = work[c];
+}
+#endif /* EBCDIC */
+
/*
* Wow! Someone wants to start up Lynx.
*/
@@ -549,6 +585,10 @@ PUBLIC int main ARGS2(
char filename[256];
BOOL LYGetStdinArgs = FALSE;
+#ifdef NOT_ASCII /* S/390 -- gil -- 2002 */
+ FixCharacters();
+#endif /* NOT_ASCII */
+
#ifdef _WINDOWS
WSADATA WSAData;
{
diff --git a/src/LYMap.c b/src/LYMap.c
index 38bbade3..68845bec 100644
--- a/src/LYMap.c
+++ b/src/LYMap.c
@@ -403,7 +403,7 @@ PRIVATE int LYLoadIMGmap ARGS4 (
{
HTFormat format_in = WWW_HTML;
HTStream *target = NULL;
- char buf[1024];
+ char *buf = NULL;
LYMapElement *new = NULL;
LYImageMap *theMap = NULL;
char *MapTitle = NULL;
@@ -511,9 +511,10 @@ PRIVATE int LYLoadIMGmap ARGS4 (
sink, anAnchor);
if (!target || target == NULL) {
- sprintf(buf, CANNOT_CONVERT_I_TO_O,
+ HTSprintf(&buf, CANNOT_CONVERT_I_TO_O,
HTAtom_name(format_in), HTAtom_name(format_out));
HTAlert(buf);
+ FREE(buf);
return(HT_NOT_LOADED);
}
@@ -533,9 +534,9 @@ PRIVATE int LYLoadIMGmap ARGS4 (
LYEntify(&MapTitle, TRUE);
}
- sprintf(buf, "<html>\n<head>\n");
+ HTSprintf0(&buf, "<html>\n<head>\n");
(*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf, "<META %s content=\"text/html;charset=%s\">\n",
+ HTSprintf0(&buf, "<META %s content=\"text/html;charset=%s\">\n",
"http-equiv=\"content-type\"",
LYCharSet_UC[current_char_set].MIMEname);
(*target->isa->put_block)(target, buf, strlen(buf));
@@ -545,20 +546,20 @@ PRIVATE int LYLoadIMGmap ARGS4 (
* they converted to current_char_set.
* That is why we insist on META charset for this page.
*/
- sprintf(buf, "<title>%s</title>\n", MapTitle);
+ HTSprintf0(&buf, "<title>%s</title>\n", MapTitle);
(*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf, "</head>\n<body>\n");
+ HTSprintf0(&buf, "</head>\n<body>\n");
(*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf,"<h1><em>%s</em></h1>\n", MapTitle);
+ HTSprintf0(&buf,"<h1><em>%s</em></h1>\n", MapTitle);
(*target->isa->put_block)(target, buf, strlen(buf));
StrAllocCopy(MapAddress, address);
LYEntify(&MapAddress, FALSE);
- sprintf(buf,"<h2><em>MAP:</em>&nbsp;%s</h2>\n", MapAddress);
+ HTSprintf0(&buf,"<h2><em>MAP:</em>&nbsp;%s</h2>\n", MapAddress);
(*target->isa->put_block)(target, buf, strlen(buf));
- sprintf(buf, "<%s compact>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ?
+ HTSprintf0(&buf, "<%s compact>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ?
"ol" : "ul"));
(*target->isa->put_block)(target, buf, strlen(buf));
cur = theMap->elements;
@@ -578,13 +579,16 @@ PRIVATE int LYLoadIMGmap ARGS4 (
(*target->isa->put_block)(target, MapTitle, strlen(MapTitle));
(*target->isa->put_block)(target, "</a>\n", 5);
}
- sprintf(buf,"</%s>\n</body>\n</html>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ?
- "ol" : "ul"));
+ HTSprintf0(&buf, "</%s>\n</body>\n</html>\n",
+ ((keypad_mode == NUMBERS_AS_ARROWS)
+ ? "ol"
+ : "ul"));
(*target->isa->put_block)(target, buf, strlen(buf));
(*target->isa->_free)(target);
FREE(MapAddress);
FREE(MapTitle);
+ FREE(buf);
return(HT_LOADED);
}
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 16b8e691..fb8bb8cc 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -119,6 +119,41 @@ PRIVATE int popup_choice PARAMS((
#define L_User_Mode (use_assume_charset ? L_USER_MODE + 1 : L_USER_MODE)
#define L_User_Agent (use_assume_charset ? L_USER_AGENT + 1 : L_USER_AGENT)
+#define LPAREN '('
+#define RPAREN ')'
+
+PRIVATE int add_it ARGS2(char *, text, int, len)
+{
+ if (len) {
+ text[len] = '\0';
+ addstr(text);
+ }
+ return 0;
+}
+
+PRIVATE void addlbl ARGS1(CONST char *, text)
+{
+ char actual[80];
+ int s, d;
+ BOOL b = FALSE;
+
+ for (s = d = 0; text[s]; s++) {
+ actual[d++] = text[s];
+ if (text[s] == LPAREN) {
+ d = add_it(actual, d-1);
+ start_bold();
+ b = TRUE;
+ actual[d++] = text[s];
+ } else if (text[s] == RPAREN) {
+ d = add_it(actual, d);
+ stop_bold();
+ b = FALSE;
+ }
+ }
+ add_it(actual, d);
+ if (b)
+ stop_bold();
+}
PUBLIC void LYoptions NOARGS
{
@@ -235,58 +270,58 @@ draw_options:
addch(')');
lynx_stop_h1_color ();
move(L_EDITOR, 5);
- addstr("E)ditor : ");
+ addlbl("(E)ditor : ");
addstr((editor && *editor) ? editor : "NONE");
move(L_DISPLAY, 5);
- addstr("D)ISPLAY variable : ");
+ addlbl("(D)ISPLAY variable : ");
addstr((x_display && *x_display) ? x_display : "NONE");
move(L_HOME, 5);
- addstr("mu(L)ti-bookmarks: ");
+ addlbl("mu(L)ti-bookmarks: ");
addstr((LYMultiBookmarks ?
(LYMBMAdvanced ? "ADVANCED"
: "STANDARD")
: "OFF "));
move(L_HOME, B_BOOK);
if (LYMultiBookmarks) {
- addstr("review/edit B)ookmarks files");
+ addlbl("review/edit (B)ookmarks files");
} else {
- addstr("B)ookmark file: ");
+ addlbl("(B)ookmark file: ");
addstr((bookmark_page && *bookmark_page) ? bookmark_page : "NONE");
}
move(L_FTPSTYPE, 5);
- addstr("F)TP sort criteria : ");
+ addlbl("(F)TP sort criteria : ");
addstr((HTfileSortMethod == FILE_BY_NAME ? "By Filename" :
(HTfileSortMethod == FILE_BY_SIZE ? "By Size " :
(HTfileSortMethod == FILE_BY_TYPE ? "By Type " :
"By Date "))));
move(L_MAIL_ADDRESS, 5);
- addstr("P)ersonal mail address : ");
+ addlbl("(P)ersonal mail address : ");
addstr((personal_mail_address && *personal_mail_address) ?
personal_mail_address : "NONE");
move(L_SSEARCH, 5);
- addstr("S)earching type : ");
+ addlbl("(S)earching type : ");
addstr(case_sensitive ? "CASE SENSITIVE " : "CASE INSENSITIVE");
move(L_Charset, 5);
- addstr("display (C)haracter set : ");
+ addlbl("display (C)haracter set : ");
addstr((char *)LYchar_set_names[current_char_set]);
move(L_LANGUAGE, 5);
- addstr("preferred document lan(G)uage: ");
+ addlbl("preferred document lan(G)uage: ");
addstr((language && *language) ? language : "NONE");
move(L_PREF_CHARSET, 5);
- addstr("preferred document c(H)arset : ");
+ addlbl("preferred document c(H)arset : ");
addstr((pref_charset && *pref_charset) ? pref_charset : "NONE");
if (use_assume_charset) {
move(L_ASSUME_CHARSET, 5);
- addstr("^A)ssume charset if unknown : ");
+ addlbl("(^A)ssume charset if unknown : ");
if (UCAssume_MIMEcharset)
addstr(UCAssume_MIMEcharset);
else
@@ -296,12 +331,12 @@ draw_options:
}
move(L_Rawmode, 5);
- addstr("Raw 8-bit or CJK m(O)de : ");
+ addlbl("Raw 8-bit or CJK m(O)de : ");
addstr(LYRawMode ? "ON " : "OFF");
#if defined(USE_SLANG) || defined(COLOR_CURSES)
move(L_Color, B_COLOR);
- addstr("show color (&) : ");
+ addlbl("show color (&) : ");
if (no_option_save) {
addstr((LYShowColor == SHOW_COLOR_OFF ? "OFF" :
"ON "));
@@ -328,27 +363,27 @@ draw_options:
#endif /* USE_SLANG || COLOR_CURSES */
move(L_Bool_A, B_VIKEYS);
- addstr("V)I keys: ");
+ addlbl("(V)I keys: ");
addstr(vi_keys ? "ON " : "OFF");
move(L_Bool_A, B_EMACSKEYS);
- addstr("e(M)acs keys: ");
+ addlbl("e(M)acs keys: ");
addstr(emacs_keys ? "ON " : "OFF");
move(L_Bool_A, B_SHOW_DOTFILES);
- addstr("sho(W) dot files: ");
+ addlbl("sho(W) dot files: ");
addstr((!no_dotfiles && show_dotfiles) ? "ON " : "OFF");
move(L_Bool_B, B_SELECT_POPUPS);
- addstr("popups for selec(T) fields : ");
+ addlbl("popups for selec(T) fields : ");
addstr(LYSelectPopups ? "ON " : "OFF");
move(L_Bool_B, B_SHOW_CURSOR);
- addstr("show cursor (@) : ");
+ addlbl("show cursor (@) : ");
addstr(LYShowCursor ? "ON " : "OFF");
move(L_Keypad, 5);
- addstr("K)eypad mode : ");
+ addlbl("(K)eypad mode : ");
addstr((keypad_mode == NUMBERS_AS_ARROWS) ?
"Numbers act as arrows " :
((keypad_mode == LINKS_ARE_NUMBERED) ?
@@ -356,28 +391,28 @@ draw_options:
"Links and form fields are numbered"));
move(L_Lineed, 5);
- addstr("li(N)e edit style : ");
+ addlbl("li(N)e edit style : ");
addstr(LYLineeditNames[current_lineedit]);
#ifdef DIRED_SUPPORT
move(L_Dired, 5);
- addstr("l(I)st directory style : ");
+ addlbl("l(I)st directory style : ");
addstr((dir_list_style == FILES_FIRST) ? "Files first " :
((dir_list_style == MIXED_STYLE) ? "Mixed style " :
"Directories first"));
#endif /* DIRED_SUPPORT */
move(L_User_Mode, 5);
- addstr("U)ser mode : ");
+ addlbl("(U)ser mode : ");
addstr( (user_mode == NOVICE_MODE) ? "Novice " :
((user_mode == INTERMEDIATE_MODE) ? "Intermediate" :
"Advanced "));
- addstr(" verbose images (!) : ");
+ addlbl(" verbose images (!) : ");
addstr( verbose_img ? "ON " : "OFF" );
move(L_User_Agent, 5);
- addstr("user (A)gent : ");
+ addlbl("user (A)gent : ");
addstr((LYUserAgent && *LYUserAgent) ? LYUserAgent : "NONE");
#ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS
@@ -3399,11 +3434,11 @@ PRIVATE PostPair * break_data ARGS1(
* pointer. MRC
*
* By changing the certain options value (like preferred language or
- * fake browser name) we need to inform the remote server and reload
- * (uncache on a proxy) the document which was active just before
- * the Options menu was invoked. Another values (like display_char_set
- * or assume_char_set) used by lynx initial rendering stages
- * and can only be changed after reloading :-(
+ * fake browser name) we need to inform the remote server and reload
+ * (uncache on a proxy) the document which was active just before
+ * the Options menu was invoked. Another values (like display_char_set
+ * or assume_char_set) used by lynx initial rendering stages
+ * and can only be changed after reloading :-(
* So we introduce boolean flag 'need_reload' (currently dummy).
*
* Options are processed in order according to gen_options(), we should not
@@ -3612,12 +3647,12 @@ PUBLIC int postoptions ARGS1(
/* Display Character Set: SELECT */
if (!strcmp(data[i].tag, display_char_set_string)) {
- current_char_set = atoi(data[i].value);
+ current_char_set = atoi(data[i].value);
}
/* Raw Mode: ON/OFF */
if (!strcmp(data[i].tag, raw_mode_string)) {
- LYRawMode = GetOptValues(bool_values, data[i].value);
+ LYRawMode = GetOptValues(bool_values, data[i].value);
}
/*
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 4946a265..80307411 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -891,7 +891,7 @@ re_read:
}
#endif /* USE_SLANG */
- if (c == 27 || (csi_is_csi && c == 155)) { /* handle escape sequence */
+ if (c == CH_ESC || (csi_is_csi && c == (unsigned char)CH_ESC_PAR)) { /* handle escape sequence S/390 -- gil -- 2024 */
b = GetChar();
if (b == '[' || b == 'O') {
@@ -1072,7 +1072,7 @@ re_read:
#endif /* KEY_HELP */
#ifdef KEY_BACKSPACE
case KEY_BACKSPACE:
- c = 127; /* backspace key (delete, not Ctrl-H) */
+ c = CH_DEL; /* backspace key (delete, not Ctrl-H) S/390 -- gil -- 2041 */
break;
#endif /* KEY_BACKSPACE */
#if defined(KEY_F) && !defined(__DJGPP__) && !defined(_WINDOWS)
@@ -2282,11 +2282,12 @@ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2)
{
/* case-insensitive match for us-ascii */
- if ((unsigned char)ch1 < 128 && (unsigned char)ch2 < 128)
+ if ((unsigned char)TOASCII(ch1) < 128 && (unsigned char)TOASCII(ch2) < 128)
return(TOUPPER(ch1) - TOUPPER(ch2));
/* case-insensitive match for upper half */
- if ((unsigned char)ch1 > 127 && (unsigned char)ch2 >127)
+ if ((unsigned char)TOASCII(ch1) > 127 && /* S/390 -- gil -- 2066 */
+ (unsigned char)TOASCII(ch2) > 127)
{
if (DisplayCharsetMatchLocale)
return(TOUPPER(ch1) - TOUPPER(ch2)); /* old-style */
diff --git a/src/LYStrings.h b/src/LYStrings.h
index 14cb46cf..224f6985 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -94,7 +94,7 @@ extern char * SNACat PARAMS((
/* EditFieldData preserves state between calls to LYEdit1
*/
typedef struct _EditFieldData {
-
+
int sx; /* Origin of editfield */
int sy;
int dspwdth; /* Screen real estate for editting */
@@ -185,7 +185,11 @@ extern char * LYLineeditNames[];
extern char * LYLineEditors[];
/* Push a character through the lineedit machinery */
+#ifdef NOT_ASCII /* S/390 -- gil -- 2080 */
+#define EditBinding(c) (LYLineEditors[current_lineedit][(c)<256 ? TOASCII(c) : c])
+#else /* NOT_ASCII */
#define EditBinding(c) (LYLineEditors[current_lineedit][c])
+#endif /* NOT_ASCII */
#define LYLineEdit(e,c,m) LYEdit1(e,c,EditBinding(c),m)
/* Dummy initializer for LYEditmap.c */
diff --git a/src/LYUtils.c b/src/LYUtils.c
index f46cf486..d1d76319 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -36,8 +36,12 @@
#ifdef UTMP_FILE
#undef UTMP_FILE
#endif /* UTMP_FILE */
+#ifdef UTMPX_FILE
#define UTMP_FILE UTMPX_FILE
#else
+#define UTMP_FILE __UTMPX_FILE /* at least in OS/390 S/390 -- gil -- 2100 */
+#endif /* UTMPX_FILE */
+#else
#include <utmp.h>
#endif /* UTMPX_FOR_UTMP */
#endif /* HAVE_UTMP */
@@ -1824,7 +1828,7 @@ PUBLIC void statusline ARGS1(
TO_SJIS((CONST unsigned char *)text, temp);
} else {
for (i = 0, j = 0; text[i]; i++) {
- if (text[i] != '\033') {
+ if (text[i] != CH_ESC) { /* S/390 -- gil -- 2119 */
temp[j++] = text[i];
}
}
@@ -1867,7 +1871,7 @@ PUBLIC void statusline ARGS1(
* as we do above for CJK. - FM
*/
for (i = 0, len = 0; text[i] != '\0' && len < max_length; i++) {
- if (text[i] != '\033') {
+ if (text[i] != CH_ESC) { /* S/390 -- gil -- 2136 */
buffer[len++] = text[i];
}
}
diff --git a/src/LYUtils.h b/src/LYUtils.h
index 5c4ab08e..9f4be263 100644
--- a/src/LYUtils.h
+++ b/src/LYUtils.h
@@ -1,6 +1,8 @@
#ifndef LYUTILS_H
#define LYUTILS_H
+#include <LYCharVals.h> /* S/390 -- gil -- 2149 */
+
#ifndef HTLIST_H
#include <HTList.h>
#endif /* HTLIST_H */