about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-03-07 19:00:00 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1998-03-07 19:00:00 -0500
commit57b42f17322a4cb27bb4b36d85e67a9f62a84fe3 (patch)
tree51b20c64e6508cd1af6251a23d87db9eb03d1f98 /src
parent373bfbe1a5d037b9eb53f512a3332746e10607a2 (diff)
downloadlynx-snapshots-57b42f17322a4cb27bb4b36d85e67a9f62a84fe3.tar.gz
snapshot of project "lynx", label v2-8pre_5
Diffstat (limited to 'src')
-rw-r--r--src/LYStrings.c26
-rw-r--r--src/LYStrings.h8
-rw-r--r--src/LYUtils.c15
3 files changed, 31 insertions, 18 deletions
diff --git a/src/LYStrings.c b/src/LYStrings.c
index 52aac4b0..98696d9f 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -1603,8 +1603,6 @@ PUBLIC char * SNACat ARGS3(
 }
 
 
-#ifdef EXP_8BIT_TOUPPER
-
 /*
 **   UPPER8 ?
 **   it was "TOUPPER(a) - TOUPPER(b)" in its previous life...
@@ -1629,29 +1627,44 @@ 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.
 */
 PUBLIC int UPPER8(int ch1, int ch2)
 {
+
+#ifdef NOTUSED
     /* Try case-Sensitive match for speed, but mostly for stability */
     /* while doing experiments with the remainder of this function. */
     if ((unsigned char)ch1==(unsigned char)ch2)
        return(0);
+#endif /* NOTUSED */
 
     /* case-insensitive match for us-ascii */
     if ((unsigned char)ch1 < 128 && (unsigned char)ch2 < 128)
 	return(TOUPPER(ch1) - TOUPPER(ch2));
 
-    /* compare "7bit approximation" for letters >127   */
+    /* 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
+	{
+	/* 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;
 	int charset_in, charset_out, uck1, uck2;
 	char replace_buf1 [10], replace_buf2 [10];
 
-	disp_charset = LYCharSet_UC[current_char_set].MIMEname;
 	charset_in  = UCGetLYhndl_byMIME(disp_charset);
 	charset_out = UCGetLYhndl_byMIME("us-ascii");
 
@@ -1662,9 +1675,8 @@ PUBLIC int UPPER8(int ch1, int ch2)
 
 	if ((uck1 > 0) && (uck2 > 0))  /* both replacement strings found */
 	    return (strcasecomp(replace_buf1, replace_buf2));
+	}
     }
 
     return(-10);  /* mismatch, if we come to here */
 }
-
-#endif /* EXP_8BIT_TOUPPER */
diff --git a/src/LYStrings.h b/src/LYStrings.h
index f161f5a6..350b88f3 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -3,17 +3,15 @@
 
 #include <string.h>
 
-#if !defined(EXP_8BIT_TOUPPER) && (!defined(LOCALE) || defined(__DJGPP__))
+#if !defined(EXP_8BIT_TOUPPER) && !defined(LOCALE)
 #define EXP_8BIT_TOUPPER
 #endif
 
-#ifdef EXP_8BIT_TOUPPER
+/*  UPPER8(ch1,ch2) is an extension of (TOUPPER(ch1) - TOUPPER(ch2))  */
 extern int UPPER8  PARAMS((
 	int		ch1,
 	int		ch2));
-#else
-#define UPPER8(a,b) (TOUPPER(a) - TOUPPER(b))
-#endif
+
 extern int get_mouse_link NOPARAMS;
 extern char * LYstrncpy PARAMS((
 	char *		dst,
diff --git a/src/LYUtils.c b/src/LYUtils.c
index b778ed71..c0d9ebc8 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -4122,14 +4122,17 @@ have_VMS_URL:
 		/*
 		 *  It is a subdirectory or file on the local system.
 		 */
-#ifndef DOSPATH
-		cp = HTEscape(temp, URL_PATH);
-#else
-		/* We need not escape DOS local paths such as c:    */
-		/* especially when we really have file://localhost/ */
-		/* at the beginning.				    */
+#ifdef DOSPATH
+		/* Don't want to see DOS local paths like c: escaped */
+		/* especially when we really have file://localhost/  */
+		/* at the beginning. To avoid any confusion we allow */
+		/* escaping the path if URL specials % or # present. */
+		if (strchr(temp, '#') == NULL &&
+			   strchr(temp, '%') == NULL)
 		StrAllocCopy(cp, temp);
+		else
 #endif /* DOSPATH */
+		cp = HTEscape(temp, URL_PATH);
 		StrAllocCat(*AllocatedString, cp);
 		FREE(cp);
 		if (TRACE) {