88c6093258eaa117996668026734ea8e6eb2761a
   1#include "../git-compat-util.h"
   2#include "win32.h"
   3#include <conio.h>
   4#include "../strbuf.h"
   5
   6DIR *opendir(const char *name)
   7{
   8        int len = strlen(name);
   9        DIR *p;
  10        p = malloc(sizeof(DIR) + len + 2);
  11        if (!p)
  12                return NULL;
  13
  14        memset(p, 0, sizeof(DIR) + len + 2);
  15        strcpy(p->dd_name, name);
  16        p->dd_name[len] = '/';
  17        p->dd_name[len+1] = '*';
  18
  19        p->dd_handle = (long)INVALID_HANDLE_VALUE;
  20        return p;
  21}
  22int closedir(DIR *dir)
  23{
  24        if (dir->dd_handle != (long)INVALID_HANDLE_VALUE)
  25                FindClose((HANDLE)dir->dd_handle);
  26        free(dir);
  27        return 0;
  28}
  29
  30#include "mingw.c"