]>
Commit | Line | Data |
---|---|---|
d75f8e61 FL |
1 | #include "../git-compat-util.h" |
2 | #include "win32.h" | |
3 | #include <conio.h> | |
4 | #include "../strbuf.h" | |
5 | ||
6 | DIR *opendir(const char *name) | |
7 | { | |
17194c1e | 8 | int len = strlen(name); |
d75f8e61 | 9 | DIR *p; |
17194c1e | 10 | p = malloc(sizeof(DIR) + len + 2); |
599b0bf4 EFL |
11 | if (!p) |
12 | return NULL; | |
13 | ||
17194c1e EFL |
14 | memset(p, 0, sizeof(DIR) + len + 2); |
15 | strcpy(p->dd_name, name); | |
d75f8e61 FL |
16 | p->dd_name[len] = '/'; |
17 | p->dd_name[len+1] = '*'; | |
18 | ||
d75f8e61 FL |
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 | } | |
27 | int closedir(DIR *dir) | |
28 | { | |
29 | _findclose(dir->dd_handle); | |
30 | free(dir); | |
31 | return 0; | |
32 | } | |
33 | ||
34 | #include "mingw.c" |