diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-03-18 12:12:19 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-03-18 12:12:19 -0500 |
commit | d8e8363bb47d88e434c2128c4c1ffbf501a67898 (patch) | |
tree | af03af9eef872e7b81ac815a702c992f2c4e1977 /src | |
parent | 88a8487639527e04313c7c87f390e7a45f7c529a (diff) | |
download | lynx-snapshots-d8e8363bb47d88e434c2128c4c1ffbf501a67898.tar.gz |
snapshot of project "lynx", label v2-8-1dev_2
Diffstat (limited to 'src')
-rw-r--r-- | src/LYCharSets.c | 38 | ||||
-rw-r--r-- | src/LYCharSets.h | 1 | ||||
-rw-r--r-- | src/LYMain.c | 10 | ||||
-rw-r--r-- | src/LYReadCFG.c | 28 | ||||
-rw-r--r-- | src/LYReadCFG.h | 2 | ||||
-rw-r--r-- | src/LYStrings.c | 19 | ||||
-rw-r--r-- | src/LYStrings.h | 3 | ||||
-rw-r--r-- | src/LYUtils.c | 2 |
8 files changed, 76 insertions, 27 deletions
diff --git a/src/LYCharSets.c b/src/LYCharSets.c index 2f9e4362..0ed8ba64 100644 --- a/src/LYCharSets.c +++ b/src/LYCharSets.c @@ -23,6 +23,7 @@ extern BOOL HTPassHighCtrlNum; extern HTCJKlang HTCJK; PUBLIC HTkcode kanji_code = NOKANJI; PUBLIC BOOLEAN LYHaveCJKCharacterSet = FALSE; +PUBLIC BOOLEAN DisplayCharsetMatchLocale = TRUE; extern void UCInit NOARGS; extern int UCInitialized; PUBLIC int LYNumCharsets = 0; /* Will be initialized later by UC_Register. */ @@ -664,6 +665,42 @@ PUBLIC void HTMLSetHaveCJKCharacterSet ARGS1(int,i) } /* + * Function to set the DisplayCharsetMatchLocale value + * based on the selected character set. + * It is used in UPPER8 for 8bit case-insensitive search + * by matching def7_uni.tbl images. - LP + */ +PRIVATE void HTMLSetDisplayCharsetMatchLocale ARGS1(int,i) +{ + if (strncasecomp(LYCharSet_UC[i].MIMEname, "cp", 2) || + strncasecomp(LYCharSet_UC[i].MIMEname, "windows", 7)) { + /* + ** Assume dos/windows displays usually on remote terminal, + ** so rarely match locale. + ** (in fact, MS Windows codepoints locale are never seen on UNIX). + */ + DisplayCharsetMatchLocale = FALSE; + } else { + DisplayCharsetMatchLocale = TRUE; + } + +#if !defined(LOCALE) + DisplayCharsetMatchLocale = FALSE; +#endif +#if defined(EXP_8BIT_TOUPPER) + /* + ** Force disable 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 + + return; +} + +/* * Entity names -- Ordered by ISO Latin 1 value. * --------------------------------------------- * For conversions of DECIMAL escaped entities. @@ -910,6 +947,7 @@ PUBLIC void HTMLUseCharacterSet ARGS1(int,i) p_entity_values = LYCharSets[i]; HTMLSetCharacterHandling(i); HTMLSetHaveCJKCharacterSet(i); + HTMLSetDisplayCharsetMatchLocale(i); return; } diff --git a/src/LYCharSets.h b/src/LYCharSets.h index 17ee98e2..7af57cdc 100644 --- a/src/LYCharSets.h +++ b/src/LYCharSets.h @@ -7,6 +7,7 @@ #endif /* !UCMAP_H */ extern BOOLEAN LYHaveCJKCharacterSet; +extern BOOLEAN DisplayCharsetMatchLocale; /* * LYchar_set_name[current_char_set] points to the currently active set. diff --git a/src/LYMain.c b/src/LYMain.c index 2e600b1e..03591d21 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -742,7 +742,7 @@ else {init_ctrl_break[0] = 1;} StrAllocCat(lynx_temp_space, ":"); } #else -#ifndef __DJGPP__ +#if !defined(__DJGPP__) && !defined(_WINDOWS) if (((len = strlen(lynx_temp_space)) > 1) && lynx_temp_space[len-1] != '/') { StrAllocCat(lynx_temp_space, "/"); @@ -752,7 +752,7 @@ else {init_ctrl_break[0] = 1;} lynx_temp_space[len-1] != '\\') { StrAllocCat(lynx_temp_space, "\\"); } -#endif /* __DJGPP__ */ +#endif /* !__DJGPP__ && !_WINDOWS */ #endif /* VMS */ #ifdef VMS StrAllocCopy(mail_adrs, MAIL_ADRS); @@ -1257,11 +1257,7 @@ else {init_ctrl_break[0] = 1;} /* * Process the configuration file. */ - if (TRACE) { - fprintf(stderr, - "Loading cfg file '%s'.\n", lynx_cfg_file); - } - read_cfg(lynx_cfg_file); + read_cfg(lynx_cfg_file, "main program", 1); FREE(lynx_cfg_file); HTSwitchDTD(New_DTD); diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 736aeab4..4a57dcdc 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -440,8 +440,10 @@ PRIVATE void parse_color ARGS1( /* * Process the configuration file (lynx.cfg). */ -PUBLIC void read_cfg ARGS1( - char *, cfg_filename) +PUBLIC void read_cfg ARGS3( + char *, cfg_filename, + char *, parent_filename, + int, nesting_level) { FILE *fp; char buffer[501]; @@ -449,6 +451,22 @@ PUBLIC void read_cfg ARGS1( char *cp, *cp1; int i, j, len; + if (TRACE) { + fprintf(stderr, + "Loading cfg file '%s'.\n", cfg_filename); + } + /* + * Don't get hung up by an include file loop. Arbitrary max depth + * of 10. - BL + */ + if (nesting_level > 10) { + fprintf(stderr, + "More than %d nested lynx.cfg includes -- perhaps there is a loop?!?\n", + nesting_level - 1); + fprintf(stderr,"Last attempted include was '%s',\n", cfg_filename); + fprintf(stderr,"included from '%s'.\n", parent_filename); + exit(-1); + } /* * Locate and open the file. */ @@ -620,6 +638,7 @@ PUBLIC void read_cfg ARGS1( } else if (!strncasecomp(buffer, "DEFAULT_CACHE_SIZE:", 19)) { HTCacheSize = atoi(buffer+19); + if (HTCacheSize < 2) HTCacheSize = 2; } else if (!system_editor && !strncasecomp(buffer, "DEFAULT_EDITOR:", 15)) { @@ -766,7 +785,10 @@ PUBLIC void read_cfg ARGS1( break; case 'I': - if (!strncasecomp(buffer, "INFOSECS:", 9)) { + if (!strncasecomp(buffer, "include:", 8)) { + strcpy(temp, buffer+8); + read_cfg(temp, cfg_filename, nesting_level + 1); + } else if (!strncasecomp(buffer, "INFOSECS:", 9)) { strcpy(temp, buffer+9); for (i = 0; temp[i]; i++) { if (!isdigit(temp[i])) { diff --git a/src/LYReadCFG.h b/src/LYReadCFG.h index 5e94f0d8..63050ee1 100644 --- a/src/LYReadCFG.h +++ b/src/LYReadCFG.h @@ -43,7 +43,7 @@ extern int default_bg; extern int check_color PARAMS((char * color, int the_default)); #endif -extern void read_cfg PARAMS((char *cfg_filename)); +extern void read_cfg PARAMS((char *cfg_filename, char *parent_filename, int nesting_level)); extern BOOLEAN have_read_cfg; #endif /* LYREADCFG_H */ diff --git a/src/LYStrings.c b/src/LYStrings.c index 2111b918..b9cfd7bd 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -1627,8 +1627,8 @@ PUBLIC char * SNACat ARGS3( ** may be interpreted as equal, but this side effect is negligible ** if the user search string is more than one character long. - LP ** -** Currently we enable new technique only for DOS/WINDOWS display charsets -** and also for EXP_8BIT_TOUPPER compilation symbol. +** We enable new technique only if DisplayCharsetMatchLocale = FALSE +** (see description in LYCharSets.c) */ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2) { @@ -1640,21 +1640,15 @@ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2) /* case-insensitive match for upper half */ if ((unsigned char)ch1 > 127 && (unsigned char)ch2 >127) { - CONST char *disp_charset; - disp_charset = LYCharSet_UC[current_char_set].MIMEname; - -#if !defined(EXP_8BIT_TOUPPER) - if (!(strncasecomp(disp_charset, "cp", 2) || - strncasecomp(disp_charset, "windows", 7))) { - - return(TOUPPER(ch1) - TOUPPER(ch2)); /* old-style */ - } else -#endif + if (DisplayCharsetMatchLocale) + return(TOUPPER(ch1) - TOUPPER(ch2)); /* old-style */ + else { /* compare "7bit approximation" for letters >127 */ /* BTW, if we remove the check for >127 above */ /* we get even more "relaxed" insensitive match... */ + CONST char *disp_charset = LYCharSet_UC[current_char_set].MIMEname; int charset_in, charset_out, uck1, uck2; char replace_buf1 [10], replace_buf2 [10]; @@ -1671,6 +1665,7 @@ PUBLIC int UPPER8 ARGS2(int,ch1, int,ch2) /* check to be sure we have not lost any strange characters */ /* which are not found in def7_uni.tbl but _equal_ in fact. */ + /* this also applied for "x-transparent" display mode. */ if ((unsigned char)ch1==(unsigned char)ch2) return(0); /* match */ } diff --git a/src/LYStrings.h b/src/LYStrings.h index 350b88f3..bb4d70f2 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -3,9 +3,6 @@ #include <string.h> -#if !defined(EXP_8BIT_TOUPPER) && !defined(LOCALE) -#define EXP_8BIT_TOUPPER -#endif /* UPPER8(ch1,ch2) is an extension of (TOUPPER(ch1) - TOUPPER(ch2)) */ extern int UPPER8 PARAMS(( diff --git a/src/LYUtils.c b/src/LYUtils.c index c0d9ebc8..48d76486 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -4063,7 +4063,7 @@ have_VMS_URL: #endif /* DOSPATH */ if (*old_string == '~') { /* - * On Unix, covert '~' to Home_Dir(). + * On Unix, convert '~' to Home_Dir(). */ StrAllocCat(*AllocatedString, Home_Dir()); if ((cp = strchr(old_string, '/')) != NULL) { |