Subversion Repositories Tewi

Rev

Rev 384 | Rev 392 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 384 Rev 389
Line 1... Line 1...
1
/* $Id: server.c 384 2024-10-17 10:30:28Z nishi $ */
1
/* $Id: server.c 389 2024-10-20 20:23:36Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "../config.h"
5
#include "../config.h"
6
 
6
 
Line 789... Line 789...
789
							addstring(&str, "		<hr>\n");
789
							addstring(&str, "		<hr>\n");
790
							addstring(&str, "		<table border=\"0\">\n");
790
							addstring(&str, "		<table border=\"0\">\n");
791
							addstring(&str, "			<tr>\n");
791
							addstring(&str, "			<tr>\n");
792
							addstring(&str, "				<th></th>\n");
792
							addstring(&str, "				<th></th>\n");
793
							addstring(&str, "				<th>Filename</th>\n");
793
							addstring(&str, "				<th>Filename</th>\n");
-
 
794
							addstring(&str, "				<th>Last-modified</th>\n");
794
							addstring(&str, "				<th>MIME</th>\n");
795
							addstring(&str, "				<th>MIME</th>\n");
795
							addstring(&str, "				<th>Size</th>\n");
796
							addstring(&str, "				<th>Size</th>\n");
796
							addstring(&str, "			</tr>\n");
797
							addstring(&str, "			</tr>\n");
797
							readme = -1;
798
							readme = -1;
798
							readmes = vhost_entry->readme_count == 0 ? config.root.readmes : vhost_entry->readmes;
799
							readmes = vhost_entry->readme_count == 0 ? config.root.readmes : vhost_entry->readmes;
Line 806... Line 807...
806
									char* itm;
807
									char* itm;
807
									char* icon;
808
									char* icon;
808
									char* fpth = cm_strcat3(path, "/", items[i]);
809
									char* fpth = cm_strcat3(path, "/", items[i]);
809
									struct stat s;
810
									struct stat s;
810
									char size[512];
811
									char size[512];
-
 
812
									char date[512];
811
									char* showmime;
813
									char* showmime;
812
									char* mime;
814
									char* mime;
-
 
815
									struct tm* tm;
813
									size[0] = 0;
816
									size[0] = 0;
814
									stat(fpth, &s);
817
									stat(fpth, &s);
-
 
818
									tm = localtime(&s.st_mtime);
-
 
819
									strftime(date, 512, "%a, %d %b %Y %H:%M:%S %Z", tm);
815
									if(phase == 0 && !S_ISDIR(s.st_mode)) {
820
									if(phase == 0 && !S_ISDIR(s.st_mode)) {
816
										free(fpth);
821
										free(fpth);
817
										continue;
822
										continue;
818
									} else if(phase == 1 && S_ISDIR(s.st_mode)) {
823
									} else if(phase == 1 && S_ISDIR(s.st_mode)) {
819
										free(fpth);
824
										free(fpth);
Line 883... Line 888...
883
										}
888
										}
884
									}
889
									}
885
									addstring(&str, "<tr>\n");
890
									addstring(&str, "<tr>\n");
886
									addstring(&str, "	<td><img src=\"%s\" alt=\"icon\"></td>\n", icon);
891
									addstring(&str, "	<td><img src=\"%s\" alt=\"icon\"></td>\n", icon);
887
									addstring(&str, "	<td><a href=\"%l\"><code>%h</code></a></td>\n", items[i], itm);
892
									addstring(&str, "	<td><a href=\"%l\"><code>%h</code></a></td>\n", items[i], itm);
-
 
893
									addstring(&str, "	<td><code>  %h  </code></td>\n", date);
888
									addstring(&str, "	<td><code>  %h  </code></td>\n", showmime);
894
									addstring(&str, "	<td><code>  %h  </code></td>\n", showmime);
889
									addstring(&str, "	<td><code>  %s  </code></td>\n", size);
895
									addstring(&str, "	<td><code>  %s  </code></td>\n", size);
890
									addstring(&str, "</tr>\n");
896
									addstring(&str, "</tr>\n");
891
									free(itm);
897
									free(itm);
892
								}
898
								}