- for (p = file_name + prefix_len; *p; )
- {
- if (p[0] == '.')
- {
- if (p[1] == '.' && (ISSLASH (p[2]) || !p[2]))
- prefix_len = p + 2 - file_name;
- else if (ISSLASH (p[1]))
- prefix_len = p + 1 - file_name;
- }
-
- do
- {
- char c = *p++;
- if (ISSLASH (c))
- break;
- }
- while (*p);
- }
-
- for (p = file_name + prefix_len; ISSLASH (*p); p++)
- continue;
- prefix_len = p - file_name;
-
- if (prefix_len)
- {
- static Hash_table *prefix_table[2];
- char *prefix = alloca (prefix_len + 1);
- memcpy (prefix, file_name, prefix_len);
- prefix[prefix_len] = '\0';
-
- if (hash_string_insert (&prefix_table[link_target], prefix))
- {
- static char const *const diagnostic[] =
- {
- N_("Removing leading `%s' from member names"),
- N_("Removing leading `%s' from hard link targets")
- };
- WARN ((0, 0, _(diagnostic[link_target]), prefix));
- }
- }
- }
-
- if (! *p)
- {
- if (p == file_name)
- {
- static char const *const diagnostic[] =
- {
- N_("Substituting `.' for empty member name"),
- N_("Substituting `.' for empty hard link target")
- };
- WARN ((0, 0, _(diagnostic[link_target])));
- }
-
- p = ISSLASH (file_name[strlen(file_name)-1]) ? "./" : ".";
- }