cygwin emu build fixes

This commit is contained in:
BVK Chaitanya 2010-05-06 08:45:39 +05:30
parent 81827e248c
commit da6e6f17f3
6 changed files with 32 additions and 36 deletions

View file

@ -19,6 +19,8 @@
#include <config.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <dirent.h>
@ -27,13 +29,6 @@
#include <stdlib.h>
#include <stdint.h>
#ifdef __CYGWIN__
# include <sys/fcntl.h>
# include <sys/cygwin.h>
# include <limits.h>
# define DEV_CYGDRIVE_MAJOR 98
#endif
#ifdef __GNU__
#include <hurd.h>
#include <hurd/lookup.h>

View file

@ -176,6 +176,26 @@ grub_get_rtc (void)
* GRUB_TICKS_PER_SECOND / 1000000));
}
#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];
if (cygwin_conv_path (CCP_POSIX_TO_WIN_A, path, winpath, sizeof(winpath)))
grub_util_error ("cygwin_conv_path() failed");
int len = strlen (winpath);
int offs = (len > 2 && winpath[1] == ':' ? 2 : 0);
int i;
for (i = offs; i < len; i++)
if (winpath[i] == '\\')
winpath[i] = '/';
return xstrdup (winpath + offs);
}
#endif
/* This function never prints trailing slashes (so that its output
can be appended a slash unconditionally). */