ben 98/02/08 10:50:52
Modified: src CHANGES
src/os/win32 util_win32.c
Log:
Support extensionless CGIs.
Submitted by: Sam Robb <[EMAIL PROTECTED]>
Revision Changes Path
1.622 +4 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.621
retrieving revision 1.622
diff -u -r1.621 -r1.622
--- CHANGES 1998/02/08 18:15:58 1.621
+++ CHANGES 1998/02/08 18:50:49 1.622
@@ -1,5 +1,9 @@
Changes with Apache 1.3b5
+ *) WIN32: Append a '.' to extensionless executables in spawn[lv]e*
+ replacements, which makes them work.
+ [Sam Robb <[EMAIL PROTECTED]>, Ben Laurie]
+
*) Sort out problems with canonical filename handling happening too late.
[Dean Gaudet, Ben Laurie]
1.8 +26 -4 apache-1.3/src/os/win32/util_win32.c
Index: util_win32.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/os/win32/util_win32.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- util_win32.c 1997/12/26 15:29:40 1.7
+++ util_win32.c 1998/02/08 18:50:51 1.8
@@ -85,10 +85,11 @@
return stat(szPath, pStat);
}
-/* Fix two really crap problems with Win32 spawn[lv]e*:
+/* Fix three really crap problems with Win32 spawn[lv]e*:
*
* 1. Win32 doesn't deal with spaces in argv.
* 2. Win95 doesn't like / in cmdname.
+ * 3. Win32 wants a '.' appended to extensionless files.
*/
#undef _spawnv
@@ -99,13 +100,20 @@
const char *szArg;
char *szCmd;
char *s;
+ int len=strlen(cmdname);
- szCmd = _alloca(strlen(cmdname)+1);
+ szCmd = _alloca(len+2);
strcpy(szCmd, cmdname);
for (s = szCmd; *s; ++s)
if (*s == '/')
*s = '\\';
+ s = strrchr(szCmd, '.');
+ if (!s || s < strrchr(szCmd, '\\')) {
+ szCmd[len] = '.';
+ szCmd[len+1] = '\0';
+ }
+
for (n=0; argv[n]; ++n)
;
@@ -138,13 +146,20 @@
const char *szArg;
char *szCmd;
char *s;
+ int len=strlen(cmdname);
- szCmd = _alloca(strlen(cmdname)+1);
+ szCmd = _alloca(len+2);
strcpy(szCmd, cmdname);
for (s = szCmd; *s; ++s)
if (*s == '/')
*s = '\\';
+ s = strrchr(szCmd, '.');
+ if (!s || s < strrchr(szCmd, '\\')) {
+ szCmd[len] = '.';
+ szCmd[len+1] = '\0';
+ }
+
for (n = 0; argv[n] ; ++n)
;
@@ -178,12 +193,19 @@
const char *const *aszEnv;
char *szCmd;
char *s;
+ int len=strlen(cmdname);
- szCmd = _alloca(strlen(cmdname)+1);
+ szCmd = _alloca(len+2);
strcpy(szCmd, cmdname);
for (s = szCmd; *s; ++s)
if(*s == '/')
*s = '\\';
+
+ s = strrchr(szCmd, '.');
+ if (!s || s < strrchr(szCmd, '\\')) {
+ szCmd[len] = '.';
+ szCmd[len+1] = '\0';
+ }
va_start(vlist, cmdname);
for (n = 0; va_arg(vlist, const char *); ++n)