diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-09-07 10:39:47 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-09-07 10:39:47 -0400 |
commit | 5816641fc3a761e00d154c4dea9551a0027a7c63 (patch) | |
tree | 5008269ea8500d473cb7ba650b68e177102b9e66 /src | |
parent | 7faa97b815d7f35ffbbb978e5fef1bd25c420ef5 (diff) | |
download | lynx-snapshots-5816641fc3a761e00d154c4dea9551a0027a7c63.tar.gz |
snapshot of project "lynx", label v2-8-1dev_25
Diffstat (limited to 'src')
64 files changed, 1428 insertions, 1107 deletions
diff --git a/src/GridText.c b/src/GridText.c index 49f65f08..5d7d2e0f 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -41,6 +41,8 @@ #include <LYexit.h> #include <LYLeaks.h> +#undef DEBUG_APPCH + #ifdef USE_COLOR_STYLE #include <AttrList.h> #include <LYHash.h> @@ -1606,14 +1608,18 @@ PRIVATE void split_line ARGS2( HTLine * previous = text->last_line; int ctrl_chars_on_previous_line = 0; char * cp; - HTLine * line = (HTLine *)LY_CALLOC(1, LINE_SIZE(MAX_LINE)); + /* can't wrap in middle of multibyte sequences, so allocate 2 extra */ + HTLine * line = (HTLine *)LY_CALLOC(1, LINE_SIZE(MAX_LINE)+2); if (line == NULL) outofmem(__FILE__, "split_line_1"); ctrl_chars_on_this_line = 0; /*reset since we are going to a new line*/ text->LastChar = ' '; - CTRACE(tfp,"GridText: split_line called\n"); +#ifdef DEBUG_APPCH + CTRACE(tfp,"GridText: split_line(%p,%d) called\n", text, split); + CTRACE(tfp," bold_on=%d, underline_on=%d\n", bold_on, underline_on); +#endif text->Lines++; @@ -1716,7 +1722,7 @@ PRIVATE void split_line ARGS2( line->styles[0].horizpos = 0xffffffff; if (previous->numstyles == 0) previous->styles[0].horizpos = 0xffffffff; -#endif +#endif /*USE_COLOR_STYLE*/ previous->next = line; text->last_line = line; line->size = 0; @@ -1839,7 +1845,8 @@ PRIVATE void split_line ARGS2( linedata[line->size] = '\0'; ctrl_chars_on_this_line++; SpecialAttrChars++;; - } + } else + bold_on = OFF; if (plen) { for (i = (plen - 1); i != 0; i--) { if (p[i] == LY_BOLD_START_CHAR) { @@ -2036,8 +2043,49 @@ PUBLIC void HText_appendCharacter ARGS2( HTStyle * style; int indent; - CTRACE(tfp, "add(%c) %d/%d\n", ch, - HTisDocumentSource(), HTOutputFormat != WWW_SOURCE); +#ifdef DEBUG_APPCH + if (TRACE) { + char * special = NULL; /* make trace a little more readable */ + switch(ch) { + case HT_NON_BREAK_SPACE: + special = "HT_NON_BREAK_SPACE"; + break; + case HT_EM_SPACE: + special = "HT_EM_SPACE"; + break; + case LY_UNDERLINE_START_CHAR: + special = "LY_UNDERLINE_START_CHAR"; + break; + case LY_UNDERLINE_END_CHAR: + special = "LY_UNDERLINE_END_CHAR"; + break; + case LY_BOLD_START_CHAR: + special = "LY_BOLD_START_CHAR"; + break; + case LY_BOLD_END_CHAR: + special = "LY_BOLD_END_CHAR"; + break; + case LY_SOFT_HYPHEN: + special = "LY_SOFT_HYPHEN"; + break; + case LY_SOFT_NEWLINE: + special = "LY_SOFT_NEWLINE"; + break; + default: + special = NULL; + break; + } + + if (special != NULL) { + CTRACE(tfp, "add(%s %d special char) %d/%d\n", special, ch, + HTisDocumentSource(), HTOutputFormat != WWW_SOURCE); + } else { + CTRACE(tfp, "add(%c) %d/%d\n", ch, + HTisDocumentSource(), HTOutputFormat != WWW_SOURCE); + } + } /* trace only */ +#endif /* DEBUG_APPCH */ + /* * Make sure we don't crash on NULLs. */ @@ -2081,19 +2129,11 @@ PUBLIC void HText_appendCharacter ARGS2( !text->T.transp && !text->T.output_utf8 && (unsigned char)ch < LYlowest_eightbit[current_char_set]) return; -#endif /* USE_SLANG */ +#endif /* !USE_SLANG */ if ((unsigned char)ch == 155 && HTCJK == NOCJK) { /* octal 233 */ if (!HTPassHighCtrlRaw && !text->T.transp && !text->T.output_utf8 && - (155 < LYlowest_eightbit[current_char_set]) && - strncmp(LYchar_set_names[current_char_set], - "DosLatin1 (cp850)", 17) && - strncmp(LYchar_set_names[current_char_set], - "DosLatinUS (cp437)", 18) && - strncmp(LYchar_set_names[current_char_set], - "Macintosh (8 bit)", 17) && - strncmp(LYchar_set_names[current_char_set], - "NeXT character set", 18)) { + (155 < LYlowest_eightbit[current_char_set])) { return; } } @@ -2242,6 +2282,7 @@ PUBLIC void HText_appendCharacter ARGS2( if (IsSpecialAttrChar(ch)) { #ifndef USE_COLOR_STYLE + 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'; @@ -3160,9 +3201,7 @@ PUBLIC void HText_endAppend ARGS1( HText *, text) { int cur_line, cur_char, cur_shift; - TextAnchor *anchor_ptr; HTLine *line_ptr; - unsigned char ch; if (!text) return; @@ -3217,6 +3256,46 @@ PUBLIC void HText_endAppend ARGS1( * Fix up the anchor structure values and * create the hightext strings. - FM */ + HText_trimHightext(HTMainText, FALSE); +} + +/* +** This function gets the hightext from the text by finding the char +** position, and brings the anchors in line with the text by adding the text +** offset to each of the anchors. +** +** `Forms input' fields cannot be displayed properly without this function +** to be invoked (detected in display_partial mode). +** +** (BOOLEAN value allow us to disable annoying repeated trace messages +** for display_partial mode). +*/ +PUBLIC void HText_trimHightext ARGS2( + HText *, text, + BOOLEAN, disable_trace) +{ + int cur_line, cur_char, cur_shift; + TextAnchor *anchor_ptr; + HTLine *line_ptr; + unsigned char ch; + + if (!text) + return; + + CTRACE(tfp,"Gridtext: Entering HText_trimHightext\n"); + + /* + * Get the first line. + */ + line_ptr = text->last_line->next; + cur_char = line_ptr->size; + cur_line = 0; + cur_shift = 0; + + /* + * Fix up the anchor structure values and + * create the hightext strings. - FM + */ for (anchor_ptr = text->first_anchor; anchor_ptr; anchor_ptr=anchor_ptr->next) { re_parse: @@ -3238,6 +3317,7 @@ re_parse: if (anchor_ptr->line_pos < 0) anchor_ptr->line_pos = 0; + if (!disable_trace) CTRACE(tfp, "Gridtext: Anchor found on line:%d col:%d\n", cur_line, anchor_ptr->line_pos); @@ -3258,6 +3338,8 @@ re_parse: if (anchor_ptr->extent < 0) { anchor_ptr->extent = 0; } + + if (!disable_trace) CTRACE(tfp, "anchor text: '%s' col: %d\n", line_ptr->data, anchor_ptr->line_pos); /* @@ -3335,7 +3417,8 @@ re_parse: anchor_ptr->line_pos += line_ptr->offset; anchor_ptr->line_num = cur_line; - CTRACE(tfp, "GridText: add link on line %d in HText_endAppend\n", + if (!disable_trace) + CTRACE(tfp, "GridText: add link on line %d in HText_trimHightext\n", cur_line); /* @@ -3978,8 +4061,8 @@ PUBLIC CONST char * HText_getServer NOARGS /* * HText_pageDisplay displays a screen of text - * starting from the line 'line_num'-1 - * this is the primary call for lynx + * starting from the line 'line_num'-1. + * This is the primary call for lynx. */ PUBLIC void HText_pageDisplay ARGS2( int, line_num, @@ -3987,16 +4070,28 @@ PUBLIC void HText_pageDisplay ARGS2( { CTRACE(tfp, "GridText: HText_pageDisplay at line %d started\n", line_num); - display_page(HTMainText, line_num-1, target); +#ifdef DISP_PARTIAL + if (display_partial && !debug_display_partial) + /* + ** Garbage is reported from forms input fields in incremental mode. + ** So we start HText_trimHightext() to forget this side effect. + ** This function was split-out from HText_endAppend(). + ** It may not be the best solution but it works. - LP + ** (TRUE = to disable annoying repeated trace messages) + */ + HText_trimHightext(HTMainText, TRUE); +#endif - CTRACE(tfp, "GridText: HText_pageDisplay finished\n"); + display_page(HTMainText, line_num-1, target); #ifdef DISP_PARTIAL - if (display_partial && debug_display_partial) + if (display_partial && debug_display_partial) sleep(MessageSecs); #endif is_www_index = HTAnchor_isIndex(HTMainAnchor); + + CTRACE(tfp, "GridText: HText_pageDisplay finished\n"); } /* diff --git a/src/GridText.h b/src/GridText.h index 8465b99a..a17ceb23 100644 --- a/src/GridText.h +++ b/src/GridText.h @@ -10,6 +10,12 @@ #include <HTForms.h> #endif /* HTFORMS_H */ +#ifndef HT_NON_BREAK_SPACE +#define HT_NON_BREAK_SPACE ((char)1) /* remember it */ +#endif /* !HT_NON_BREAK_SPACE */ +#ifndef HT_EM_SPACE +#define HT_EM_SPACE ((char)2) /* remember it */ +#endif /* !HT_EM_SPACE */ #define LY_UNDERLINE_START_CHAR '\003' #define LY_UNDERLINE_END_CHAR '\004' #define LY_BOLD_START_CHAR '\005' @@ -18,8 +24,46 @@ #define LY_SOFT_HYPHEN ((char)7) #endif /* !LY_SOFT_HYPHEN */ #define LY_SOFT_NEWLINE ((char)8) + #define IsSpecialAttrChar(a) ((a > '\002') && (a <= '\010')) +/* just for information: +US-ASCII control characters <32 which are not defined in Unicode standard +=00 U+0000 NULL +=01 U+0001 START OF HEADING +=02 U+0002 START OF TEXT +=03 U+0003 END OF TEXT +=04 U+0004 END OF TRANSMISSION +=05 U+0005 ENQUIRY +=06 U+0006 ACKNOWLEDGE +=07 U+0007 BELL +=08 U+0008 BACKSPACE +=09 U+0009 HORIZONTAL TABULATION +=0A U+000A LINE FEED +=0B U+000B VERTICAL TABULATION +=0C U+000C FORM FEED +=0D U+000D CARRIAGE RETURN +=0E U+000E SHIFT OUT +=0F U+000F SHIFT IN +=10 U+0010 DATA LINK ESCAPE +=11 U+0011 DEVICE CONTROL ONE +=12 U+0012 DEVICE CONTROL TWO +=13 U+0013 DEVICE CONTROL THREE +=14 U+0014 DEVICE CONTROL FOUR +=15 U+0015 NEGATIVE ACKNOWLEDGE +=16 U+0016 SYNCHRONOUS IDLE +=17 U+0017 END OF TRANSMISSION BLOCK +=18 U+0018 CANCEL +=19 U+0019 END OF MEDIUM +=1A U+001A SUBSTITUTE +=1B U+001B ESCAPE +=1C U+001C FILE SEPARATOR +=1D U+001D GROUP SEPARATOR +=1E U+001E RECORD SEPARATOR +=1F U+001F UNIT SEPARATOR +=7F U+007F DELETE +*/ + extern int HTCurSelectGroupType; extern char * HTCurSelectGroupSize; extern HText * HTMainText; /* Equivalent of main window */ @@ -159,6 +203,9 @@ extern int HText_beginInput PARAMS(( HText * text, BOOL underline, InputFieldData *I)); +extern void HText_trimHightext PARAMS(( + HText * text, + BOOLEAN disable_trace)); extern void HText_SubmitForm PARAMS(( FormInfo * submit_item, document * doc, diff --git a/src/HTFWriter.c b/src/HTFWriter.c index 3d9ae874..f171905a 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -30,7 +30,6 @@ #include <LYUtils.h> #include <LYGlobalDefs.h> #include <LYSignal.h> -#include <LYSystem.h> #include <GridText.h> #include <LYexit.h> #include <LYLeaks.h> @@ -139,7 +138,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) * we want to convert to fixed records format. - FM */ #ifdef USE_COMMAND_FILE - system(FIXED_RECORD_COMMAND); + LYSystem(FIXED_RECORD_COMMAND); #else LYVMS_FixedLengthRecords(FIXED_RECORD_COMMAND); #endif /* USE_COMMAND_FILE */ @@ -147,7 +146,6 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!*/ - /* system(me->remove_command); */ FREE(me->remove_command); } } else @@ -191,7 +189,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) * Uncompress it. - FM */ if (me->end_command && me->end_command[0]) - system(me->end_command); + LYSystem(me->end_command); fp = fopen(me->anchor->FileCache, "r"); } if (fp != NULL) { @@ -318,11 +316,10 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) HTProgress(me->end_command); stop_curses(); } - system(me->end_command); + LYSystem(me->end_command); if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!!!*/ - /* system(me->remove_command); */ FREE(me->remove_command); } if (!dump_output_immediately) @@ -348,7 +345,6 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) } if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!!!*/ - /* system(me->remove_command); */ FREE(me->remove_command); } } else if (strcmp(me->end_command, "SaveToFile")) { @@ -363,11 +359,10 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) _HTProgress(me->end_command); stop_curses(); } - system(me->end_command); + LYSystem(me->end_command); if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!!!*/ - /* system(me->remove_command); */ FREE(me->remove_command); } if (!dump_output_immediately) @@ -379,7 +374,6 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) */ if (me->remove_command) { /* NEVER REMOVE THE FILE unless during an abort!!!*/ - /* system(me->remove_command); */ FREE(me->remove_command); } } @@ -423,7 +417,7 @@ PRIVATE void HTFWriter_abort ARGS2( CTRACE(tfp, "HTFWriter: Aborting: file not executed.\n"); FREE(me->end_command); if (me->remove_command) { - system(me->remove_command); + LYSystem(me->remove_command); FREE(me->remove_command); } } diff --git a/src/HTInit.c b/src/HTInit.c index 69efa8e7..aac98355 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -26,24 +26,16 @@ #include <LYUtils.h> #include <LYGlobalDefs.h> #include <LYSignal.h> -#include <LYSystem.h> #include <LYexit.h> #include <LYLeaks.h> -#ifdef VMS -#define DISPLAY "DECW$DISPLAY" -#else -#define DISPLAY "DISPLAY" -#endif /* VMS */ - PRIVATE int HTLoadTypesConfigFile PARAMS((char *fn)); PRIVATE int HTLoadExtensionsConfigFile PARAMS((char *fn)); PUBLIC void HTFormatInit NOARGS { FILE *fp = NULL; - char *cp = NULL; #ifdef NeXT HTSetPresentation("application/postscript", "open %s", 1.0, 2.0, 0.0, 0); @@ -52,7 +44,7 @@ PUBLIC void HTFormatInit NOARGS HTSetPresentation("audio/basic", "open %s", 1.0, 2.0, 0.0, 0); HTSetPresentation("*", "open %s", 1.0, 0.0, 0.0, 0); #else - if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { /* Must have X11 */ + if (LYgetXDisplay() != 0) { /* Must have X11 */ HTSetPresentation("application/postscript", "ghostview %s&", 1.0, 3.0, 0.0, 0); HTSetPresentation("image/gif", XLoadImageCommand, 1.0, 3.0, 0.0, 0); @@ -491,7 +483,6 @@ PRIVATE int PassesTest ARGS1( { int result; char *cmd, TmpFileName[TMPFILE_NAME_SIZE]; - char *cp = NULL; /* * Make sure we have a command @@ -505,7 +496,7 @@ PRIVATE int PassesTest ARGS1( if (0 == strcasecomp(mc->testcommand, "test -n \"$DISPLAY\"")) { FREE(mc->testcommand); CTRACE(tfp, "PassesTest: Testing for XWINDOWS environment.\n"); - if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { + if (LYgetXDisplay() != NULL) { CTRACE(tfp, "PassesTest: Test passed!\n"); return(0 == 0); } else { @@ -516,7 +507,7 @@ PRIVATE int PassesTest ARGS1( if (0 == strcasecomp(mc->testcommand, "test -z \"$DISPLAY\"")) { FREE(mc->testcommand); CTRACE(tfp, "PassesTest: Testing for NON_XWINDOWS environment.\n"); - if (!((cp = getenv(DISPLAY)) != NULL && *cp != '\0')) { + if (LYgetXDisplay() == NULL) { CTRACE(tfp,"PassesTest: Test passed!\n"); return(0 == 0); } else { @@ -558,7 +549,7 @@ PRIVATE int PassesTest ARGS1( TmpFileName, strlen(TmpFileName)); CTRACE(tfp, "PassesTest: Executing test command: %s\n", cmd); - result = system(cmd); + result = LYSystem(cmd); FREE(cmd); LYRemoveTemp(TmpFileName); diff --git a/src/HTML.c b/src/HTML.c index f49116fd..ac10f00e 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -737,8 +737,7 @@ PRIVATE void HTML_start_element ARGS6( char *related = NULL; StrAllocCopy(base, value[HTML_BASE_HREF]); - if (!(url_type = LYLegitimizeHREF(me, (char**)&base, - TRUE, TRUE))) { + if (!(url_type = LYLegitimizeHREF(me, &base, TRUE, TRUE))) { CTRACE(tfp, "HTML: BASE '%s' is not an absolute URL.\n", (base ? base : "")); if (me->inBadBASE == FALSE) @@ -832,7 +831,7 @@ PRIVATE void HTML_start_element ARGS6( case HTML_META: if (present) - LYHandleMETA(me, present, value, (char **)&include); + LYHandleMETA(me, present, value, include); break; case HTML_TITLE: @@ -856,7 +855,7 @@ PRIVATE void HTML_start_element ARGS6( } } else { StrAllocCopy(href, value[HTML_LINK_HREF]); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); } /* @@ -874,7 +873,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -899,7 +898,7 @@ PRIVATE void HTML_start_element ARGS6( PARSE_ALL); StrAllocCopy(href, temp); FREE(temp); - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, (me->inBASE ? me->base_href : me->node_anchor->address)); @@ -1074,7 +1073,7 @@ PRIVATE void HTML_start_element ARGS6( * fingers. - FM */ SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } /* @@ -1163,8 +1162,7 @@ PRIVATE void HTML_start_element ARGS6( StrAllocCopy(isindex_href, value[HTML_ISINDEX_HREF]); else StrAllocCopy(isindex_href, value[HTML_ISINDEX_ACTION]); - url_type = LYLegitimizeHREF(me, (char**)&isindex_href, - TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &isindex_href, TRUE, TRUE); /* * Check whether a base tag is in effect. @@ -1260,7 +1258,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_FRAME_SRC] && *value[HTML_FRAME_SRC] != '\0') { StrAllocCopy(href, value[HTML_FRAME_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -1277,14 +1275,14 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -1332,7 +1330,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_IFRAME_SRC] && *value[HTML_IFRAME_SRC] != '\0') { StrAllocCopy(href, value[HTML_IFRAME_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -1349,13 +1347,13 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ NULL, /* Tag */ @@ -1544,7 +1542,7 @@ PRIVATE void HTML_start_element ARGS6( break; case HTML_P: - LYHandleP(me, present, value, (char **)&include, TRUE); + LYHandleP(me, present, value, include, TRUE); break; case HTML_BR: @@ -1791,7 +1789,7 @@ PRIVATE void HTML_start_element ARGS6( */ #ifdef NOTUSED_FOTEMODS if (me->inFONT == TRUE) - HTML_end_element(me, HTML_FONT, (char **)&include); + HTML_end_element(me, HTML_FONT, &include); #endif /* NOTUSED_FOTEMODS */ /* @@ -2394,7 +2392,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } /* * Set to know we are in an anchor. @@ -2441,7 +2439,7 @@ PRIVATE void HTML_start_element ARGS6( } else { StrAllocCopy(href, value[HTML_A_HREF]); } - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Deal with our ftp gateway kludge. - FM @@ -2473,7 +2471,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -2577,7 +2575,7 @@ PRIVATE void HTML_start_element ARGS6( */ if (href == NULL && me->inBoldA == FALSE) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, &include); } #endif /* NOTUSED_FOTEMODS */ FREE(href); @@ -2617,7 +2615,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_IMG_USEMAP] && *value[HTML_IMG_USEMAP]) { StrAllocCopy(map_href, value[HTML_IMG_USEMAP]); CHECK_FOR_INTERN(map_href); - url_type = LYLegitimizeHREF(me, (char**)&map_href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &map_href, TRUE, TRUE); /* * If map_href ended up zero-length or otherwise doesn't * have a hash, it can't be valid, so ignore it. - FM @@ -2665,7 +2663,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&map_href, + LYFillLocalFileURL(&map_href, ((UseBASE && me->inBASE) ? me->base_href : me->node_anchor->address)); UseBASE = TRUE; @@ -2809,7 +2807,7 @@ PRIVATE void HTML_start_element ARGS6( present && present[HTML_IMG_SRC] && value[HTML_IMG_SRC] && *value[HTML_IMG_SRC] != '\0') { StrAllocCopy(href, value[HTML_IMG_SRC]); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Check whether a base tag is in effect. - FM @@ -2826,7 +2824,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '\0' && *href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3151,7 +3149,7 @@ PRIVATE void HTML_start_element ARGS6( */ StrAllocCopy(href, value[HTML_AREA_HREF]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); /* * Check whether a BASE tag is in effect, and use it @@ -3173,7 +3171,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((((me->inBASE && *href != '\0') && !(*href == '#' && LYSeekFragAREAinCur == TRUE))) @@ -3256,7 +3254,7 @@ PRIVATE void HTML_start_element ARGS6( me->inFIG = TRUE; if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (!present || (present && !present[HTML_FIG_ISOBJECT])) { @@ -3275,7 +3273,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_FIG_SRC] && *value[HTML_FIG_SRC] != '\0') { StrAllocCopy(href, value[HTML_FIG_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -3292,7 +3290,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3435,7 +3433,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_OVERLAY_SRC] && *value[HTML_OVERLAY_SRC] != '\0') { StrAllocCopy(href, value[HTML_OVERLAY_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -3452,14 +3450,14 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -3555,14 +3553,13 @@ PRIVATE void HTML_start_element ARGS6( */ if (*base == '\0') StrAllocCopy(base, "/"); - if (base[strlen(base)-1] != '/') - StrAllocCat(base, "/"); - url_type = LYLegitimizeHREF(me, (char**)&base, TRUE, FALSE); + LYAddHtmlSep(&base); + url_type = LYLegitimizeHREF(me, &base, TRUE, FALSE); /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&base, + LYFillLocalFileURL(&base, (me->inBASE ? me->base_href : me->node_anchor->address)); @@ -3588,7 +3585,7 @@ PRIVATE void HTML_start_element ARGS6( } StrAllocCopy(code, value[HTML_APPLET_CODE]); - url_type = LYLegitimizeHREF(me, (char**)&code, TRUE, FALSE); + url_type = LYLegitimizeHREF(me, &code, TRUE, FALSE); href = HTParse(code, base, PARSE_ALL); FREE(base); FREE(code); @@ -3641,7 +3638,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_BGSOUND_SRC] && *value[HTML_BGSOUND_SRC] != '\0') { StrAllocCopy(href, value[HTML_BGSOUND_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href == '\0') { FREE(href); break; @@ -3662,7 +3659,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3755,7 +3752,7 @@ PRIVATE void HTML_start_element ARGS6( value[HTML_EMBED_SRC] && *value[HTML_EMBED_SRC] != '\0') { StrAllocCopy(href, value[HTML_EMBED_SRC]); CHECK_FOR_INTERN(href); - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href != '\0') { /* * Check whether a base tag is in effect. - FM @@ -3772,7 +3769,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : me->node_anchor->address)); @@ -3901,7 +3898,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->inFORM) { CTRACE(tfp, "HTML: Missing FORM end tag. Faking it!\n"); SET_SKIP_STACK(HTML_FORM); - HTML_end_element(me, HTML_FORM, (char **)&include); + HTML_end_element(me, HTML_FORM, include); } /* @@ -3919,7 +3916,7 @@ PRIVATE void HTML_start_element ARGS6( * Prepare to do housekeeping on the reference. - FM */ StrAllocCopy(action, value[HTML_FORM_ACTION]); - url_type = LYLegitimizeHREF(me, (char**)&action, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &action, TRUE, TRUE); /* * Check whether a base tag is in effect. Note that @@ -4355,7 +4352,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, (char **)&include); + HTML_end_element(me, HTML_SELECT, include); } /* @@ -4401,7 +4398,7 @@ PRIVATE void HTML_start_element ARGS6( * SRC's value a link if it's still not zero-length * legitiimizing it. - FM */ - url_type = LYLegitimizeHREF(me, (char**)&href, TRUE, TRUE); + url_type = LYLegitimizeHREF(me, &href, TRUE, TRUE); if (*href) { /* * Check whether a base tag is in effect. - FM @@ -4418,7 +4415,7 @@ PRIVATE void HTML_start_element ARGS6( /* * Check whether to fill in localhost. - FM */ - LYFillLocalFileURL((char **)&href, + LYFillLocalFileURL(&href, ((*href != '#' && me->inBASE) ? me->base_href : @@ -4426,7 +4423,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } me->CurrentA = HTAnchor_findChildAndLink( me->node_anchor, /* Parent */ @@ -4798,7 +4795,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, (char **)&include); + HTML_end_element(me, HTML_SELECT, include); } /* @@ -4806,7 +4803,7 @@ PRIVATE void HTML_start_element ARGS6( */ LYHandleSELECT(me, present, (CONST char **)value, - (char **)&include, + include, TRUE); break; @@ -5022,11 +5019,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } me->inTABLE = TRUE; if (!strcmp(me->sp->style->name, "Preformatted")) { @@ -5076,11 +5073,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; if (HText_LastLineSize(me->text, FALSE)) { @@ -5128,11 +5125,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; CHECK_ID(HTML_TR_ID); @@ -5145,11 +5142,11 @@ PRIVATE void HTML_start_element ARGS6( */ if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; CHECK_ID(HTML_COL_ID); @@ -5158,11 +5155,11 @@ PRIVATE void HTML_start_element ARGS6( case HTML_TH: if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; CHECK_ID(HTML_TD_ID); @@ -5176,11 +5173,11 @@ PRIVATE void HTML_start_element ARGS6( case HTML_TD: if (me->inA) { SET_SKIP_STACK(HTML_A); - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, include); } if (me->Underline_Level > 0) { SET_SKIP_STACK(HTML_U); - HTML_end_element(me, HTML_U, (char **)&include); + HTML_end_element(me, HTML_U, include); } UPDATE_STYLE; CHECK_ID(HTML_TD_ID); @@ -5269,7 +5266,7 @@ PRIVATE void HTML_start_element ARGS6( #if defined(PREVAIL) start=strrchr(Style_className, '.'); if (start) - strcpy(prevailing_class, (char*)(start+1)); + strcpy(prevailing_class, (start+1)); else strcpy(prevailing_class, ""); #endif @@ -5489,7 +5486,7 @@ PRIVATE void HTML_end_element ARGS3( ((MBM_A_subdescript[i] && *MBM_A_subdescript[i]) ? MBM_A_subdescript[i] : "(none)")); - LYEntify((char **)&temp, TRUE); + LYEntify(&temp, TRUE); StrAllocCat(*include, temp); StrAllocCat(*include, "<BR><EM> Filepath:</EM> "); @@ -5497,7 +5494,7 @@ PRIVATE void HTML_end_element ARGS3( ((MBM_A_subbookmark[i] && *MBM_A_subbookmark[i]) ? MBM_A_subbookmark[i] : "(unknown)")); - LYEntify((char **)&temp, TRUE); + LYEntify(&temp, TRUE); StrAllocCat(*include, temp); FREE(temp); StrAllocCat(*include, "</H2>"); @@ -5626,7 +5623,7 @@ PRIVATE void HTML_end_element ARGS3( case HTML_P: LYHandleP(me, (CONST BOOL*)0, (CONST char **)0, - (char **)&include, + include, FALSE); break; @@ -6200,7 +6197,7 @@ End_Object: if (me->sp->tag_number != HTML_SELECT) { SET_SKIP_STACK(HTML_SELECT); } - HTML_end_element(me, HTML_SELECT, (char **)&include); + HTML_end_element(me, HTML_SELECT, include); } /* @@ -6651,7 +6648,7 @@ End_Object: { char *dot=strrchr(Style_className,'.'); LYstrncpy(prevailing_class, - dot ? (char*)(dot+1) : "", + dot ? (dot+1) : "", (TEMPSTRINGSIZE - 1)); } #endif @@ -6730,15 +6727,15 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) CTRACE(tfp,"HTML_free: Ending underline\n"); } if (me->inA) { - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, &include); me->inA = FALSE; } if (me->inFONT) { - HTML_end_element(me, HTML_FONT, (char **)&include); + HTML_end_element(me, HTML_FONT, &include); me->inFONT = FALSE; } if (me->inFORM) { - HTML_end_element(me, HTML_FORM, (char **)&include); + HTML_end_element(me, HTML_FORM, &include); me->inFORM = FALSE; } if (me->option.size > 0) { @@ -6795,14 +6792,14 @@ PRIVATE void HTML_free ARGS1(HTStructured *, me) if (!dump_output_immediately && HText_sourceAnchors(me->text) < 1 && HText_HiddenLinkCount(me->text) > 0) { - HTML_start_element(me, HTML_P, 0, 0, -1, (char **)&include); + HTML_start_element(me, HTML_P, 0, 0, -1, &include); HTML_put_character(me, '['); - HTML_start_element(me, HTML_EM, 0, 0, -1, (char **)&include); + HTML_start_element(me, HTML_EM, 0, 0, -1, &include); HTML_put_string(me, "Document has only hidden links. Use the 'l'ist command."); - HTML_end_element(me, HTML_EM, (char **)&include); + HTML_end_element(me, HTML_EM, &include); HTML_put_character(me, ']'); - HTML_end_element(me, HTML_P, (char **)&include); + HTML_end_element(me, HTML_P, &include); } /* @@ -6888,15 +6885,15 @@ PRIVATE void HTML_abort ARGS2(HTStructured *, me, HTError, e) me->Underline_Level = 0; } if (me->inA) { - HTML_end_element(me, HTML_A, (char **)&include); + HTML_end_element(me, HTML_A, &include); me->inA = FALSE; } if (me->inFONT) { - HTML_end_element(me, HTML_FONT, (char **)&include); + HTML_end_element(me, HTML_FONT, &include); me->inFONT = FALSE; } if (me->inFORM) { - HTML_end_element(me, HTML_FORM, (char **)&include); + HTML_end_element(me, HTML_FORM, &include); me->inFORM = FALSE; } diff --git a/src/LYBookmark.c b/src/LYBookmark.c index a75c5eaa..60dcda52 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -5,7 +5,6 @@ #include <LYBookmark.h> #include <LYGlobalDefs.h> #include <LYSignal.h> -#include <LYSystem.h> #include <LYKeymap.h> #include <LYCharUtils.h> /* need for META charset */ #include <LYCharSets.h> /* need for LYHaveCJKCharacterSet */ @@ -289,7 +288,7 @@ PUBLIC void save_bookmark_link ARGS2( */ StrAllocCopy(Title, string_buffer); LYEntify(&Title, TRUE); - if (LYSaveBookmarksInUnicode && + if (UCSaveBookmarksInUnicode && have8bit(Title) && (!LYHaveCJKCharacterSet)) StrAllocCopy(Title, title_convert8bit(Title)); @@ -525,7 +524,7 @@ PUBLIC void remove_bookmark_link ARGS2( RM_PATH, newfile); CTRACE(tfp, "remove_bookmark_link: %s\n", buffer); - if( system( buffer ) ) { + if( LYSystem( buffer ) ) { HTAlert(BOOKTEMP_COPY_FAIL); } else { return; @@ -563,7 +562,7 @@ PUBLIC void remove_bookmark_link ARGS2( { char buffer[2048]; sprintf(buffer, "%s %s %s", MV_PATH, newfile, filename_buffer); - system(buffer); + LYSystem(buffer); return; } #endif /* !VMS */ diff --git a/src/LYCgi.c b/src/LYCgi.c index 5c51fe9b..b5cdcb2e 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -545,9 +545,7 @@ PRIVATE int LYLoadCGI ARGS4( if (LYCgiDocumentRoot != NULL && path_info != NULL ) { /* Construct and add PATH_TRANSLATED to env */ StrAllocCopy(document_root, LYCgiDocumentRoot); - if (document_root[strlen(document_root) - 1] == '/') { - document_root[strlen(document_root) - 1] = '\0'; - } + LYTrimHtmlSep(document_root); path_translated = document_root; StrAllocCat(path_translated, path_info); cp = NULL; diff --git a/src/LYCharSets.c b/src/LYCharSets.c index 7fe7e749..415d1584 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -331,8 +331,8 @@ PUBLIC CONST char ** LYCharSets[MAXCHARSETS]={ SevenBitApproximations, /* Macintosh (8 bit) */ SevenBitApproximations, /* NeXT character set */ SevenBitApproximations, /* Chinese */ - SevenBitApproximations, /* Japanese (EUC) */ - SevenBitApproximations, /* Japanese (SJIS) */ + SevenBitApproximations, /* Japanese (EUC-JP) */ + SevenBitApproximations, /* Japanese (Shift_JIS) */ SevenBitApproximations, /* Korean */ SevenBitApproximations, /* Taipei (Big5) */ SevenBitApproximations, /* Vietnamese (VISCII) */ @@ -345,20 +345,20 @@ PUBLIC CONST char ** LYCharSets[MAXCHARSETS]={ * The order of LYCharSets and LYchar_set_names MUST be the same */ PUBLIC CONST char * LYchar_set_names[MAXCHARSETSP]={ - "ISO Latin 1 ", - "DosLatin1 (cp850) ", - "WinLatin1 (cp1252) ", - "DosLatinUS (cp437) ", + "Western (ISO-8859-1) ", + "Western (cp850) ", + "Western (windows-1252)", + "IBM PC US codepage (cp437)", "DEC Multinational ", "Macintosh (8 bit) ", "NeXT character set ", "Chinese ", - "Japanese (EUC) ", - "Japanese (SJIS) ", + "Japanese (EUC-JP) ", + "Japanese (Shift_JIS)", "Korean ", "Taipei (Big5) ", "Vietnamese (VISCII) ", - "7 bit approximations", + "7 bit approximations (US-ASCII)", "Transparent ", (char *) 0 }; @@ -469,7 +469,7 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) { int chndl = -2; if (LYCharSet_UC[i].enc != UCT_ENC_CJK) { - chndl = 0; + chndl = UCGetLYhndl_byMIME("iso-8859-1"); if (UCAssume_MIMEcharset) chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); @@ -507,7 +507,7 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; HTPassHighCtrlNum = FALSE; - } else if (!strncmp(LYchar_set_names[i], "Japanese (EUC)", 14)) { + } else if (!strncmp(LYchar_set_names[i], "Japanese (EUC-JP)", 17)) { HTCJK = LYUseDefaultRawMode ? JAPANESE : NOCJK; LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; kanji_code = EUC; @@ -516,7 +516,7 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) HTPassHighCtrlRaw = (HTCJK != NOCJK) ? TRUE : FALSE; HTPassHighCtrlNum = FALSE; - } else if (!strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15)) { + } else if (!strncmp(LYchar_set_names[i], "Japanese (Shift_JIS)", 20)) { HTCJK = LYUseDefaultRawMode ? JAPANESE : NOCJK; LYRawMode = (HTCJK != NOCJK) ? TRUE : FALSE; kanji_code = SJIS; @@ -557,7 +557,7 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) UCLYhndl_for_unspec = i; } else { if (chndl == -2) { - chndl = 0; + chndl = UCGetLYhndl_byMIME("iso-8859-1"); if (UCAssume_MIMEcharset) chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); @@ -567,7 +567,7 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) LYCharSet_UC[chndl].enc != UCT_ENC_CJK)) { UCLYhndl_for_unspec = chndl; } else { - UCLYhndl_for_unspec = 0; + UCLYhndl_for_unspec = UCGetLYhndl_byMIME("iso-8859-1"); } } @@ -593,10 +593,10 @@ PUBLIC void HTMLSetCharacterHandling ARGS1(int,i) */ PUBLIC void HTMLSetRawModeDefault ARGS1(int,i) { - if (!strncmp(LYchar_set_names[i], "ISO Latin 1", 11) || + if (!strncmp(LYchar_set_names[i], "Western (ISO-8859-1)", 20) || !strncmp(LYchar_set_names[i], "Chinese", 7) || - !strncmp(LYchar_set_names[i], "Japanese (EUC)", 14) || - !strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15) || + !strncmp(LYchar_set_names[i], "Japanese (EUC-JP)", 17) || + !strncmp(LYchar_set_names[i], "Japanese (Shift_JIS)", 20) || !strncmp(LYchar_set_names[i], "Korean", 6) || !strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { LYDefaultRawMode = TRUE; @@ -616,7 +616,7 @@ PUBLIC void HTMLSetUseDefaultRawMode ARGS2( BOOLEAN, modeflag) { if (LYCharSet_UC[i].enc != UCT_ENC_CJK) { - int chndl = 0; + int chndl = UCGetLYhndl_byMIME("iso-8859-1"); if (UCAssume_MIMEcharset) chndl = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); @@ -624,10 +624,10 @@ PUBLIC void HTMLSetUseDefaultRawMode ARGS2( LYUseDefaultRawMode = modeflag; else LYUseDefaultRawMode = (!modeflag); - } else if (!strncmp(LYchar_set_names[i], "ISO Latin 1", 11) || + } else if (!strncmp(LYchar_set_names[i], "Western (ISO-8859-1)", 20) || !strncmp(LYchar_set_names[i], "Chinese", 7) || - !strncmp(LYchar_set_names[i], "Japanese (EUC)", 14) || - !strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15) || + !strncmp(LYchar_set_names[i], "Japanese (EUC-JP)", 17) || + !strncmp(LYchar_set_names[i], "Japanese (Shift_JIS)", 20) || !strncmp(LYchar_set_names[i], "Korean", 6) || !strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { if (modeflag == TRUE) { @@ -652,8 +652,8 @@ PUBLIC void HTMLSetUseDefaultRawMode ARGS2( PUBLIC void HTMLSetHaveCJKCharacterSet ARGS1(int,i) { if (!strncmp(LYchar_set_names[i], "Chinese", 7) || - !strncmp(LYchar_set_names[i], "Japanese (EUC)", 14) || - !strncmp(LYchar_set_names[i], "Japanese (SJIS)", 15) || + !strncmp(LYchar_set_names[i], "Japanese (EUC-JP)", 17) || + !strncmp(LYchar_set_names[i], "Japanese (Shift_JIS)", 20) || !strncmp(LYchar_set_names[i], "Korean", 6) || !strncmp(LYchar_set_names[i], "Taipei (Big5)", 13)) { LYHaveCJKCharacterSet = TRUE; @@ -671,33 +671,36 @@ PUBLIC void HTMLSetHaveCJKCharacterSet ARGS1(int,i) */ PRIVATE void HTMLSetDisplayCharsetMatchLocale ARGS1(int,i) { - if (strncasecomp(LYCharSet_UC[i].MIMEname, "cp", 2) || - strncasecomp(LYCharSet_UC[i].MIMEname, "windows", 7)) { + if (LYHaveCJKCharacterSet) { /* - ** Assume dos/windows displays usually on remote terminal, - ** so rarely match locale. - ** (in fact, MS Windows codepoints locale are never seen on UNIX). + ** We have no intention to pass CJK via UCTransChar if that happened. + ** Let someone from CJK correct this if necessary. + */ + DisplayCharsetMatchLocale = TRUE; /* old-style */ + return; + + } else if (strncasecomp(LYCharSet_UC[i].MIMEname, "cp", 2) || + strncasecomp(LYCharSet_UC[i].MIMEname, "windows", 7)) { + /* + ** Assume dos/windows displays usually on remote terminal, hence it + ** rarely matches locale. (In fact, MS Windows codepoints locale are + ** never seen on UNIX). */ DisplayCharsetMatchLocale = FALSE; } else { - DisplayCharsetMatchLocale = TRUE; - } + DisplayCharsetMatchLocale = TRUE; /* guess, but see below */ #if !defined(LOCALE) - /* - ** But we have no intention to pass CJK via UCTransChar if that happened. - ** Let someone from CJK correct this if necessary. - */ - if (!LYHaveCJKCharacterSet) - DisplayCharsetMatchLocale = FALSE; -#endif -#if defined(LOCALE) && defined(EXP_8BIT_TOUPPER) - /* - ** Force disable locale - */ - if (!LYHaveCJKCharacterSet) + DisplayCharsetMatchLocale = FALSE; +#else + if (UCForce8bitTOUPPER) { + /* + ** Force disable locale (from lynx.cfg) + */ DisplayCharsetMatchLocale = FALSE; + } #endif + } return; } @@ -897,7 +900,7 @@ PUBLIC int LYCharSetsDeclared NOPARAMS if (UCAssume_MIMEcharset && *UCAssume_MIMEcharset) { UCLYhndl_for_unspec = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); } else { - UCLYhndl_for_unspec = 0; + UCLYhndl_for_unspec = UCGetLYhndl_byMIME("iso-8859-1"); } if (UCAssume_localMIMEcharset && *UCAssume_localMIMEcharset) UCLYhndl_HTFile_for_unspec = diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index fed8a24b..cc53b72f 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -335,7 +335,7 @@ PUBLIC void LYFillLocalFileURL ARGS2( StrAllocCopy(temp, (*href+7)); StrAllocCopy(*href, "file://localhost"); StrAllocCat(*href, temp); - } else if (!strncmp(*href, "file:/", 6) && *(*href+6) != '/') { + } else if (!strncmp(*href, "file:/", 6) && !LYIsHtmlSep(*(*href+6))) { StrAllocCopy(temp, (*href+5)); StrAllocCopy(*href, "file://localhost"); StrAllocCat(*href, temp); @@ -363,8 +363,7 @@ PUBLIC void LYFillLocalFileURL ARGS2( temp2 = curdir; #endif /* DOSPATH */ #endif /* VMS */ - if (temp2[0] != '/') - StrAllocCat(*href, "/"); + LYAddHtmlSep(href); /* * Check for pathological cases - current dir has chars which * MUST BE URL-escaped - kw @@ -3532,7 +3531,7 @@ PUBLIC int LYLegitimizeHREF ARGS4( PARSE_PATH+PARSE_PUNCTUATION)) != NULL && !strncmp(path, "/..", 3)) { cp = (path + 3); - if (*cp == '/' || *cp == '\0') { + if (LYIsHtmlSep(*cp) || *cp == '\0') { if ((me->inBASE ? me->base_href[4] : me->node_anchor->address[4]) == 's') { str = "s"; @@ -3550,7 +3549,7 @@ PUBLIC int LYLegitimizeHREF ARGS4( } if (*cp == '\0') { StrAllocCopy(*href, "/"); - } else if (*cp == '/') { + } else if (LYIsHtmlSep(*cp)) { while (!strncmp(cp, "/..", 3)) { if (*(cp + 3) == '/') { cp += 3; diff --git a/src/LYCookie.c b/src/LYCookie.c index 9f84e2f6..c82dd592 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -17,8 +17,6 @@ ** - FM 1997-08-02 ** ** TO DO: (roughly in order of decreasing priority) - * A means to specify "always allow" and "never allow" domains via - a configuration file is needed. * Hex escaping isn't considered at all. Any semi-colons, commas, or spaces actually in cookie names or values (i.e., not serving as punctuation for the overall Set-Cookie value) should be hex @@ -56,7 +54,6 @@ #include <LYGlobalDefs.h> #include <LYEdit.h> #include <LYStrings.h> -#include <LYSystem.h> #include <GridText.h> #include <LYUtils.h> #include <LYCharUtils.h> @@ -1908,14 +1905,13 @@ PUBLIC void LYLoadCookies ARGS1 ( /* rjp - experimental persistent cookie support */ PRIVATE void LYStoreCookies ARGS1 ( - CONST char *, cookie_fileX) + CONST char *, cookie_file) { char buf[1024]; HTList *dl, *cl; domain_entry *de; cookie *co; FILE *cookie_handle; - char *cookie_file = "cookies"; #ifdef VMS extern BOOLEAN HadVMSInterrupt; #endif /* VMS */ @@ -2016,7 +2012,7 @@ PRIVATE int LYHandleCookies ARGS4 ( #ifdef EXP_PERSISTENT_COOKIES /* rjp - this can go here for now */ - LYStoreCookies ("j"); + LYStoreCookies (LYCookieFile); #endif /* @@ -2481,7 +2477,7 @@ PUBLIC void cookie_add_acceptlist ARGS1( de = (domain_entry *)calloc(1, sizeof(domain_entry)); if (de == NULL) - outofmem(__FILE__, "cookie_accept_domain"); + outofmem(__FILE__, "cookie_add_acceptlist"); de->bv = ACCEPT_ALWAYS; @@ -2548,7 +2544,7 @@ PUBLIC void cookie_add_rejectlist ARGS1( de = (domain_entry *)calloc(1, sizeof(domain_entry)); if (de == NULL) - outofmem(__FILE__, "cookie_reject_domain"); + outofmem(__FILE__, "cookie_add_rejectlist"); de->bv = REJECT_ALWAYS; diff --git a/src/LYCurses.c b/src/LYCurses.c index 1794d363..4bbd8758 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -14,12 +14,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#ifdef VMS -#define DISPLAY "DECW$DISPLAY" -#else -#define DISPLAY "DISPLAY" -#endif /* VMS */ - #if defined(VMS) && defined(__GNUC__) #include <gnu_hacks.h> #undef LINES @@ -944,10 +938,10 @@ PUBLIC BOOLEAN setup ARGS1( * If the display was not set by a command line option then * see if it is available from the environment. */ - if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { - StrAllocCopy(display, cp); + if ((cp = LYgetXDisplay()) != 0) { + StrAllocCopy(x_display, cp); } else { - FREE(display); + FREE(x_display); } /* @@ -1041,10 +1035,10 @@ PUBLIC BOOLEAN setup ARGS1( * If the display was not set by a command line option then * see if it is available from the environment . */ - if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { - StrAllocCopy(display, cp); + if ((cp = LYgetXDisplay()) != NULL) { + StrAllocCopy(x_display, cp); } else { - FREE(display); + FREE(x_display); } if (terminal != NULL) { @@ -1582,7 +1576,7 @@ void (*func)(); * Exception-handler routines for regulating interrupts and enabling * Control-T during spawns. Includes TRUSTED flag for versions of VMS * which require it in captive accounts. This code should be used - * instead of the VAXC or DECC system(), by including LYSystem.h in + * instead of the VAXC or DECC system(), by including LYUtils.h in * modules which have system() calls. It helps ensure that we return * to Lynx instead of breaking out to DCL if a user issues interrupts * or generates an ACCVIO during spawns. diff --git a/src/LYCurses.h b/src/LYCurses.h index cd658287..9df3b749 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -157,6 +157,7 @@ extern void LYstartTargetEmphasis NOPARAMS; extern void LYstopTargetEmphasis NOPARAMS; #ifdef VMS +extern int DCLsystem (char *command); extern void VMSexit(); extern int ttopen(); extern int ttclose(); diff --git a/src/LYDownload.c b/src/LYDownload.c index 73a82c6b..26b1eef9 100644 --- a/src/LYDownload.c +++ b/src/LYDownload.c @@ -10,7 +10,6 @@ #include <LYClean.h> #include <LYGetFile.h> #include <LYDownload.h> -#include <LYSystem.h> #ifdef VMS #include <HTVMSUtils.h> #endif /* VMS */ @@ -46,7 +45,7 @@ PUBLIC void LYDownload ARGS1( char command[512]; char *cp, *cp1; lynx_html_item_type *download_command = 0; - int c, len; + int c; FILE *fp; int ch, recall; int FnameTotal; @@ -236,8 +235,7 @@ check_recall: if ((cp = strchr(buffer, '~'))) { *(cp++) = '\0'; strcpy(command, buffer); - if ((len = strlen(command)) > 0 && command[len-1] == '/') - command[len-1] = '\0'; + LYTrimPathSep(command); #ifdef DOSPATH strcat(command, HTDOS_wwwName((char *)Home_Dir())); #else @@ -263,12 +261,22 @@ check_recall: strcpy(buffer, command); } #else + #ifndef __EMX__ - if (*buffer != '/') + if (!LYIsPathSep(*buffer)) { +#if defined(__DJGPP__) || defined(_WINDOWS) + if (strchr(buffer, ':') != NULL) + cp = NULL; + else +#endif /* __DJGPP__ || _WINDOWS */ cp = getenv("PWD"); + } else #endif /* __EMX__*/ cp = NULL; + + LYTrimPathSep(cp); + if (cp) { sprintf(command, "%s/%s", cp, buffer); #ifdef DOSPATH @@ -343,12 +351,8 @@ check_recall: CTRACE(tfp, " FAILED!\n"); sprintf(command, COPY_COMMAND, file, buffer); CTRACE(tfp, "command: %s\n", command); - fflush(stderr); - fflush(stdout); stop_curses(); - system(command); - fflush(stdout); - fflush(stderr); + LYSystem(command); start_curses(); } else { /* @@ -373,12 +377,8 @@ check_recall: sprintf(command, "%s %s %s", COPY_PATH, file, buffer); #endif /* __EMX__ */ CTRACE(tfp, "command: %s\n", command); - fflush(stderr); - fflush(stdout); stop_curses(); - system(command); - fflush(stdout); - fflush(stderr); + LYSystem(command); start_curses(); #if defined(UNIX) LYRelaxFilePermissions(buffer); @@ -542,11 +542,7 @@ check_recall: CTRACE(tfp, "command: %s\n", command); stop_curses(); - fflush(stderr); - fflush(stdout); - system(command); - fflush(stderr); - fflush(stdout); + LYSystem(command); start_curses(); /* don't remove(file); */ } @@ -617,11 +613,8 @@ PUBLIC int LYdownload_options ARGS2( LYforce_no_cache = TRUE; /* don't cache this doc */ - fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n", - DOWNLOAD_OPTIONS_TITLE); - fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, DOWNLOAD_OPTIONS_HELP, DOWNLOAD_OPTIONS_TITLE); + BeginInternalPage(fp0, DOWNLOAD_OPTIONS_TITLE, DOWNLOAD_OPTIONS_HELP); + fprintf(fp0, "<pre>\n"); fprintf(fp0, "\ <em>You download the link:</em> %s\n\ @@ -669,7 +662,8 @@ sections 'DOWNLOAD' and 'INCLUDE'. \ --> \n", LYNX_CFG_FILE); } - fprintf(fp0, "</pre>\n</body>\n"); + fprintf(fp0, "</pre>\n"); + EndInternalPage(fp0); LYCloseTempFP(fp0); /* diff --git a/src/LYEdit.c b/src/LYEdit.c index 3c8997c6..f433080d 100644 --- a/src/LYEdit.c +++ b/src/LYEdit.c @@ -8,7 +8,7 @@ #include <LYGlobalDefs.h> #include <LYEdit.h> #include <LYStrings.h> -#include <LYSystem.h> +#include <LYUtils.h> #ifdef VMS #include <unixio.h> #include <HTVMSUtils.h> @@ -161,12 +161,8 @@ PUBLIC int edit_current_file ARGS3( /* * Invoke the editor. - FM */ - fflush(stderr); - fflush(stdout); stop_curses(); - system(command); - fflush(stdout); - fflush(stderr); + LYSystem(command); start_curses(); /* diff --git a/src/LYExtern.c b/src/LYExtern.c index 78e7c235..8b6959e9 100644 --- a/src/LYExtern.c +++ b/src/LYExtern.c @@ -69,18 +69,7 @@ void run_external ARGS1(char *, c) HTUserMsg(command); stop_curses(); - fflush(stdout); -#ifdef __DJGPP__ - __djgpp_set_ctrl_c(0); - _go32_want_ctrl_break(1); -#endif /* __DJGPP__ */ - system(command); -#ifdef __DJGPP__ - __djgpp_set_ctrl_c(1); - _go32_want_ctrl_break(0); -#endif /* __DJGPP__ */ - - fflush(stdout); + LYSystem(command); start_curses(); } diff --git a/src/LYGetFile.c b/src/LYGetFile.c index 1a54c161..319deacf 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -20,7 +20,6 @@ #include <LYDownload.h> #include <LYNews.h> #include <LYMail.h> -#include <LYSystem.h> #include <LYKeymap.h> #include <LYBookmark.h> #include <LYMap.h> @@ -50,41 +49,6 @@ extern char * WWW_Download_File; extern BOOLEAN LYDidRename; #endif /* VMS */ -#if 0 /* UNUSED */ -#ifdef DIRED_SUPPORT -PRIVATE char * LYSanctify ARGS1( - char *, href) -{ - int i; - char *p, *cp, *tp; - char address_buffer[1024]; - - i = (strlen(href) - 1); - while (i && href[i] == '/') href[i--] = '\0'; - - if ((cp = (char *)strchr(href,'~')) != NULL) { - if (!strncmp(href, "file://localhost/", 17)) - tp = (href + 17); - else - tp = (href + 5); - if ((cp - tp) && *(cp-1) != '/') - return href; - LYstrncpy(address_buffer, href, (cp - href)); - if (address_buffer[(strlen(address_buffer) - 1)] == '/') - address_buffer[(strlen(address_buffer) - 1)] = '\0'; - p = (char *)Home_Dir(); - strcat(address_buffer, p); - if (strlen(++cp)) - strcat(address_buffer, cp); - if (strcmp(href, address_buffer)) - StrAllocCopy(href, address_buffer); - } - return href; -} -#endif /* DIRED_SUPPORT */ -#endif - - PUBLIC BOOLEAN getfile ARGS1( document *, doc) { @@ -426,14 +390,10 @@ Try_Redirected_URL: /* * Run the command. */ -#ifdef __DJGPP__ - __djgpp_set_ctrl_c(0); - _go32_want_ctrl_break(1); -#endif /* __DJGPP__ */ if (strstr(p,"//") == p+9) - system(p+11); + LYSystem(p+11); else - system(p+9); + LYSystem(p+9); if (url_type != LYNXPROG_URL_TYPE) { /* * Make sure user gets to see screen output. @@ -450,10 +410,6 @@ Try_Redirected_URL: HadVMSInterrupt = FALSE; } #endif /* VMS */ -#ifdef __DJGPP__ - __djgpp_set_ctrl_c(1); - _go32_want_ctrl_break(0); -#endif /* __DJGPP__ */ } start_curses(); LYAddVisitedLink(doc); @@ -1309,7 +1265,7 @@ PRIVATE int fix_http_urls ARGS1( * If it's an ftp URL with a trailing slash, trim it off. */ if (!strncmp(doc->address, "ftp", 3) && - doc->address[strlen(doc->address)-1] == '/') { + LYIsHtmlSep(doc->address[strlen(doc->address)-1])) { char * proxy; char *path = HTParse(doc->address, "", PARSE_PATH|PARSE_PUNCTUATION); @@ -1317,7 +1273,7 @@ PRIVATE int fix_http_urls ARGS1( * If the path is a lone slash, we're done. - FM */ if (path) { - if (path[0] == '/' && path[1] == '\0') { + if (LYIsHtmlSep(path[0]) && path[1] == '\0') { FREE(path); return 0; } @@ -1335,7 +1291,7 @@ PRIVATE int fix_http_urls ARGS1( * If we get to here, trim the trailing slash. - FM */ CTRACE(tfp, "fix_http_urls: URL '%s'\n", doc->address); - doc->address[strlen(doc->address)-1] = '\0'; + LYTrimHtmlSep(doc->address); CTRACE(tfp, " changed to '%s'\n", doc->address); CTRACE_SLEEP(MessageSecs); } @@ -1344,12 +1300,12 @@ PRIVATE int fix_http_urls ARGS1( * If there isn't a slash besides the two at the beginning, append one. */ if ((slash = strrchr(doc->address, '/')) != NULL) { - if (*(slash-1) != '/' || *(slash-2) != ':') { + if (!LYIsHtmlSep(*(slash-1)) || *(slash-2) != ':') { return(0); } } CTRACE(tfp, "fix_http_urls: URL '%s'\n", doc->address); - StrAllocCat(doc->address, "/"); + LYAddHtmlSep(&(doc->address)); CTRACE(tfp, " changed to '%s'\n",doc->address); CTRACE_SLEEP(MessageSecs); diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index 7b543738..ebc78984 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -135,7 +135,7 @@ extern char *helpfilepath; extern char *lynxjumpfile; extern char *lynxlistfile; extern char *lynxlinksfile; -extern char *display; +extern char *x_display; extern char *language; extern char *pref_charset; /* Lynx's preferred character set - MM */ extern BOOLEAN LYNewsPosting; /* News posting supported if TRUE */ @@ -289,7 +289,8 @@ extern BOOLEAN LYUseDefaultRawMode; extern char *UCAssume_MIMEcharset; extern char *UCAssume_localMIMEcharset; extern char *UCAssume_unrecMIMEcharset; -extern BOOLEAN LYSaveBookmarksInUnicode; /* in titles, chars >127 save as &#xUUUU */ +extern BOOLEAN UCSaveBookmarksInUnicode; /* in titles, chars >127 save as &#xUUUU */ +extern BOOLEAN UCForce8bitTOUPPER; /* disable locale case-conversion for >127 */ extern BOOLEAN LYisConfiguredForX; extern char *URLDomainPrefixes; extern char *URLDomainSuffixes; @@ -302,9 +303,12 @@ extern BOOLEAN LYMBMAdvanced; /* MBM statusline for ADVANCED? */ extern int LYStatusLine; /* Line for statusline() or -1 */ extern BOOLEAN LYCollapseBRs; /* Collapse serial BRs? */ extern BOOLEAN LYSetCookies; /* Process Set-Cookie headers? */ -extern BOOLEAN LYAcceptAllCookies; /* accept ALL cookies? */ +extern BOOLEAN LYAcceptAllCookies; /* accept ALL cookies? */ extern char *LYCookieAcceptDomains; /* domains to accept all cookies */ extern char *LYCookieRejectDomains; /* domains to reject all cookies */ +#ifdef EXP_PERSISTENT_COOKIES +extern char *LYCookieFile; /* file to store cookies in */ +#endif /* EXP_PERSISTENT_COOKIES */ extern char *XLoadImageCommand; /* Default image viewer for X */ #ifdef USE_EXTERNALS extern BOOLEAN no_externals; /* don't allow the use of externals */ diff --git a/src/LYHistory.c b/src/LYHistory.c index 4d39d58a..e046a9e5 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -118,6 +118,26 @@ PUBLIC void LYAddVisitedLink ARGS1( } /* + * Returns true if this is a page that we would push onto the stack if not + * forced. + */ +PUBLIC BOOLEAN LYwouldPush ARGS1( + char *, title) +{ + return (!strcmp(title, HISTORY_PAGE_TITLE) + || !strcmp(title, PRINT_OPTIONS_TITLE) + || !strcmp(title, DOWNLOAD_OPTIONS_TITLE) +#ifdef DIRED_SUPPORT + || !strcmp(title, DIRED_MENU_TITLE) + || !strcmp(title, UPLOAD_OPTIONS_TITLE) + || !strcmp(title, PERMIT_OPTIONS_TITLE) +#endif /* DIRED_SUPPORT */ + ) + ? FALSE + : TRUE; +} + +/* * Push the current filename, link and line number onto the history list. */ PUBLIC void LYpush ARGS2( @@ -138,26 +158,11 @@ PUBLIC void LYpush ARGS2( /* * Don't push the history, printer, or download lists. */ - if (!strcmp(doc->title, HISTORY_PAGE_TITLE) || - !strcmp(doc->title, PRINT_OPTIONS_TITLE) || - !strcmp(doc->title, DOWNLOAD_OPTIONS_TITLE)) { - if (!LYforce_no_cache) - LYoverride_no_cache = TRUE; - return; - } - -#ifdef DIRED_SUPPORT - /* - * Don't push DIRED menu, upload or permit lists. - */ - if (!strcmp(doc->title, DIRED_MENU_TITLE) || - !strcmp(doc->title, UPLOAD_OPTIONS_TITLE) || - !strcmp(doc->title, PERMIT_OPTIONS_TITLE)) { + if (!LYwouldPush(doc->title)) { if (!LYforce_no_cache) LYoverride_no_cache = TRUE; return; } -#endif /* DIRED_SUPPORT */ } /* @@ -402,13 +407,8 @@ PUBLIC int showhistory ARGS1( LYforce_HTML_mode = TRUE; /* force this file to be HTML */ LYforce_no_cache = TRUE; /* force this file to be new */ - fprintf(fp0, "<head>\n"); - LYAddMETAcharsetToFD(fp0, -1); - fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", - HISTORY_PAGE_TITLE); - fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, HISTORY_PAGE_HELP, HISTORY_PAGE_TITLE); + BeginInternalPage(fp0, HISTORY_PAGE_TITLE, HISTORY_PAGE_HELP); + fprintf(fp0, "<pre>\n"); fprintf(fp0, "<em>You selected:</em>\n"); for (x = nhist-1; x >= 0; x--) { @@ -440,7 +440,8 @@ PUBLIC int showhistory ARGS1( } fprintf(fp0, "<tab to=t%d>%s\n", x, Title); } - fprintf(fp0,"</pre>\n</body>\n"); + fprintf(fp0,"</pre>\n"); + EndInternalPage(fp0); LYCloseTempFP(fp0); FREE(Title); @@ -553,13 +554,8 @@ PUBLIC int LYShowVisitedLinks ARGS1( LYforce_HTML_mode = TRUE; /* force this file to be HTML */ LYforce_no_cache = TRUE; /* force this file to be new */ - fprintf(fp0, "<head>\n"); - LYAddMETAcharsetToFD(fp0, -1); - fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", - VISITED_LINKS_TITLE); - fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, VISITED_LINKS_HELP, VISITED_LINKS_TITLE); + BeginInternalPage(fp0, VISITED_LINKS_TITLE, VISITED_LINKS_HELP); + fprintf(fp0, "<pre>\n"); fprintf(fp0, "<em>You visited (POSTs, bookmark, menu and list files excluded):</em>\n"); @@ -596,7 +592,8 @@ PUBLIC int LYShowVisitedLinks ARGS1( fprintf(fp0, "<tab to=t%d>%s\n", x, ((Address != NULL) ? Address : "(no address)")); } - fprintf(fp0,"</pre>\n</body>\n"); + fprintf(fp0,"</pre>\n"); + EndInternalPage(fp0); LYCloseTempFP(fp0); FREE(Title); diff --git a/src/LYHistory.h b/src/LYHistory.h index 254889d1..7593a2ca 100644 --- a/src/LYHistory.h +++ b/src/LYHistory.h @@ -1,4 +1,3 @@ - #ifndef LYHISTORY_H #define LYHISTORY_H @@ -6,12 +5,13 @@ #include <LYStructs.h> #endif /* LYSTRUCTS_H */ +extern BOOLEAN LYwouldPush PARAMS((char *title)); +extern BOOLEAN historytarget PARAMS((document *newdoc)); +extern int LYShowVisitedLinks PARAMS((char **newfile)); +extern int showhistory PARAMS((char **newfile)); extern void LYAddVisitedLink PARAMS((document *doc)); -extern void LYpush PARAMS((document *doc, BOOLEAN force_push)); extern void LYpop PARAMS((document *doc)); extern void LYpop_num PARAMS((int number, document *doc)); -extern int showhistory PARAMS((char **newfile)); -extern BOOLEAN historytarget PARAMS((document *newdoc)); -extern int LYShowVisitedLinks PARAMS((char **newfile)); +extern void LYpush PARAMS((document *doc, BOOLEAN force_push)); #endif /* LYHISTORY_H */ diff --git a/src/LYList.c b/src/LYList.c index b7de7392..e31036fb 100644 --- a/src/LYList.c +++ b/src/LYList.c @@ -80,25 +80,8 @@ PUBLIC int showlist ARGS2( LYforce_HTML_mode = TRUE; /* force this file to be HTML */ LYforce_no_cache = TRUE; /* force this file to be new */ + BeginInternalPage(fp0, LIST_PAGE_TITLE, LIST_PAGE_HELP); - fprintf(fp0, "<head>\n"); - LYAddMETAcharsetToFD(fp0, -1); - if (strchr(HTLoadedDocumentURL(), '"') == NULL) { - /* - * Insert a BASE tag so there is some way to relate the List Page - * file to its underlying document after we are done. It won't - * be actually used for resolving relative URLs. - kw - */ - StrAllocCopy(Address, HTLoadedDocumentURL()); - LYEntify(&Address, FALSE); - fprintf(fp0, "<base href=\"%s\">\n", Address); - FREE(Address); - } - fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", - LIST_PAGE_TITLE); - fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, LIST_PAGE_HELP, LIST_PAGE_TITLE); StrAllocCopy(Address, HTLoadedDocumentURL()); LYEntify(&Address, FALSE); fprintf(fp0, "References in %s<p>\n", @@ -213,8 +196,10 @@ PUBLIC int showlist ARGS2( FREE(Address); } - fprintf(fp0,"\n</%s>\n</body>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ? - "ol" : "ul")); + fprintf(fp0,"\n</%s>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ? + "ol" : "ul")); + EndInternalPage(fp0); + LYCloseTempFP(fp0); /* * Make necessary changes to newdoc before returning to caller. @@ -236,7 +221,6 @@ PUBLIC int showlist ARGS2( } newdoc->isHEAD = FALSE; newdoc->safe = FALSE; - LYCloseTempFP(fp0); return(0); } diff --git a/src/LYLocal.c b/src/LYLocal.c index 57c821c9..21288e67 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -41,7 +41,6 @@ #include <LYHistory.h> #include <LYUpload.h> #include <LYLocal.h> -#include <LYSystem.h> #ifndef VMS #ifndef _WINDOWS @@ -247,7 +246,7 @@ PRIVATE BOOLEAN remove_tagged NOARGS char tmpbuf[1024]; char *testpath = NULL; struct stat dir_info; - int count, i; + int count; HTList *tag; char *args[5]; @@ -270,8 +269,7 @@ PRIVATE BOOLEAN remove_tagged NOARGS } StrAllocCopy(testpath, tp); HTUnEscape(testpath); - if ((i = strlen(testpath)) && testpath[i-1] == '/') - testpath[(i - 1)] = '\0'; + LYTrimPathSep(testpath); /* * Check the current status of the path to be deleted. @@ -406,9 +404,8 @@ PRIVATE BOOLEAN modify_tagged ARGS1( /* * If path is relative, prefix it with current location. */ - if (tmpbuf[0] != '/') { - if (savepath[(strlen(savepath) - 1)] != '/') - StrAllocCat(savepath,"/"); + if (!LYIsPathSep(tmpbuf[0])) { + LYAddPathSep(&savepath); StrAllocCat(savepath,tmpbuf); } else { StrAllocCopy(savepath,tmpbuf); @@ -616,7 +613,7 @@ PRIVATE BOOLEAN modify_location ARGS1( strcat(newpath, (tmpbuf + 1)); strcpy(tmpbuf, newpath); } - if (tmpbuf[0] != '/') { + if (!LYIsPathSep(tmpbuf[0])) { if ((cp = strrchr(newpath,'/')) != NULL) { *++cp = '\0'; strcat(newpath,tmpbuf); @@ -774,9 +771,7 @@ PRIVATE BOOLEAN create_file ARGS1( HTAlert("Illegal redirection \"//\" found! Request ignored."); } else if (strlen(tmpbuf) && strchr(bad_chars, tmpbuf[0]) == NULL) { strcpy(testpath,current_location); - if (testpath[(strlen(testpath) - 1)] != '/') { - strcat(testpath,"/"); - } + LYAddPathSep0(testpath); /* * Append the target filename to the current location. @@ -836,9 +831,8 @@ PRIVATE BOOLEAN create_directory ARGS1( HTAlert("Illegal redirection \"//\" found! Request ignored."); } else if (strlen(tmpbuf) && strchr(bad_chars, tmpbuf[0]) == NULL) { strcpy(testpath,current_location); - if (testpath[(strlen(testpath) - 1)] != '/') { - strcat(testpath,"/"); - } + LYAddPathSep0(testpath); + strcat(testpath, tmpbuf); /* @@ -1450,8 +1444,7 @@ PUBLIC int local_dired ARGS1( if (LYUpload(line_url)) LYforce_no_cache = TRUE; } else { - if (line[(strlen(line) - 1)] == '/') - line[strlen(line)-1] = '\0'; + LYTrimPathSep(line); if ((cp = strrchr(line, '/')) == NULL) { FREE(line); return 0; @@ -1586,8 +1579,7 @@ PUBLIC int local_dired ARGS1( _statusline(tmpbuf); stop_curses(); printf("%s\n", tmpbuf); - fflush(stdout); - system(buffer); + LYSystem(buffer); #ifdef VMS extern BOOLEAN HadVMSInterrupt HadVMSInterrupt = FALSE; @@ -1647,13 +1639,12 @@ PUBLIC int dired_options ARGS2( } else if (!strncmp(cp, "file:", 5)) { cp += 5; } - strcpy(dir, cp); StrAllocCopy(dir_url, cp); - if (dir_url[(strlen(dir_url) - 1)] == '/') - dir_url[(strlen(dir_url) - 1)] = '\0'; + LYTrimHtmlSep(dir_url); + + strcpy(dir, cp); HTUnEscape(dir); - if (dir[(strlen(dir) - 1)] == '/') - dir[(strlen(dir) - 1)] = '\0'; + LYTrimPathSep(dir); if (doc->link > -1 && doc->link < (nlinks+1)) { cp = links[doc->link].lname; @@ -1662,13 +1653,12 @@ PUBLIC int dired_options ARGS2( } else if (!strncmp(cp, "file:", 5)) { cp += 5; } - strcpy(path, cp); StrAllocCopy(path_url, cp); - if (*path_url && path_url[1] && path_url[(strlen(path_url) - 1)] == '/') - path_url[(strlen(path_url) - 1)] = '\0'; + LYTrimHtmlSep(path_url); + + strcpy(path, cp); HTUnEscape(path); - if (*path && path[1] && path[(strlen(path) - 1)] == '/') - path[(strlen(path) - 1)] = '\0'; + LYTrimPathSep(path); if (lstat(path, &dir_info) == -1 && stat(path, &dir_info) == -1) { sprintf(tmpbuf, "Unable to get status of '%s'.", path); @@ -1686,11 +1676,8 @@ PUBLIC int dired_options ARGS2( nothing_tagged = (HTList_isEmpty(tagged)); - fprintf(fp0, "<head>\n<title>%s</title></head>\n<body>\n", - DIRED_MENU_TITLE); - fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, DIRED_MENU_HELP, DIRED_MENU_TITLE); + BeginInternalPage(fp0, DIRED_MENU_TITLE, DIRED_MENU_HELP); + fprintf(fp0, "<em>Current directory:</em> %s<br>\n", dir); if (nothing_tagged) { @@ -1714,8 +1701,7 @@ PUBLIC int dired_options ARGS2( n, ((n == 1) ? ":" : "s:")); StrAllocCopy(cd, doc->address); HTUnEscapeSome(cd, "/"); - if (*cd && cd[(strlen(cd) - 1)] != '/') - StrAllocCat(cd, "/"); + LYAddHtmlSep(&cd); m = (n < NUM_TAGS_TO_WRITE) ? n : NUM_TAGS_TO_WRITE; for (i = 1; i <= m; i++) { cp1 = HTRelative(HTList_objectAt(tagged, i-1), @@ -1782,7 +1768,7 @@ PUBLIC int dired_options ARGS2( } } - fprintf(fp0, "</body>\n"); + EndInternalPage(fp0); LYCloseTempFP(fp0); FREE(dir_url); diff --git a/src/LYMail.c b/src/LYMail.c index 7c70f798..3d1138f3 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -18,7 +18,6 @@ #include <LYClean.h> #include <LYStrings.h> #include <GridText.h> -#include <LYSystem.h> #include <LYMail.h> #include <LYCharSets.h> /* to get current charset for mail header */ @@ -28,6 +27,27 @@ BOOLEAN term_letter; /* Global variable for async i/o. */ PRIVATE void terminate_letter PARAMS((int sig)); PRIVATE void remove_tildes PARAMS((char *string)); +/* HTUnEscape with control-code nuking */ +PRIVATE void SafeHTUnEscape ARGS1( + char *, string) +{ + int i; + int flg = FALSE; + + HTUnEscape(string); + for (i=0; string[i] != '\0'; i++) + { + /* FIXME: this is explicitly 7-bit ASCII */ + if (string[i] < ' ' || string[i] >= 127) + { + string[i] = '?'; + flg = TRUE; + } + } + if (flg) + HTAlert(MAILTO_SQUASH_CTL); +} + /* ** mailform() sends form content to the mailto address(es). - FM */ @@ -95,7 +115,7 @@ PUBLIC void mailform ARGS4( *cp1 = '\0'; } if (*cp) { - HTUnEscape(subject); + SafeHTUnEscape(subject); LYstrncpy(subject, cp, 70); } if (cp1) { @@ -202,7 +222,7 @@ PUBLIC void mailform ARGS4( } if (keywords != NULL) { if (*keywords != '\0') { - HTUnEscape(keywords); + SafeHTUnEscape(keywords); } else { FREE(keywords); } @@ -255,9 +275,9 @@ PUBLIC void mailform ARGS4( /* * Unescape the address and ccaddr fields. - FM */ - HTUnEscape(address); + SafeHTUnEscape(address); if (ccaddr != NULL) { - HTUnEscape(ccaddr); + SafeHTUnEscape(ccaddr); } /* @@ -531,7 +551,7 @@ PUBLIC void mailform ARGS4( stop_curses(); printf("Sending form content:\n\n$ %s\n\nPlease wait...", command); - system(command); + LYSystem(command); FREE(command); sleep(AlertSecs); start_curses(); @@ -545,7 +565,7 @@ PUBLIC void mailform ARGS4( StrAllocCat(command, my_tmpfile); stop_curses(); printf("Sending form content:\n\n$ %s\n\nPlease wait...", command); - system(command); + LYSystem(command); FREE(command); sleep(MessageSecs); start_curses(); @@ -658,7 +678,7 @@ PUBLIC void mailmsg ARGS4( /* * Unescape the address field. - FM */ - HTUnEscape(address); + SafeHTUnEscape(address); if (address[(strlen(address) - 1)] == ',') address[(strlen(address) - 1)] = '\0'; if (*address == '\0') { @@ -788,7 +808,7 @@ PUBLIC void mailmsg ARGS4( address_ptr1 = address_ptr2; } while (address_ptr1 != NULL); - system(command); + LYSystem(command); FREE(command); LYRemoveTemp(my_tmpfile); if (isPMDF) { @@ -800,7 +820,7 @@ PUBLIC void mailmsg ARGS4( StrAllocCat(command, address); StrAllocCat(command, "\" -F "); StrAllocCat(command, my_tmpfile); - system(command); + LYSystem(command); FREE(command); LYRemoveTemp(my_tmpfile); #endif @@ -934,7 +954,7 @@ PUBLIC void reply_by_mail ARGS3( if (*cp) { strncpy(subject, cp, 70); subject[70] = '\0'; - HTUnEscape(subject); + SafeHTUnEscape(subject); } if (cp1) { *cp1 = '&'; @@ -1041,7 +1061,7 @@ PUBLIC void reply_by_mail ARGS3( } if (keywords != NULL) { if (*keywords != '\0') { - HTUnEscape(keywords); + SafeHTUnEscape(keywords); } else { FREE(keywords); } @@ -1164,9 +1184,9 @@ PUBLIC void reply_by_mail ARGS3( /* * Unescape the address and ccaddr fields. - FM */ - HTUnEscape(address); + SafeHTUnEscape(address); if (ccaddr != NULL) { - HTUnEscape(ccaddr); + SafeHTUnEscape(ccaddr); } /* @@ -1563,7 +1583,7 @@ PUBLIC void reply_by_mail ARGS3( sprintf(user_input, "%s%s %s", editor, editor_arg, my_tmpfile); _statusline(SPAWNING_EDITOR_FOR_MAIL); stop_curses(); - if (system(user_input)) { + if (LYSystem(user_input)) { start_curses(); HTAlert(ERROR_SPAWNING_EDITOR); } else { @@ -1802,7 +1822,7 @@ PUBLIC void reply_by_mail ARGS3( stop_curses(); printf("Sending your comment:\n\n$ %s\n\nPlease wait...", command); - system(command); + LYSystem(command); FREE(command); sleep(AlertSecs); start_curses(); @@ -1844,7 +1864,7 @@ PUBLIC void reply_by_mail ARGS3( LYCloseTempFP(fp); /* Close the tmpfile. */ stop_curses(); printf("Sending your comment:\n\n$ %s\n\nPlease wait...", command); - system(command); + LYSystem(command); FREE(command); sleep(MessageSecs); start_curses(); diff --git a/src/LYMain.c b/src/LYMain.c index 78a8a10a..9d7f174a 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -51,12 +51,6 @@ #include <LYexit.h> #include <LYLeaks.h> -#ifdef VMS -#define DISPLAY "DECW$DISPLAY" -#else -#define DISPLAY "DISPLAY" -#endif /* VMS */ - /* ahhhhhhhhhh!! Global variables :-< */ #ifdef SOCKS PUBLIC BOOLEAN socks_flag=TRUE; @@ -259,7 +253,7 @@ 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 char *personal_mail_address = NULL; /* the users mail address */ -PUBLIC char *display = NULL; /* display environment variable */ +PUBLIC char *x_display = NULL; /* display environment variable */ PUBLIC char *personal_type_map = NULL; /* .mailcap */ PUBLIC char *global_type_map = NULL; /* global mailcap */ PUBLIC char *global_extension_map = NULL; /* global mime.types */ @@ -301,7 +295,8 @@ PUBLIC BOOLEAN LYUseDefaultRawMode = TRUE; PUBLIC char *UCAssume_MIMEcharset = NULL; PUBLIC char *UCAssume_localMIMEcharset = NULL; PUBLIC char *UCAssume_unrecMIMEcharset = NULL; -PUBLIC BOOLEAN LYSaveBookmarksInUnicode = FALSE; +PUBLIC BOOLEAN UCSaveBookmarksInUnicode = FALSE; +PUBLIC BOOLEAN UCForce8bitTOUPPER = FALSE; /* override locale for case-conversion? */ PUBLIC int LYlines = 24; PUBLIC int LYcols = 80; PUBLIC int dump_output_width = 0; @@ -337,6 +332,9 @@ PUBLIC BOOLEAN LYSetCookies = SET_COOKIES; /* Process Set-Cookie headers? */ PUBLIC BOOLEAN LYAcceptAllCookies = ACCEPT_ALL_COOKIES; /* take all cookies? */ PUBLIC char *LYCookieAcceptDomains = NULL; /* domains to accept all cookies */ PUBLIC char *LYCookieRejectDomains = NULL; /* domains to reject all cookies */ +#ifdef EXP_PERSISTENT_COOKIES +PUBLIC char *LYCookieFile = NULL; /* default cookie file */ +#endif /* EXP_PERSISTENT_COOKIES */ PUBLIC char *XLoadImageCommand = NULL; /* Default image viewer for X */ PUBLIC BOOLEAN LYNoISMAPifUSEMAP = FALSE; /* Omit ISMAP link if MAP present? */ PUBLIC int LYHiddenLinks = HIDDENLINKS_SEPARATE; /* Show hidden links? */ @@ -357,7 +355,8 @@ PUBLIC BOOLEAN LYPrependCharsetToSource = FALSE; PUBLIC BOOLEAN LYQuitDefaultYes = QUIT_DEFAULT_YES; #ifdef DISP_PARTIAL -PUBLIC BOOLEAN display_partial = FALSE; /* Display document during download */ +PUBLIC BOOLEAN display_partial = TRUE; /* Display document during download */ +PUBLIC BOOLEAN debug_display_partial = FALSE; /* Show with MessageSecs delay */ #endif /* These are declared in cutil.h for current freeWAIS libraries. - FM */ @@ -441,7 +440,7 @@ PRIVATE void free_lynx_globals NOARGS FREE(jumpfile); #endif /* JUMPFILE */ FREE(indexfile); - FREE(display); + FREE(x_display); FREE(global_type_map); FREE(personal_type_map); FREE(global_extension_map); @@ -518,7 +517,6 @@ PUBLIC int main ARGS2( { int i; /* indexing variable */ int status = 0; /* exit status */ - int len; char *lynx_cfg_file = NULL; char *temp = NULL; char *cp; @@ -694,8 +692,7 @@ PUBLIC int main ARGS2( if ((cp = strchr(lynx_temp_space, '~'))) { *(cp++) = '\0'; StrAllocCopy(temp, lynx_temp_space); - if (((len = strlen(temp)) > 0) && temp[len-1] == '/') - temp[len-1] = '\0'; + LYTrimPathSep(temp); #ifdef DOSPATH StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir())); #else @@ -726,11 +723,10 @@ PUBLIC int main ARGS2( #ifdef VMS LYLowerCase(lynx_temp_space); if (strchr(lynx_temp_space, '/') != NULL) { - if ((len = strlen(lynx_temp_space)) == 1) { + if (strlen(lynx_temp_space) == 1) { StrAllocCopy(lynx_temp_space, "sys$scratch:"); } else { - if (lynx_temp_space[len-1] != '/') - StrAllocCat(lynx_temp_space, "/"); + LYAddPathSep(&lynx_temp_space); StrAllocCopy(temp, HTVMS_name("", lynx_temp_space)); StrAllocCopy(lynx_temp_space, temp); FREE(temp); @@ -741,17 +737,7 @@ PUBLIC int main ARGS2( StrAllocCat(lynx_temp_space, ":"); } #else -#if !defined(__DJGPP__) && !defined(_WINDOWS) - if (((len = strlen(lynx_temp_space)) > 1) && - lynx_temp_space[len-1] != '/') { - StrAllocCat(lynx_temp_space, "/"); - } -#else - if (((len = strlen(lynx_temp_space)) > 1) && - lynx_temp_space[len-1] != '\\') { - StrAllocCat(lynx_temp_space, "\\"); - } -#endif /* !__DJGPP__ && !_WINDOWS */ + LYAddPathSep(&lynx_temp_space); #endif /* VMS */ #ifdef VMS StrAllocCopy(mail_adrs, MAIL_ADRS); @@ -1068,7 +1054,7 @@ PUBLIC int main ARGS2( fprintf(stderr, "%s\n", TRACELOG_OPEN_FAILED); #if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_BINARY; + _fmode = O_BINARY; #endif /* __DJGPP__ or _WINDOWS */ exit(-1); } @@ -1137,7 +1123,7 @@ PUBLIC int main ARGS2( */ #ifndef _WINDOWS /* avoid the whole ~ thing for now */ /* I think this should only be performed if lynx_cfg_file starts with ~/ */ - if ((lynx_cfg_file[0] == '~') && (lynx_cfg_file[1] == '/')) + if ((lynx_cfg_file[0] == '~') && LYIsPathSep(lynx_cfg_file[1])) { #ifdef VMS StrAllocCopy(temp, HTVMS_wwwName((char *)Home_Dir())); @@ -1198,8 +1184,7 @@ PUBLIC int main ARGS2( if ((cp = strchr(lynx_lss_file, '~'))) { *(cp++) = '\0'; StrAllocCopy(temp, lynx_lss_file); - if ((len=strlen(temp)) > 0 && temp[len-1] == '/') - temp[len-1] = '\0'; + LYTrimPathSep(temp); #ifdef VMS StrAllocCat(temp, HTVMS_wwwName((char *)Home_Dir())); #else @@ -1278,8 +1263,7 @@ PUBLIC int main ARGS2( if ((cp = strchr(lynx_save_space, '~')) != NULL) { *(cp++) = '\0'; StrAllocCopy(temp, lynx_save_space); - if (((len = strlen(temp)) > 0) && temp[len-1] == '/') - temp[len-1] = '\0'; + LYTrimPathSep(temp); #ifdef DOSPATH StrAllocCat(temp, HTDOS_wwwName((char *)Home_Dir())); #else @@ -1296,11 +1280,10 @@ PUBLIC int main ARGS2( #ifdef VMS LYLowerCase(lynx_save_space); if (strchr(lynx_save_space, '/') != NULL) { - if ((len = strlen(lynx_save_space)) == 1) { + if (strlen(lynx_save_space) == 1) { StrAllocCopy(lynx_save_space, "sys$login:"); } else { - if (lynx_save_space[len-1] != '/') - StrAllocCat(lynx_save_space, "/"); + LYAddPathSep(&lynx_save_space); StrAllocCopy(temp, HTVMS_name("", lynx_save_space)); StrAllocCopy(lynx_save_space, temp); FREE(temp); @@ -1311,12 +1294,7 @@ PUBLIC int main ARGS2( StrAllocCat(lynx_save_space, ":"); } #else - { - if (((len = strlen(lynx_save_space)) > 1) && - lynx_save_space[len-1] != '/') { - StrAllocCat(lynx_save_space, "/"); - } - } + LYAddPathSep(&lynx_save_space); #endif /* VMS */ } @@ -1523,7 +1501,37 @@ PUBLIC int main ARGS2( * Sod it, this looks like a reasonable place to load the * cookies file, probably. - RP */ - LYLoadCookies("cookies"); /* add command line options! */ + if(LYCookieFile == NULL) { +#ifdef VMS + /* I really don't know if this is going to work on VMS. Someone + * who knows needs to take a look. - BJP + */ + StrAllocCopy(LYCookieFile, "sys$login:cookies"); +#else + StrAllocCopy(LYCookieFile, Home_Dir()); + StrAllocCat(LYCookieFile, "/cookies"); +#endif /* VMS */ + } else { + if ((cp = strchr(LYCookieFile, '~'))) { + temp = NULL; + *(cp++) = '\0'; + StrAllocCopy(temp, cp); + LYTrimPathSep(temp); +#ifdef DOSPATH + StrAllocCopy(LYCookieFile, HTDOS_wwwName((char *)Home_Dir())); +#else +#ifdef VMS + StrAllocCopy(LYCookieFile, HTVMS_wwwName((char *)Home_Dir())); +#else + StrAllocCopy(LYCookieFile, Home_Dir()); +#endif /* VMS */ +#endif /* DOSPATH */ + + StrAllocCat(LYCookieFile, temp); + FREE(temp); + } + } + LYLoadCookies(LYCookieFile); #endif /* @@ -1654,14 +1662,9 @@ PUBLIC int main ARGS2( * Set up our help and about file base paths. - FM */ StrAllocCopy(helpfilepath, helpfile); - if ((cp=strrchr(helpfilepath, '/')) != NULL) - *cp = '\0'; - /* - * Remove code to merge the historical about_lynx - * directory into lynx_help. - HN - */ - StrAllocCat(helpfilepath, "/"); - + if ((cp = LYPathLeaf(helpfilepath)) != helpfilepath) + *cp = '\0'; + LYAddPathSep(&helpfilepath); /* * Make sure our bookmark default strings @@ -1695,7 +1698,7 @@ PUBLIC int main ARGS2( keypad_mode = LINKS_ARE_NUMBERED; } } - if (display != NULL && *display != '\0') { + if (x_display != NULL && *x_display != '\0') { LYisConfiguredForX = TRUE; } if (dump_output_width > 0) { @@ -1723,7 +1726,7 @@ PUBLIC int main ARGS2( * INTERACTIVE session. - FM */ if (setup(terminal)) { - if (display != NULL && *display != '\0') { + if (x_display != NULL && *x_display != '\0') { LYisConfiguredForX = TRUE; } ena_csi((LYlowest_eightbit[current_char_set] > 155)); @@ -1888,7 +1891,7 @@ static int assume_charset_fun ARGS3( char *, next_arg) { if (next_arg == 0) { - UCLYhndl_for_unspec = 0; + UCLYhndl_for_unspec = UCGetLYhndl_byMIME("iso-8859-1"); } else { LYLowerCase(next_arg); StrAllocCopy(UCAssume_MIMEcharset, next_arg); @@ -1905,7 +1908,7 @@ static int assume_local_charset_fun ARGS3( char *, next_arg) { if (next_arg == 0) { - UCLYhndl_HTFile_for_unspec = 0; + UCLYhndl_HTFile_for_unspec = UCGetLYhndl_byMIME("iso-8859-1"); } else { LYLowerCase(next_arg); StrAllocCopy(UCAssume_localMIMEcharset, next_arg); @@ -1923,7 +1926,7 @@ static int assume_unrec_charset_fun ARGS3( char *, next_arg) { if (next_arg == 0) { - UCLYhndl_for_unrec = 0; + UCLYhndl_for_unrec = UCGetLYhndl_byMIME("iso-8859-1"); } else { LYLowerCase(next_arg); StrAllocCopy(UCAssume_unrecMIMEcharset, next_arg); @@ -2037,19 +2040,9 @@ static int display_fun ARGS3( char *, next_arg) { if (next_arg != 0) { -#ifdef VMS - LYUpperCase(next_arg); - Define_VMSLogical(DISPLAY, next_arg); -#else - static char display_putenv_command[142]; - - sprintf(display_putenv_command, "DISPLAY=%s", next_arg); - putenv(display_putenv_command); -#endif /* VMS */ - - if ((0 != (next_arg = getenv(DISPLAY))) - && (*next_arg != '\0')) - StrAllocCopy(display, next_arg); + LYsetXDisplay(next_arg); + if ((next_arg = LYgetXDisplay()) != 0) + StrAllocCopy(x_display, next_arg); } return 0; @@ -2096,9 +2089,9 @@ static int error_file_fun ARGS3( #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) /* -exec */ static int exec_fun ARGS3( - Parse_Args_Type*, p, - char **, argv, - char *, next_arg) + Parse_Args_Type*, p GCC_UNUSED, + char **, argv GCC_UNUSED, + char *, next_arg GCC_UNUSED) { #ifndef NEVER_ALLOW_REMOTE_EXEC local_exec = TRUE; @@ -2538,6 +2531,7 @@ static int width_fun ARGS3( return 0; } +/* NOTE: This table is sorted by name; the lookup relies on that. */ static Parse_Args_Type Arg_Table [] = { PARSE_SET( @@ -2608,6 +2602,12 @@ static Parse_Args_Type Arg_Table [] = "cookies", TOGGLE_ARG, &LYSetCookies, "toggles handling of Set-Cookie headers" ), +#ifdef EXP_PERSISTENT_COOKIES + PARSE_STR( + "cookie_file", LYSTRING_ARG, &LYCookieFile, + "=FILENAME\nspecifies a file to use to store cookies" + ), +#endif /* EXP_PERSISTENT_COOKIES */ #ifndef VMS PARSE_SET( "core", TOGGLE_ARG, &LYNoCore, @@ -2619,6 +2619,12 @@ static Parse_Args_Type Arg_Table [] = "with -traversal, output each page to a file\n\ with -dump, format output as with -traversal, but to stdout" ), +#ifdef DISP_PARTIAL + PARSE_SET( + "debug_partial", TOGGLE_ARG, &debug_display_partial, + "incremental display stages with MessageSecs delay" + ), +#endif PARSE_FUN( "display", NEED_FUNCTION_ARG, display_fun, "=DISPLAY\nset the display variable for X exec'ed programs" diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 2f8d856b..a65bee19 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -27,7 +27,6 @@ #include <LYEdit.h> #include <LYShowInfo.h> #include <LYBookmark.h> -#include <LYSystem.h> #include <LYKeymap.h> #include <LYJump.h> #include <LYDownload.h> @@ -90,7 +89,6 @@ PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */ #ifdef DISP_PARTIAL PUBLIC int Newline_partial = 0; /* required for display_partial mode */ PUBLIC int NumOfLines_partial = -1; /* required for display_partial mode */ -PUBLIC BOOLEAN debug_display_partial; /* show with MessageSecs delay */ #endif PRIVATE document newdoc; @@ -1159,9 +1157,7 @@ try_again: FREE(temp); if (!(temp = HTParse(curdoc.address, "", PARSE_PATH+PARSE_PUNCTUATION))) { - if (startrealm[strlen(startrealm)-1] != '/') { - StrAllocCat(startrealm, "/"); - } + LYAddHtmlSep(&startrealm); } else { if (forced_HTML_mode && !dump_output_immediately && @@ -1219,9 +1215,7 @@ try_again: StrAllocCopy(traversal_host, "None"); } else { StrAllocCopy(traversal_host, temp); - if (traversal_host[strlen(traversal_host)-1] != '/') { - StrAllocCat(traversal_host, "/"); - } + LYAddHtmlSep(&traversal_host); } FREE(temp); } @@ -4548,8 +4542,7 @@ check_goto_URL: * We're viewing a local directory. Make * that the CSwing argument. - FM */ - if (cp[(strlen(cp) - 1)] != '/') - StrAllocCat(cp, "/"); + LYAddPathSep(&cp); StrAllocCopy(VMSdir, HTVMS_name("", cp)); FREE(cp); } else { @@ -4603,7 +4596,7 @@ check_goto_URL: refresh_screen = TRUE; /* redisplay */ } stop_curses(); - system(temp); + LYSystem(temp); start_curses(); FREE(temp); break; @@ -4840,37 +4833,7 @@ check_add_bookmark_to_self: if (!no_shell) { stop_curses(); printf(SPAWNING_MSG); - fflush(stdout); - fflush(stderr); -#ifdef DOSPATH -#ifdef __DJGPP__ - __djgpp_set_ctrl_c(0); - _go32_want_ctrl_break(1); -#endif /* __DJGPP__ */ - if (getenv("SHELL") != NULL) { - system(getenv("SHELL")); - } else { - system(getenv("COMSPEC") == NULL ? "command.com" : getenv("COMSPEC")); - } -#ifdef __DJGPP__ - __djgpp_set_ctrl_c(1); - _go32_want_ctrl_break(0); -#endif /* __DJGPP__ */ -#else -#ifdef __EMX__ - if (getenv("SHELL") != NULL) { - system(getenv("SHELL")); - } else { - system(getenv("COMSPEC") == NULL ? "cmd.exe" : getenv("COMSPEC")); - } -#else -#ifdef VMS - system(""); -#else - system("exec $SHELL"); -#endif /* __EMX__ */ -#endif /* VMS */ -#endif /* DOSPATH */ + LYSystem(LYSysShell()); start_curses(); refresh_screen = TRUE; /* for an HText_pageDisplay() */ } else { diff --git a/src/LYNews.c b/src/LYNews.c index b04e7a96..97e93e24 100644 --- a/src/LYNews.c +++ b/src/LYNews.c @@ -11,7 +11,6 @@ #include <LYStrings.h> #include <LYGetFile.h> #include <LYHistory.h> -#include <LYSystem.h> #include <GridText.h> #include <LYCharSets.h> #include <LYNews.h> @@ -240,7 +239,7 @@ PUBLIC char *LYNewsPost ARGS2( sprintf(user_input,"%s%s %s", editor, editor_arg, my_tempfile); _statusline(SPAWNING_EDITOR_FOR_NEWS); stop_curses(); - if (system(user_input)) { + if (LYSystem(user_input)) { start_curses(); HTAlert(ERROR_SPAWNING_EDITOR); } else { diff --git a/src/LYOptions.c b/src/LYOptions.c index cf1c3293..41017171 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -22,12 +22,6 @@ #include <LYLeaks.h> -#ifdef VMS -#define DISPLAY "DECW$DISPLAY" -#else -#define DISPLAY "DISPLAY" -#endif /* VMS */ - BOOLEAN term_options; PRIVATE void terminate_options PARAMS((int sig)); @@ -74,9 +68,6 @@ PUBLIC void LYoptions NOARGS * If the user changes the display we need memory to put it in. */ char display_option[256]; -#ifndef VMS - static char putenv_command[142]; -#endif /* !VMS */ char *choices[MAXCHOICES]; int CurrentCharSet = current_char_set; int CurrentAssumeCharSet = UCLYhndl_for_unspec; @@ -189,7 +180,7 @@ draw_options: move(L_DISPLAY, 5); addstr("D)ISPLAY variable : "); - addstr((display && *display) ? display : "NONE"); + addstr((x_display && *x_display) ? x_display : "NONE"); move(L_HOME, 5); addstr("mu(L)ti-bookmarks: "); @@ -430,8 +421,8 @@ draw_options: case 'd': /* Change the display. */ case 'D': - if (display && *display) { - strcpy(display_option, display); + if (x_display && *x_display) { + strcpy(display_option, x_display); } else { /* clear the NONE */ move(L_DISPLAY, COL_OPTION_VALUES); addstr(" "); @@ -445,18 +436,18 @@ draw_options: stop_bold(); move(L_DISPLAY, COL_OPTION_VALUES); if ((term_options || ch == -1) || - (display != NULL && + (x_display != NULL && #ifdef VMS - !strcasecomp(display, display_option))) + !strcasecomp(x_display, display_option))) #else - !strcmp(display, display_option))) + !strcmp(x_display, display_option))) #endif /* VMS */ { /* * Cancelled, or a non-NULL display string * wasn't changed. - FM */ - addstr((display && *display) ? display : "NONE"); + addstr((x_display && *x_display) ? x_display : "NONE"); clrtoeol(); if (ch == -1) { HTInfoMsg(CANCELLED); @@ -467,8 +458,8 @@ draw_options: response = ' '; break; } else if (*display_option == '\0') { - if ((display == NULL) || - (display != NULL && *display == '\0')) { + if ((x_display == NULL) || + (x_display != NULL && *x_display == '\0')) { /* * NULL or zero-length display string * wasn't changed. - FM @@ -483,28 +474,22 @@ draw_options: /* * Set the new DISPLAY variable. - FM */ -#ifdef VMS - LYUpperCase(display_option); - Define_VMSLogical(DISPLAY, display_option); -#else - sprintf(putenv_command, "DISPLAY=%s", display_option); - putenv(putenv_command); -#endif /* VMS */ - if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') { - StrAllocCopy(display, cp); + LYsetXDisplay(display_option); + if ((cp = LYgetXDisplay()) != NULL) { + StrAllocCopy(x_display, cp); } else { - FREE(display); + FREE(x_display); } cp = NULL; - addstr(display ? display : "NONE"); + addstr(x_display ? x_display : "NONE"); clrtoeol(); - if ((display == NULL && *display_option == '\0') || - (display != NULL && - !strcmp(display, display_option))) { - if (display == NULL && + if ((x_display == NULL && *display_option == '\0') || + (x_display != NULL && + !strcmp(x_display, display_option))) { + if (x_display == NULL && LYisConfiguredForX == TRUE) { _statusline(VALUE_ACCEPTED_WARNING_X); - } else if (display != NULL && + } else if (x_display != NULL && LYisConfiguredForX == FALSE) { _statusline(VALUE_ACCEPTED_WARNING_NONX); } else { @@ -786,8 +771,8 @@ draw_options: } /* - * Set the raw 8-bit or CJK mode defaults and - * character set if changed. - FM + * Set the raw 8-bit or CJK mode defaults and + * character set if changed. - FM */ if (CurrentAssumeCharSet != UCLYhndl_for_unspec || UCLYhndl_for_unspec != curval) { @@ -3110,106 +3095,116 @@ typedef struct { static CONST char selected_string[] = "selected"; static CONST char disabled_string[] = "disabled"; -static CONST char on_string[] = "ON"; -static CONST char off_string[] = "OFF"; +static CONST char on_string[] = "ON"; +static CONST char off_string[] = "OFF"; static CONST char never_string[] = "NEVER"; static CONST char always_string[] = "ALWAYS"; - -static char * secure_string = "secure"; -static char * secure_value = NULL; - -static char * editor_string = "editor"; - -static char * display_string = "display"; - -static char * mbm_string = "multi_bookmarks_mode"; -static char * mbm_off_string = "OFF"; -static char * mbm_standard_string = "STANDARD"; -static char * mbm_advanced_string = "ADVANCED"; -static char * single_bookmark_string = "single_bookmark_name"; - -static char * mail_address_string = "mail_address"; - -static char * save_options_string = "save_options"; - -static char * preferred_doc_lang_string = "preferred_doc_lang"; - -static char * preferred_doc_char_string = "preferred_doc_char"; - -static char * assume_char_set_string = "assume_char_set"; - -static char * display_char_set_string = "display_char_set"; - -static char * raw_mode_string = "raw_mode"; - -static char * show_color_string = "show_color"; - -static char * verbose_images_string = "verbose_images"; - -static char * vi_keys_string = "vi_keys"; - -static char * emacs_keys_string = "emacs_keys"; - -static char * show_dotfiles_string = "show_dotfiles"; - -static char * select_popups_string = "select_popups"; - -static char * show_cursor_string = "show_cursor"; - -static char * user_agent_string = "user_agent"; - static OptValues bool_values[] = { - { FALSE, "OFF", "OFF" }, - { TRUE, "ON", "ON" }, + { FALSE, "OFF", "OFF" }, + { TRUE, "ON", "ON" }, { 0, 0, 0 }}; -#ifdef DIRED_SUPPORT -static OptValues dired_values[] = { - { 0, "Directories first", "dired_dir" }, - { FILES_FIRST, "Files first", "dired_files" }, - { MIXED_STYLE, "Mixed style", "dired_mixed" }, - { 0, 0, 0 }}; -static char * dired_sort_string = "dired_sort"; -#endif /* DIRED_SUPPORT */ +static char * secure_string = "secure"; +static char * secure_value = NULL; +static char * save_options_string = "save_options"; -static OptValues ftp_sort_values[] = { - { FILE_BY_NAME, "By Name", "ftp_by_name" }, - { FILE_BY_TYPE, "By Type", "ftp_by_type" }, - { FILE_BY_SIZE, "By Size", "ftp_by_size" }, - { FILE_BY_DATE, "By Date", "ftp_by_date" }, +/* + * Personal Preferences + */ +static char * cookies_string = "cookies"; +static char * cookies_ignore_all_string = "ignore"; +static char * cookies_up_to_user_string = "ask user"; +static char * cookies_accept_all_string = "accept all"; +static char * display_string = "display"; +static char * editor_string = "editor"; +static char * emacs_keys_string = "emacs_keys"; +#ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS +#define EXEC_ALWAYS 2 +#define EXEC_LOCAL 1 +#define EXEC_NEVER 0 +static char * exec_links_string = "exec_options"; +static OptValues exec_links_values[] = { + { EXEC_NEVER, "ALWAYS OFF", "ALWAYS OFF" }, + { EXEC_LOCAL, "FOR LOCAL FILES ONLY", "FOR LOCAL FILES ONLY" }, +#ifndef NEVER_ALLOW_REMOTE_EXEC + { EXEC_ALWAYS, "ALWAYS ON", "ALWAYS ON" }, +#endif { 0, 0, 0 }}; -static char * ftp_sort_string = "ftp_sort"; - -static OptValues keypad_mode_values[] = { - { NUMBERS_AS_ARROWS, "Numbers act as arrows", "number_arrows" }, - { LINKS_ARE_NUMBERED, - "Links are numbered", - "links_numbered" }, +#endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ +static char * keypad_mode_string = "keypad_mode"; +static OptValues keypad_mode_values[] = { + { NUMBERS_AS_ARROWS, "Numbers act as arrows", "number_arrows" }, + { LINKS_ARE_NUMBERED, "Links are numbered", "links_numbered" }, { LINKS_AND_FORM_FIELDS_ARE_NUMBERED, - "Links and form fields are numbered", - "links_and_forms" }, + "Links and form fields are numbered", + "links_and_forms" }, { 0, 0, 0 }}; -static char * keypad_mode_string = "keypad_mode"; - +static char * mail_address_string = "mail_address"; +static char * search_type_string = "search_type"; static OptValues search_type_values[] = { - { FALSE, "Case insensitive", "case_insensitive" }, - { TRUE, "Case sensitive", "case_sensitive" }, + { FALSE, "Case insensitive", "case_insensitive" }, + { TRUE, "Case sensitive", "case_sensitive" }, { 0, 0, 0 }}; -static char * search_type_string = "search_type"; - +static char * select_popups_string = "select_popups"; +static char * show_color_string = "show_color"; static OptValues show_color_values[] = { - { SHOW_COLOR_NEVER, never_string, never_string }, - { SHOW_COLOR_OFF, off_string, off_string }, - { SHOW_COLOR_ON, on_string, on_string }, - { SHOW_COLOR_ALWAYS, always_string, always_string }, + { SHOW_COLOR_NEVER, never_string, never_string }, + { SHOW_COLOR_OFF, off_string, off_string }, + { SHOW_COLOR_ON, on_string, on_string }, + { SHOW_COLOR_ALWAYS, always_string, always_string }, { 0, 0, 0 }}; - +static char * show_cursor_string = "show_cursor"; +static char * user_mode_string = "user_mode"; static OptValues user_mode_values[] = { - { NOVICE_MODE, "Novice", "Novice" }, - { INTERMEDIATE_MODE, "Intermediate", "Intermediate" }, - { ADVANCED_MODE, "Advanced", "Advanced" }, + { NOVICE_MODE, "Novice", "Novice" }, + { INTERMEDIATE_MODE, "Intermediate", "Intermediate" }, + { ADVANCED_MODE, "Advanced", "Advanced" }, { 0, 0, 0 }}; -static char * user_mode_string = "user_mode"; +static char * verbose_images_string = "verbose_images"; +static char * vi_keys_string = "vi_keys"; + +/* + * Bookmark Options + */ +static char * mbm_advanced_string = "ADVANCED"; +static char * mbm_off_string = "OFF"; +static char * mbm_standard_string = "STANDARD"; +static char * mbm_string = "multi_bookmarks_mode"; +static char * single_bookmark_string = "single_bookmark_name"; + +/* + * Character Set Options + */ +static char * assume_char_set_string = "assume_char_set"; +static char * display_char_set_string = "display_char_set"; +static char * raw_mode_string = "raw_mode"; + +/* + * File Management Options + */ +static char * show_dotfiles_string = "show_dotfiles"; +#ifdef DIRED_SUPPORT +static char * dired_sort_string = "dired_sort"; +static OptValues dired_values[] = { + { 0, "Directories first", "dired_dir" }, + { FILES_FIRST, "Files first", "dired_files" }, + { MIXED_STYLE, "Mixed style", "dired_mixed" }, + { 0, 0, 0 }}; +#endif /* DIRED_SUPPORT */ +static char * ftp_sort_string = "ftp_sort"; +static OptValues ftp_sort_values[] = { + { FILE_BY_NAME, "By Name", "ftp_by_name" }, + { FILE_BY_TYPE, "By Type", "ftp_by_type" }, + { FILE_BY_SIZE, "By Size", "ftp_by_size" }, + { FILE_BY_DATE, "By Date", "ftp_by_date" }, + { 0, 0, 0 }}; + +/* + * Headers transferred to remote server + */ +static char * preferred_doc_char_string = "preferred_doc_char"; +static char * preferred_doc_lang_string = "preferred_doc_lang"; +static char * user_agent_string = "user_agent"; #define PutLabel(fp, text) \ fprintf(fp,"%-35s: ", text) @@ -3232,7 +3227,7 @@ static char * user_mode_string = "user_mode"; fprintf(fp,"</select>\n") PRIVATE void PutOptValues ARGS3( - FILE *, fp, + FILE *, fp, int, value, OptValues *, table) { @@ -3247,7 +3242,7 @@ PRIVATE void PutOptValues ARGS3( PRIVATE int GetOptValues ARGS2( OptValues *, table, - char *, value) + char *, value) { while (table->LongName != 0) { if (!strcmp(value, table->HtmlName)) @@ -3295,6 +3290,33 @@ PRIVATE PostPair * break_data ARGS1( * Clean them up a bit, in case user entered a funky string. */ HTUnEscape(q[count].tag); + + /* In the value field we have '+' instead of ' '. So do a simple + * find&replace on the value field before UnEscaping() - SKY + */ + { + size_t i, len; + len = strlen(q[count].value); + for (i = 0; i < len; i++) { + if (q[count].value[i] == '+') { +#ifdef UNIX + /* + * Allow for special case of options which begin with a "+" on + * Unix - TD + */ + if (i > 0 + && q[count].value[i+1] == '+' + && isalnum(q[count].value[i+2])) { + q[count].value[i++] = ' '; + i++; + continue; + } + +#endif + q[count].value[i] = ' '; + } + } + } HTUnEscape(q[count].value); count++; @@ -3322,13 +3344,18 @@ PRIVATE PostPair * break_data ARGS1( * initial rendering stages and can be changed only after reloading :-( * So we introduce boolean flag 'need_reload' (currently dummy). * - * Options processed in order according to gen_options(), - * to avoid possible dependencies we add boolean flags - * where the order is essential (save, character sets...) + * Options are processed in order according to gen_options(), we should not + * depend on it and add boolean flags where the order is essential (save, + * character sets...) + * + * Security: some options are disabled in gen_options() under certain + * conditions. We *should* duplicate the same conditions here in postoptions() + * to prevent user with a limited access from editing HTML options code + * manually and submit it to access the restricted items. - LP */ PUBLIC int postoptions ARGS1( - document *, newdoc) + document *, newdoc) { PostPair *data = 0; int i; @@ -3338,6 +3365,7 @@ PUBLIC int postoptions ARGS1( BOOLEAN assume_char_set_changed = FALSE; BOOLEAN need_reload = FALSE; char *link_info = NULL; + int CurrentShowColor = LYShowColor; /*------------------------------------------------- * kludge a link from mbm_menu, the URL was: @@ -3369,142 +3397,107 @@ PUBLIC int postoptions ARGS1( FREE(secure_value); } - /* - * editor - */ - if (!strcmp(data[i].tag, editor_string)) { - FREE(editor); - StrAllocCopy(editor, data[i].value); + /* Save options */ + if (!strcmp(data[i].tag, save_options_string) && (!no_option_save)) { + save_all = TRUE; } - /* - * display - */ + /* Cookies: SELECT */ + if (!strcmp(data[i].tag, cookies_string)) { + if (!strcmp(data[i].value, cookies_ignore_all_string)) { + LYSetCookies = FALSE; + } else if (!strcmp(data[i].value, cookies_up_to_user_string)) { + LYSetCookies = TRUE; + LYAcceptAllCookies = FALSE; + } else if (!strcmp(data[i].value, cookies_accept_all_string)) { + LYSetCookies = TRUE; + LYAcceptAllCookies = TRUE; + } + } + + /* Display: INPUT */ if (!strcmp(data[i].tag, display_string)) { - FREE(display); - StrAllocCopy(display, data[i].value); + LYsetXDisplay(data[i].value); } - /* - * multi-bookmarks mode - */ - if (!strcmp(data[i].tag, mbm_string)) { - if (!strcmp(data[i].value, mbm_off_string)) { - LYMultiBookmarks = FALSE; - } else if (!strcmp(data[i].value, mbm_standard_string)) { - LYMultiBookmarks = TRUE; - LYMBMAdvanced = FALSE; - } else if (!strcmp(data[i].value, mbm_advanced_string)) { - LYMultiBookmarks = TRUE; - LYMBMAdvanced = TRUE; - } + /* Editor: INPUT */ + if (!strcmp(data[i].tag, editor_string)) { + FREE(editor); + StrAllocCopy(editor, data[i].value); } - /* - * single bookmarks file name - */ - if (!strcmp(data[i].tag, single_bookmark_string)) { - if (strcmp(data[i].value, "")) { - FREE(bookmark_page); - StrAllocCopy(bookmark_page, data[i].value); + /* Emacs keys: ON/OFF */ + if (!strcmp(data[i].tag, emacs_keys_string)) { + if ((emacs_keys = GetOptValues(bool_values, data[i].value))) { + set_emacs_keys(); + } else { + reset_emacs_keys(); } } - /* - * ftp sort - */ - if (!strcmp(data[i].tag, ftp_sort_string)) { - HTfileSortMethod = GetOptValues(ftp_sort_values, data[i].value); + /* Execution links: SELECT */ +#ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS + if (!strcmp(data[i].tag, exec_links_string)) { + int code = GetOptValues(exec_links_values, data[i].value); +#ifndef NEVER_ALLOW_REMOTE_EXEC + local_exec = (code == EXEC_ALWAYS); +#endif /* !NEVER_ALLOW_REMOTE_EXEC */ + local_exec_on_local_files = (code == EXEC_LOCAL); } +#endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ - /* - * mail_address - */ + /* Keypad Mode: SELECT */ + if (!strcmp(data[i].tag, keypad_mode_string)) { + keypad_mode = GetOptValues(keypad_mode_values, data[i].value); + } + + /* Mail Address: INPUT */ if (!strcmp(data[i].tag, mail_address_string)) { FREE(personal_mail_address); StrAllocCopy(personal_mail_address, data[i].value); } - /* - * search_type - */ + /* Search Type: SELECT */ if (!strcmp(data[i].tag, search_type_string)) { case_sensitive = GetOptValues(search_type_values, data[i].value); } - /* - * preferred_doc_lang - */ - if (!strcmp(data[i].tag, preferred_doc_lang_string)) { - FREE(language); - StrAllocCopy(language, data[i].value); - } - - /* - * preferred_doc_char - */ - if (!strcmp(data[i].tag, preferred_doc_char_string)) { - FREE(pref_charset); - StrAllocCopy(pref_charset, data[i].value); - } - - /* - * display_char_set - */ - if (!strcmp(data[i].tag, display_char_set_string)) { - int newval; - - newval = atoi(data[i].value); - if (newval != current_char_set) { - current_char_set = newval; - display_char_set_changed = TRUE; - } + /* Select Popups: ON/OFF */ + if (!strcmp(data[i].tag, select_popups_string)) { + LYSelectPopups = GetOptValues(bool_values, data[i].value); } - /* - * raw_mode - */ - if (!strcmp(data[i].tag, raw_mode_string)) { - BOOLEAN newmode = GetOptValues(bool_values, data[i].value); - - if (newmode != LYRawMode) { - LYRawMode = newmode; - raw_mode_changed = TRUE; +#if defined(USE_SLANG) || defined(COLOR_CURSES) + /* Show Color: SELECT */ + if (!strcmp(data[i].tag, show_color_string)) { + LYShowColor = GetOptValues(show_color_values, data[i].value); + LYChosenShowColor = LYShowColor; + if (CurrentShowColor != LYShowColor) { + lynx_force_repaint(); } + CurrentShowColor = LYShowColor; +#ifdef USE_SLANG + SLtt_Use_Ansi_Colors = (LYShowColor > 1 ? 1 : 0); +#endif } +#endif /* USE_SLANG || COLOR_CURSES */ - /* - * assume_char_set - */ - if (!strcmp(data[i].tag, assume_char_set_string)) { - int newval; - - newval = UCGetLYhndl_byMIME(data[i].value); - if (newval != UCLYhndl_for_unspec) { - UCLYhndl_for_unspec = newval; - StrAllocCopy(UCAssume_MIMEcharset, data[i].value); - assume_char_set_changed = TRUE; - } + /* Show Cursor: ON/OFF */ + if (!strcmp(data[i].tag, show_cursor_string)) { + LYShowCursor = GetOptValues(bool_values, data[i].value); } - /* - * show_color - */ - if (!strcmp(data[i].tag, show_color_string)) { - LYShowColor = GetOptValues(show_color_values, data[i].value); - LYChosenShowColor = LYShowColor; + /* User Mode: Default: */ + if (!strcmp(data[i].tag, user_mode_string)) { + user_mode = GetOptValues(user_mode_values, data[i].value); } - /* - * verbose images mode - */ + /* Verbose Images: ON/OFF */ if (!strcmp(data[i].tag, verbose_images_string)) { verbose_img = GetOptValues(bool_values, data[i].value); } - /* - * vi_keys - */ + /* VI Keys: ON/OFF */ if (!strcmp(data[i].tag, vi_keys_string)) { if ((vi_keys = GetOptValues(bool_values, data[i].value))) { set_vi_keys(); @@ -3513,76 +3506,97 @@ PUBLIC int postoptions ARGS1( } } - /* - * emacs_keys - */ - if (!strcmp(data[i].tag, emacs_keys_string)) { - if ((emacs_keys = GetOptValues(bool_values, data[i].value))) { - set_emacs_keys(); - } else { - reset_emacs_keys(); + /* Bookmarks File Menu: SELECT */ + if (!strcmp(data[i].tag, mbm_string) && (!LYMBMBlocked)) { + if (!strcmp(data[i].value, mbm_off_string)) { + LYMultiBookmarks = FALSE; + } else if (!strcmp(data[i].value, mbm_standard_string)) { + LYMultiBookmarks = TRUE; + LYMBMAdvanced = FALSE; + } else if (!strcmp(data[i].value, mbm_advanced_string)) { + LYMultiBookmarks = TRUE; + LYMBMAdvanced = TRUE; } } - /* - * show_dotfiles - */ - if (!strcmp(data[i].tag, show_dotfiles_string)) { - show_dotfiles = GetOptValues(bool_values, data[i].value); + /* Single Bookmarks filename: INPUT */ + if (!strcmp(data[i].tag, single_bookmark_string)) { + if (strcmp(data[i].value, "")) { + FREE(bookmark_page); + StrAllocCopy(bookmark_page, data[i].value); + } } - /* - * select_popups - */ - if (!strcmp(data[i].tag, select_popups_string)) { - LYSelectPopups = GetOptValues(bool_values, data[i].value); + /* Assume Character Set: SELECT */ + if (!strcmp(data[i].tag, assume_char_set_string)) { + int newval; + + newval = UCGetLYhndl_byMIME(data[i].value); + if (newval != UCLYhndl_for_unspec) { + UCLYhndl_for_unspec = newval; + StrAllocCopy(UCAssume_MIMEcharset, data[i].value); + assume_char_set_changed = TRUE; + } } - /* - * show_cursor - */ - if (!strcmp(data[i].tag, show_cursor_string)) { - LYShowCursor = GetOptValues(bool_values, data[i].value); + /* Display Character Set: SELECT */ + if (!strcmp(data[i].tag, display_char_set_string)) { + int newval; + + newval = atoi(data[i].value); + if (newval != current_char_set) { + current_char_set = newval; + display_char_set_changed = TRUE; + } + } + + /* Raw Mode: ON/OFF */ + if (!strcmp(data[i].tag, raw_mode_string)) { + BOOLEAN newmode = GetOptValues(bool_values, data[i].value); + + if (newmode != LYRawMode) { + LYRawMode = newmode; + raw_mode_changed = TRUE; + } } /* - * keypad_mode + * ftp sort: SELECT */ - if (!strcmp(data[i].tag, keypad_mode_string)) { - keypad_mode = GetOptValues(keypad_mode_values, data[i].value); + if (!strcmp(data[i].tag, ftp_sort_string)) { + HTfileSortMethod = GetOptValues(ftp_sort_values, data[i].value); } #ifdef DIRED_SUPPORT - /* - * dired_sort - */ + /* Local Directory Sort: SELECT */ if (!strcmp(data[i].tag, dired_sort_string)) { dir_list_style = GetOptValues(dired_values, data[i].value); } #endif /* DIRED_SUPPORT */ - /* - * user_mode - */ - if (!strcmp(data[i].tag, user_mode_string)) { - user_mode = GetOptValues(user_mode_values, data[i].value); + /* Show dot files: ON/OFF */ + if (!strcmp(data[i].tag, show_dotfiles_string) && (!no_dotfiles)) { + show_dotfiles = GetOptValues(bool_values, data[i].value); } - /* - * user_agent header - */ - if (!strcmp(data[i].tag, user_agent_string)) { + /* Preferred Document Character Set: INPUT */ + if (!strcmp(data[i].tag, preferred_doc_char_string)) { + FREE(pref_charset); + StrAllocCopy(pref_charset, data[i].value); + } + + /* Preferred Document Language: INPUT */ + if (!strcmp(data[i].tag, preferred_doc_lang_string)) { + FREE(language); + StrAllocCopy(language, data[i].value); + } + + /* User Agent: INPUT */ + if (!strcmp(data[i].tag, user_agent_string) && (!no_useragent)) { FREE(LYUserAgent); /* ignore Copyright warning ? */ StrAllocCopy(LYUserAgent, data[i].value); } - - /* - * save_options - */ - if (!strcmp(data[i].tag, save_options_string)) { - save_all = TRUE; - } } /* end of loop */ /* @@ -3630,8 +3644,9 @@ PUBLIC int postoptions ARGS1( } } LYpop(newdoc); /* return to previous doc, not to options menu! */ + if (need_reload == TRUE) { - /* FIXME: currently dummy */ + /* FIXME: currently dummy */ } return(NULLFILE); } @@ -3643,6 +3658,9 @@ PUBLIC int postoptions ARGS1( * Basic Strategy: For each option, throw up the appropriate type of * control, giving defaults as appropriate. If nothing else, we're * probably going to test every control there is. MRC + * + * This function is synchronized with postoptions(). Read the comments in + * postoptions() header if you change something in gen_options(). */ PUBLIC int gen_options ARGS1( char **, newfile) @@ -3667,11 +3685,7 @@ PUBLIC int gen_options ARGS1( StrAllocCopy(*newfile, any_filename); LYforce_no_cache = TRUE; - fprintf(fp0, "<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n", - OPTIONS_TITLE); - fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, OPTIONS_HELP, OPTIONS_TITLE); + BeginInternalPage(fp0, OPTIONS_TITLE, OPTIONS_HELP); /* * I do C, not HTML. Feel free to pretty this up. @@ -3691,20 +3705,18 @@ PUBLIC int gen_options ARGS1( * visible text begins here */ - /* - * save/reset - */ + /* Submit/Reset/Help */ fprintf(fp0,"<p align=center>\n"); - fprintf(fp0,"<input type=\"submit\" value=\"Accept Changes\">\n"); + fprintf(fp0,"<input type=\"submit\" value=\"Accept Changes\"> - \n"); fprintf(fp0,"<input type=\"reset\" value=\"Reset Changes\">\n"); - fprintf(fp0,"Left Arrow cancels changes<br>\n"); + fprintf(fp0,"Left Arrow cancels changes\n"); + fprintf(fp0, "<a href=\"%s%s\">HELP!</a>\n", + helpfilepath, OPTIONS_HELP); - /* - * save options - */ + /* Save options */ if (!no_option_save) { - fprintf(fp0, "<p>Save options to disk: "); - fprintf(fp0,"<input type=\"checkbox\" name=\"%s\">\n", + fprintf(fp0, "<p align=center>Save options to disk: "); + fprintf(fp0, "<input type=\"checkbox\" name=\"%s\">\n", save_options_string); } @@ -3714,82 +3726,86 @@ PUBLIC int gen_options ARGS1( fprintf(fp0,"<pre>\n"); fprintf(fp0,"\n<em>Personal Preferences</em>\n"); - /* - * user_mode - * - * This option is here because we come from LYMainLoop() with - * newdoc.links = 3, and land on 'save options', however if - * no_option_save is set we will land on 'Display' which is an input - * field and leaving back to previous document will be annoying. - * Thus 'user mode' is the most sensible option to put into the - * front lines. - SKY - */ - PutLabel(fp0, "User Mode"); - BeginSelect(fp0, user_mode_string); - PutOptValues(fp0, user_mode, user_mode_values); + /* Cookies: SELECT */ + PutLabel(fp0, "Cookies"); + BeginSelect(fp0, cookies_string); + PutOption(fp0, !LYSetCookies, + cookies_ignore_all_string, + cookies_ignore_all_string); + PutOption(fp0, LYSetCookies && !LYAcceptAllCookies, + cookies_up_to_user_string, + cookies_up_to_user_string); + PutOption(fp0, LYSetCookies && LYAcceptAllCookies, + cookies_accept_all_string, + cookies_accept_all_string); EndSelect(fp0); - /* - * display - */ + /* Display: Input */ PutLabel(fp0, "Display"); - PutTextInput(fp0, display_string, NOTEMPTY(display), text_len, ""); + PutTextInput(fp0, display_string, NOTEMPTY(x_display), text_len, ""); - /* - * editor - */ + /* Editor: Input */ PutLabel(fp0, "Editor"); PutTextInput(fp0, editor_string, NOTEMPTY(editor), text_len, DISABLED(no_editor || system_editor)); - /* - * emacs_keys - */ - PutLabel(fp0, "Emacs Keys"); + + /* Emacs keys: ON/OFF */ + PutLabel(fp0, "Emacs keys"); BeginSelect(fp0, emacs_keys_string); PutOptValues(fp0, emacs_keys, bool_values); EndSelect(fp0); - /* - * keypad_mode - */ - PutLabel(fp0, "Keypad Mode"); - BeginSelect(fp0, keypad_mode_string); - PutOptValues(fp0, keypad_mode, keypad_mode_values); + /* Execution links: SELECT */ +#ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS + PutLabel(fp0, "Execution links"); + BeginSelect(fp0, exec_links_string); +#ifndef NEVER_ALLOW_REMOTE_EXEC + PutOptValues(fp0, local_exec + ? EXEC_ALWAYS + : (local_exec_on_local_files + ? EXEC_LOCAL + : EXEC_NEVER), + exec_links_values); +#else + PutOptValues(fp0, local_exec_on_local_files + ? EXEC_LOCAL + : EXEC_NEVER, + exec_links_values); +#endif /* !NEVER_ALLOW_REMOTE_EXEC */ EndSelect(fp0); +#endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */ - /* - * search_type - */ - PutLabel(fp0, "Searching type"); - BeginSelect(fp0, search_type_string); - PutOptValues(fp0, case_sensitive, search_type_values); + /* Keypad Mode: SELECT */ + PutLabel(fp0, "Keypad mode"); + BeginSelect(fp0, keypad_mode_string); + PutOptValues(fp0, keypad_mode, keypad_mode_values); EndSelect(fp0); - /* - * mail_address - */ + /* Mail Address: INPUT */ PutLabel(fp0, "Personal mail address"); PutTextInput(fp0, mail_address_string, NOTEMPTY(personal_mail_address), text_len, ""); - /* - * select_popups - */ + /* Select Popups: ON/OFF */ PutLabel(fp0, "Popups for select fields"); BeginSelect(fp0, select_popups_string); PutOptValues(fp0, LYSelectPopups, bool_values); EndSelect(fp0); - /* - * show_color - */ + /* Search Type: SELECT */ + PutLabel(fp0, "Searching type"); + BeginSelect(fp0, search_type_string); + PutOptValues(fp0, case_sensitive, search_type_values); + EndSelect(fp0); + + /* Show Color: SELECT */ #if defined(USE_SLANG) || defined(COLOR_CURSES) can_do_colors = 1; #if defined(COLOR_CURSES) can_do_colors = has_colors(); #endif - PutLabel(fp0, "Show Color"); - MaybeSelect(fp0, DISABLED(!can_do_colors), show_color_string); + PutLabel(fp0, "Show color"); + MaybeSelect(fp0, !can_do_colors, show_color_string); if (no_option_save) { if (LYShowColor == SHOW_COLOR_NEVER) { LYShowColor = SHOW_COLOR_OFF; @@ -3819,41 +3835,44 @@ PUBLIC int gen_options ARGS1( SHOW_COLOR_ON : SHOW_COLOR_OFF; } } - show_color_values[3].LongName = (can_do_colors)?always_string:"Always try"; + show_color_values[3].LongName = (can_do_colors) ? always_string + : "Always try"; PutOptValues(fp0, LYChosenShowColor, show_color_values); } EndSelect(fp0); #endif /* USE_SLANG || COLOR_CURSES */ - /* - * verbose images mode - */ - PutLabel(fp0, "Verbose images"); - BeginSelect(fp0, verbose_images_string); - PutOptValues(fp0, verbose_img, bool_values); - EndSelect(fp0); - - /* - * show_cursor - */ + /* Show cursor: ON/OFF */ PutLabel(fp0, "Show cursor"); BeginSelect(fp0, show_cursor_string); PutOptValues(fp0, LYShowCursor, bool_values); EndSelect(fp0); - /* - * vi_keys - */ - PutLabel(fp0, "VI Keys"); + /* User Mode: Default: */ + PutLabel(fp0, "User mode"); + BeginSelect(fp0, user_mode_string); + PutOptValues(fp0, user_mode, user_mode_values); + EndSelect(fp0); + + /* Verbose Images: ON/OFF */ + PutLabel(fp0, "Verbose images"); + BeginSelect(fp0, verbose_images_string); + PutOptValues(fp0, verbose_img, bool_values); + EndSelect(fp0); + + /* VI Keys: ON/OFF */ + PutLabel(fp0, "VI keys"); BeginSelect(fp0, vi_keys_string); PutOptValues(fp0, vi_keys, bool_values); EndSelect(fp0); - fprintf(fp0,"\n<em>Bookmarks Options</em>\n"); /* - * multi-bookmarks mode + * Bookmark Options */ + fprintf(fp0,"\n<em>Bookmark Options</em>\n"); + + /* Multi-Bookmark Mode: SELECT */ if (!LYMBMBlocked) { PutLabel(fp0, "Multi-bookmarks"); BeginSelect(fp0, mbm_string); @@ -3869,35 +3888,35 @@ PUBLIC int gen_options ARGS1( EndSelect(fp0); } - /* - * bookmarks files menu - */ + /* Bookmarks File Menu: LINK/INPUT */ if (LYMultiBookmarks) { - PutLabel(fp0, "Review/edit Bookmarks files"); - fprintf(fp0, + PutLabel(fp0, "Review/edit Bookmarks files"); + fprintf(fp0, "<a href=\"LYNXOPTIONS://MBM_MENU\">Goto multi-bookmark menu</a>\n"); } else { - PutLabel(fp0, "Bookmarks file"); - PutTextInput(fp0, single_bookmark_string, + PutLabel(fp0, "Bookmarks file"); + PutTextInput(fp0, single_bookmark_string, NOTEMPTY(bookmark_page), text_len, ""); } - fprintf(fp0,"\n<em>Character Set Options</em>\n"); - /* - * assume_char_set + * Character Set Options */ + fprintf(fp0,"\n<em>Character Set Options</em>\n"); + + /* Assume Character Set: SELECT */ + /* if (user_mode==ADVANCED_MODE) */ + { + int curval; + curval = UCLYhndl_for_unspec; + /* * FIXME: If bogus value in lynx.cfg, then in old way, that is the * string that was displayed. Now, user will never see that. Good * or bad? I don't know. MRC */ - /* if (user_mode==ADVANCED_MODE) */ { - int curval; - - curval = UCLYhndl_for_unspec; if (curval == current_char_set && UCAssume_MIMEcharset) { curval = UCGetLYhndl_byMIME(UCAssume_MIMEcharset); } @@ -3914,9 +3933,7 @@ PUBLIC int gen_options ARGS1( EndSelect(fp0); } - /* - * display_char_set - */ + /* Display Character Set: SELECT */ PutLabel(fp0, "Display character set"); BeginSelect(fp0, display_char_set_string); for (i = 0; LYchar_set_names[i]; i++) { @@ -3925,28 +3942,12 @@ PUBLIC int gen_options ARGS1( if (len > cset_len) cset_len = len; sprintf(temp, "%d", i); - PutOption(fp0, i==current_char_set, temp, LYchar_set_names[i]); + PutOption(fp0, i==current_char_set, temp, LYchar_set_names[i]); } EndSelect(fp0); - /* - * preferred_doc_char - */ - PutLabel(fp0, "Preferred document character set"); - PutTextInput(fp0, preferred_doc_char_string, - NOTEMPTY(pref_charset), cset_len+2, ""); - - /* - * preferred_doc_lang - */ - PutLabel(fp0, "Preferred document language"); - PutTextInput(fp0, preferred_doc_lang_string, - NOTEMPTY(language), cset_len+2, ""); - - /* - * raw_mode - */ - if (LYHaveCJKCharacterSet) + /* Raw Mode: ON/OFF */ + if (LYHaveCJKCharacterSet) /* * Since CJK people hardly mixed with other world * we split the header to make it more readable: @@ -3960,29 +3961,26 @@ PUBLIC int gen_options ARGS1( PutOptValues(fp0, LYRawMode, bool_values); EndSelect(fp0); - fprintf(fp0,"\n<em>File Management Options</em>\n"); - /* - * ftp sort + * File Management Options */ + fprintf(fp0,"\n<em>File Management Options</em>\n"); + + /* FTP sort: SELECT */ PutLabel(fp0, "Ftp sort criteria"); BeginSelect(fp0, ftp_sort_string); PutOptValues(fp0, HTfileSortMethod, ftp_sort_values); EndSelect(fp0); #ifdef DIRED_SUPPORT - /* - * dired_sort - */ + /* Local Directory Sort: SELECT */ PutLabel(fp0, "Local directory sort criteria"); BeginSelect(fp0, dired_sort_string); PutOptValues(fp0, dir_list_style, dired_values); EndSelect(fp0); #endif /* DIRED_SUPPORT */ - /* - * show_dotfiles - */ + /* Show dot files: ON/OFF */ if (!no_dotfiles) { PutLabel(fp0, "Show dot files"); BeginSelect(fp0, show_dotfiles_string); @@ -3990,32 +3988,41 @@ PUBLIC int gen_options ARGS1( EndSelect(fp0); } - fprintf(fp0,"\n"); - /* - * user_agent + * Headers transferred to remote server */ + fprintf(fp0,"\n<em>Headers transferred to remote server</em>\n"); + + /* Preferred Document Character Set: INPUT */ + PutLabel(fp0, "Preferred document character set"); + PutTextInput(fp0, preferred_doc_char_string, + NOTEMPTY(pref_charset), cset_len+2, ""); + + /* Preferred Document Language: INPUT */ + PutLabel(fp0, "Preferred document language"); + PutTextInput(fp0, preferred_doc_lang_string, + NOTEMPTY(language), cset_len+2, ""); + + /* User Agent: INPUT */ if (!no_useragent) { PutLabel(fp0, "User-Agent header"); - PutTextInput(fp0, user_agent_string, NOTEMPTY(LYUserAgent), text_len, ""); + PutTextInput(fp0, user_agent_string, + NOTEMPTY(LYUserAgent), text_len, ""); } fprintf(fp0,"\n</pre>\n"); - /* - * save/reset - */ + /* Submit/Reset */ fprintf(fp0,"<p align=center>\n"); - fprintf(fp0,"<input type=\"submit\" value=\"Accept Changes\">\n "); + fprintf(fp0,"<input type=\"submit\" value=\"Accept Changes\">\n - "); fprintf(fp0,"<input type=\"reset\" value=\"Reset Changes\">\n"); - fprintf(fp0,"Left Arrow cancels changes<br>\n"); + fprintf(fp0,"Left Arrow cancels changes\n"); /* * close HTML */ fprintf(fp0,"</form>\n"); - fprintf(fp0,"</body>\n"); - fprintf(fp0,"</html>\n"); + EndInternalPage(fp0); LYCloseTempFP(fp0); return(0); diff --git a/src/LYPrint.c b/src/LYPrint.c index 548a577f..24c824ee 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -13,7 +13,6 @@ #include <LYClean.h> #include <LYGetFile.h> #include <LYHistory.h> -#include <LYSystem.h> #include <LYList.h> #include <LYCharSets.h> /* To get current charset for mail header. */ #ifdef VMS @@ -74,7 +73,7 @@ PUBLIC int printfile ARGS1( int lines_in_file = 0; int printer_number = 0; int pages = 0; - int type = 0, c, len; + int type = 0, c; BOOLEAN Lpansi = FALSE; FILE *outfile_fp; char *cp = NULL; @@ -372,8 +371,7 @@ PUBLIC int printfile ARGS1( if ((cp = strchr(filename, '~'))) { *(cp++) = '\0'; strcpy(buffer, filename); - if ((len=strlen(buffer)) > 0 && buffer[len-1] == '/') - buffer[len-1] = '\0'; + LYTrimPathSep(buffer); #ifdef DOSPATH strcat(buffer, HTDOS_wwwName((char *)Home_Dir())); #else @@ -400,12 +398,21 @@ PUBLIC int printfile ARGS1( strcpy(buffer, filename); } #else + #ifndef __EMX__ - if (*filename != '/') + if (!LYIsPathSep(*filename)) { +#if defined(__DJGPP__) || defined(_WINDOWS) + if (strchr(buffer, ':') != NULL) + cp = NULL; + else +#endif /* __DJGPP__ || _WINDOWS */ cp = getenv("PWD"); + } else #endif cp = NULL; + + LYTrimPathSep(cp); if (cp) #ifdef DOSPATH sprintf(buffer, "%s/%s", cp, HTDOS_name(filename)); @@ -717,9 +724,7 @@ PUBLIC int printfile ARGS1( stop_curses(); printf(MAILING_FILE); - fflush(stdout); - system(buffer); - fflush(stdout); + LYSystem(buffer); sleep(AlertSecs); start_curses(); if (isPMDF) @@ -846,7 +851,7 @@ PUBLIC int printfile ARGS1( LYCloseTempFP(outfile_fp); /* Close the tmpfile. */ stop_curses(); printf("Sending \n\n$ %s\n\nPlease wait...", buffer); - system(buffer); + LYSystem(buffer); sleep(MessageSecs); start_curses(); LYRemoveTemp(tempfile); /* Delete the tmpfile. */ @@ -1181,8 +1186,7 @@ PUBLIC int printfile ARGS1( StrAllocCat(envbuffer, HText_getTitle()); putenv(envbuffer); #endif /* VMS */ - fflush(stdout); - system(buffer); + LYSystem(buffer); #ifdef VMS /* * Remove LYNX_PRINT_TITLE logical. - FM @@ -1264,14 +1268,10 @@ PUBLIC int print_options ARGS2( StrAllocCopy(*newfile, print_filename); - fprintf(fp0, "<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n", - PRINT_OPTIONS_TITLE); - fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, PRINT_OPTIONS_HELP, PRINT_OPTIONS_TITLE); + BeginInternalPage(fp0, PRINT_OPTIONS_TITLE, PRINT_OPTIONS_HELP); - pages = (lines_in_file+65)/66; fprintf(fp0, "<pre>\n"); + pages = (lines_in_file+65)/66; sprintf(buffer, " \ <em>You print the document:</em> %s\n \ <em>Number of lines:</em> %d\n \ @@ -1315,7 +1315,8 @@ PUBLIC int print_options ARGS2( cur_printer->name : "No Name Given")); fprintf(fp0, "</a>\n"); } - fprintf(fp0, "</pre>\n</body>\n</html>\n"); + fprintf(fp0, "</pre>\n"); + EndInternalPage(fp0); LYCloseTempFP(fp0); LYforce_no_cache = TRUE; diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 69bb6a32..f68c0d94 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -30,12 +30,6 @@ extern int HTNewsChunkSize; /* Number of news articles per chunk (HTNews.c) */ PUBLIC BOOLEAN have_read_cfg=FALSE; PUBLIC BOOLEAN LYUseNoviceLineTwo=TRUE; -#ifdef VMS -#define DISPLAY "DECW$DISPLAY" -#else -#define DISPLAY "DISPLAY" -#endif /* VMS */ - /* * Translate a TRUE/FALSE field in a string buffer. */ @@ -526,14 +520,16 @@ static int character_set_fun ARGS1( size_t len; len = strlen (value); - for (i = 0; LYchar_set_names[i]; i++) { + for (i = 0; LYchar_set_names[i]; i++) { /* search by name, compatibility */ if (!strncmp(value, LYchar_set_names[i], len)) { current_char_set = i; - HTMLSetRawModeDefault(i); - break; + HTMLSetRawModeDefault(current_char_set); + return 0; } } + current_char_set = UCGetLYhndl_byMIME(value); /* by MIME */ + HTMLSetRawModeDefault(current_char_set); return 0; } @@ -744,7 +740,6 @@ static int viewer_fun ARGS1( char *mime_type; char *viewer; char *environment; - char *cp; mime_type = value; @@ -767,10 +762,10 @@ static int viewer_fun ARGS1( * there is a $DISPLAY variable. */ if (!strcasecomp(environment,"XWINDOWS")) { - if ((cp = getenv(DISPLAY)) != NULL && *cp != '\0') + if (LYgetXDisplay() != NULL) HTSetPresentation(mime_type, viewer, 1.0, 3.0, 0.0, 0); } else if (!strcasecomp(environment,"NON_XWINDOWS")) { - if ((cp = getenv(DISPLAY)) == NULL || *cp == '\0') + if (LYgetXDisplay() == NULL) HTSetPresentation(mime_type, viewer, 1.0, 3.0, 0.0, 0); } else { HTSetPresentation(mime_type, viewer, 1.0, 3.0, 0.0, 0); @@ -807,6 +802,9 @@ static Config_Type Config_Table [] = PARSE_FUN("color", CONF_FUN, color_fun), #endif PARSE_STR("cookie_accept_domains", CONF_STR, LYCookieAcceptDomains), +#ifdef EXP_PERSISTENT_COOKIES + PARSE_STR("cookie_file", CONF_STR, LYCookieFile), +#endif /* EXP_PERSISTENT_COOKIES */ PARSE_STR("cookie_reject_domains", CONF_STR, LYCookieRejectDomains), PARSE_ENV("cso_proxy", CONF_ENV, 0 ), #ifdef VMS @@ -831,6 +829,7 @@ static Config_Type Config_Table [] = PARSE_ADD("external", CONF_ADD_ITEM, externals), #endif PARSE_ENV("finger_proxy", CONF_ENV, 0 ), + PARSE_SET("force_8bit_toupper", CONF_BOOL, UCForce8bitTOUPPER), PARSE_SET("force_ssl_cookies_secure", CONF_BOOL, LYForceSSLCookiesSecure), PARSE_ENV("ftp_proxy", CONF_ENV, 0 ), PARSE_STR("global_extension_map", CONF_STR, global_extension_map), @@ -875,7 +874,7 @@ static Config_Type Config_Table [] = PARSE_INT("messagesecs", CONF_INT, MessageSecs), PARSE_SET("minimal_comments", CONF_BOOL, minimal_comments), PARSE_INT("multi_bookmark_support", CONF_BOOL, LYMultiBookmarks), - PARSE_SET("ncr_in_bookmarks", CONF_BOOL, LYSaveBookmarksInUnicode), + PARSE_SET("ncr_in_bookmarks", CONF_BOOL, UCSaveBookmarksInUnicode), PARSE_FUN("news_chunk_size", CONF_FUN, news_chunk_size_fun), PARSE_FUN("news_max_chunk", CONF_FUN, news_max_chunk_fun), PARSE_FUN("news_posting", CONF_FUN, news_posting_fun), diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index 03f1cb02..7b88643c 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -71,19 +71,19 @@ PUBLIC int showinfo ARGS4( } } - fprintf(fp0, "<head>\n"); + fprintf(fp0, "<html>\n<head>\n"); LYAddMETAcharsetToFD(fp0, -1); fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", SHOWINFO_TITLE); #ifdef LYNX_COMPILE_OPTS - fprintf(fp0, "<h1>%s %s (<a href=\"%s\">%s</a>) - <a href=\"%s\">compile time settings</a>\n", + fprintf(fp0, "<h1>%s %s (<a href=\"%s\">%s</a>) - <a href=\"%s\">compile time settings</a></h1>\n", LYNX_NAME, LYNX_VERSION, (LYNX_RELEASE ? LYNX_WWW_HOME : LYNX_WWW_DIST), (LYNX_RELEASE ? "major release" : "development version"), LYNX_COMPILE_OPTS); #else - fprintf(fp0, "<h1>%s %s (<a href=\"%s\">%s</a>)\n", + fprintf(fp0, "<h1>%s %s (<a href=\"%s\">%s</a>)</h1>\n", LYNX_NAME, LYNX_VERSION, (LYNX_RELEASE ? LYNX_WWW_HOME : LYNX_WWW_DIST), (LYNX_RELEASE ? "major release" : "development version") ); @@ -346,7 +346,7 @@ PUBLIC int showinfo ARGS4( #ifdef DIRED_SUPPORT } #endif /* DIRED_SUPPORT */ - fprintf(fp0, "</body>\n"); + EndInternalPage(fp0); refresh(); diff --git a/src/LYSystem.h b/src/LYSystem.h deleted file mode 100644 index 6acd02b3..00000000 --- a/src/LYSystem.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef LYSYSTEM_H -#define LYSYSTEM_H - -#ifdef VMS -extern int DCLsystem PARAMS((char *command)); -#define system(a) DCLsystem(a) /* use LYCurses.c routines for spawns */ -#endif /* VMS */ - -#endif /* LYSYSTEM_H */ diff --git a/src/LYUpload.c b/src/LYUpload.c index 78609f2c..8d1c5e62 100644 --- a/src/LYUpload.c +++ b/src/LYUpload.c @@ -25,7 +25,6 @@ #include <LYClean.h> #include <LYGetFile.h> #include <LYUpload.h> -#include <LYSystem.h> #include <LYLocal.h> #include <LYexit.h> @@ -180,8 +179,7 @@ retry: FREE(dir); stop_curses(); CTRACE(tfp, "command: %s\n", cmd); - system(cmd); - fflush(stdout); + LYSystem(cmd); start_curses(); #ifdef UNIX chmod(buffer, HIDE_CHMOD); @@ -232,18 +230,14 @@ PUBLIC int LYUpload_options ARGS2( cp += 5; strcpy(curloc,cp); HTUnEscape(curloc); - if (curloc[strlen(curloc) - 1] == '/') - curloc[strlen(curloc) - 1] = '\0'; + LYTrimPathSep(curloc); #endif /* VMS */ LYLocalFileToURL(LYUploadFileURL, tempfile); StrAllocCopy(*newfile, LYUploadFileURL); - fprintf(fp0, "<head>\n<title>%s</title>\n</head>\n<body>\n", - UPLOAD_OPTIONS_TITLE); - fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", - LYNX_NAME, LYNX_VERSION, - helpfilepath, UPLOAD_OPTIONS_HELP, UPLOAD_OPTIONS_TITLE); + BeginInternalPage(fp0, UPLOAD_OPTIONS_TITLE, UPLOAD_OPTIONS_HELP); + fprintf(fp0, "<pre>\n"); fprintf(fp0, " <em>Upload To:</em> %s\n", curloc); fputs("\nUpload options:\n", fp0); @@ -266,7 +260,8 @@ Please refer to the <a href=\"%s\">lynx.cfg</a> file, \ sections 'UPLOAD' and 'INCLUDE'.\n", LYNX_CFG_FILE); } - fprintf(fp0, "</pre>\n</body>\n"); + fprintf(fp0, "</pre>\n"); + EndInternalPage(fp0); LYCloseTempFP(fp0); LYforce_no_cache = TRUE; diff --git a/src/LYUtils.c b/src/LYUtils.c index 532bd69d..caebd6b0 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -4,12 +4,14 @@ #include <HTCJK.h> #include <HTAlert.h> #include <LYCurses.h> +#include <LYHistory.h> #include <LYUtils.h> #include <LYStrings.h> #include <LYGlobalDefs.h> #include <LYSignal.h> #include <GridText.h> #include <LYCharSets.h> +#include <LYCharUtils.h> #ifdef DOSPATH #include <HTDOS.h> @@ -2393,7 +2395,7 @@ PUBLIC int LYCheckForProxyURL ARGS1( if (isdigit((unsigned char)*cp1)) { while (*cp1 && isdigit((unsigned char)*cp1)) cp1++; - if (*cp1 && *cp1 != '/') + if (*cp1 && !LYIsHtmlSep(*cp1)) return(UNKNOWN_URL_TYPE); } } @@ -2462,7 +2464,7 @@ PUBLIC int is_url ARGS1( * also to avoid false positives if there was * a colon later in the string. - KW */ - if (*cp == '/') + if (LYIsHtmlSep(*cp)) return(0); #if defined (DOSPATH) || defined (__EMX__) /* sorry! */ @@ -2510,7 +2512,7 @@ PUBLIC int is_url ARGS1( } else if (compare_type(cp, "file:", 5)) { if (LYisLocalFile(cp)) { return(FILE_URL_TYPE); - } else if (cp[5] == '/' && cp[6] == '/') { + } else if (LYIsHtmlSep(cp[5]) && LYIsHtmlSep(cp[6])) { return(FTP_URL_TYPE); } else { return(0); @@ -2742,8 +2744,11 @@ PUBLIC char * quote_pathname ARGS1( if (result == NULL) outofmem(__FILE__, "quote_pathname"); - result[0] = '\''; - for (i = 0, n = 1; i < strlen(pathname); i++) + n = 0; +#ifndef __DJGPP__ + result[n++] = '\''; +#endif /* __DJGPP__ */ + for (i = 0; i < strlen(pathname); i++) { if (pathname[i] == '\'') { result[n++] = '\''; result[n++] = '"'; @@ -2753,7 +2758,10 @@ PUBLIC char * quote_pathname ARGS1( } else { result[n++] = pathname[i]; } + } +#ifndef __DJGPP__ result[n++] = '\''; +#endif /* !__DJGPP__ */ result[n] = '\0'; return result; } @@ -2991,7 +2999,7 @@ PUBLIC void change_sug_filename ARGS1( #else cp = lynx_temp_space; #endif - if (*cp == '/') { + if (LYIsHtmlSep(*cp)) { sprintf(temp, "file://localhost%s%d", cp, (int)getpid()); } else { sprintf(temp, "file://localhost/%s%d", cp, (int)getpid()); @@ -3900,8 +3908,7 @@ have_VMS_URL: #else StrAllocCopy(temp, curdir); #endif - if(curdir[strlen(curdir)-1] != '/') - StrAllocCat(temp, "/"); + LYAddPathSep(&temp); LYstrncpy(curdir, temp, (DIRNAMESIZE - 1)); StrAllocCat(temp, old_string); } else { @@ -3939,8 +3946,7 @@ have_VMS_URL: } else { char *cp2 = NULL; StrAllocCopy(temp2, curdir); - if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') - StrAllocCat(temp2, "/"); + LYAddPathSep(&temp2); StrAllocCopy(cp, old_string); if ((fragment = strchr(cp, '#')) != NULL) *fragment = '\0'; /* keep as pointer into cp string */ @@ -3965,8 +3971,7 @@ have_VMS_URL: * old_string as given. - kw */ temp = HTEscape(curdir, URL_PATH); - if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') - StrAllocCat(temp, "/"); + LYAddHtmlSep(&temp); StrAllocCat(temp, old_string); } else { temp = HTEscape(temp2, URL_PATH); @@ -3996,8 +4001,7 @@ have_VMS_URL: * old_string as given. - kw */ temp = HTEscape(curdir, URL_PATH); - if (curdir[0] != '\0' && curdir[strlen(curdir)-1] != '/') - StrAllocCat(temp, "/"); + LYAddHtmlSep(&temp); StrAllocCat(temp, old_string); } else { temp = HTEscape(temp2, URL_PATH); @@ -4552,13 +4556,13 @@ PUBLIC void LYTrimRelFromAbsPath ARGS1( /* * Make sure we have a pointer to an absolute path. - FM */ - if (path == NULL || *path != '/') + if (path == NULL || !LYIsPathSep(*path)) return; /* * Check whether the path has a terminal slash. - FM */ - TerminalSlash = (path[(strlen(path) - 1)] == '/'); + TerminalSlash = LYIsPathSep(path[(strlen(path) - 1)]); /* * Simplify the path and then do any necessary trimming. - FM @@ -4571,7 +4575,7 @@ PUBLIC void LYTrimRelFromAbsPath ARGS1( * Eliminate trailing dot. - FM */ cp[1] = '\0'; - } else if (cp[2] == '/') { + } else if (LYIsPathSep(cp[2])) { /* * Skip over the "/." of a "/./". - FM */ @@ -4604,9 +4608,8 @@ PUBLIC void LYTrimRelFromAbsPath ARGS1( path[i] = cp[i]; path[i] = '\0'; } - if (TerminalSlash == FALSE && - path[(strlen(path) - 1)] == '/') { - path[(strlen(path) - 1)] = '\0'; + if (TerminalSlash == FALSE) { + LYTrimPathSep(path); } } @@ -4888,7 +4891,7 @@ PUBLIC BOOLEAN LYPathOffHomeOK ARGS2( /* * Check for a URL or absolute path, and reject if present. - FM */ - if (is_url(cp) || *cp == '/') { + if (is_url(cp) || LYIsPathSep(*cp)) { FREE(file); return(FALSE); } @@ -4910,8 +4913,11 @@ PUBLIC BOOLEAN LYPathOffHomeOK ARGS2( /* * Check for spoofing. - FM */ - if (*cp == '\0' || *cp == '/' || cp[(strlen(cp) - 1)] == '/' || - strstr(cp, "..") != NULL || !strcmp(cp, ".")) { + if (*cp == '\0' + || LYIsPathSep(*cp) + || LYIsPathSep(cp[(strlen(cp) - 1)]) + || strstr(cp, "..") != NULL + || !strcmp(cp, ".")) { FREE(file); return(FALSE); } @@ -5820,3 +5826,254 @@ PUBLIC void LYLocalFileToURL ARGS2( #endif /* VMS */ #endif /* DOSPATH */ } + +PUBLIC void BeginInternalPage ARGS3( + FILE *, fp0, + char*, Title, + char*, HelpURL) +{ + fprintf(fp0, "<html>\n<head>\n"); + LYAddMETAcharsetToFD(fp0, -1); + if (!strcmp(Title, LIST_PAGE_TITLE)) { + if (strchr(HTLoadedDocumentURL(), '"') == NULL) { + char *Address = NULL; + /* + * Insert a BASE tag so there is some way to relate the List Page + * file to its underlying document after we are done. It won't be + * actually used for resolving relative URLs. - kw + */ + StrAllocCopy(Address, HTLoadedDocumentURL()); + LYEntify(&Address, FALSE); + fprintf(fp0, "<base href=\"%s\">\n", Address); + FREE(Address); + } + } + fprintf(fp0, "<title>%s</title>\n</head>\n<body>\n", + Title); + + if ((user_mode == NOVICE_MODE) + && LYwouldPush(Title) + && (HelpURL != 0)) { + fprintf(fp0, "<h1>%s (%s), help on <a href=\"%s%s\">%s</a></h1>\n", + LYNX_NAME, LYNX_VERSION, + helpfilepath, HelpURL, Title); + } else { + fprintf(fp0, "<h1>%s (%s Version %s)</h1>\n", + Title, LYNX_NAME, LYNX_VERSION); + } +} + + +PUBLIC void EndInternalPage ARGS1( + FILE *, fp0) +{ + fprintf(fp0, "</body>\n</html>"); +} + +/* + * Trim a trailing path-separator to avoid confusing other programs when we concatenate + * to it. This only applies to local filesystems. + */ +PUBLIC void LYTrimPathSep ARGS1( + char *, path) +{ + size_t len; + + if (path != 0 + && (len = strlen(path)) != 0 + && LYIsPathSep(path[len-1])) + path[len-1] = 0; +} + +#ifdef DOSPATH +#define PATHSEP_STR "\\" +#else +#define PATHSEP_STR "/" +#endif + +/* + * Add a trailing path-separator to avoid confusing other programs when we concatenate + * to it. This only applies to local filesystems. + */ +PUBLIC void LYAddPathSep ARGS1( + char **, path) +{ + size_t len; + char *temp; + + if ((path != 0) + && ((temp = *path) != 0) + && (len = strlen(temp)) != 0 + && !LYIsPathSep(temp[len-1])) { + StrAllocCat(*path, PATHSEP_STR); + } +} + +/* + * Add a trailing path-separator to avoid confusing other programs when we concatenate + * to it. This only applies to local filesystems. + */ +PUBLIC void LYAddPathSep0 ARGS1( + char *, path) +{ + size_t len; + + if ((path != 0) + && (len = strlen(path)) != 0 + && !LYIsPathSep(path[len-1])) { + strcat(path, PATHSEP_STR); + } +} + +/* + * Trim a trailing path-separator to avoid confusing other programs when we concatenate + * to it. This only applies to HTML paths. + */ +PUBLIC void LYTrimHtmlSep ARGS1( + char *, path) +{ + size_t len; + + if (path != 0 + && (len = strlen(path)) != 0 + && LYIsHtmlSep(path[len-1])) + path[len-1] = 0; +} + +/* + * Add a trailing path-separator to avoid confusing other programs when we concatenate + * to it. This only applies to HTML paths. + */ +PUBLIC void LYAddHtmlSep ARGS1( + char **, path) +{ + size_t len; + char *temp; + + if ((path != 0) + && ((temp = *path) != 0) + && (len = strlen(temp)) != 0 + && !LYIsHtmlSep(temp[len-1])) { + StrAllocCat(*path, "/"); + } +} + +/* + * Add a trailing path-separator to avoid confusing other programs when we concatenate + * to it. This only applies to HTML paths. + */ +PUBLIC void LYAddHtmlSep0 ARGS1( + char *, path) +{ + size_t len; + + if ((path != 0) + && (len = strlen(path)) != 0 + && !LYIsHtmlSep(path[len-1])) { + strcat(path, "/"); + } +} + +/* + * Invoke a shell command + */ +PUBLIC int LYSystem ARGS1( + char *, command) +{ + int code; + + fflush(stdout); + fflush(stderr); + +#ifdef __DJGPP__ + __djgpp_set_ctrl_c(0); + _go32_want_ctrl_break(1); +#endif /* __DJGPP__ */ + +#ifdef VMS + code = DCLsystem(command); +#else + code = system(command); +#endif + +#ifdef __DJGPP__ + __djgpp_set_ctrl_c(1); + _go32_want_ctrl_break(0); +#endif /* __DJGPP__ */ + + fflush(stdout); + fflush(stderr); + + return code; +} + +/* + * Return a string which can be used in LYSystem() for spawning a subshell + */ +PUBLIC char *LYSysShell NOARGS +{ + char *shell = 0; +#ifdef DOSPATH + if (getenv("SHELL") != NULL) { + shell = getenv("SHELL"); + } else { + shell = (getenv("COMSPEC") == NULL) ? "command.com" : getenv("COMSPEC"); + } +#else +#ifdef __EMX__ + if (getenv("SHELL") != NULL) { + shell = getenv("SHELL"); + } else { + shell = (getenv("COMSPEC") == NULL) ? "cmd.exe" : getenv("COMSPEC"); + } +#else +#ifdef VMS + shell = ""; +#else + shell = "exec $SHELL"; +#endif /* __EMX__ */ +#endif /* VMS */ +#endif /* DOSPATH */ + return shell; +} + +#ifdef VMS +#define DISPLAY "DECW$DISPLAY" +#else +#define DISPLAY "DISPLAY" +#endif /* VMS */ + +/* + * Return the X-Window $DISPLAY string if it is nonnull/nonempty + */ +PUBLIC char *LYgetXDisplay NOARGS +{ + char *cp; + if ((cp = getenv(DISPLAY)) == NULL || *cp == '\0') + cp = 0; + return cp; +} + +/* + * Set the value of the X-Window $DISPLAY variable (yes it leaks memory, but + * that is putenv's fault). + */ +PUBLIC void LYsetXDisplay ARGS1( + char *, new_display) +{ + if (new_display != 0 && *new_display != '\0') { +#ifdef VMS + LYUpperCase(new_display); + Define_VMSLogical(DISPLAY, new_display); +#else + static char *display_putenv_command; + display_putenv_command = malloc(strlen(new_display) + 12); + + sprintf(display_putenv_command, "DISPLAY=%s", new_display); + putenv(display_putenv_command); +#endif /* VMS */ + if ((new_display = LYgetXDisplay()) != 0) { + StrAllocCopy(x_display, new_display); + } + } +} diff --git a/src/LYUtils.h b/src/LYUtils.h index 5fd0868b..fee1718e 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -5,71 +5,89 @@ #include <HTList.h> #endif /* HTLIST_H */ -extern void highlight PARAMS((int flag, int cur, char *target)); -extern void free_and_clear PARAMS((char **obj)); -extern void convert_to_spaces PARAMS((char *string, BOOL condense)); -extern char * strip_trailing_slash PARAMS((char * my_dirname)); -extern void statusline PARAMS((CONST char *text)); -extern void toggle_novice_line NOPARAMS; -extern void noviceline PARAMS((int more_flag)); -extern void LYFakeZap PARAMS((BOOL set)); -extern int HTCheckForInterrupt NOPARAMS; +#ifdef DOSPATH +#define LYIsPathSep(ch) ((ch) == '/' || (ch) == '\\') +#else +#define LYIsPathSep(ch) ((ch) == '/') +#endif + +#define LYIsHtmlSep(ch) ((ch) == '/') + +extern BOOLEAN LYAddSchemeForURL PARAMS((char **AllocatedString, char *default_scheme)); +extern BOOLEAN LYCachedTemp PARAMS((char *result, char **cached)); +extern BOOLEAN LYCanDoHEAD PARAMS((CONST char *address)); +extern BOOLEAN LYExpandHostForURL PARAMS((char **AllocatedString, char *prefix_list, char *suffix_list)); +extern BOOLEAN LYPathOffHomeOK PARAMS((char *fbuffer, size_t fbuffer_size)); +extern BOOLEAN LYisLocalAlias PARAMS((char *filename)); extern BOOLEAN LYisLocalFile PARAMS((char *filename)); extern BOOLEAN LYisLocalHost PARAMS((char *filename)); -extern void LYLocalhostAliases_free NOPARAMS; -extern void LYAddLocalhostAlias PARAMS((char *alias)); -extern BOOLEAN LYisLocalAlias PARAMS((char *filename)); +extern BOOLEAN inlocaldomain NOPARAMS; +extern CONST char *Home_Dir NOPARAMS; +extern FILE *LYAppendToTxtFile PARAMS((char * name)); +extern FILE *LYNewBinFile PARAMS((char * name)); +extern FILE *LYNewTxtFile PARAMS((char * name)); +extern FILE *LYOpenScratch PARAMS((char *result, CONST char *prefix)); +extern FILE *LYOpenTemp PARAMS((char *result, CONST char *suffix, CONST char *mode)); +extern FILE *LYReopenTemp PARAMS((char *name)); +extern char *LYPathLeaf PARAMS((char * pathname)); +extern char *LYSysShell NOPARAMS; +extern char *LYgetXDisplay NOPARAMS; +extern char *quote_pathname PARAMS((char *pathname)); +extern char *strip_trailing_slash PARAMS((char * my_dirname)); +extern int HTCheckForInterrupt NOPARAMS; extern int LYCheckForProxyURL PARAMS((char *filename)); +extern int LYSystem PARAMS((char *command)); extern int is_url PARAMS((char *filename)); -extern BOOLEAN LYCanDoHEAD PARAMS((CONST char *address)); -extern void remove_backslashes PARAMS((char *buf)); -extern char *quote_pathname PARAMS((char *pathname)); -extern BOOLEAN inlocaldomain NOPARAMS; -extern void size_change PARAMS((int sig)); -extern void HTSugFilenames_free NOPARAMS; -extern void HTAddSugFilename PARAMS((char *fname)); -extern void change_sug_filename PARAMS((char *fname)); extern int number2arrows PARAMS((int number)); -extern void parse_restrictions PARAMS((CONST char *s)); -extern void checkmail NOPARAMS; +extern time_t LYmktime PARAMS((char *string, BOOL absolute)); +extern void BeginInternalPage PARAMS((FILE *fp0, char *Title, char *HelpURL)); +extern void EndInternalPage PARAMS((FILE *fp0)); +extern void HTAddSugFilename PARAMS((char *fname)); +extern void HTSugFilenames_free NOPARAMS; +extern void LYAddHtmlSep PARAMS((char **path)); +extern void LYAddHtmlSep0 PARAMS((char *path)); +extern void LYAddLocalhostAlias PARAMS((char *alias)); +extern void LYAddPathSep PARAMS((char **path)); +extern void LYAddPathSep0 PARAMS((char *path)); +extern void LYAddPathToHome PARAMS((char *fbuffer, size_t fbuffer_size, char *fname)); extern void LYCheckMail NOPARAMS; -extern void LYEnsureAbsoluteURL PARAMS((char **href, CONST char *name)); +extern void LYCleanupTemp NOPARAMS; +extern void LYCloseTemp PARAMS((char *name)); +extern void LYCloseTempFP PARAMS((FILE *fp)); extern void LYConvertToURL PARAMS((char **AllocatedString)); -extern BOOLEAN LYExpandHostForURL PARAMS(( - char **AllocatedString, char *prefix_list, char *suffix_list)); -extern BOOLEAN LYAddSchemeForURL PARAMS(( - char **AllocatedString, char *default_scheme)); -extern void LYTrimRelFromAbsPath PARAMS((char *path)); extern void LYDoCSI PARAMS((char *url, CONST char *comment, char **csi)); +extern void LYEnsureAbsoluteURL PARAMS((char **href, CONST char *name)); +extern void LYFakeZap PARAMS((BOOL set)); +extern void LYLocalFileToURL PARAMS((char *target, char *source)); +extern void LYLocalhostAliases_free NOPARAMS; +extern void LYRemoveTemp PARAMS((char *name)); +extern void LYTrimHtmlSep PARAMS((char *path)); +extern void LYTrimPathSep PARAMS((char *path)); +extern void LYTrimRelFromAbsPath PARAMS((char *path)); +extern void LYsetXDisplay PARAMS((char *new_display)); +extern void change_sug_filename PARAMS((char *fname)); +extern void checkmail NOPARAMS; +extern void convert_to_spaces PARAMS((char *string, BOOL condense)); +extern void free_and_clear PARAMS((char **obj)); +extern void highlight PARAMS((int flag, int cur, char *target)); +extern void noviceline PARAMS((int more_flag)); +extern void parse_restrictions PARAMS((CONST char *s)); +extern void remove_backslashes PARAMS((char *buf)); +extern void size_change PARAMS((int sig)); +extern void statusline PARAMS((CONST char *text)); +extern void toggle_novice_line NOPARAMS; + #ifdef VMS -extern void Define_VMSLogical PARAMS(( - char *LogicalName, char *LogicalValue)); +extern void Define_VMSLogical PARAMS((char *LogicalName, char *LogicalValue)); #endif /* VMS */ -extern CONST char *Home_Dir NOPARAMS; -extern char *LYPathLeaf PARAMS((char * pathname)); -extern BOOLEAN LYPathOffHomeOK PARAMS((char *fbuffer, size_t fbuffer_size)); -extern void LYAddPathToHome PARAMS(( - char *fbuffer, size_t fbuffer_size, char *fname)); -extern time_t LYmktime PARAMS((char *string, BOOL absolute)); + #if ! HAVE_PUTENV extern int putenv PARAMS((CONST char *string)); #endif /* HAVE_PUTENV */ -extern FILE *LYNewBinFile PARAMS((char * name)); -extern FILE *LYNewTxtFile PARAMS((char * name)); -extern FILE *LYAppendToTxtFile PARAMS((char * name)); #ifdef UNIX extern void LYRelaxFilePermissions PARAMS((CONST char * name)); #endif -extern BOOLEAN LYCachedTemp PARAMS((char *result, char **cached)); -extern FILE *LYOpenTemp PARAMS((char *result, CONST char *suffix, CONST char *mode)); -extern FILE *LYReopenTemp PARAMS((char *name)); -extern FILE *LYOpenScratch PARAMS((char *result, CONST char *prefix)); -extern void LYCloseTemp PARAMS((char *name)); -extern void LYCloseTempFP PARAMS((FILE *fp)); -extern void LYRemoveTemp PARAMS((char *name)); -extern void LYCleanupTemp NOPARAMS; -extern void LYLocalFileToURL PARAMS((char *target, char *source)); /* * Whether or not the status line must be shown. diff --git a/src/LYrcFile.c b/src/LYrcFile.c index 77f5dca1..c5326615 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -451,7 +451,7 @@ PUBLIC void read_rc NOPARAMS cp = cp2 + 1; while (isspace(*cp)) cp++; /* get rid of spaces */ - cookie_add_acceptlist(cp); + cookie_add_acceptlist(cp); /* @@ -465,6 +465,19 @@ PUBLIC void read_rc NOPARAMS cp++; /* get rid of spaces */ cookie_add_rejectlist(cp); +#ifdef EXP_PERSISTENT_COOKIES + /* + * File to store cookies in. + */ + } else if ((cp = LYstrstr(line_buffer, "cookie_file")) + != NULL && cp-line_buffer < number_sign) { + if((cp2 = (char *)strchr(cp,'=')) != NULL) + cp = cp2 + 1; + while (isspace(*cp)) + cp++; /* get rid of spaces */ + + StrAllocCopy(LYCookieFile, cp); +#endif /* EXP_PERSISTENT_COOKIES */ /* * User mode. @@ -892,6 +905,44 @@ PUBLIC int save_rc NOPARAMS (user_mode == ADVANCED_MODE ? "ADVANCED" : "INTERMEDIATE"))); + /* + * Cookie options + */ + fprintf(fp, "\ +# accept_all_cookies allows the user to tell Lynx to automatically\n\ +# accept all cookies if desired. The default is \"FALSE\" which will\n\ +# prompt for each cookie. Set accept_all_cookies to \"TRUE\" to accept\n\ +# all cookies.\n"); + fprintf(fp, "accept_all_cookies=%s\n\n", + (LYAcceptAllCookies == FALSE ? "FALSE" : "TRUE")); + + fprintf(fp, "\ +# cookie_accept_domains and cookie_reject_domains are comma-delimited\n\ +# lists of domains (with a leading '.') to automatically accept or\n\ +# reject all cookies from. The accept_all_cookies parameter will\n\ +# override any settings made here. If a single domain is specified in\n\ +# both cookie_accept_domains and in cookie_reject_domains, the rejection\n\ +# will take precedence.\n"); + fprintf(fp, "# cookie_accept_domains=\n"); + fprintf(fp, "# cookie_reject_domains=\n\n"); + + /* + * cookie_accept_domains and cookie_reject_domains not set here because + * there's not currently a method on the options menu (maybe later?) + * to set them. + */ + +#ifdef EXP_PERSISTENT_COOKIES + /* + * Cookie file. + */ + fprintf(fp, "\ +# cookie_file specifies the file in which to store persistent cookies.\n\ +# The default is ~/.lynx_cookies.\n"); + fprintf(fp, "cookie_file=%s\n\n", + (LYCookieFile == NULL ? "~/.lynx_cookies" : LYCookieFile)); +#endif /* EXP_PERSISTENT_COOKIES */ + #if defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) /* * Local execution mode - all links. diff --git a/src/UCAuto.c b/src/UCAuto.c index 7d910a20..a3584ecb 100644 --- a/src/UCAuto.c +++ b/src/UCAuto.c @@ -15,6 +15,7 @@ */ #include <HTUtils.h> +#include <LYUtils.h> #include <UCMap.h> #include <UCDefs.h> @@ -25,12 +26,6 @@ #ifdef EXP_CHARTRANS_AUTOSWITCH -#ifdef VMS -#define DISPLAY "DECW$DISPLAY" -#else -#define DISPLAY "DISPLAY" -#endif /* VMS */ - #ifdef LINUX typedef enum { Is_Unset, Is_Set, Dunno, Dont_Care @@ -83,7 +78,7 @@ PRIVATE void call_setfont ARGS3( if (*T_setfont_cmd) { CTRACE(tfp, "Executing setfont: '%s'\n", T_setfont_cmd); - system(T_setfont_cmd); + LYSystem(T_setfont_cmd); } } @@ -130,7 +125,6 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( TGen_state_t HasUmap = Dunno; char tmpbuf1[100], tmpbuf2[20]; - char *cp; /* * Restore the original character set. @@ -149,7 +143,7 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( sprintf(tmpbuf1, "%s %s %s", SETFONT, old_font, NOOUTPUT); } - system(tmpbuf1); + LYSystem(tmpbuf1); } remove(old_font); @@ -166,7 +160,7 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( old_font = tempnam((char *)0, "font"); sprintf(tmpbuf1, "%s -o %s -ou %s %s", SETFONT, old_font, old_umap, NOOUTPUT); - system(tmpbuf1); + LYSystem(tmpbuf1); } name = p->MIMEname; @@ -182,8 +176,8 @@ PUBLIC void UCChangeTerminalCodepage ARGS2( /* * Use this for output of escape sequences. */ - if ((display != NULL) || - ((cp = getenv(DISPLAY)) != NULL && *cp != '\0')) { + if ((x_display != NULL) || + LYgetXDisplay() != NULL) { /* * We won't do anything in an xterm. Better that way... */ diff --git a/src/chrtrans/README.tables b/src/chrtrans/README.tables index b9311729..5993ccee 100644 --- a/src/chrtrans/README.tables +++ b/src/chrtrans/README.tables @@ -4,6 +4,7 @@ ftp://dkuug.dk/) and are believed to be correct in their mappings, but not checked in detail. The Unicode/UCS2 values for some of the RFC 1345 Mnemonic codes are out of date, a cleanup and update would be needed for serious use. +[See also http://czyborra.com/charsets/iso8859.html for codepages survey.] More translation files can be easily provided (and new character entities added to entities.h), this set is just to test whether the system works diff --git a/src/chrtrans/cp1250_uni.tbl b/src/chrtrans/cp1250_uni.tbl index e7b19995..49ba9008 100644 --- a/src/chrtrans/cp1250_uni.tbl +++ b/src/chrtrans/cp1250_uni.tbl @@ -2,7 +2,7 @@ Mwindows-1250 #Name as a Display Charset (used on Options screen) -OWinLatin2 (cp1250) +OEastern European (windows-1250) # # Name: cp1250 to Unicode table diff --git a/src/chrtrans/cp1251_uni.tbl b/src/chrtrans/cp1251_uni.tbl index ed4a1e18..541f8640 100644 --- a/src/chrtrans/cp1251_uni.tbl +++ b/src/chrtrans/cp1251_uni.tbl @@ -2,7 +2,7 @@ Mwindows-1251 #Name as a Display Charset (used on Options screen) -OWinCyrillic (cp1251) +OCyrillic (windows-1251) # # Name: cp1251 to Unicode table diff --git a/src/chrtrans/cp1252_uni.tbl b/src/chrtrans/cp1252_uni.tbl index d5912022..09ee9b6a 100644 --- a/src/chrtrans/cp1252_uni.tbl +++ b/src/chrtrans/cp1252_uni.tbl @@ -6,7 +6,7 @@ D0 Mwindows-1252 #Name as a Display Charset (used on Options screen) -OWinLatin1 (cp1252) +OWestern (windows-1252) # # Name: cp1252 to Unicode table diff --git a/src/chrtrans/cp1253_uni.tbl b/src/chrtrans/cp1253_uni.tbl index ed50b1ed..b53e44a2 100644 --- a/src/chrtrans/cp1253_uni.tbl +++ b/src/chrtrans/cp1253_uni.tbl @@ -2,7 +2,7 @@ Mwindows-1253 #Name as a Display Charset (used on Options screen) -OWinGreek (cp1253) +OGreek (windows-1253) # # Name: cp1253 to Unicode table @@ -26,7 +26,7 @@ OWinGreek (cp1253) 0x20-0x7e idem # -0x80 U+20AC #EURO SIGN +0x80 U+20AC #EURO SIGN 0x81 #UNDEFINED 0x82 U+201A #SINGLE LOW-9 QUOTATION MARK 0x83 U+0192 #LATIN SMALL LETTER F WITH HOOK diff --git a/src/chrtrans/cp1255_uni.tbl b/src/chrtrans/cp1255_uni.tbl index 67517353..6c4ca7d0 100644 --- a/src/chrtrans/cp1255_uni.tbl +++ b/src/chrtrans/cp1255_uni.tbl @@ -2,7 +2,7 @@ Mwindows-1255 #Name as a Display Charset (used on Options screen). -OWinHebrew (cp1255) +OHebrew (windows-1255) # # Name: cp1255 to Unicode table diff --git a/src/chrtrans/cp1256_uni.tbl b/src/chrtrans/cp1256_uni.tbl index 844e450d..23af4614 100644 --- a/src/chrtrans/cp1256_uni.tbl +++ b/src/chrtrans/cp1256_uni.tbl @@ -2,7 +2,7 @@ Mwindows-1256 #Name as a Display Charset (used on Options screen). -OWinArabic (cp1256) +OArabic (windows-1256) # # Name: cp1256 to Unicode table diff --git a/src/chrtrans/cp1257_uni.tbl b/src/chrtrans/cp1257_uni.tbl index 5339fa7c..4c1e70e6 100644 --- a/src/chrtrans/cp1257_uni.tbl +++ b/src/chrtrans/cp1257_uni.tbl @@ -2,7 +2,7 @@ Mwindows-1257 #Name as a Display Charset (used on Options screen) -OWinBaltRim (cp1257) +OBaltic Rim (windows-1257) # # Name: cp1257 to Unicode table diff --git a/src/chrtrans/cp437_uni.tbl b/src/chrtrans/cp437_uni.tbl index 621e730e..289f73ea 100644 --- a/src/chrtrans/cp437_uni.tbl +++ b/src/chrtrans/cp437_uni.tbl @@ -6,7 +6,7 @@ D0 Mcp437 #Name as a Display Charset (used on Options screen) -ODosLatinUS (cp437) +OLatinUS (cp437) # # Name: cp437_DOSLatinUS to Unicode table # Unicode version: 1.1 diff --git a/src/chrtrans/cp737_uni.tbl b/src/chrtrans/cp737_uni.tbl index 32f01c8c..81442ccc 100644 --- a/src/chrtrans/cp737_uni.tbl +++ b/src/chrtrans/cp737_uni.tbl @@ -2,7 +2,7 @@ Mcp737 #Name as a Display Charset (used on Options screen) -ODosGreek (cp737) +OGreek (cp737) # # Name: cp737_DOSGreek to Unicode table diff --git a/src/chrtrans/cp775_uni.tbl b/src/chrtrans/cp775_uni.tbl index 02a8b61b..8e56c3f4 100644 --- a/src/chrtrans/cp775_uni.tbl +++ b/src/chrtrans/cp775_uni.tbl @@ -2,7 +2,7 @@ Mcp775 #Name as a Display Charset (used on Options screen) -ODosBaltRim (cp775) +OBaltic Rim (cp775) # Name: cp775_DOSBaltRim to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/cp850_uni.tbl b/src/chrtrans/cp850_uni.tbl index 05685971..816cc2db 100644 --- a/src/chrtrans/cp850_uni.tbl +++ b/src/chrtrans/cp850_uni.tbl @@ -8,7 +8,7 @@ D0 Mcp850 #Name as a Display Charset (used on Options screen) -ODosLatin1 (cp850) +OWestern (cp850) # # Name: cp850_DOSLatin1 to Unicode table diff --git a/src/chrtrans/cp852_uni.tbl b/src/chrtrans/cp852_uni.tbl index 0658d893..79047ace 100644 --- a/src/chrtrans/cp852_uni.tbl +++ b/src/chrtrans/cp852_uni.tbl @@ -2,7 +2,7 @@ Mcp852 #Name as a Display Charset (used on Options screen) -ODosLatin2 (cp852) +OEastern European (cp852) # # Name: cp852_DOSLatin2 to Unicode table diff --git a/src/chrtrans/cp862_uni.tbl b/src/chrtrans/cp862_uni.tbl index 3d21c138..60d9692e 100644 --- a/src/chrtrans/cp862_uni.tbl +++ b/src/chrtrans/cp862_uni.tbl @@ -2,7 +2,7 @@ Mcp862 #Name as a Display Charset (used on Options screen). -ODosHebrew (cp862) +OHebrew (cp862) # Name: cp862_DOSHebrew to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/cp864_uni.tbl b/src/chrtrans/cp864_uni.tbl index d6e92431..8411f8b7 100644 --- a/src/chrtrans/cp864_uni.tbl +++ b/src/chrtrans/cp864_uni.tbl @@ -2,7 +2,7 @@ Mcp864 #Name as a Display Charset (used on Options screen). -ODosArabic (cp864) +OArabic (cp864) # Name: cp864_DOSArabic to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/cp866_uni.tbl b/src/chrtrans/cp866_uni.tbl index 2d02ce1b..55ce0718 100644 --- a/src/chrtrans/cp866_uni.tbl +++ b/src/chrtrans/cp866_uni.tbl @@ -3,7 +3,7 @@ Mcp866 #Name as a Display Charset (used on Options screen) -ODosCyrillic (cp866) +OCyrillic (cp866) # # Name: cp866_DOSCyrillicRussian to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/cp869_uni.tbl b/src/chrtrans/cp869_uni.tbl index 21cdeb95..1f418728 100644 --- a/src/chrtrans/cp869_uni.tbl +++ b/src/chrtrans/cp869_uni.tbl @@ -2,7 +2,7 @@ Mcp869 #Name as a Display Charset (used on Options screen) -ODosGreek2 (cp869) +OGreek2 (cp869) # Name: cp869_DOSGreek2 to Unicode table # Unicode version: 2.0 diff --git a/src/chrtrans/iso01_uni.tbl b/src/chrtrans/iso01_uni.tbl index f792164d..5b697e02 100644 --- a/src/chrtrans/iso01_uni.tbl +++ b/src/chrtrans/iso01_uni.tbl @@ -8,7 +8,7 @@ D0 Miso-8859-1 #Name as a Display Charset (used on Options screen) -OISO Latin 1 +OWestern (ISO-8859-1) # # Name: ISO 8859-1 (1987) to Unicode diff --git a/src/chrtrans/iso02_uni.tbl b/src/chrtrans/iso02_uni.tbl index af97bc55..7fa0df92 100644 --- a/src/chrtrans/iso02_uni.tbl +++ b/src/chrtrans/iso02_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-2 #Name as a Display Charset (used on Options screen) -OISO Latin 2 +OEastern European (ISO-8859-2) # # Name: ISO 8859-2 (1987) to Unicode diff --git a/src/chrtrans/iso03_uni.tbl b/src/chrtrans/iso03_uni.tbl index bb8cd90f..a3c1f07a 100644 --- a/src/chrtrans/iso03_uni.tbl +++ b/src/chrtrans/iso03_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-3 #Name as a Display Charset (used on Options screen) -OISO Latin 3 +OLatin 3 (ISO-8859-3) # # Name: ISO 8859-3 (1988) to Unicode diff --git a/src/chrtrans/iso04_uni.tbl b/src/chrtrans/iso04_uni.tbl index 3f54afda..29be0be5 100644 --- a/src/chrtrans/iso04_uni.tbl +++ b/src/chrtrans/iso04_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-4 #Name as a Display Charset (used on Options screen) -OISO Latin 4 +OLatin 4 (ISO-8859-4) # # Name: ISO 8859-4 (1988) to Unicode diff --git a/src/chrtrans/iso05_uni.tbl b/src/chrtrans/iso05_uni.tbl index 40cdc24d..a715b64f 100644 --- a/src/chrtrans/iso05_uni.tbl +++ b/src/chrtrans/iso05_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-5 #Name as a Display Charset (used on Options screen) -OISO 8859-5 Cyrillic +OCyrillic (ISO-8859-5) # # Name: ISO 8859-5 (1988) to Unicode diff --git a/src/chrtrans/iso06_uni.tbl b/src/chrtrans/iso06_uni.tbl index c9418864..549b592d 100644 --- a/src/chrtrans/iso06_uni.tbl +++ b/src/chrtrans/iso06_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-6 #Name as a Display Charset (used on Options screen). -OISO 8859-6 Arabic +OArabic (ISO-8859-6) # # Name: ISO 8859-6 (1987) to Unicode diff --git a/src/chrtrans/iso07_uni.tbl b/src/chrtrans/iso07_uni.tbl index 368209bf..dffca758 100644 --- a/src/chrtrans/iso07_uni.tbl +++ b/src/chrtrans/iso07_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-7 #Name as a Display Charset (used on Options screen) -OISO 8859-7 Greek +OGreek (ISO-8859-7) # # Name: ISO 8859-7 (1987) to Unicode diff --git a/src/chrtrans/iso08_uni.tbl b/src/chrtrans/iso08_uni.tbl index 4d83f5c4..050be29d 100644 --- a/src/chrtrans/iso08_uni.tbl +++ b/src/chrtrans/iso08_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-8 #Name as a Display Charset (used on Options screen). -OISO 8859-8 Hebrew +OHebrew (ISO-8859-8) # # Name: ISO 8859-8 (1988) to Unicode diff --git a/src/chrtrans/iso09_uni.tbl b/src/chrtrans/iso09_uni.tbl index 1b204835..5abe799f 100644 --- a/src/chrtrans/iso09_uni.tbl +++ b/src/chrtrans/iso09_uni.tbl @@ -2,7 +2,7 @@ Miso-8859-9 #Name as a Display Charset (used on Options screen) -OISO 8859-9 (Latin 5) +OTurkish (ISO-8859-9) # # Name: ISO 8859-9 (1989) to Unicode diff --git a/src/chrtrans/iso10_uni.tbl b/src/chrtrans/iso10_uni.tbl index be3c02cd..ab8128f0 100644 --- a/src/chrtrans/iso10_uni.tbl +++ b/src/chrtrans/iso10_uni.tbl @@ -10,7 +10,7 @@ D0 Miso-8859-10 #Name as a Display Charset (used on Options screen) -OISO 8859-10 +OISO-8859-10 0x20-0x7e idem #0x7f U+2302 diff --git a/src/chrtrans/koi8r_uni.tbl b/src/chrtrans/koi8r_uni.tbl index 09e8743c..69eef3c2 100644 --- a/src/chrtrans/koi8r_uni.tbl +++ b/src/chrtrans/koi8r_uni.tbl @@ -1,5 +1,5 @@ # Options screen name for this character set -OKOI8-R Cyrillic +OCyrillic (KOI8-R) # MIME name for this charset Mkoi8-r diff --git a/src/chrtrans/utf8_uni.tbl b/src/chrtrans/utf8_uni.tbl index 67ff3460..9fc470ad 100644 --- a/src/chrtrans/utf8_uni.tbl +++ b/src/chrtrans/utf8_uni.tbl @@ -7,7 +7,7 @@ Mutf-8 #Name as a Display Charset (used on Options screen) -OUNICODE UTF-8 +OUNICODE (UTF-8) # Some kind of raw Unicode? # Use 6 for for really "raw" 16bit UCS-2, 7 for UTF-8, ... |