about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTFile.c
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation/HTFile.c')
-rw-r--r--WWW/Library/Implementation/HTFile.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 1c419daa..5991ca7d 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -154,7 +154,7 @@ PRIVATE void free_suffixes NOPARAMS;
 PRIVATE char *FormatStr ARGS3(
     char **,	bufp,
     char *,	start,
-    char *,	entry)
+    CONST char *,	entry)
 {
     char fmt[512];
     if (*start) {
@@ -218,7 +218,7 @@ PRIVATE void LYListFmtParse ARGS5(
 #endif
 
 	if (lstat(file, &st) < 0)
-		fmtstr = "%a";	/* can't stat so just do anchor */
+		fmtstr = "    %a";	/* can't stat so just do anchor */
 
 	StrAllocCopy(str, fmtstr);
 	s = str;
@@ -251,7 +251,7 @@ PRIVATE void LYListFmtParse ARGS5(
 
 		switch (c) {
 		case '\0':
-		        PUTS(start);
+			PUTS(start);
 			continue;
 
 		case 'A':
@@ -271,6 +271,37 @@ PRIVATE void LYListFmtParse ARGS5(
 #endif
 			break;
 
+		case 'T':	/* MIME type */
+		case 't':	/* MIME type description */
+		    if (S_ISDIR(st.st_mode)) {
+			if (c != 'T') {
+			    FormatStr(&buf, start, ENTRY_IS_DIRECTORY);
+			} else {
+			    FormatStr(&buf, start, "");
+			}
+		    } else {
+			CONST char *cp2;
+			HTFormat format;
+			format = HTFileFormat(file, NULL, &cp2);
+
+			if (c != 'T') {
+			    if (cp2 == NULL) {
+				if (!strncmp(HTAtom_name(format),
+					     "application",11)) {
+				    cp2 = HTAtom_name(format) + 12;
+				    if (!strncmp(cp2,"x-",2))
+					cp2 += 2;
+				} else {
+				    cp2 = HTAtom_name(format);
+				}
+			    }
+			    FormatStr(&buf, start, cp2);
+			} else {
+			    FormatStr(&buf, start, HTAtom_name(format));
+			}
+		    }
+		    break;
+
 		case 'd':	/* date */
 			now = time(0);
 			datestr = ctime(&st.st_mtime);
@@ -593,7 +624,7 @@ PUBLIC char * HTnameOfFile_WWW ARGS3(
     char * result = NULL;
 
     if (expand_all)
-    	HTUnEscape(path);		/* Interpret all % signs */
+	HTUnEscape(path);		/* Interpret all % signs */
     else
 	HTUnEscapeSome(path, "/");	/* Interpret % signs for path delims */
 
@@ -2139,7 +2170,7 @@ PUBLIC int HTLoadFile ARGS4(
 				    if (dir_list_style != MIXED_STYLE) {
 				       START(HTML_EM);
 				       PUTS(state == 'D'
-				          ? LABEL_SUBDIRECTORIES
+					  ? LABEL_SUBDIRECTORIES
 					  : LABEL_FILES);
 				       END(HTML_EM);
 				    }
@@ -2161,7 +2192,7 @@ PUBLIC int HTLoadFile ARGS4(
 				    START(HTML_H2);
 				    START(HTML_EM);
 				    PUTS(state == 'D'
-				        ? LABEL_SUBDIRECTORIES
+					? LABEL_SUBDIRECTORIES
 					: LABEL_FILES);
 				    END(HTML_EM);
 				    END(HTML_H2);
='alt'>
efdc7b16 ^
f597489c ^


efdc7b16 ^

a8f9cf2c ^

efdc7b16 ^






f597489c ^
efdc7b16 ^




23905709 ^
efdc7b16 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92