compat / mingw.con commit Windows: Treat Windows style path names. (25fe217)
   1#include "../git-compat-util.h"
   2
   3unsigned int _CRT_fmode = _O_BINARY;
   4
   5unsigned int sleep (unsigned int seconds)
   6{
   7        Sleep(seconds*1000);
   8        return 0;
   9}
  10
  11int mkstemp(char *template)
  12{
  13        char *filename = mktemp(template);
  14        if (filename == NULL)
  15                return -1;
  16        return open(filename, O_RDWR | O_CREAT, 0600);
  17}
  18
  19int gettimeofday(struct timeval *tv, void *tz)
  20{
  21        return -1;
  22}
  23
  24int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
  25{
  26        return -1;
  27}
  28
  29struct tm *gmtime_r(const time_t *timep, struct tm *result)
  30{
  31        /* gmtime() in MSVCRT.DLL is thread-safe, but not reentrant */
  32        memcpy(result, gmtime(timep), sizeof(struct tm));
  33        return result;
  34}
  35
  36struct tm *localtime_r(const time_t *timep, struct tm *result)
  37{
  38        /* localtime() in MSVCRT.DLL is thread-safe, but not reentrant */
  39        memcpy(result, localtime(timep), sizeof(struct tm));
  40        return result;
  41}
  42
  43#undef getcwd
  44char *mingw_getcwd(char *pointer, int len)
  45{
  46        int i;
  47        char *ret = getcwd(pointer, len);
  48        if (!ret)
  49                return ret;
  50        for (i = 0; pointer[i]; i++)
  51                if (pointer[i] == '\\')
  52                        pointer[i] = '/';
  53        return ret;
  54}
  55
  56struct passwd *getpwuid(int uid)
  57{
  58        static struct passwd p;
  59        return &p;
  60}
  61
  62int setitimer(int type, struct itimerval *in, struct itimerval *out)
  63{
  64        return -1;
  65}
  66
  67int sigaction(int sig, struct sigaction *in, struct sigaction *out)
  68{
  69        return -1;
  70}