msvc: opendir: do not start the search
[alt-git.git] / compat / msvc.c
blob88c6093258eaa117996668026734ea8e6eb2761a
1 #include "../git-compat-util.h"
2 #include "win32.h"
3 #include <conio.h>
4 #include "../strbuf.h"
6 DIR *opendir(const char *name)
8 int len = strlen(name);
9 DIR *p;
10 p = malloc(sizeof(DIR) + len + 2);
11 if (!p)
12 return NULL;
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] = '*';
19 p->dd_handle = (long)INVALID_HANDLE_VALUE;
20 return p;
22 int closedir(DIR *dir)
24 if (dir->dd_handle != (long)INVALID_HANDLE_VALUE)
25 FindClose((HANDLE)dir->dd_handle);
26 free(dir);
27 return 0;
30 #include "mingw.c"