about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTFile.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2002-01-02 01:55:54 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2002-01-02 01:55:54 -0500
commitd83d4af153de5a3cfacc4ce014183fd36e0cd920 (patch)
tree9e662d0b0ea4548c781e16e0159c0146f9dd3105 /WWW/Library/Implementation/HTFile.c
parent90d33dc9d0323ee3faf8477fcbddb376a6fcdb9a (diff)
downloadlynx-snapshots-d83d4af153de5a3cfacc4ce014183fd36e0cd920.tar.gz
snapshot of project "lynx", label v2-8-5dev_6
Diffstat (limited to 'WWW/Library/Implementation/HTFile.c')
-rw-r--r--WWW/Library/Implementation/HTFile.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 4ca9a6f1..9ddfd398 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -340,6 +340,7 @@ PRIVATE void LYListFmtParse ARGS5(
 		case 'K':	/* size in Kilobytes but not for directories */
 			if (S_ISDIR(data->file_info.st_mode)) {
 				FormatStr(&buf, start, "");
+				StrAllocCat(buf, " ");
 				break;
 			}
 			/* FALL THROUGH */
@@ -1318,16 +1319,15 @@ PUBLIC void HTDirEntry ARGS3(
 	CONST char *,	entry)
 {
     char * relative = NULL;
+    char * stripped = NULL;
     char * escaped = NULL;
     int len;
 
-    if (0 == strcmp(entry,"../")) {
-	/*
-	**  Undo slash appending for anchor creation.
-	*/
-	StrAllocCopy(escaped,"..");
-    } else {
-	escaped = HTEscape(entry, URL_XPALPHAS);
+    StrAllocCopy(escaped, entry);
+    LYTrimPathSep(escaped);
+    if (strcmp(escaped, "..") != 0) {
+	stripped = escaped;
+	escaped = HTEscape(stripped, URL_XPALPHAS);
 	if (((len = strlen(escaped)) > 2) &&
 	    escaped[(len - 3)] == '%' &&
 	    escaped[(len - 2)] == '2' &&
@@ -1353,6 +1353,7 @@ PUBLIC void HTDirEntry ARGS3(
 	HTStartAnchor(target, NULL, relative);
 	FREE(relative);
     }
+    FREE(stripped);
     FREE(escaped);
 }
 
@@ -1632,7 +1633,10 @@ PRIVATE void do_readme ARGS2(HTStructured *, target, CONST char *, localname)
 
 PRIVATE char *file_type ARGS1(char *, path)
 {
-    char *type = strchr(path, '.');
+    char *type;
+    while (*path == '.')
+	++path;
+    type = strchr(path, '.');
     if (type == NULL)
 	type = "";
     return type;
@@ -1672,6 +1676,13 @@ PRIVATE int dired_cmp ARGS2(void *, a, void *, b)
 #endif /* LONG_LIST */
     if (code == 0)
 	code = AS_cmp(p->file_name, q->file_name);
+#if 0
+    CTRACE((tfp, "dired_cmp(%d) ->%d\n\t%c:%s (%s)\n\t%c:%s (%s)\n",
+	    dir_list_order,
+	    code,
+	    p->sort_tags, p->file_name, file_type(p->file_name),
+	    q->sort_tags, q->file_name, file_type(q->file_name)));
+#endif
     return code;
 }