ben 97/10/21 02:12:15
Modified: src/main conf.h
src/os/win32 os.h util_win32.c
Log:
Work around buggy stat() implementation on Win95.
Revision Changes Path
1.148 +4 -1 apachen/src/main/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/conf.h,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -r1.147 -r1.148
--- conf.h 1997/10/07 05:53:39 1.147
+++ conf.h 1997/10/21 09:12:11 1.148
@@ -56,6 +56,10 @@
*/
+/* Have to include sys/stat.h before ../os/win32/os.h so we can override
+stat() properly */
+#include <sys/stat.h>
+
#ifdef WIN32
#include "../os/win32/os.h"
#else
@@ -713,7 +717,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
#include <ctype.h>
#if !defined(MPE) && !defined(WIN32)
#include <sys/file.h>
1.6 +2 -0 apachen/src/os/win32/os.h
Index: os.h
===================================================================
RCS file: /export/home/cvs/apachen/src/os/win32/os.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- os.h 1997/09/14 14:20:47 1.5
+++ os.h 1997/10/21 09:12:13 1.6
@@ -80,3 +80,5 @@
return file && (file[0] == '/' || file[1] == ':');
}
+#define stat(f,ps) os_stat(f,ps)
+API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat);
1.2 +25 -0 apachen/src/os/win32/util_win32.c
Index: util_win32.c
===================================================================
RCS file: /export/home/cvs/apachen/src/os/win32/util_win32.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- util_win32.c 1997/08/18 10:59:06 1.1
+++ util_win32.c 1997/10/21 09:12:14 1.2
@@ -1,5 +1,6 @@
#include <windows.h>
#include <assert.h>
+#include <sys/stat.h>
#include "httpd.h"
@@ -60,4 +61,28 @@
sub_canonical_filename(buf,szFile);
strlwr(buf);
return pstrdup(pPool,buf);
+}
+
+/*
+Win95 doesn't like trailing /s. NT and Unix don't mind. This works around
+the problem
+*/
+
+#undef stat
+API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat)
+{
+ int n;
+
+ n=strlen(szPath);
+ if(szPath[n-1] == '\\' || szPath[n-1] == '/')
+ {
+ char buf[_MAX_PATH];
+
+ ap_assert(n < _MAX_PATH);
+ strcpy(buf,szPath);
+ buf[n-1]='\0';
+
+ return stat(buf,pStat);
+ }
+ return stat(szPath,pStat);
}