You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Havard <br...@kheldar.apana.org.au> on 1999/02/14 06:34:40 UTC

[PATCH] Use HAVE_DRIVE_LETTERS define instead of OS2 || WIN32

With Ben and Paul's approval and no objections I've added a 
HAVE_DRIVE_LETTERS define and put it to work where appropriate.

As nobody's committed my previous patch for UserDirs it is also included 
(it was related anyway).

I had to remove use of the Win32 BOOL/TRUE/FALSE in one function. And yes,
OS/2 supports UNC paths too.


Index: main/http_core.c
===================================================================
RCS file: /cvs/apache-1.3/src/main/http_core.c,v
retrieving revision 1.249
diff -u -r1.249 http_core.c
--- http_core.c	1999/02/09 20:20:26	1.249
+++ http_core.c	1999/02/14 04:08:14
@@ -348,7 +348,7 @@
  * See directory_walk().
  */
 
-#if defined(OS2) || defined(WIN32)
+#ifdef HAVE_DRIVE_LETTERS
 #define IS_SPECIAL(entry_core)	\
     ((entry_core)->r != NULL \
 	|| ((entry_core)->d[0] != '/' && (entry_core)->d[1] != ':'))
Index: main/http_request.c
===================================================================
RCS file: /cvs/apache-1.3/src/main/http_request.c,v
retrieving revision 1.144
diff -u -r1.144 http_request.c
--- http_request.c	1999/01/09 21:37:56	1.144
+++ http_request.c	1999/02/14 04:09:07
@@ -178,8 +178,8 @@
     char *end = &path[strlen(path)];
     char *last_cp = NULL;
     int rv;
-#ifdef WIN32
-    BOOL bStripSlash=TRUE;
+#ifdef HAVE_DRIVE_LETTERS
+    char bStripSlash=1;
 #endif
 
     if (r->finfo.st_mode) {
@@ -187,12 +187,12 @@
 	return OK;
     }
 
-#ifdef WIN32
+#ifdef HAVE_DRIVE_LETTERS
     /* If the directory is x:\, then we don't want to strip
      * the trailing slash since x: is not a valid directory.
      */
     if (strlen(path) == 3 && path[1] == ':' && path[2] == '/')
