jcf-path.c (add_entry): Don't add trailing separator if entry is a .zip file.
authorTom Tromey <tromey@cygnus.com>
Thu, 22 Oct 1998 16:30:34 +0000 (16:30 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 22 Oct 1998 16:30:34 +0000 (16:30 +0000)
* jcf-path.c (add_entry): Don't add trailing separator if entry is
a .zip file.
(add_path): Don't add trailing separator to non-empty path
elements.
* lang.c (lang_decode_option): Check for -fclasspath and
-fCLASSPATH before examining other `-f' options.

From-SVN: r23229

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

index c117009..67da726 100644 (file)
@@ -1,5 +1,13 @@
 1998-10-22  Tom Tromey  <tromey@cygnus.com>
 
+       * jcf-path.c (add_entry): Don't add trailing separator if entry is
+       a .zip file.
+       (add_path): Don't add trailing separator to non-empty path
+       elements.
+
+       * lang.c (lang_decode_option): Check for -fclasspath and
+       -fCLASSPATH before examining other `-f' options.
+
        * java-tree.h (finalize_identifier_node): Don't declare.
        * class.c (make_class_data): Don't push "final" field.
        * decl.c (init_decl_processing): Don't push "final" field.
index 6e88496..829f99a 100644 (file)
@@ -152,7 +152,9 @@ add_entry (entp, filename, is_system)
        n->flags |= FLAG_SYSTEM;
     }
 
-  if (filename[len - 1] != '/' && filename[len - 1] != DIR_SEPARATOR)
+  if (! (n->flags & FLAG_ZIP)
+      && filename[len - 1] != '/'
+      && filename[len - 1] != DIR_SEPARATOR)
     {
       char *f2 = (char *) alloca (len + 1);
       strcpy (f2, filename);
@@ -186,20 +188,17 @@ add_path (entp, cp, is_system)
        {
          if (! *endp || *endp == PATH_SEPARATOR)
            {
-             strncpy (buf, startp, endp - startp);
              if (endp == startp)
                {
                  buf[0] = '.';
                  buf[1] = DIR_SEPARATOR;
                  buf[2] = '\0';
                }
-             else if (endp[-1] != '/' && endp[1] != DIR_SEPARATOR)
+             else
                {
-                 buf[endp - startp] = DIR_SEPARATOR;
-                 buf[endp - startp + 1] = '\0';
+                 strncpy (buf, startp, endp - startp);
+                 buf[endp - startp] = '\0';
                }
-             else
-               buf[endp - startp] = '\0';
              add_entry (entp, buf, is_system);
              if (! *endp)
                break;
index b425b8b..96debd0 100644 (file)
@@ -126,6 +126,27 @@ lang_decode_option (argc, argv)
      char **argv;
 {
   char *p = argv[0];
+
+#define CLARG "-fclasspath="
+  if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
+    {
+      jcf_path_classpath_arg (p + sizeof (CLARG) - 1);
+      return 1;
+    }
+#undef CLARG
+#define CLARG "-fCLASSPATH="
+  else if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
+    {
+      jcf_path_CLASSPATH_arg (p + sizeof (CLARG) - 1);
+      return 1;
+    }
+#undef CLARG
+  else if (strncmp (p, "-I", 2) == 0)
+    {
+      jcf_path_include_arg (p + 2);
+      return 1;
+    }
+
   if (p[0] == '-' && p[1] == 'f')
     {
       /* Some kind of -f option.
@@ -183,26 +204,6 @@ lang_decode_option (argc, argv)
       return 1;
     }
 
-#define CLARG "-fclasspath="
-  if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
-    {
-      jcf_path_classpath_arg (p + sizeof (CLARG));
-      return 1;
-    }
-#undef CLARG
-#define CLARG "-fCLASSPATH="
-  else if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
-    {
-      jcf_path_CLASSPATH_arg (p + sizeof (CLARG));
-      return 1;
-    }
-#undef CLARG
-  else if (strncmp (p, "-I", 2) == 0)
-    {
-      jcf_path_include_arg (p + 2);
-      return 1;
-    }
-
   return 0;
 }