aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-09-25 10:50:40 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1998-09-25 10:50:40 -0400
commit652c51a528c2cceab8a4ff02283ae854d0427678 (patch)
treee0e9b09748c5d361638f64cb5a7dd8815fb94277 /src
parent07e246c51644d9790f2eaf4001ff4ffd40e3274f (diff)
downloadlynx-snapshots-652c51a528c2cceab8a4ff02283ae854d0427678.tar.gz
snapshot of project "lynx", label v2-8-1pre_2
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c290
-rw-r--r--src/HTML.c28
-rw-r--r--src/LYCharSets.c97
-rw-r--r--src/LYCharSets.h6
-rw-r--r--src/LYDownload.c1
-rw-r--r--src/LYGlobalDefs.h2
-rw-r--r--src/LYLocal.c7
-rw-r--r--src/LYMain.c19
-rw-r--r--src/LYOptions.c8
-rw-r--r--src/LYPrint.c71
-rw-r--r--src/LYReadCFG.c35
-rw-r--r--src/LYShowInfo.c15
-rw-r--r--src/LYrcFile.c12
13 files changed, 384 insertions, 207 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 53bf9c54..098e45e0 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -63,7 +63,7 @@ void LynxClearScreenCache NOARGS
}
#endif /* USE_COLOR_STYLE */
-struct _HTStream { /* only know it as object */
+struct _HTStream { /* only know it as object */
CONST HTStreamClass * isa;
/* ... */
};
@@ -244,7 +244,7 @@ PRIVATE int HText_TrueLineSize PARAMS((
/*
* text->halted = 1: have set fake 'Z' and output a message
- * 2: next time when HText_appendCharacter is called
+ * 2: next time when HText_appendCharacter is called
* it will append *** MEMORY EXHAUSTED ***, then set
* to 3.
* 3: normal text output will be suppressed (but not anchors,
@@ -533,7 +533,7 @@ PUBLIC HText * HText_new ARGS1(
* so we may start displaying the document while downloading. - LP
*/
if (display_partial)
- NumOfLines_partial = 0; /* enable HTDisplayPartial() */
+ NumOfLines_partial = 0; /* enable HTDisplayPartial() */
#endif
CTRACE(tfp, "GridText: start HText_new\n");
@@ -541,8 +541,8 @@ PUBLIC HText * HText_new ARGS1(
return self;
}
-/* Creation Method 2
-** ---------------
+/* Creation Method 2
+** ---------------
**
** Stream is assumed open and left open.
*/
@@ -578,9 +578,9 @@ PUBLIC void HText_free ARGS1(
l->prev->next = l->next; /* Unlink l */
self->last_line = l->prev;
if (l != self->last_line) {
- FREE(l);
+ FREE(l);
} else {
- free(l);
+ free(l);
}
}
if (l == self->last_line) { /* empty */
@@ -768,7 +768,7 @@ PRIVATE int display_line ARGS2(
#ifndef USE_COLOR_STYLE
case LY_UNDERLINE_START_CHAR:
- if (dump_output_immediately && use_underscore) {
+ if (dump_output_immediately && use_underscore) {
addch('_');
i++;
} else {
@@ -777,7 +777,7 @@ PRIVATE int display_line ARGS2(
break;
case LY_UNDERLINE_END_CHAR:
- if (dump_output_immediately && use_underscore) {
+ if (dump_output_immediately && use_underscore) {
addch('_');
i++;
} else {
@@ -800,7 +800,7 @@ PRIVATE int display_line ARGS2(
break;
case LY_SOFT_HYPHEN:
- if (*data != '\0' ||
+ if (*data != '\0' ||
isspace((unsigned char)LastDisplayChar) ||
LastDisplayChar == '-') {
/*
@@ -964,7 +964,7 @@ PRIVATE void display_title ARGS1(
sprintf(percent, " (p%d of %d)",
((text->top_of_screen >= start_of_last_page) ?
total_pages :
- ((text->top_of_screen + display_lines)/(display_lines))),
+ ((text->top_of_screen + display_lines)/(display_lines))),
total_pages);
} else {
percent[0] = '\0'; /* Null string */
@@ -979,13 +979,13 @@ PRIVATE void display_title ARGS1(
if (*title &&
(tmp = (unsigned char *)calloc(1, (strlen(title) + 1)))) {
if (kanji_code == EUC) {
- TO_EUC((unsigned char *)title, tmp);
+ TO_EUC((unsigned char *)title, tmp);
} else if (kanji_code == SJIS) {
- TO_SJIS((unsigned char *)title, tmp);
+ TO_SJIS((unsigned char *)title, tmp);
} else {
- for (i = 0, j = 0; title[i]; i++) {
+ for (i = 0, j = 0; title[i]; i++) {
if (title[i] != '\033') {
- tmp[j++] = title[i];
+ tmp[j++] = title[i];
}
}
tmp[j] = '\0';
@@ -1387,9 +1387,9 @@ PRIVATE void display_page ARGS3(
* Memory leak fixed 05-27-94
* Garrett Arch Blythe
*/
- auto char *cp_AnchorAddress = NULL;
+ auto char *cp_AnchorAddress = NULL;
if (traversal)
- cp_AnchorAddress = stub_HTAnchor_address(link_dest);
+ cp_AnchorAddress = stub_HTAnchor_address(link_dest);
else {
#ifndef DONT_TRACK_INTERNAL_LINKS
if (Anchor_ptr->link_type == INTERNAL_LINK_ANCHOR) {
@@ -1428,7 +1428,7 @@ PRIVATE void display_page ARGS3(
links[nlinks].target = empty_string;
links[nlinks].form = NULL;
- nlinks++;
+ nlinks++;
display_flag = TRUE;
} else if (Anchor_ptr->link_type == INPUT_ANCHOR
@@ -1477,7 +1477,7 @@ PRIVATE void display_page ARGS3(
links[nlinks].hightext2_offset = 0;
nlinks++;
- /*
+ /*
* Bold the link after incrementing nlinks.
*/
highlight(OFF, (nlinks - 1), target);
@@ -1796,7 +1796,7 @@ PRIVATE void split_line ARGS2(
* Act on the global flag if set above. - FM
*/
if (underline_on && *p != LY_UNDERLINE_END_CHAR) {
- linedata[line->size++] = LY_UNDERLINE_START_CHAR;
+ linedata[line->size++] = LY_UNDERLINE_START_CHAR;
linedata[line->size] = '\0';
ctrl_chars_on_this_line++;
SpecialAttrChars++;
@@ -1958,7 +1958,7 @@ PRIVATE void split_line ARGS2(
(unsigned)(a->line_pos + a->extent) >= split) {
a->extent -= (TailTrim + HeadTrim);
if (a->extent < 0) {
- a->extent = 0;
+ a->extent = 0;
}
}
}
@@ -1981,7 +1981,7 @@ PRIVATE void blank_lines ARGS2(
while ((line != text->last_line) &&
(HText_TrueLineSize(line, text, IgnoreSpaces) == 0)) {
if (newlines == 0)
- break;
+ break;
newlines--; /* Don't bother: already blank */
line = line->prev;
}
@@ -2254,7 +2254,7 @@ PUBLIC void HText_appendCharacter ARGS2(
/*
* JIS X0201 Kana in SJIS support. - by ASATAKU
*/
- if ((text->kcode == SJIS) &&
+ if ((text->kcode == SJIS) &&
((unsigned char)ch >= 0xA1) &&
((unsigned char)ch <= 0xDF)) {
unsigned char c = (unsigned char)ch;
@@ -2264,14 +2264,14 @@ PUBLIC void HText_appendCharacter ARGS2(
(unsigned char *)&c);
ch = (char)c;
text->kanji_buf = (char)kb;
- } else {
+ } else {
text->kanji_buf = ch;
/*
* Can split here. - FM
*/
text->permissible_split = text->last_line->size;
return;
- }
+ }
}
} else {
goto check_IgnoreExcess;
@@ -2282,7 +2282,7 @@ PUBLIC void HText_appendCharacter ARGS2(
if (IsSpecialAttrChar(ch)) {
#ifndef USE_COLOR_STYLE
- if (line->size >= (MAX_LINE-1)) return;
+ if (line->size >= (MAX_LINE-1)) return;
if (ch == LY_UNDERLINE_START_CHAR) {
line->data[line->size++] = LY_UNDERLINE_START_CHAR;
line->data[line->size] = '\0';
@@ -2420,10 +2420,10 @@ PUBLIC void HText_appendCharacter ARGS2(
target = Tab->position;
} else if (text->in_line_1) { /* Use 2nd indent */
if (here >= (int)style->leftIndent) {
- new_line(text); /* wrap */
+ new_line(text); /* wrap */
return;
} else {
- target = (int)style->leftIndent;
+ target = (int)style->leftIndent;
}
} else { /* Default tabs align with left indent mod 8 */
#ifdef DEFAULT_TABS_8
@@ -2444,13 +2444,13 @@ PUBLIC void HText_appendCharacter ARGS2(
*/
text->permissible_split = line->size;
if (line->size == 0) {
- line->offset = line->offset + target - here;
+ line->offset = line->offset + target - here;
} else {
- for (; here<target; here++) {
+ for (; here<target; here++) {
/* Put character into line */
line->data[line->size++] = ' ';
line->data[line->size] = '\0';
- }
+ }
}
}
return;
@@ -2754,7 +2754,7 @@ PUBLIC void HText_endAnchor ARGS2(
} else {
for (a = text->first_anchor; a; a = a->next) {
if (a->number == number) {
- break;
+ break;
}
}
if (a == NULL) {
@@ -2818,7 +2818,7 @@ PUBLIC void HText_endAnchor ARGS2(
j = (last->size - i);
while (j < last->size) {
if (!IsSpecialAttrChar(last->data[j]) &&
- !isspace((unsigned char)last->data[j]) &&
+ !isspace((unsigned char)last->data[j]) &&
last->data[j] != HT_NON_BREAK_SPACE &&
last->data[j] != HT_EM_SPACE)
break;
@@ -2854,20 +2854,20 @@ PUBLIC void HText_endAnchor ARGS2(
while (i == 0 && a->extent > CurBlankExtent) {
j = prev->size - a->extent + CurBlankExtent;
if (j < 0) {
- /*
+ /*
* The anchor starts on a preceding line,
* so check all of this line. - FM
*/
- j = 0;
+ j = 0;
i = prev->size;
} else {
- /*
+ /*
* The anchor starts on this line. - FM
*/
- i = a->extent - CurBlankExtent;
+ i = a->extent - CurBlankExtent;
}
while (j < prev->size) {
- if (!IsSpecialAttrChar(prev->data[j]) &&
+ if (!IsSpecialAttrChar(prev->data[j]) &&
!isspace((unsigned char)prev->data[j]) &&
prev->data[j] != HT_NON_BREAK_SPACE &&
prev->data[j] != HT_EM_SPACE)
@@ -2958,15 +2958,15 @@ PUBLIC void HText_endAnchor ARGS2(
j--;
NumSize++;
while (j >= 0 && isdigit((unsigned char)start->data[j])) {
- j--;
+ j--;
NumSize++;
}
while (j < 0) {
- j++;
+ j++;
NumSize--;
}
if (start->data[j] == '[') {
- /*
+ /*
* The numbered bracket is entirely
* on this line. - FM
*/
@@ -2980,16 +2980,16 @@ PUBLIC void HText_endAnchor ARGS2(
anc->start -= NumSize;
anc->line_pos -= NumSize;
}
- start->size = j;
+ start->size = j;
start->data[j++] = '\0';
while (j < k)
start->data[j++] = '\0';
} else if (prev && prev->size > 1) {
k = (i + 1);
j = (prev->size - 1);
- while ((j >= 0) && IsSpecialAttrChar(prev->data[j]))
+ while ((j >= 0) && IsSpecialAttrChar(prev->data[j]))
j--;
- i = (j + 1);
+ i = (j + 1);
while (j >= 0 &&
isdigit((unsigned char)prev->data[j])) {
j--;
@@ -3020,9 +3020,9 @@ PUBLIC void HText_endAnchor ARGS2(
j = 0;
i = k;
while (k < start->size)
- start->data[j++] = start->data[k++];
+ start->data[j++] = start->data[k++];
if (start != last)
- text->chars -= i;
+ text->chars -= i;
for (anc = a; anc; anc = anc->next) {
anc->start -= i;
anc->line_pos -= i;
@@ -3030,7 +3030,7 @@ PUBLIC void HText_endAnchor ARGS2(
start->size = j;
start->data[j++] = '\0';
while (j < k)
- start->data[j++] = '\0';
+ start->data[j++] = '\0';
} else {
/*
* Shucks! We didn't find the
@@ -3048,16 +3048,16 @@ PUBLIC void HText_endAnchor ARGS2(
} else if (prev && prev->size > 2) {
j = (prev->size - 1);
while ((j >= 0) && IsSpecialAttrChar(prev->data[j]))
- j--;
+ j--;
if (j < 0)
- j = 0;
+ j = 0;
i = (j + 1);
if ((j > 2) &&
- (prev->data[j] == ']' &&
+ (prev->data[j] == ']' &&
isdigit((unsigned char)prev->data[j - 1]))) {
- j--;
+ j--;
NumSize++;
- k = (j + 1);
+ k = (j + 1);
while (j >= 0 &&
isdigit((unsigned char)prev->data[j])) {
j--;
@@ -3097,7 +3097,7 @@ PUBLIC void HText_endAnchor ARGS2(
* Shucks! We didn't find the
* numbered bracket. - FM
*/
- a->show_anchor = YES;
+ a->show_anchor = YES;
}
} else {
/*
@@ -3126,7 +3126,7 @@ PUBLIC void HText_endAnchor ARGS2(
a->extent = 0;
if (text->hiddenlinkflag != HIDDENLINKS_MERGE) {
a->number = 0;
- text->last_anchor_number--;
+ text->last_anchor_number--;
HText_AddHiddenLink(text, a);
}
} else {
@@ -3277,6 +3277,9 @@ PUBLIC void HText_trimHightext ARGS2(
CTRACE(tfp,"Gridtext: Entering HText_trimHightext\n");
+ if (disable_trace)
+ CTRACE(tfp,"HText_trimHightext: trace disabled in display_partial mode\n");
+
/*
* Get the first line.
*/
@@ -3321,7 +3324,7 @@ re_parse:
if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) {
ch = (unsigned char)line_ptr->data[anchor_ptr->line_pos];
while (isspace(ch) ||
- IsSpecialAttrChar(ch)) {
+ IsSpecialAttrChar(ch)) {
anchor_ptr->line_pos++;
anchor_ptr->extent--;
cur_shift++;
@@ -3333,8 +3336,8 @@ re_parse:
}
if (!disable_trace)
- CTRACE(tfp, "anchor text: '%s' col: %d\n",
- line_ptr->data, anchor_ptr->line_pos);
+ CTRACE(tfp, "anchor text: '%s'\n",
+ line_ptr->data);
/*
* If the link begins with an end of line and we have more
* lines, then start the highlighting on the next line. - FM
@@ -3375,7 +3378,7 @@ re_parse:
line_ptr2->data,
(anchor_ptr->extent -
strlen(anchor_ptr->hightext)));
- anchor_ptr->hightext2offset = line_ptr2->offset;
+ anchor_ptr->hightext2offset = line_ptr2->offset;
remove_special_attr_chars(anchor_ptr->hightext2);
if (anchor_ptr->link_type & HYPERTEXT_ANCHOR) {
LYTrimTrailing(anchor_ptr->hightext2);
@@ -3411,8 +3414,8 @@ re_parse:
anchor_ptr->line_num = cur_line;
if (!disable_trace)
- CTRACE(tfp, "GridText: add link on line %d in HText_trimHightext\n",
- cur_line);
+ CTRACE(tfp, "GridText: add link on line %d col %d in HText_trimHightext\n",
+ cur_line, anchor_ptr->line_pos);
/*
* If this is the last anchor, we're done!
@@ -3484,7 +3487,7 @@ PUBLIC void HText_FormDescNumber ARGS2(
for (a = HTMainText->first_anchor; a; a = a->next) {
if (a->number == number) {
if (!(a->input_field && a->input_field->type)) {
- *desc = "unknown field or link";
+ *desc = "unknown field or link";
return;
}
break;
@@ -3627,7 +3630,7 @@ PUBLIC int HTGetLinkInfo ARGS6(
*/
return(NO);
}
- if (anchors_this_screen > 0 &&
+ if (anchors_this_screen > 0 &&
anchors_this_screen <= nlinks &&
a->line_num >= HTMainText->top_of_screen &&
a->line_num < HTMainText->top_of_screen+(display_lines)) {
@@ -3639,7 +3642,7 @@ PUBLIC int HTGetLinkInfo ARGS6(
*/
*go_line = HTMainText->top_of_screen;
if (linknum)
- *linknum = anchors_this_screen - 1;
+ *linknum = anchors_this_screen - 1;
} else {
/*
* if the requested anchor is not within the currently
@@ -3663,13 +3666,13 @@ PUBLIC int HTGetLinkInfo ARGS6(
max_offset = display_lines - 1;
*go_line = prev_anchor_line - max_offset;
if (*go_line <= prev_prev_anchor_line)
- *go_line = prev_prev_anchor_line + 1;
+ *go_line = prev_prev_anchor_line + 1;
if (*go_line < 0)
- *go_line = 0;
+ *go_line = 0;
if (linknum)
- *linknum = anchors_this_line - 1;
- }
- return(LINK_LINE_FOUND);
+ *linknum = anchors_this_line - 1;
+ }
+ return(LINK_LINE_FOUND);
} else {
*hightext= a->hightext;
link_dest = HTAnchor_followMainLink((HTAnchor *)a->anchor);
@@ -3921,12 +3924,12 @@ PUBLIC void HTCheckFnameForCompression ARGS3(
!strcasecomp(dot, ".gz") ||
!strcasecomp(dot, ".Z")) {
if (!method) {
- /*
+ /*
* It has a suffix which signifies a gzipped
* or compressed file for us, but the anchor
* claims otherwise, so tweak the suffix. - FM
*/
- cp = (dot + 1);
+ cp = (dot + 1);
*dot = '\0';
if (!strcasecomp(cp, "tgz")) {
StrAllocCat(*fname, ".tar");
@@ -3939,7 +3942,7 @@ PUBLIC void HTCheckFnameForCompression ARGS3(
if (!strcasecomp(cp, "-gz") ||
!strcasecomp(cp, "_gz")) {
if (!method) {
- /*
+ /*
* It has a tail which signifies a gzipped
* file for us, but the anchor claims otherwise,
* so tweak the suffix. - FM
@@ -3969,7 +3972,7 @@ PUBLIC void HTCheckFnameForCompression ARGS3(
if (!strcasecomp(cp, "-Z") ||
!strcasecomp(cp, "_Z")) {
if (!method) {
- /*
+ /*
* It has a tail which signifies a compressed
* file for us, but the anchor claims otherwise,
* so tweak the suffix. - FM
@@ -4348,7 +4351,7 @@ PUBLIC BOOL HText_selectAnchor ARGS2(
if ( !text->stale &&
(l >= text->top_of_screen) &&
( l < text->top_of_screen + display_lines+1))
- return YES;
+ return YES;
www_search_result = l - (display_lines/3); /* put in global variable */
}
@@ -4540,7 +4543,7 @@ PUBLIC int do_www_search ARGS1(
strcpy(searchstring, ++cp);
for (cp=searchstring; *cp; cp++)
if (*cp == '+')
- *cp = ' ';
+ *cp = ' ';
HTUnEscape(searchstring);
strcpy(temp, searchstring);
/*
@@ -4575,22 +4578,22 @@ get_query:
*searchstring == '\0' || ch == UPARROW || ch == DNARROW) {
if (recall && ch == UPARROW) {
if (PreviousSearch) {
- /*
+ /*
* Use the second to last query in the list. - FM
*/
- QueryNum = 1;
+ QueryNum = 1;
PreviousSearch = FALSE;
} else {
- /*
+ /*
* Go back to the previous query in the list. - FM
*/
- QueryNum++;
+ QueryNum++;
}
if (QueryNum >= QueryTotal)
- /*
+ /*
* Roll around to the last query in the list. - FM
*/
- QueryNum = 0;
+ QueryNum = 0;
if ((cp=(char *)HTList_objectAt(search_queries,
QueryNum)) != NULL) {
strcpy(searchstring, cp);
@@ -4606,19 +4609,19 @@ get_query:
}
} else if (recall && ch == DNARROW) {
if (PreviousSearch) {
- /*
+ /*
* Use the first query in the list. - FM
*/
- QueryNum = QueryTotal - 1;
+ QueryNum = QueryTotal - 1;
PreviousSearch = FALSE;
} else {
- /*
+ /*
* Advance to the next query in the list. - FM
*/
- QueryNum--;
+ QueryNum--;
}
if (QueryNum < 0)
- /*
+ /*
* Roll around to the first query in the list. - FM
*/
QueryNum = QueryTotal - 1;
@@ -4754,7 +4757,7 @@ PUBLIC void print_wwwfile_to_fd ARGS2(
fputc('>',fp);
}
- /*
+ /*
* Add offset.
*/
for (i = 0; i < (int)line->offset; i++) {
@@ -5013,7 +5016,7 @@ PUBLIC void www_user_search ARGS3(
if ((a->input_field != NULL && a->input_field->value != NULL) &&
a->input_field->type != F_HIDDEN_TYPE) {
if (a->input_field->type == F_PASSWORD_TYPE) {
- /*
+ /*
* Check the actual, hidden password, and then
* the displayed string. - FM
*/
@@ -5062,7 +5065,7 @@ PUBLIC void www_user_search ARGS3(
/*
* Search for checked or unchecked parens. - FM
*/
- if (a->input_field->num_value) {
+ if (a->input_field->num_value) {
cp = checked_radio;
} else {
cp = unchecked_radio;
@@ -5079,7 +5082,7 @@ PUBLIC void www_user_search ARGS3(
* Search for checked or unchecked
* square brackets. - FM
*/
- if (a->input_field->num_value) {
+ if (a->input_field->num_value) {
cp = checked_box;
} else {
cp = unchecked_box;
@@ -5092,7 +5095,7 @@ PUBLIC void www_user_search ARGS3(
return;
}
} else {
- /*
+ /*
* Check the values intended for display.
* May have been found already via the
* hightext search, but make sure here
@@ -5172,7 +5175,7 @@ PUBLIC void www_user_search ARGS3(
if ((a->input_field != NULL && a->input_field->value != NULL) &&
a->input_field->type != F_HIDDEN_TYPE) {
if (a->input_field->type == F_PASSWORD_TYPE) {
- /*
+ /*
* Check the actual, hidden password, and then
* the displayed string. - FM
*/
@@ -5221,7 +5224,7 @@ PUBLIC void www_user_search ARGS3(
/*
* Search for checked or unchecked parens. - FM
*/
- if (a->input_field->num_value) {
+ if (a->input_field->num_value) {
cp = checked_radio;
} else {
cp = unchecked_radio;
@@ -5238,7 +5241,7 @@ PUBLIC void www_user_search ARGS3(
* Search for checked or unchecked
* square brackets. - FM
*/
- if (a->input_field->num_value) {
+ if (a->input_field->num_value) {
cp = checked_box;
} else {
cp = unchecked_box;
@@ -5251,7 +5254,7 @@ PUBLIC void www_user_search ARGS3(
return;
}
} else {
- /*
+ /*
* Check the values intended for display.
* May have been found already via the
* hightext search, but make sure here
@@ -5276,17 +5279,17 @@ PUBLIC void www_user_search ARGS3(
}
if (case_sensitive && LYno_attr_char_strstr(line->data, target)) {
- tentative_result=count;
+ tentative_result=count;
break;
} else if (!case_sensitive &&
LYno_attr_char_case_strstr(line->data, target)) {
- tentative_result = count;
+ tentative_result = count;
break;
} else if (count > start_line) { /* next line */
HTUserMsg2(STRING_NOT_FOUND, target);
- return; /* end */
+ return; /* end */
} else {
- line = line->next;
+ line = line->next;
count++;
}
}
@@ -5544,7 +5547,7 @@ PRIVATE int HText_TrueLineSize ARGS3(
(!(text && text->T.output_utf8) ||
(unsigned char)line->data[i] < 128 ||
((unsigned char)(line->data[i] & 0xc0) == 0xc0)) &&
- !isspace((unsigned char)line->data[i]) &&
+ !isspace((unsigned char)line->data[i]) &&
(unsigned char)line->data[i] != HT_NON_BREAK_SPACE &&
(unsigned char)line->data[i] != HT_EM_SPACE) {
true_size++;
@@ -5656,7 +5659,7 @@ PUBLIC void HText_setTabID ARGS2(
} else {
while (NULL != (Tab = (HTTabID *)HTList_nextObject(cur))) {
if (Tab->name && !strcmp(Tab->name, name))
- return; /* Already set. Keep the first value. */
+ return; /* Already set. Keep the first value. */
last = cur;
}
if (last)
@@ -5684,7 +5687,7 @@ PUBLIC int HText_getTabIDColumn ARGS2(
if (text && name && *name && cur) {
while (NULL != (Tab = (HTTabID *)HTList_nextObject(cur))) {
if (Tab->name && !strcmp(Tab->name, name))
- break;
+ break;
}
if (Tab)
column = Tab->column;
@@ -5884,7 +5887,7 @@ PUBLIC void HText_endForm ARGS1(
*/
while (a) {
if (a->link_type == INPUT_ANCHOR &&
- a->input_field->number == HTFormNumber &&
+ a->input_field->number == HTFormNumber &&
a->input_field->type == F_TEXT_TYPE) {
/*
* Got it. Make it submitting. - FM
@@ -5903,7 +5906,7 @@ PUBLIC void HText_endForm ARGS1(
break;
}
if (a == text->last_anchor)
- break;
+ break;
a = a->next;
}
}
@@ -6032,13 +6035,13 @@ PRIVATE char * HText_skipOptionNumPrefix ARGS1(
if ((cp && *cp && *cp++ == '(') &&
*cp && isdigit(*cp++)) {
while (*cp && isdigit(*cp))
- ++cp;
+ ++cp;
if (*cp && *cp++ == ')') {
int i = (cp - opname);
while (i < 5) {
if (*cp != '_')
- break;
+ break;
i++;
cp++;
}
@@ -6046,7 +6049,7 @@ PRIVATE char * HText_skipOptionNumPrefix ARGS1(
cp = opname;
}
} else {
- cp = opname;
+ cp = opname;
}
} else {
cp = opname;
@@ -6171,7 +6174,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7(
new_ptr = text->last_anchor->input_field->select_list =
(OptionType *)calloc(1, sizeof(OptionType));
if (new_ptr == NULL)
- outofmem(__FILE__, "HText_setLastOptionValue");
+ outofmem(__FILE__, "HText_setLastOptionValue");
first_option = TRUE;
} else {
@@ -6184,7 +6187,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7(
op_ptr->next = new_ptr =
(OptionType *)calloc(1, sizeof(OptionType));
if (new_ptr == NULL)
- outofmem(__FILE__, "HText_setLastOptionValue");
+ outofmem(__FILE__, "HText_setLastOptionValue");
}
new_ptr->name = NULL;
@@ -6192,7 +6195,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7(
new_ptr->next = NULL;
for (i = 0, j = 0; cp[i]; i++) {
if (cp[i] == HT_NON_BREAK_SPACE ||
- cp[i] == HT_EM_SPACE) {
+ cp[i] == HT_EM_SPACE) {
cp[j++] = ' ';
} else if (cp[i] != LY_SOFT_HYPHEN &&
!IsSpecialAttrChar((unsigned char)cp[i])) {
@@ -6202,7 +6205,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7(
cp[j] = '\0';
if (HTCJK != NOCJK) {
if (cp &&
- (tmp = (unsigned char *)calloc(1, strlen(cp)+1))) {
+ (tmp = (unsigned char *)calloc(1, strlen(cp)+1))) {
if (kanji_code == EUC) {
TO_EUC((unsigned char *)cp, tmp);
val_cs = current_char_set;
@@ -6211,7 +6214,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] != '\033') {
tmp[j++] = cp[i];
}
}
@@ -6309,7 +6312,7 @@ PUBLIC char * HText_setLastOptionValue ARGS7(
(submit_val_cs >= 0 ?
LYCharSet_UC[submit_val_cs].MIMEname : "<UNKNOWN>"),
(HTCurSelectGroupType == F_CHECKBOX_TYPE) ?
- "(ignored)" : "",
+ "(ignored)" : "",
submit_value);
}
else {
@@ -6372,7 +6375,7 @@ PUBLIC int HText_beginInput ARGS3(
TextAnchor * b = text->first_anchor;
int i2 = 0;
while (b) {
- if (b->link_type == INPUT_ANCHOR &&
+ if (b->link_type == INPUT_ANCHOR &&
b->input_field->type == F_RADIO_TYPE &&
b->input_field->number == HTFormNumber) {
if (!strcmp(b->input_field->name, I->name)) {
@@ -6434,7 +6437,7 @@ PUBLIC int HText_beginInput ARGS3(
} else {
for (i = 0, j = 0; IValue[i]; i++) {
if (IValue[i] != '\033') {
- tmp[j++] = IValue[i];
+ tmp[j++] = IValue[i];
}
}
}
@@ -6740,9 +6743,9 @@ PUBLIC int HText_beginInput ARGS3(
* account as well. - FM
*/
if (keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED)
- MaximumSize -= ((a->number/10) + 3);
+ MaximumSize -= ((a->number/10) + 3);
if (f->size > MaximumSize)
- f->size = MaximumSize;
+ f->size = MaximumSize;
/*
* Save value for submit/reset buttons so they
@@ -7044,10 +7047,15 @@ PUBLIC void HText_SubmitForm ARGS4(
HTMainText->node_anchor->charset &&
*HTMainText->node_anchor->charset) {
target_cs = UCGetLYhndl_byMIME(HTMainText->node_anchor->charset);
- if (target_cs < 0) {
+ if (target_cs >= 0) {
+ target_csname = HTMainText->node_anchor->charset;
+ } else {
target_cs = UCLYhndl_for_unspec; /* always >= 0 */
+ target_csname = LYCharSet_UC[target_cs].MIMEname;
}
- target_csname = LYCharSet_UC[target_cs].MIMEname;
+ }
+ if (target_cs < 0) {
+ target_cs = UCLYhndl_for_unspec; /* always >= 0 */
}
/*
@@ -7063,22 +7071,22 @@ PUBLIC void HText_SubmitForm ARGS4(
char *p;
char * val;
- form_ptr = anchor_ptr->input_field;
+ form_ptr = anchor_ptr->input_field;
val = form_ptr->cp_submit_value != NULL ?
- form_ptr->cp_submit_value : form_ptr->value;
+ form_ptr->cp_submit_value : form_ptr->value;
field_has_8bit = NO;
field_has_special = NO;
- len += (strlen(form_ptr->name) + (Boundary ? 100 : 10));
+ 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 += (strlen(form_ptr->value) + 10);
}
- len += 32; /* plus and ampersand + safety net */
+ len += 32; /* plus and ampersand + safety net */
for (p = val;
p && *p && !(field_has_8bit && field_has_special);
@@ -7146,7 +7154,7 @@ PUBLIC void HText_SubmitForm ARGS4(
}
} else if (anchor_ptr->input_field->number > form_number) {
- break;
+ break;
}
}
@@ -7269,16 +7277,16 @@ PUBLIC void HText_SubmitForm ARGS4(
textarea_lineno = 0;
switch(form_ptr->type) {
- case F_RESET_TYPE:
+ case F_RESET_TYPE:
break;
- case F_SUBMIT_TYPE:
- case F_TEXT_SUBMIT_TYPE:
- case F_IMAGE_SUBMIT_TYPE:
+ case F_SUBMIT_TYPE:
+ case F_TEXT_SUBMIT_TYPE:
+ case F_IMAGE_SUBMIT_TYPE:
if (!(form_ptr->name && *form_ptr->name != '\0' &&
!strcmp(form_ptr->name, link_name))) {
CTRACE(tfp,
"SubmitForm: skipping submit field with ");
- CTRACE(tfp, "name \"%s\" for link_name \"%s\", %s.",
+ CTRACE(tfp, "name \"%s\" for link_name \"%s\", %s.\n",
form_ptr->name ? form_ptr->name : "???",
link_name ? link_name : "???",
(form_ptr->name && *form_ptr->name) ?
@@ -7292,7 +7300,7 @@ PUBLIC void HText_SubmitForm ARGS4(
fprintf(tfp,
"SubmitForm: skipping submit field with ");
fprintf(tfp,
- "name \"%s\" for link_name \"%s\", %s!",
+ "name \"%s\" for link_name \"%s\", %s!\n",
form_ptr->name ? form_ptr->name : "???",
link_name ? link_name : "???",
"values are different");
@@ -7300,11 +7308,11 @@ PUBLIC void HText_SubmitForm ARGS4(
break;
}
/* fall through */
- case F_RADIO_TYPE:
+ case F_RADIO_TYPE:
case F_CHECKBOX_TYPE:
case F_TEXTAREA_TYPE:
case F_PASSWORD_TYPE:
- case F_TEXT_TYPE:
+ case F_TEXT_TYPE:
case F_OPTION_LIST_TYPE:
case F_HIDDEN_TYPE:
/*
@@ -7825,9 +7833,9 @@ PUBLIC void HText_SubmitForm ARGS4(
FREE(copied_name_used);
FREE(copied_val_used);
break;
- }
+ }
} else if (anchor_ptr->input_field->number > form_number) {
- break;
+ break;
}
}
@@ -7851,7 +7859,7 @@ PUBLIC void HText_SubmitForm ARGS4(
*submit_item->submit_title) ?
(submit_item->submit_title) :
(HText_getTitle() ?
- HText_getTitle() : "")));
+ HText_getTitle() : "")));
CTRACE(tfp,"GridText - mailto_content: %s\n",query);
mailform((submit_item->submit_action+7),
((submit_item->submit_title &&
@@ -7933,9 +7941,9 @@ PUBLIC void HText_ResetForm ARGS1(
anchor_ptr->input_field->type == F_CHECKBOX_TYPE) {
if (anchor_ptr->input_field->orig_value[0] == '0')
- anchor_ptr->input_field->num_value = 0;
+ anchor_ptr->input_field->num_value = 0;
else
- anchor_ptr->input_field->num_value = 1;
+ anchor_ptr->input_field->num_value = 1;
} else if (anchor_ptr->input_field->type ==
F_OPTION_LIST_TYPE) {
@@ -7945,7 +7953,7 @@ PUBLIC void HText_ResetForm ARGS1(
anchor_ptr->input_field->cp_submit_value =
anchor_ptr->input_field->orig_submit_value;
- } else {
+ } else {
StrAllocCopy(anchor_ptr->input_field->value,
anchor_ptr->input_field->orig_value);
}
@@ -7979,13 +7987,13 @@ PUBLIC void HText_activateRadioButton ARGS1(
if (anchor_ptr->input_field->number == form_number) {
/* if it has the same name and its on */
- if (!strcmp(anchor_ptr->input_field->name, form->name) &&
+ if (!strcmp(anchor_ptr->input_field->name, form->name) &&
anchor_ptr->input_field->num_value) {
anchor_ptr->input_field->num_value = 0;
break;
- }
+ }
} else if (anchor_ptr->input_field->number > form_number) {
- break;
+ break;
}
}
diff --git a/src/HTML.c b/src/HTML.c
index 4271a1d3..9ad52f49 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -177,6 +177,18 @@ PRIVATE void change_paragraph_style ARGS2(HTStructured *, me, HTStyle *,style)
** A C T I O N R O U T I N E S
*/
+/* FIXME: this should be amended to do the substitution only when not in a
+ * multibyte stream.
+ */
+#if EXP_JAPANESE_SPACES
+#define FIX_JAPANESE_SPACES \
+ (HTCJK == CHINESE || HTCJK == JAPANESE || HTCJK == TAIPEI)
+ /* don't replace '\n' with ' ' if Chinese or Japanese - HN
+ */
+#else
+#define FIX_JAPANESE_SPACES 0
+#endif
+
/* Character handling
** ------------------
*/
@@ -218,13 +230,12 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
return;
if (c != '\n' && c != '\t' && c != '\r') {
HTChunkPutc(&me->title, c);
- } else if (HTCJK == CHINESE || HTCJK == JAPANESE || HTCJK == TAIPEI) {
+ } else if (FIX_JAPANESE_SPACES) {
if (c == '\t') {
HTChunkPutc(&me->title, ' ');
} else {
return;
}
- /* don't replace '\n' with ' ' if Chinese or Japanese - HN */
} else {
HTChunkPutc(&me->title, ' ');
}
@@ -339,11 +350,7 @@ PUBLIC void HTML_put_character ARGS2(HTStructured *, me, char, c)
UPDATE_STYLE;
}
if (c == '\n') {
- if (HTCJK == CHINESE || HTCJK == JAPANESE ||
- HTCJK == TAIPEI) {
- /* don't replace '\n' with ' ' if Chinese or Japanese - HN
- */
- } else {
+ if (!FIX_JAPANESE_SPACES) {
if (me->in_word) {
if (HText_getLastChar(me->text) != ' ') {
me->inP = TRUE;
@@ -480,12 +487,7 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s)
UPDATE_STYLE;
}
if (c == '\n') {
- if (HTCJK == CHINESE || HTCJK == JAPANESE ||
- HTCJK == TAIPEI) {
- /* don't replace '\n' with ' '
- * if Chinese or Japanese - HN
- */
- } else {
+ if (!FIX_JAPANESE_SPACES) {
if (me->in_word) {
if (HText_getLastChar(me->text) != ' ')
HText_appendCharacter(me->text, ' ');
diff --git a/src/LYCharSets.c b/src/LYCharSets.c
index c2540e13..029b8546 100644
--- a/src/LYCharSets.c
+++ b/src/LYCharSets.c
@@ -673,13 +673,106 @@ PRIVATE void HTMLSetDisplayCharsetMatchLocale ARGS1(int,i)
return;
}
+
+/*
+ * lynx 2.8/2.7.2(and more early) compatibility code:
+ * "human-readable" charset names changes with time
+ * so we map that history names to MIME here
+ * to get old lynx.cfg and (especially) .lynxrc always recognized.
+ * Please update this table when you change "fullname" of any present charset.
+ */
+typedef struct _names_pairs {
+ CONST char * fullname;
+ CONST char * MIMEname;
+} names_pairs;
+
+PRIVATE CONST names_pairs OLD_charset_names[] = {
+ {"ISO Latin 1", "iso-8859-1"},
+ {"ISO Latin 2", "iso-8859-2"},
+ {"WinLatin1 (cp1252)", "windows-1252"},
+ {"DEC Multinational", "dec-mcs"},
+ {"Macintosh (8 bit)", "macintosh"},
+ {"NeXT character set", "next"},
+ {"KOI8-R Cyrillic", "koi8-r"},
+ {"Chinese", "euc-cn"},
+ {"Japanese (EUC)", "euc-jp"},
+ {"Japanese (SJIS)", "shift_jis"},
+ {"Korean", "euc-kr"},
+ {"Taipei (Big5)", "big5"},
+ {"Vietnamese (VISCII)", "viscii"},
+ {"7 bit approximations","us-ascii"},
+ {"Transparent", "x-transparent"},
+ {"DosLatinUS (cp437)", "cp437"},
+ {"IBM PC character set","cp437"},
+ {"DosLatin1 (cp850)", "cp850"},
+ {"IBM PC codepage 850", "cp850"},
+ {"DosLatin2 (cp852)", "cp852"},
+ {"PC Latin2 CP 852", "cp852"},
+ {"DosCyrillic (cp866)", "cp866"},
+ {"DosArabic (cp864)", "cp864"},
+ {"DosGreek (cp737)", "cp737"},
+ {"DosBaltRim (cp775)", "cp775"},
+ {"DosGreek2 (cp869)", "cp869"},
+ {"DosHebrew (cp862)", "cp862"},
+ {"WinLatin2 (cp1250)", "windows-1250"},
+ {"WinCyrillic (cp1251)","windows-1251"},
+ {"WinGreek (cp1253)", "windows-1253"},
+ {"WinHebrew (cp1255)", "windows-1255"},
+ {"WinArabic (cp1256)", "windows-1256"},
+ {"WinBaltRim (cp1257)", "windows-1257"},
+ {"ISO Latin 3", "iso-8859-3"},
+ {"ISO Latin 4", "iso-8859-4"},
+ {"ISO 8859-5 Cyrillic", "iso-8859-5"},
+ {"ISO 8859-6 Arabic", "iso-8859-6"},
+ {"ISO 8859-7 Greek", "iso-8859-7"},
+ {"ISO 8859-8 Hebrew", "iso-8859-8"},
+ {"ISO 8859-9 (Latin 5)","iso-8859-9"},
+ {"ISO 8859-10", "iso-8859-10"},
+ {"UNICODE UTF 8", "utf-8"},
+ {"RFC 1345 w/o Intro", "mnemonic+ascii+0"},
+ {"RFC 1345 Mnemonic", "mnemonic"},
+ {NULL, NULL},
+};
+
+/*
+ * lynx 2.8/2.7.2 compatibility code:
+ * read "character_set" parameter from lynx.cfg and .lynxrc
+ * in both MIME name and "human-readable" name (old and new style).
+ * Returns -1 if not recognized.
+ */
+PUBLIC int UCGetLYhndl_byAnyName ARGS1 (CONST char *, value)
+{
+ int i;
+
+ if (value == NULL) return -1;
+
+ /* search by name */
+ for (i = 0; (i < MAXCHARSETS && LYchar_set_names[i]); i++) {
+ if (!strncmp(LYchar_set_names[i], value,
+ strlen(LYchar_set_names[i]))) {
+ return i; /* OK */
+ }
+ }
+
+ /* search by old name from 2.8/2.7.2 version */
+ for (i = 0; (OLD_charset_names[i].fullname); i++) {
+ if (!strncmp(OLD_charset_names[i].fullname, value,
+ strlen(OLD_charset_names[i].fullname))) {
+ return UCGetLYhndl_byMIME(OLD_charset_names[i].MIMEname); /* OK */
+ }
+ }
+
+ return UCGetLYhndl_byMIME(value); /* by MIME */
+}
+
+
/*
* Entity names -- Ordered by ISO Latin 1 value.
* ---------------------------------------------
* For conversions of DECIMAL escaped entities.
* Must be in order of ascending value.
*/
-PUBLIC CONST char * LYEntityNames[] = {
+PRIVATE CONST char * LYEntityNames[] = {
/* NAME DECIMAL VALUE */
"nbsp", /* 160, non breaking space */
"iexcl", /* 161, inverted exclamation mark */
@@ -801,7 +894,7 @@ PUBLIC CONST char * HTMLGetEntityName ARGS1(
* in the ISO_Latin1 and UC_entity_info unicode_entities arrays.
* It returns 0 if not found. - FM
*
- * unicode_entities[] now handles all the names from old style entities[] too.
+ * unicode_entities[] handles all the names from old style entities[] too.
* Lynx now calls unicode_entities[] only through this function:
* HTMLGetEntityUCValue(). Note, we need not check for special characters
* here in function or even before it, we should check them *after*
diff --git a/src/LYCharSets.h b/src/LYCharSets.h
index 33c6ef76..36b583ef 100644
--- a/src/LYCharSets.h
+++ b/src/LYCharSets.h
@@ -12,10 +12,9 @@ extern BOOLEAN LYHaveCJKCharacterSet;
extern BOOLEAN DisplayCharsetMatchLocale;
/*
- * LYchar_set_name[current_char_set] points to the currently active set.
+ * currently active character set (internal handler)
*/
extern int current_char_set;
-extern CONST char * LYchar_set_names[];
/*
* Initializer, calls initialization function for the
@@ -27,16 +26,17 @@ extern int LYCharSetsDeclared NOPARAMS;
extern CONST char ** LYCharSets[];
extern CONST char * SevenBitApproximations[];
extern CONST char ** p_entity_values;
+extern CONST char * LYchar_set_names[]; /* Full name, not MIME */
extern int LYlowest_eightbit[];
extern int LYNumCharsets;
extern LYUCcharset LYCharSet_UC[];
+extern int UCGetLYhndl_byAnyName PARAMS((CONST char *value));
extern void HTMLSetCharacterHandling PARAMS((int i));
extern void HTMLSetUseDefaultRawMode PARAMS((int i, BOOLEAN modeflag));
extern void HTMLUseCharacterSet PARAMS((int i));
extern UCode_t HTMLGetEntityUCValue PARAMS((CONST char *name));
extern void Set_HTCJK PARAMS((CONST char *inMIMEname, CONST char *outMIMEname));
-extern CONST char * LYEntityNames[];
extern CONST char * HTMLGetEntityName PARAMS((UCode_t code));
/*
** HTMLGetEntityName calls LYEntityNames for iso-8859-1 entity
diff --git a/src/LYDownload.c b/src/LYDownload.c
index a0b9a86f..db42b431 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -81,6 +81,7 @@ PUBLIC void LYDownload ARGS1(
* Go past "SugFile=".
*/
sug_file += 8;
+ HTUnEscape(sug_file);
}
if ((file = (char *)strstr(Line, "File=")) == NULL)
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index c3ebddbd..6852a5d6 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -231,6 +231,7 @@ extern BOOLEAN local_host_only;
extern BOOLEAN override_no_download;
extern BOOLEAN show_dotfiles; /* From rcfile if no_dotfiles is false */
extern char *indexfile;
+extern int outgoing_mail_charset; /* translate outgoing mail to this charset */
extern char *personal_mail_address;
extern char *homepage; /* startfile or command line argument */
extern char *editor; /* if non empty it enables edit mode with
@@ -250,6 +251,7 @@ extern BOOLEAN historical_comments;
extern BOOLEAN minimal_comments;
extern BOOLEAN soft_dquotes;
extern BOOLEAN LYCancelDownload;
+extern BOOLEAN LYRestricted;
extern BOOLEAN LYValidate;
extern BOOLEAN LYPermitURL;
extern BOOLEAN enable_scrollback; /* Clear screen before displaying new page */
diff --git a/src/LYLocal.c b/src/LYLocal.c
index 4490e16c..5750d7ae 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -240,6 +240,7 @@ PRIVATE BOOLEAN ok_stat ARGS2(char *, name, struct stat*, sb)
{
char tmpbuf[LY_MAXPATH+80];
+ CTRACE(tfp, "testing ok_stat(%s)\n", name);
if (stat(name, sb) < 0) {
sprintf(tmpbuf, "Unable to get status of '%s'.", name);
HTAlert(tmpbuf);
@@ -253,6 +254,7 @@ PRIVATE BOOLEAN ok_lstat ARGS2(char *, name, struct stat*, sb)
{
char tmpbuf[LY_MAXPATH+80];
+ CTRACE(tfp, "testing ok_lstat(%s)\n", name);
if (lstat(name, sb) < 0) {
sprintf(tmpbuf, "Unable to get status of '%s'.", name);
HTAlert(tmpbuf);
@@ -638,7 +640,8 @@ PRIVATE BOOLEAN modify_location ARGS1(
/*
* Allow ~/ references to the home directory.
*/
- if (!strncmp(tmpbuf,"~/",2)) {
+ if (!strncmp(tmpbuf, "~/", 2)
+ || !strcmp(tmpbuf,"~")) {
strcpy(newpath, Home_Dir());
strcat(newpath, (tmpbuf + 1));
strcpy(tmpbuf, newpath);
@@ -665,7 +668,7 @@ PRIVATE BOOLEAN modify_location ARGS1(
if (!ok_stat(newpath, &dir_info)) {
return 0;
}
- if (S_ISDIR(dir_info.st_mode)) {
+ if (!S_ISDIR(dir_info.st_mode)) {
HTAlert("Destination is not a valid directory! Request denied.");
return 0;
}
diff --git a/src/LYMain.c b/src/LYMain.c
index 05e7d45f..f42d3bcc 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -168,6 +168,7 @@ PUBLIC BOOLEAN nolist = FALSE;
PUBLIC BOOLEAN historical_comments = FALSE;
PUBLIC BOOLEAN minimal_comments = FALSE;
PUBLIC BOOLEAN soft_dquotes = FALSE;
+PUBLIC BOOLEAN LYRestricted = FALSE;
PUBLIC BOOLEAN LYValidate = FALSE;
PUBLIC BOOLEAN LYPermitURL = FALSE;
PUBLIC BOOLEAN child_lynx = FALSE;
@@ -253,6 +254,7 @@ PUBLIC char *lynxlistfile = NULL; /* the current list file URL */
PUBLIC char *lynxlinksfile = NULL; /* the current visited links file URL */
PUBLIC char *startrealm = NULL; /* the startfile realm */
PUBLIC char *indexfile = NULL; /* an index file if there is one */
+PUBLIC int outgoing_mail_charset = -1; /* translate mail to this charset */
PUBLIC char *personal_mail_address = NULL; /* the users mail address */
PUBLIC char *x_display = NULL; /* display environment variable */
PUBLIC char *personal_type_map = NULL; /* .mailcap */
@@ -369,7 +371,6 @@ PUBLIC FILE *logfile = NULL; /* for WAIS log file output in libWWW */
extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */
extern int HTNewsMaxChunk; /* Max news articles before chunking (HTNews.c) */
-PRIVATE BOOLEAN anon_restrictions_set = FALSE;
PRIVATE BOOLEAN stack_dump = FALSE;
PRIVATE char *terminal = NULL;
PRIVATE char *pgm;
@@ -772,7 +773,7 @@ PUBLIC int main ARGS2(
} else if (strncmp(argv[i], "-anonymous", 10) == 0) {
if (!LYValidate)
parse_restrictions("default");
- anon_restrictions_set = TRUE;
+ LYRestricted = TRUE;
} else if (strcmp(argv[i], "-validate") == 0) {
/*
* Follow only http URLs.
@@ -844,9 +845,9 @@ PUBLIC int main ARGS2(
LYUseTraceLog = TRUE;
}
} else if (strncmp(buf, "-anonymous", 10) == 0) {
- if (!LYValidate && !anon_restrictions_set)
+ if (!LYValidate && !LYRestricted)
parse_restrictions("default");
- anon_restrictions_set = TRUE;
+ LYRestricted = TRUE;
} else if (strcmp(buf, "-validate") == 0) {
/*
* Follow only http URLs.
@@ -988,7 +989,7 @@ PUBLIC int main ARGS2(
* set the default restrictions for that account and disallow
* a TRACE log NOW. - FM
*/
- if (!LYValidate && !anon_restrictions_set &&
+ if (!LYValidate && !LYRestricted &&
strlen((char *)ANONYMOUS_USER) > 0 &&
#if defined (VMS) || defined (NOUSERS)
!strcasecomp(((char *)getenv("USER")==NULL ? " " : getenv("USER")),
@@ -1002,7 +1003,7 @@ PUBLIC int main ARGS2(
#endif /* VMS */
{
parse_restrictions("default");
- anon_restrictions_set = TRUE;
+ LYRestricted = TRUE;
LYUseTraceLog = FALSE;
}
@@ -1050,7 +1051,7 @@ PUBLIC int main ARGS2(
* If TRACE is on, indicate whether the
* anonymous restrictions are set. - FM
*/
- if (anon_restrictions_set) {
+ if (LYRestricted) {
CTRACE(tfp, "LYMain: Anonymous restrictions set.\n");
}
@@ -1847,9 +1848,9 @@ static int anonymous_fun ARGS3(
* override or replace any additional
* restrictions from the command line. - FM
*/
- if (!anon_restrictions_set)
+ if (!LYRestricted)
parse_restrictions("default");
- anon_restrictions_set = TRUE;
+ LYRestricted = TRUE;
return 0;
}
diff --git a/src/LYOptions.c b/src/LYOptions.c
index b735913c..94a8ac3c 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -4031,9 +4031,11 @@ PUBLIC int gen_options ARGS1(
NOTEMPTY(LYUserAgent), text_len, "");
}
- fprintf(fp0,
- "<a href=\"%s\">lynx.cfg information (read-only)</a>\n",
- lynx_cfg_infopage());
+ if (!LYRestricted) {
+ fprintf(fp0,
+ "<a href=\"%s\">lynx.cfg information (read-only)</a>\n",
+ lynx_cfg_infopage());
+ }
fprintf(fp0,"\n</pre>\n");
diff --git a/src/LYPrint.c b/src/LYPrint.c
index 94e447a0..da791c6a 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -63,6 +63,8 @@
PRIVATE int remove_quotes PARAMS((char *string));
#endif /* VMS */
+PRIVATE CONST char* subject_translate8bit PARAMS((char *source));
+
PUBLIC int printfile ARGS1(
document *, newdoc)
{
@@ -91,6 +93,7 @@ PUBLIC int printfile ARGS1(
HTAtom *encoding;
BOOL use_mime, use_cte, use_type;
CONST char *disp_charset;
+ CONST char *subject; /* print-to-email */
static BOOLEAN first_mail_preparsed = TRUE;
char *envbuffer = NULL;
#ifdef VMS
@@ -243,6 +246,7 @@ PUBLIC int printfile ARGS1(
* Act on the request. - FM
*/
switch (type) {
+
case TO_FILE:
#if defined(__DJGPP__) || defined(_WINDOWS)
_fmode = O_TEXT;
@@ -591,7 +595,13 @@ PUBLIC int printfile ARGS1(
}
use_type = (disp_charset || HTisDocumentSource());
- change_sug_filename(sug_filename);
+ /*
+ * Use newdoc->title as a subject instead of sug_filename:
+ * MORE readable and 8-bit letters shouldn't be a problem - LP
+ */
+ /* change_sug_filename(sug_filename); */
+ subject = subject_translate8bit(newdoc->title);
+
#ifdef VMS
if (strchr(user_response,'@') && !strchr(user_response,':') &&
!strchr(user_response,'%') && !strchr(user_response,'"')) {
@@ -687,7 +697,7 @@ PUBLIC int printfile ARGS1(
* For PMDF, put the subject in the
* header file and close it. - FM
*/
- fprintf(hfd, "Subject: %.70s\n\n", newdoc->title);
+ fprintf(hfd, "Subject: %.70s\n\n", subject);
LYCloseTempFP(hfd);
/*
* Now set up the command. - FM
@@ -704,12 +714,12 @@ PUBLIC int printfile ARGS1(
* For "generic" VMS MAIL, include
* the subject in the command. - FM
*/
- remove_quotes(sug_filename);
+ remove_quotes(subject); */
sprintf(buffer,
"%s %s/subject=\"%.70s\" %s %s",
system_mail,
system_mail_flags,
- newdoc->title,
+ subject,
tempfile,
user_response);
}
@@ -815,11 +825,9 @@ PUBLIC int printfile ARGS1(
/*
* Add the To, Subject, and X-URL headers. - FM
- * Use newdoc->title as a subject instead of sug_filename:
- * MORE readable and 8-bit letters shouldn't be a problem - LP
*/
fprintf(outfile_fp, "To: %s\nSubject: %s\n",
- user_response, newdoc->title);
+ user_response, subject);
fprintf(outfile_fp, "X-URL: %s\n\n", newdoc->address);
if (LYPrependBaseToSource && HTisDocumentSource()) {
/*
@@ -1226,6 +1234,55 @@ PRIVATE int remove_quotes ARGS1(
#endif /* VMS */
/*
+ * Mail subject may have 8-bit characters and they are in display charset.
+ * There is no stable practice for 8-bit subject encodings:
+ * MIME define "quoted-printable" which holds charset info
+ * but most mailers still don't support it, on the other hand
+ * many mailers send open 8-bit subjects without charset info
+ * and use local assumption for certain countries.
+ *
+ * We translate subject to "outgoing_mail_charset" (defined in lynx.cfg)
+ * it may correspond to US-ASCII as the safest value or any other
+ * lynx character handler, -1 for no translation (so display charset).
+ *
+ */
+PRIVATE CONST char* subject_translate8bit ARGS1(char *, source)
+{
+ CONST char *p = source;
+ char temp[256];
+ char *q = temp;
+ char *target = NULL;
+
+ int charset_in, charset_out, uck;
+ char replace_buf [10];
+
+ int i = outgoing_mail_charset; /* from lynx.cfg, -1 by default */
+
+ if (i < 0
+ || LYHaveCJKCharacterSet
+ || LYCharSet_UC[i].enc == UCT_ENC_CJK) {
+ return(source); /* OK */
+ } else {
+ charset_out = i;
+ charset_in = current_char_set;
+ }
+
+ for ( ; *p; p++) {
+ LYstrncpy(q, p, 1);
+ if ((unsigned char)*q <= 127) {
+ StrAllocCat(target, q);
+ } else {
+ uck = UCTransCharStr(replace_buf, sizeof(replace_buf), *q,
+ charset_in, charset_out, YES);
+ if (uck >0)
+ StrAllocCat(target, replace_buf);
+ }
+ }
+
+ return(target);
+}
+
+/*
* print_options writes out the current printer choices to a file
* so that the user can select printers in the same way that
* they select all other links
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index e88aa621..c90a390e 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -519,21 +519,25 @@ static int assume_unrec_charset_fun ARGS1(
static int character_set_fun ARGS1(
char *, value)
{
- size_t i;
- size_t len;
-
- len = strlen (value);
- for (i = 0; LYchar_set_names[i]; i++) { /* search by name, compatibility */
- if (!strncmp(value, LYchar_set_names[i], len)) {
- current_char_set = i;
- return 0;
- }
- }
+ int i = UCGetLYhndl_byAnyName(value); /* by MIME or full name */
+ if (i < 0)
+ ; /* do nothing here: so fallback to userdefs.h */
+ else
+ current_char_set = i;
- current_char_set = safeUCGetLYhndl_byMIME(value); /* by MIME */
return 0;
}
+static int outgoing_mail_charset_fun ARGS1(
+ char *, value)
+{
+ outgoing_mail_charset = UCGetLYhndl_byMIME(value);
+ /* -1 if NULL or not recognized value: no translation (compatibility) */
+
+ return 0;
+}
+
+
#ifdef USE_COLOR_TABLE
static int color_fun ARGS1(
char *, value)
@@ -896,6 +900,7 @@ static Config_Type Config_Table [] =
PARSE_SET("no_ismap_if_usemap", CONF_BOOL, LYNoISMAPifUSEMAP),
PARSE_ENV("no_proxy", CONF_ENV, 0 ),
PARSE_SET("no_referer_header", CONF_BOOL, LYNoRefererHeader),
+ PARSE_FUN("outgoing_mail_charset", CONF_FUN, outgoing_mail_charset_fun),
#ifdef DISP_PARTIAL
PARSE_SET("partial", CONF_BOOL, display_partial),
#endif
@@ -1127,7 +1132,7 @@ PUBLIC void read_cfg ARGS4(
LYLowerCase(name);
else
LYUpperCase(name);
-
+
if (getenv (name) == 0) {
#ifdef VMS
Define_VMSLogical(tbl->name, value);
@@ -1225,11 +1230,11 @@ PUBLIC char *lynx_cfg_infopage NOARGS
LYforce_no_cache = TRUE; /* don't cache this doc */
-#ifdef HAVE_CONFIG_H
+#if defined(HAVE_CONFIG_H) || defined(VMS)
StrAllocCopy(temp, LYNX_CFG_FILE);
#else
- StrAllocCopy(temp, helpfilepath);
- StrAllocCat(temp, LYNXCFG_HELP); /* DJGPP/Win32/VMS should care of */
+ StrAllocCopy(temp, helpfilepath); /* FIXME: no absolute path */
+ StrAllocCat(temp, LYNXCFG_HELP); /* for lynx.cfg on DOS/Win32 */
#endif /* HAVE_CONFIG_H */
BeginInternalPage (fp0, LYNXCFG_TITLE, NULL);
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c
index fa00ccc3..0783c393 100644
--- a/src/LYShowInfo.c
+++ b/src/LYShowInfo.c
@@ -52,11 +52,11 @@ PRIVATE char *lynx_compile_opts NOARGS
fprintf(fp0, "See also <a href=\"%s\">your lynx.cfg</a> for run-time options\n\n",
lynx_cfg_infopage());
- fprintf(fp0, "\n<em>config.cache</em>\n");
+ fprintf(fp0, "\n%s<br>\n<em>config.cache</em>\n", AUTOCONF_CONFIG_CACHE);
for (n = 0; n < TABLESIZE(config_cache); n++) {
PutDefs(config_cache, n);
}
- fprintf(fp0, "\n<em>lynx_cfg.h</em>\n");
+ fprintf(fp0, "\n%s<br>\n<em>lynx_cfg.h</em>\n", AUTOCONF_LYNXCFG_H);
for (n = 0; n < TABLESIZE(config_defines); n++) {
PutDefs(config_defines, n);
}
@@ -131,13 +131,16 @@ PUBLIC int showinfo ARGS4(
(LYNX_RELEASE ? LYNX_RELEASE_DATE : &LYNX_DATE[LYNX_DATE_OFF]),
(LYNX_RELEASE ? LYNX_WWW_HOME : LYNX_WWW_DIST),
(LYNX_RELEASE ? "latest release" : "development version") );
+
+ if (!LYRestricted) {
#ifdef HAVE_CFG_DEFS_H
- fprintf(fp0, " - <a href=\"%s\">compile time settings</a></h1>\n",
- lynx_compile_opts());
+ fprintf(fp0, " - <a href=\"%s\">compile time settings</a></h1>\n",
+ lynx_compile_opts());
#else
- fprintf(fp0, " - <a href=\"%s\">your lynx.cfg</a></h1>\n",
- lynx_cfg_infopage());
+ fprintf(fp0, " - <a href=\"%s\">your lynx.cfg</a></h1>\n",
+ lynx_cfg_infopage());
#endif
+ }
#ifdef DIRED_SUPPORT
if (lynx_edit_mode && nlinks > 0) {
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index 579b6db5..d998ea7e 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -246,12 +246,12 @@ PUBLIC void read_rc NOPARAMS
if ((cp2 = (char *)strchr(cp, '=')) != NULL)
cp = cp2 + 1;
cp = LYSkipBlanks(cp);
- for (; LYchar_set_names[i]; i++) {
- if (!strncmp(cp, LYchar_set_names[i], strlen(cp))) {
- current_char_set=i;
- break;
- }
- }
+
+ i = UCGetLYhndl_byAnyName(cp); /* by MIME or full name */
+ if (i < 0)
+ ; /* do nothing here: so fallback to lynx.cfg */
+ else
+ current_char_set = i;
/*
* Preferred language.