aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-write.c
diff options
context:
space:
mode:
authorRanjit Mathew <rmathew@hotmail.com>2003-03-10 19:39:18 +0000
committerAndrew Haley <aph@gcc.gnu.org>2003-03-10 19:39:18 +0000
commit630287af48fcf25759f9e96d0ef39db90b5fa3af (patch)
treefa4274affbe4493621a42186068b16c1747c9778 /gcc/java/jcf-write.c
parent5c2424217a35eee7fa8bf1e8456b2143af632e53 (diff)
downloadgcc-630287af48fcf25759f9e96d0ef39db90b5fa3af.zip
gcc-630287af48fcf25759f9e96d0ef39db90b5fa3af.tar.gz
gcc-630287af48fcf25759f9e96d0ef39db90b5fa3af.tar.bz2
jcf-io.c (caching_stat): Account for both DIR_SEPARATOR and DIR_SEPARATOR_2 for a target.
2003-03-10 Ranjit Mathew <rmathew@hotmail.com> * jcf-io.c (caching_stat): Account for both DIR_SEPARATOR and DIR_SEPARATOR_2 for a target. Correct minor typos. * jcf-write.c (make_class_file_name): Take both DIR_SEPARATOR and DIR_SEPARATOR_2 for a target into account. From-SVN: r64110
Diffstat (limited to 'gcc/java/jcf-write.c')
-rw-r--r--gcc/java/jcf-write.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index a18f062..d9fc650 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -3263,6 +3263,7 @@ make_class_file_name (tree clas)
const char *dname, *cname, *slash;
char *r;
struct stat sb;
+ char sep;
cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)),
"", '.', DIR_SEPARATOR,
@@ -3274,24 +3275,45 @@ make_class_file_name (tree clas)
char *t;
dname = DECL_SOURCE_FILE (TYPE_NAME (clas));
slash = strrchr (dname, DIR_SEPARATOR);
+#ifdef DIR_SEPARATOR_2
if (! slash)
- {
- dname = ".";
- slash = dname + 1;
- }
+ slash = strrchr (dname, DIR_SEPARATOR_2);
+#endif
+ if (! slash)
+ {
+ dname = ".";
+ slash = dname + 1;
+ sep = DIR_SEPARATOR;
+ }
+ else
+ sep = *slash;
+
t = strrchr (cname, DIR_SEPARATOR);
if (t)
cname = t + 1;
}
else
{
+ char *s;
+
dname = jcf_write_base_directory;
+
+ s = strrchr (dname, DIR_SEPARATOR);
+#ifdef DIR_SEPARATOR_2
+ if (! s)
+ s = strrchr (dname, DIR_SEPARATOR_2);
+#endif
+ if (s)
+ sep = *s;
+ else
+ sep = DIR_SEPARATOR;
+
slash = dname + strlen (dname);
}
r = xmalloc (slash - dname + strlen (cname) + 2);
strncpy (r, dname, slash - dname);
- r[slash - dname] = DIR_SEPARATOR;
+ r[slash - dname] = sep;
strcpy (&r[slash - dname + 1], cname);
/* We try to make new directories when we need them. We only do
@@ -3303,7 +3325,7 @@ make_class_file_name (tree clas)
dname = r + (slash - dname) + 1;
while (1)
{
- char *s = strchr (dname, DIR_SEPARATOR);
+ char *s = strchr (dname, sep);
if (s == NULL)
break;
*s = '\0';
@@ -3312,9 +3334,9 @@ make_class_file_name (tree clas)
&& mkdir (r, 0755) == -1)
fatal_io_error ("can't create directory %s", r);
- *s = DIR_SEPARATOR;
+ *s = sep;
/* Skip consecutive separators. */
- for (dname = s + 1; *dname && *dname == DIR_SEPARATOR; ++dname)
+ for (dname = s + 1; *dname && *dname == sep; ++dname)
;
}