+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.
+
2003-03-08 Neil Booth <neil@daikokuya.co.uk>
* lang.c (java_init): Update prototype, move code to java_post_options.
{
#if JCF_USE_SCANDIR
char *sep;
+ char origsep;
char *base;
memoized_dirlist_entry *dent;
void **slot;
/* Get the name of the directory. */
sep = strrchr (filename, DIR_SEPARATOR);
+#ifdef DIR_SEPARATOR_2
+ if (! sep)
+ sep = strrchr (filename, DIR_SEPARATOR_2);
+#endif
if (sep)
{
+ origsep = *sep;
*sep = '\0';
base = sep + 1;
}
else
base = filename;
- /* Obtain the entry for this directory form the hash table. */
+ /* Obtain the entry for this directory from the hash table. */
slot = htab_find_slot (memoized_dirlists, filename, INSERT);
if (!*slot)
{
/* Put the separator back. */
if (sep)
- *sep = DIR_SEPARATOR;
+ *sep = origsep;
/* If the file is not in the list, there is no need to stat it; it
does not exist. */
const char *dname, *cname, *slash;
char *r;
struct stat sb;
+ char sep;
cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)),
"", '.', DIR_SEPARATOR,
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
dname = r + (slash - dname) + 1;
while (1)
{
- char *s = strchr (dname, DIR_SEPARATOR);
+ char *s = strchr (dname, sep);
if (s == NULL)
break;
*s = '\0';
&& 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)
;
}