--- Server/server.c 2024/10/17 09:53:39 1.1
+++ Server/server.c 2024/10/20 20:23:51 1.4
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.1 2024/10/17 09:53:39 nishi Exp $ */
+/* $Id: server.c,v 1.4 2024/10/20 20:23:51 nishi Exp $ */
#define SOURCE
@@ -107,7 +107,7 @@ uint16_t htons(uint16_t n) { return ((n
#endif
#endif
-#if defined(_PSP) || defined(__ps2sdk__)
+#if defined(_PSP) || defined(__ps2sdk__) || defined(__bsdi__)
#include "strptime.h"
#endif
@@ -620,7 +620,7 @@ int tw_server_pass(void* ptr) {
time_t t;
struct tm* btm;
strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm);
-#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__USLC__) || defined(__NeXT__)
+#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__USLC__) || defined(__NeXT__) || defined(__bsdi__)
t = 0;
btm = localtime(&t);
cmtime = mktime(&tm);
@@ -791,6 +791,7 @@ int tw_server_pass(void* ptr) {
addstring(&str, "
\n");
addstring(&str, " | \n");
addstring(&str, " Filename | \n");
+ addstring(&str, " Last-modified | \n");
addstring(&str, " MIME | \n");
addstring(&str, " Size | \n");
addstring(&str, "
\n");
@@ -808,10 +809,14 @@ int tw_server_pass(void* ptr) {
char* fpth = cm_strcat3(path, "/", items[i]);
struct stat s;
char size[512];
+ char date[512];
char* showmime;
char* mime;
+ struct tm* tm;
size[0] = 0;
stat(fpth, &s);
+ tm = localtime(&s.st_mtime);
+ strftime(date, 512, "%a, %d %b %Y %H:%M:%S %Z", tm);
if(phase == 0 && !S_ISDIR(s.st_mode)) {
free(fpth);
continue;
@@ -885,6 +890,7 @@ int tw_server_pass(void* ptr) {
addstring(&str, "\n");
addstring(&str, " | \n", icon);
addstring(&str, " %h | \n", items[i], itm);
+ addstring(&str, " %h | \n", date);
addstring(&str, " %h | \n", showmime);
addstring(&str, " %s | \n", size);
addstring(&str, "
\n");
@@ -1013,7 +1019,7 @@ void tw_server_loop(void) {
fd_set fdset;
struct timeval tv;
#endif
-#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__NETWARE__))
+#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__NETWARE__) && !defined(__DOS__))
struct thread_entry threads[2048];
for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) {
threads[i].used = false;