ben 97/08/18 03:59:06
Modified: src ApacheCore.dsp ApacheCore.mak
src/core conf.h http_request.c httpd.h
Added: src/os/win32 util_win32.c
Log:
First crack at Win32 filename canonicalisation. Needs work!
Revision Changes Path
1.6 +4 -0 apachen/src/ApacheCore.dsp
Index: ApacheCore.dsp
===================================================================
RCS file: /export/home/cvs/apachen/src/ApacheCore.dsp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ApacheCore.dsp 1997/08/13 08:37:13 1.5
+++ ApacheCore.dsp 1997/08/18 10:59:01 1.6
@@ -253,6 +253,10 @@
# End Source File
# Begin Source File
+SOURCE=.\os\win32\util_nt.c
+# End Source File
+# Begin Source File
+
SOURCE=.\core\util_script.c
# End Source File
# Begin Source File
1.12 +61 -164 apachen/src/ApacheCore.mak
Index: ApacheCore.mak
===================================================================
RCS file: /export/home/cvs/apachen/src/ApacheCore.mak,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ApacheCore.mak 1997/08/13 08:37:14 1.11
+++ ApacheCore.mak 1997/08/18 10:59:02 1.12
@@ -92,6 +92,7 @@
[EMAIL PROTECTED] "$(INTDIR)\util_md5.obj"
[EMAIL PROTECTED] "$(INTDIR)\util_script.obj"
[EMAIL PROTECTED] "$(INTDIR)\util_snprintf.obj"
+ [EMAIL PROTECTED] "$(INTDIR)\util_win32.obj"
[EMAIL PROTECTED] "$(INTDIR)\vc50.idb"
[EMAIL PROTECTED] "$(OUTDIR)\ApacheCore.dll"
[EMAIL PROTECTED] "$(OUTDIR)\ApacheCore.exp"
@@ -160,7 +161,8 @@
"$(INTDIR)\util_date.obj" \
"$(INTDIR)\util_md5.obj" \
"$(INTDIR)\util_script.obj" \
- "$(INTDIR)\util_snprintf.obj"
+ "$(INTDIR)\util_snprintf.obj" \
+ "$(INTDIR)\util_win32.obj"
"$(OUTDIR)\ApacheCore.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
@@ -268,6 +270,8 @@
[EMAIL PROTECTED] "$(INTDIR)\util_script.sbr"
[EMAIL PROTECTED] "$(INTDIR)\util_snprintf.obj"
[EMAIL PROTECTED] "$(INTDIR)\util_snprintf.sbr"
+ [EMAIL PROTECTED] "$(INTDIR)\util_win32.obj"
+ [EMAIL PROTECTED] "$(INTDIR)\util_win32.sbr"
[EMAIL PROTECTED] "$(INTDIR)\vc50.idb"
[EMAIL PROTECTED] "$(INTDIR)\vc50.pdb"
[EMAIL PROTECTED] "$(OUTDIR)\ApacheCore.bsc"
@@ -329,7 +333,8 @@
"$(INTDIR)\util_date.sbr" \
"$(INTDIR)\util_md5.sbr" \
"$(INTDIR)\util_script.sbr" \
- "$(INTDIR)\util_snprintf.sbr"
+ "$(INTDIR)\util_snprintf.sbr" \
+ "$(INTDIR)\util_win32.sbr"
"$(OUTDIR)\ApacheCore.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
@@ -386,7 +391,8 @@
"$(INTDIR)\util_date.obj" \
"$(INTDIR)\util_md5.obj" \
"$(INTDIR)\util_script.obj" \
- "$(INTDIR)\util_snprintf.obj"
+ "$(INTDIR)\util_snprintf.obj" \
+ "$(INTDIR)\util_win32.obj"
"$(OUTDIR)\ApacheCore.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
@@ -961,11 +967,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_A=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_access.obj" "$(INTDIR)\mod_access.sbr" : $(SOURCE)\
@@ -1015,11 +1016,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_AC=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_actions.obj" "$(INTDIR)\mod_actions.sbr" : $(SOURCE)\
@@ -1057,11 +1053,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_AL=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_alias.obj" "$(INTDIR)\mod_alias.sbr" : $(SOURCE)\
@@ -1109,11 +1100,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_AS=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_asis.obj" "$(INTDIR)\mod_asis.sbr" : $(SOURCE)
$(DEP_CPP_MOD_AS)\
@@ -1157,11 +1143,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_AU=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_auth.obj" "$(INTDIR)\mod_auth.sbr" : $(SOURCE)
$(DEP_CPP_MOD_AU)\
@@ -1211,11 +1192,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_AUT=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_autoindex.obj" "$(INTDIR)\mod_autoindex.sbr" :
$(SOURCE)\
@@ -1267,11 +1243,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_C=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_cgi.obj" "$(INTDIR)\mod_cgi.sbr" : $(SOURCE)
$(DEP_CPP_MOD_C)\
@@ -1321,11 +1292,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_D=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_dir.obj" "$(INTDIR)\mod_dir.sbr" : $(SOURCE)
$(DEP_CPP_MOD_D)\
@@ -1363,11 +1329,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_DL=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_dll.obj" "$(INTDIR)\mod_dll.sbr" : $(SOURCE)
$(DEP_CPP_MOD_DL)\
@@ -1405,11 +1366,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_E=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_env.obj" "$(INTDIR)\mod_env.sbr" : $(SOURCE)
$(DEP_CPP_MOD_E)\
@@ -1459,11 +1415,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_I=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_imap.obj" "$(INTDIR)\mod_imap.sbr" : $(SOURCE)
$(DEP_CPP_MOD_I)\
@@ -1513,13 +1464,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_IN=\
- ".\core\sfio.h"\
- ".\modules\standard\config.h"\
- ".\modules\standard\modules\perl\mod_perl.h"\
"$(INTDIR)\mod_include.obj" "$(INTDIR)\mod_include.sbr" : $(SOURCE)\
@@ -1567,11 +1511,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_IS=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_isapi.obj" "$(INTDIR)\mod_isapi.sbr" : $(SOURCE)\
@@ -1611,11 +1550,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_L=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_log_config.obj" "$(INTDIR)\mod_log_config.sbr" :
$(SOURCE)\
@@ -1655,11 +1589,6 @@
".\modules\standard\mod_mime.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_M=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_mime.obj" "$(INTDIR)\mod_mime.sbr" : $(SOURCE)
$(DEP_CPP_MOD_M)\
@@ -1705,11 +1634,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_N=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_negotiation.obj" "$(INTDIR)\mod_negotiation.sbr" :
$(SOURCE)\
@@ -1751,11 +1675,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_S=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_setenvif.obj" "$(INTDIR)\mod_setenvif.sbr" : $(SOURCE)\
@@ -1793,11 +1712,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MOD_U=\
- ".\core\sfio.h"\
"$(INTDIR)\mod_userdir.obj" "$(INTDIR)\mod_userdir.sbr" : $(SOURCE)\
@@ -1835,11 +1749,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_MODUL=\
- ".\core\sfio.h"\
"$(INTDIR)\modules.obj" "$(INTDIR)\modules.sbr" : $(SOURCE)
$(DEP_CPP_MODUL)\
@@ -1850,28 +1759,21 @@
!ENDIF
SOURCE=.\os\win32\multithread.c
-
-!IF "$(CFG)" == "ApacheCore - Win32 Release"
-
DEP_CPP_MULTI=\
".\core\conf.h"\
".\core\multithread.h"\
".\regex\regex.h"\
+!IF "$(CFG)" == "ApacheCore - Win32 Release"
+
+
"$(INTDIR)\multithread.obj" : $(SOURCE) $(DEP_CPP_MULTI) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "ApacheCore - Win32 Debug"
-DEP_CPP_MULTI=\
- ".\core\conf.h"\
- ".\core\multithread.h"\
- ".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
"$(INTDIR)\multithread.obj" "$(INTDIR)\multithread.sbr" : $(SOURCE)\
$(DEP_CPP_MULTI) "$(INTDIR)"
@@ -1881,23 +1783,19 @@
!ENDIF
SOURCE=.\os\win32\readdir.c
-
-!IF "$(CFG)" == "ApacheCore - Win32 Release"
-
DEP_CPP_READD=\
".\os\win32\readdir.h"\
+!IF "$(CFG)" == "ApacheCore - Win32 Release"
+
+
"$(INTDIR)\readdir.obj" : $(SOURCE) $(DEP_CPP_READD) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "ApacheCore - Win32 Debug"
-DEP_CPP_READD=\
- ".\os\win32\readdir.h"\
- {$(INCLUDE)}"sys\types.h"\
-
"$(INTDIR)\readdir.obj" "$(INTDIR)\readdir.sbr" : $(SOURCE)
$(DEP_CPP_READD)\
"$(INTDIR)"
@@ -1938,11 +1836,6 @@
".\core\rfc1413.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_RFC14=\
- ".\core\sfio.h"\
"$(INTDIR)\rfc1413.obj" "$(INTDIR)\rfc1413.sbr" : $(SOURCE)
$(DEP_CPP_RFC14)\
@@ -1953,9 +1846,6 @@
!ENDIF
SOURCE=.\os\win32\service.c
-
-!IF "$(CFG)" == "ApacheCore - Win32 Release"
-
DEP_CPP_SERVI=\
".\core\conf.h"\
".\core\multithread.h"\
@@ -1963,20 +1853,15 @@
".\regex\regex.h"\
+!IF "$(CFG)" == "ApacheCore - Win32 Release"
+
+
"$(INTDIR)\service.obj" : $(SOURCE) $(DEP_CPP_SERVI) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "ApacheCore - Win32 Debug"
-DEP_CPP_SERVI=\
- ".\core\conf.h"\
- ".\core\multithread.h"\
- ".\os\win32\service.h"\
- ".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
"$(INTDIR)\service.obj" "$(INTDIR)\service.sbr" : $(SOURCE)
$(DEP_CPP_SERVI)\
"$(INTDIR)"
@@ -2013,11 +1898,6 @@
".\core\httpd.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_UTIL_=\
- ".\core\sfio.h"\
"$(INTDIR)\util.obj" "$(INTDIR)\util.sbr" : $(SOURCE) $(DEP_CPP_UTIL_)\
@@ -2028,28 +1908,21 @@
!ENDIF
SOURCE=.\core\util_date.c
-
-!IF "$(CFG)" == "ApacheCore - Win32 Release"
-
DEP_CPP_UTIL_D=\
".\core\conf.h"\
".\core\util_date.h"\
".\regex\regex.h"\
+!IF "$(CFG)" == "ApacheCore - Win32 Release"
+
+
"$(INTDIR)\util_date.obj" : $(SOURCE) $(DEP_CPP_UTIL_D) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "ApacheCore - Win32 Debug"
-DEP_CPP_UTIL_D=\
- ".\core\conf.h"\
- ".\core\util_date.h"\
- ".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
"$(INTDIR)\util_date.obj" "$(INTDIR)\util_date.sbr" : $(SOURCE)\
$(DEP_CPP_UTIL_D) "$(INTDIR)"
@@ -2088,11 +1961,6 @@
".\core\util_md5.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_UTIL_M=\
- ".\core\sfio.h"\
"$(INTDIR)\util_md5.obj" "$(INTDIR)\util_md5.sbr" : $(SOURCE)
$(DEP_CPP_UTIL_M)\
@@ -2144,11 +2012,6 @@
".\core\util_script.h"\
".\os\win32\readdir.h"\
".\regex\regex.h"\
- {$(INCLUDE)}"sys\stat.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-NODEP_CPP_UTIL_S=\
- ".\core\sfio.h"\
"$(INTDIR)\util_script.obj" "$(INTDIR)\util_script.sbr" : $(SOURCE)\
@@ -2159,29 +2022,63 @@
!ENDIF
SOURCE=.\core\util_snprintf.c
-
-!IF "$(CFG)" == "ApacheCore - Win32 Release"
-
DEP_CPP_UTIL_SN=\
".\core\conf.h"\
".\regex\regex.h"\
+!IF "$(CFG)" == "ApacheCore - Win32 Release"
+
+
"$(INTDIR)\util_snprintf.obj" : $(SOURCE) $(DEP_CPP_UTIL_SN) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ELSEIF "$(CFG)" == "ApacheCore - Win32 Debug"
-DEP_CPP_UTIL_SN=\
+
+"$(INTDIR)\util_snprintf.obj" "$(INTDIR)\util_snprintf.sbr" :
$(SOURCE)\
+ $(DEP_CPP_UTIL_SN) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF
+
+SOURCE=.\os\win32\util_win32.c
+
+!IF "$(CFG)" == "ApacheCore - Win32 Release"
+
+DEP_CPP_UTIL_W=\
+ ".\core\alloc.h"\
+ ".\core\buff.h"\
".\core\conf.h"\
+ ".\core\httpd.h"\
+ ".\os\win32\readdir.h"\
".\regex\regex.h"\
{$(INCLUDE)}"sys\stat.h"\
{$(INCLUDE)}"sys\types.h"\
+NODEP_CPP_UTIL_W=\
+ ".\core\sfio.h"\
+
-"$(INTDIR)\util_snprintf.obj" "$(INTDIR)\util_snprintf.sbr" :
$(SOURCE)\
- $(DEP_CPP_UTIL_SN) "$(INTDIR)"
+"$(INTDIR)\util_win32.obj" : $(SOURCE) $(DEP_CPP_UTIL_W) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "ApacheCore - Win32 Debug"
+
+DEP_CPP_UTIL_W=\
+ ".\core\alloc.h"\
+ ".\core\buff.h"\
+ ".\core\conf.h"\
+ ".\core\httpd.h"\
+ ".\os\win32\readdir.h"\
+ ".\regex\regex.h"\
+
+
+"$(INTDIR)\util_win32.obj" "$(INTDIR)\util_win32.sbr" : $(SOURCE)\
+ $(DEP_CPP_UTIL_W) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
1.126 +1 -0 apachen/src/core/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apachen/src/core/conf.h,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- conf.h 1997/08/18 07:19:34 1.125
+++ conf.h 1997/08/18 10:59:03 1.126
@@ -574,6 +574,7 @@
#define USE_LONGJMP
#define HAVE_MMAP
#define MULTITHREAD
+#define HAVE_CANONICAL_FILENAME
typedef int uid_t;
typedef int gid_t;
typedef int pid_t;
1.77 +5 -1 apachen/src/core/http_request.c
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apachen/src/core/http_request.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- http_request.c 1997/08/18 07:17:26 1.76
+++ http_request.c 1997/08/18 10:59:04 1.77
@@ -249,7 +249,7 @@
void *per_dir_defaults = r->server->lookup_defaults;
void **sec = (void **)sconf->sec->elts;
int num_sec = sconf->sec->nelts;
- char *test_filename = pstrdup (r->pool, r->filename);
+ char *test_filename;
char *test_dirname;
int res;
unsigned i,num_dirs;
@@ -268,6 +268,10 @@
return OK;
}
+
+ /* FIX ME: this is disgusting - Ben */
+ r->filename = os_canonical_filename(r->pool, r->filename);
+ test_filename = pstrdup(r->pool, r->filename);
/* Go down the directory hierarchy. Where we have to check for symlinks,
* do so. Where a .htaccess file has permission to override anything,
1.140 +6 -0 apachen/src/core/httpd.h
Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apachen/src/core/httpd.h,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- httpd.h 1997/08/17 11:40:13 1.139
+++ httpd.h 1997/08/18 10:59:04 1.140
@@ -830,6 +830,12 @@
API_EXPORT(int) is_directory(const char *name);
API_EXPORT(int) can_exec(const struct stat *);
API_EXPORT(void) chdir_file(const char *file);
+
+#ifndef HAVE_CANONICAL_FILENAME
+#define os_canonical_filename(p,f) pstrdup(p,f)
+#endif
+
+API_EXPORT(char *)os_canonical_filename(pool *p,const char *file);
char *get_local_host(pool *);
unsigned long get_virthost_addr (const char *hostname, unsigned short *port);
1.1 apachen/src/os/win32/util_win32.c
Index: util_win32.c
===================================================================
#include <windows.h>
#include <assert.h>
#include "httpd.h"
static void sub_canonical_filename(char *szCanon,const char *szFile)
{
char buf[_MAX_PATH];
int n;
char *szFilePart;
WIN32_FIND_DATA d;
HANDLE h;
n=GetFullPathName(szFile,sizeof buf,buf,&szFilePart);
assert(n);
assert(n < sizeof buf);
if(!strchr(buf,'*') && !strchr(buf,'?'))
{
h=FindFirstFile(buf,&d);
if(h != INVALID_HANDLE_VALUE)
FindClose(h);
}
else
h=INVALID_HANDLE_VALUE;
if(szFilePart < buf+3)
{
strcpy(szCanon,buf);
szCanon[2]='/';
return;
}
if(szFilePart != buf+3)
{
char b2[_MAX_PATH];
assert(szFilePart > buf+3);
szFilePart[-1]='\0';
sub_canonical_filename(b2,buf);
strcpy(szCanon,b2);
strcat(szCanon,"/");
}
else
{
strcpy(szCanon,buf);
szCanon[2]='/';
szCanon[3]='\0';
}
if(h == INVALID_HANDLE_VALUE)
strcat(szCanon,szFilePart);
else
strcat(szCanon,d.cFileName);
}
API_EXPORT(char *) os_canonical_filename(pool *pPool,const char *szFile)
{
char buf[_MAX_PATH];
sub_canonical_filename(buf,szFile);
strlwr(buf);
return pstrdup(pPool,buf);
}