+2004-12-20 Christopher Faylor <cgf@timesys.com>
+
+ * path.cc (normalize_posix_path): Remove unneeded check for dots.
+ (path_conv::set_normalized_path): Strip trailing dots, similarly to
+ what had previously been done for the win32 path.
+
2004-12-18 Christopher Faylor <cgf@timesys.com>
* path.cc (normalize_win32_path): Make third arg pass-by reference.
break;
}
else if (src[2] && !isslash (src[2]))
- {
- if (src[2] == '.')
- {
- /* Is this a run of dots? That would be an invalid
- filename. A bunch of leading dots would be ok,
- though. */
- int n = strspn (src, ".");
- if (!src[n] || isslash (src[n])) /* just dots... */
- return ENOENT;
- }
- break;
- }
+ break;
else
{
while (tail > dst && !isslash (*--tail))
path_conv::set_normalized_path (const char *path_copy)
{
char *eopath = strchr (path, '\0');
- size_t n = strlen (path_copy) + 1;
+ size_t n;
+
+ if (dev.devn != FH_FS || strncmp (path_copy, "//./", 4) == 0)
+ n = strlen (path_copy) + 1;
+ else
+ {
+ char *p = strchr (path_copy, '\0');
+ while (*--p == '.' || *p == ' ')
+ continue;
+ p[1] = '\0';
+ n = 2 + p - path_copy;
+ }
normalized_path = path + sizeof (path) - n;
if (normalized_path > eopath)
normalized_path = (char *) cmalloc (HEAP_STR, n);
normalized_path_size = 0;
}
+
memcpy (normalized_path, path_copy, n);
}