OSDN Git Service

2003-03-05 Ranjit Mathew <rmathew@hotmail.com>
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Mar 2003 04:40:08 +0000 (04:40 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Mar 2003 04:40:08 +0000 (04:40 +0000)
* jcf.h (COMPARE_FILENAMES): New macro similar to "strcmp" to
compare file name components depending on the case-sensitivity
or otherwise of the host file system.

* jcf-path.c (add_entry): Use COMPARE_FILENAMES instead of
"strcmp" to compare file name components.
Use IS_DIR_SEPARATOR instead of comparing directly against
DIR_SEPARATOR.
(jcf_path_extdirs_arg): Use IS_DIR_SEPARATOR instead of
comparing directly against DIR_SEPARATOR.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63927 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/java/ChangeLog
gcc/java/jcf-path.c
gcc/java/jcf.h

index a934a75..b65f0fc 100644 (file)
@@ -1,3 +1,16 @@
+2003-03-05  Ranjit Mathew  <rmathew@hotmail.com>
+
+       * jcf.h (COMPARE_FILENAMES): New macro similar to "strcmp" to
+       compare file name components depending on the case-sensitivity
+       or otherwise of the host file system.
+
+       * jcf-path.c (add_entry): Use COMPARE_FILENAMES instead of
+       "strcmp" to compare file name components.
+       Use IS_DIR_SEPARATOR instead of comparing directly against
+       DIR_SEPARATOR.
+       (jcf_path_extdirs_arg): Use IS_DIR_SEPARATOR instead of 
+       comparing directly against DIR_SEPARATOR.
+
 2003-03-04  Tom Tromey  <tromey@redhat.com>
 
        * Make-lang.in (java.tags): New target.
index 33f4f80..8771e6f 100644 (file)
@@ -146,22 +146,23 @@ add_entry (struct entry **entp, const char *filename, int is_system)
   n->next = NULL;
 
   len = strlen (filename);
-  if (len > 4 && (strcmp (filename + len - 4, ".zip") == 0
-                 || strcmp (filename + len - 4, ".jar") == 0))
+
+  if (len > 4 && (COMPARE_FILENAMES (filename + len - 4, ".zip") == 0
+                 || COMPARE_FILENAMES (filename + len - 4, ".jar") == 0))
     {
       n->flags |= FLAG_ZIP;
       /* If the user uses -classpath then he'll have to include
         libgcj.jar in the value.  We check for this in a simplistic
         way.  Symlinks will fool this test.  This is only used for
         -MM and -MMD, so it probably isn't terribly important.  */
-      if (! strcmp (filename, LIBGCJ_ZIP_FILE))
+      if (! COMPARE_FILENAMES (filename, LIBGCJ_ZIP_FILE))
        n->flags |= FLAG_SYSTEM;
     }
 
   /* Note that we add a trailing separator to `.zip' names as well.
      This is a little hack that lets the searching code in jcf-io.c
      work more easily.  Eww.  */
-  if (filename[len - 1] != '/' && filename[len - 1] != DIR_SEPARATOR)
+  if (! IS_DIR_SEPARATOR (filename[len - 1]))
     {
       char *f2 = alloca (len + 2);
       strcpy (f2, filename);
@@ -370,7 +371,7 @@ jcf_path_extdirs_arg (const char *cp)
                        char *name = alloca (dirname_length
                                             + strlen (direntp->d_name) + 2);
                        strcpy (name, buf);
-                       if (name[dirname_length-1] != DIR_SEPARATOR)
+                       if (! IS_DIR_SEPARATOR (name[dirname_length-1]))
                          {
                            name[dirname_length] = DIR_SEPARATOR;
                            name[dirname_length+1] = 0;
index c8e6aa7..9680974 100644 (file)
@@ -54,6 +54,15 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #define JCF_USE_SCANDIR 0
 #endif 
 
+/* On case-insensitive file systems, file name components must be 
+   compared using "strcasecmp", if available, instead of "strcmp".
+   Assumes "config.h" has already been included.  */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM) && defined (HAVE_STRCASECMP)
+#define COMPARE_FILENAMES(X, Y) strcasecmp ((X), (Y))
+#else
+#define COMPARE_FILENAMES(X, Y) strcmp ((X), (Y))
+#endif
+
 struct JCF;
 typedef int (*jcf_filbuf_t) PARAMS ((struct JCF*, int needed));