-        bStripSlash = FALSE;
+        bStripSlash = 0;
 
 
     /* If UNC name == //machine/share/, do not 
@@ -211,7 +211,7 @@
         }
     
         if (iCount == 4)
-            bStripSlash = FALSE;
+            bStripSlash = 0;
     }
 
     if (bStripSlash)
Index: modules/standard/mod_include.c
===================================================================
RCS file: /cvs/apache-1.3/src/modules/standard/mod_include.c,v
retrieving revision 1.110
diff -u -r1.110 mod_include.c
--- mod_include.c	1999/01/01 19:05:09	1.110
+++ mod_include.c	1999/02/14 04:09:12
@@ -628,7 +628,7 @@
  */
 static int is_only_below(const char *path)
 {
-#if WIN32
+#ifdef HAVE_DRIVE_LETTERS
     if (path[1] == ':')
 	return 0;
 #endif
Index: modules/standard/mod_userdir.c
===================================================================
RCS file: /cvs/apache-1.3/src/modules/standard/mod_userdir.c,v
retrieving revision 1.38
diff -u -r1.38 mod_userdir.c
--- mod_userdir.c	1999/01/01 19:05:15	1.38
+++ mod_userdir.c	1999/02/14 04:09:14
@@ -262,7 +262,7 @@
 
 	if (userdir[0] == '\0' || ap_os_is_path_absolute(userdir)) {
             if (x) {
-#ifdef WIN32
+#ifdef HAVE_DRIVE_LETTERS
                 /*
                  * Crummy hack. Need to figure out whether we have been
                  * redirected to a URL or to a file on some drive. Since I
Index: os/os2/os.h
===================================================================
RCS file: /cvs/apache-1.3/src/os/os2/os.h,v
retrieving revision 1.11
diff -u -r1.11 os.h
--- os.h	1999/01/08 23:46:44	1.11
+++ os.h	1999/02/14 04:09:14
@@ -3,6 +3,7 @@
 
 #define PLATFORM "OS/2"
 #define HAVE_CANONICAL_FILENAME
+#define HAVE_DRIVE_LETTERS
 
 /*
  * This file in included in all Apache source code. It contains definitions
Index: os/win32/os.h
===================================================================
RCS file: /cvs/apache-1.3/src/os/win32/os.h,v
retrieving revision 1.27
diff -u -r1.27 os.h
--- os.h	1999/01/08 23:46:47	1.27
+++ os.h	1999/02/14 04:09:15
@@ -34,6 +34,7 @@
 #define USE_MMAP_SCOREBOARD
 #define MULTITHREAD
 #define HAVE_CANONICAL_FILENAME
+#define HAVE_DRIVE_LETTERS
 typedef int uid_t;
 typedef int gid_t;
 typedef int pid_t;

--
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Re: [PATCH] Use HAVE_DRIVE_LETTERS define instead of OS2 || WIN32

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On Sun, 07 Mar 1999 22:27:23 +0000, Ben Laurie wrote:

>Brian Havard wrote:
>> 
>> Did this one get lost in the commotion or was there some problem with it?
>
>Why remove TRUE/FALSE? Anyway, I still approve.

Because BOOL/TRUE/FALSE aren't defined if you're not compiling for windows.
They're only used in Win32 specific code which the part in question no longer
is.

--
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Re: [PATCH] Use HAVE_DRIVE_LETTERS define instead of OS2 || WIN32

Posted by Ben Laurie <be...@algroup.co.uk>.
Brian Havard wrote:
> 
> Did this one get lost in the commotion or was there some problem with it?

Why remove TRUE/FALSE? Anyway, I still approve.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

Re: [PATCH] Use HAVE_DRIVE_LETTERS define instead of OS2 || WIN32

Posted by Brian Havard <br...@kheldar.apana.org.au>.
Did this one get lost in the commotion or was there some problem with it?



On Sun, 14 Feb 1999 15:34:40 +1000 (EST), Brian Havard wrote:

>With Ben and Paul's approval and no objections I've added a 
>HAVE_DRIVE_LETTERS define and put it to work where appropriate.
>
>As nobody's committed my previous patch for UserDirs it is also included 
>(it was related anyway).
>
>I had to remove use of the Win32 BOOL/TRUE/FALSE in one function. And yes,
>OS/2 supports UNC paths too.
>
>
>Index: main/http_core.c
>===================================================================
>RCS file: /cvs/apache-1.3/src/main/http_core.c,v
>retrieving revision 1.249
>diff -u -r1.249 http_core.c
>--- http_core.c	1999/02/09 20:20:26	1.249
>+++ http_core.c	1999/02/14 04:08:14
>@@ -348,7 +348,7 @@
>  * See directory_walk().
>  */
> 
>-#if defined(OS2) || defined(WIN32)
>+#ifdef HAVE_DRIVE_LETTERS
> #define IS_SPECIAL(entry_core)	\
>     ((entry_core)->r != NULL \
> 	|| ((entry_core)->d[0] != '/' && (entry_core)->d[1] != ':'))
>Index: main/http_request.c
>===================================================================
>RCS file: /cvs/apache-1.3/src/main/http_request.c,v
>retrieving revision 1.144
>diff -u -r1.144 http_request.c
>--- http_request.c	1999/01/09 21:37:56	1.144
>+++ http_request.c	1999/02/14 04:09:07
>@@ -178,8 +178,8 @@
>     char *end = &path[strlen(path)];
>     char *last_cp = NULL;
>     int rv;
>-#ifdef WIN32
>-    BOOL bStripSlash=TRUE;
>+#ifdef HAVE_DRIVE_LETTERS
>+    char bStripSlash=1;
> #endif
> 
>     if (r->finfo.st_mode) {
>@@ -187,12 +187,12 @@
> 	return OK;
>     }
> 
>-#ifdef WIN32
>+#ifdef HAVE_DRIVE_LETTERS
>     /* If the directory is x:\, then we don't want to strip
>      * the trailing slash since x: is not a valid directory.
>      */
>     if (strlen(path) == 3 && path[1] == ':' && path[2] == '/')
>-        bStripSlash = FALSE;
>+        bStripSlash = 0;
> 
> 
>     /* If UNC name == //machine/share/, do not 
>@@ -211,7 +211,7 @@
>         }
>     
>         if (iCount == 4)
>-            bStripSlash = FALSE;
>+            bStripSlash = 0;
>     }
> 
>     if (bStripSlash)
>Index: modules/standard/mod_include.c
>===================================================================
>RCS file: /cvs/apache-1.3/src/modules/standard/mod_include.c,v
>retrieving revision 1.110
>diff -u -r1.110 mod_include.c
>--- mod_include.c	1999/01/01 19:05:09	1.110
>+++ mod_include.c	1999/02/14 04:09:12
>@@ -628,7 +628,7 @@
>  */
> static int is_only_below(const char *path)
> {
>-#if WIN32
>+#ifdef HAVE_DRIVE_LETTERS
>     if (path[1] == ':')
> 	return 0;
> #endif
>Index: modules/standard/mod_userdir.c
>===================================================================
>RCS file: /cvs/apache-1.3/src/modules/standard/mod_userdir.c,v
>retrieving revision 1.38
>diff -u -r1.38 mod_userdir.c
>--- mod_userdir.c	1999/01/01 19:05:15	1.38
>+++ mod_userdir.c	1999/02/14 04:09:14
>@@ -262,7 +262,7 @@
> 
> 	if (userdir[0] == '\0' || ap_os_is_path_absolute(userdir)) {
>             if (x) {
>-#ifdef WIN32
>+#ifdef HAVE_DRIVE_LETTERS
>                 /*
>                  * Crummy hack. Need to figure out whether we have been
>                  * redirected to a URL or to a file on some drive. Since I
>Index: os/os2/os.h
>===================================================================
>RCS file: /cvs/apache-1.3/src/os/os2/os.h,v
>retrieving revision 1.11
>diff -u -r1.11 os.h
>--- os.h	1999/01/08 23:46:44	1.11
>+++ os.h	1999/02/14 04:09:14
>@@ -3,6 +3,7 @@
> 
> #define PLATFORM "OS/2"
> #define HAVE_CANONICAL_FILENAME
>+#define HAVE_DRIVE_LETTERS
> 
> /*
>  * This file in included in all Apache source code. It contains definitions
>Index: os/win32/os.h
>===================================================================
>RCS file: /cvs/apache-1.3/src/os/win32/os.h,v
>retrieving revision 1.27
>diff -u -r1.27 os.h
>--- os.h	1999/01/08 23:46:47	1.27
>+++ os.h	1999/02/14 04:09:15
>@@ -34,6 +34,7 @@
> #define USE_MMAP_SCOREBOARD
> #define MULTITHREAD
> #define HAVE_CANONICAL_FILENAME
>+#define HAVE_DRIVE_LETTERS
> typedef int uid_t;
> typedef int gid_t;
> typedef int pid_t;

--
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------