c195365d2cf77348b0646f210adb984ae75d07bc
   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 = _findfirst(p->dd_name, &p->dd_dta);
  20
  21        if (p->dd_handle == -1) {
  22                free(p);
  23                return NULL;
  24        }
  25        return p;
  26}
  27int closedir(DIR *dir)
  28{
  29        _findclose(dir->dd_handle);
  30        free(dir);
  31        return 0;
  32}
  33
  34#include "mingw.c"