- /* FIXME: strncmp loses in interesting ways on MS-DOS and
- MS-Windows because of case-insensitivity and two different
- but functionally identical slash characters. We need a
- special filesystem-dependent file-name comparison function.
-
- Actually, even on Unix I would use realpath() or its work-
- alike before comparing. Then all the code above which
- removes excess slashes and dots could simply go away. */
- if (!strncmp (p, name, len)
- && (p[len] == '\0' || p[len] == DIRNAME_SEPARATOR))
- {
- /* Found it in the search path, remove old copy */
- if (p > *which_path)
- p--; /* Back over leading separator */
- if (prefix > p - *which_path)
- goto skip_dup; /* Same dir twice in one cmd */
- strcpy (p, &p[len + 1]); /* Copy from next \0 or : */
- }
- p = strchr (p, DIRNAME_SEPARATOR);
- if (p != 0)
- ++p;
- else
- break;
+ /* Found it in the search path, remove old copy. */
+ if (p > *which_path)
+ p--; /* Back over leading separator. */
+ if (prefix > p - *which_path)
+ goto skip_dup; /* Same dir twice in one cmd. */
+ memmove (p, &p[len + 1], strlen (&p[len + 1]) + 1); /* Copy from next \0 or : */