-static bool
-try_pos (char *name, int pos, const char *dumpdir)
-{
- int i;
- static char namechars[] =
- "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
- if (pos > 0)
- for (i = 0; i < sizeof namechars; i++)
- {
- name[pos] = namechars[i];
- if (!dumpdir_locate (dumpdir, name)
- || try_pos (name, pos-1, dumpdir))
- return true;
- }
-
- return false;
-}
-
-static bool
-create_temp_name (char *name, const char *dumpdir)
-{
- size_t pos = strlen (name) - 6;
- return try_pos (name + pos, 5, dumpdir);
-}
-
-char *
-make_tmp_dir_name (const char *name)
-{
- char *dirname = dir_name (name);
- char *tmp_name = NULL;
- struct directory *dir = find_directory (dirname);
-
- tmp_name = new_name (dirname, "000000");
- if (!create_temp_name (tmp_name, dir ? dir->contents : NULL))
- {
- free (tmp_name);
- tmp_name = NULL;
- }
- free (dirname);
- return tmp_name;
-}
-