+2010-04-26 Christian Franke <franke@computer.org>
+
+ * include/grub/util/getroot.h (grub_get_prefix): Remove prototype.
+ * util/getroot.c [__CYGWIN__] (get_win32_path): Remove function.
+ (grub_get_prefix): Remove function.
+ * util/grub-emu.c (main): Replace grub_get_prefix () call by
+ make_system_path_relative_to_its_root ().
+ * util/sparc64/ieee1275/grub-setup.c (main): Likewise.
+
2010-04-24 Christian Franke <franke@computer.org>
* Makefile.in (TARGET_LDFLAGS): Add -static-libgcc.
* disk/lvm.c (grub_lvm_memberlist): Issue an error if pv->disk = 0.
-2010-04-17 Christian Franke <franke@computer.org>
+2010-04-17 Christian Franke <franke@computer.org>
* Makefile.in: Add missing localedir setting.
return path;
}
-#ifdef __CYGWIN__
-/* Convert POSIX path to Win32 path,
- remove drive letter, replace backslashes. */
-static char *
-get_win32_path (const char *path)
-{
- char winpath[PATH_MAX];
- cygwin_conv_to_full_win32_path (path, winpath);
-
- int len = strlen (winpath);
- if (len > 2 && winpath[1] == ':')
- {
- len -= 2;
- memmove (winpath, winpath + 2, len + 1);
- }
-
- int i;
- for (i = 0; i < len; i++)
- if (winpath[i] == '\\')
- winpath[i] = '/';
- return xstrdup (winpath);
-}
-#endif
-
-char *
-grub_get_prefix (const char *dir)
-{
- char *saved_cwd;
- char *abs_dir, *prev_dir;
- char *prefix;
- struct stat st, prev_st;
-
- /* Save the current directory. */
- saved_cwd = xgetcwd ();
-
- if (chdir (dir) < 0)
- grub_util_error ("cannot change directory to `%s'", dir);
-
- abs_dir = xgetcwd ();
- strip_extra_slashes (abs_dir);
- prev_dir = xstrdup (abs_dir);
-
- if (stat (".", &prev_st) < 0)
- grub_util_error ("cannot stat `%s'", dir);
-
- if (! S_ISDIR (prev_st.st_mode))
- grub_util_error ("`%s' is not a directory", dir);
-
- while (1)
- {
- if (chdir ("..") < 0)
- grub_util_error ("cannot change directory to the parent");
-
- if (stat (".", &st) < 0)
- grub_util_error ("cannot stat current directory");
-
- if (! S_ISDIR (st.st_mode))
- grub_util_error ("current directory is not a directory???");
-
- if (prev_st.st_dev != st.st_dev || prev_st.st_ino == st.st_ino)
- break;
-
- free (prev_dir);
- prev_dir = xgetcwd ();
- prev_st = st;
- }
-
- strip_extra_slashes (prev_dir);
- prefix = xmalloc (strlen (abs_dir) - strlen (prev_dir) + 2);
- prefix[0] = '/';
- strcpy (prefix + 1, abs_dir + strlen (prev_dir));
- strip_extra_slashes (prefix);
-
- if (chdir (saved_cwd) < 0)
- grub_util_error ("cannot change directory to `%s'", dir);
-
-#ifdef __CYGWIN__
- if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16))
- {
- /* Reached some mount point not below /cygdrive.
- GRUB does not know Cygwin's emulated mounts,
- convert to Win32 path. */
- grub_util_info ("Cygwin prefix = %s", prefix);
- char * wprefix = get_win32_path (prefix);
- free (prefix);
- prefix = wprefix;
- }
-#endif
-
- free (saved_cwd);
- free (abs_dir);
- free (prev_dir);
-
- grub_util_info ("prefix = %s", prefix);
- return prefix;
-}
-
#ifdef __MINGW32__
static char *