diff options
Diffstat (limited to 'uisimulator/win32/dir-win32.c')
-rw-r--r-- | uisimulator/win32/dir-win32.c | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/uisimulator/win32/dir-win32.c b/uisimulator/win32/dir-win32.c deleted file mode 100644 index 6f14e798be..0000000000 --- a/uisimulator/win32/dir-win32.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Felix Arends | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <io.h> | ||
21 | #include <windows.h> | ||
22 | #include <malloc.h> | ||
23 | #include "dir-win32.h" | ||
24 | |||
25 | // Directory operations | ||
26 | // | ||
27 | |||
28 | // opendir | ||
29 | // open directory for scanning | ||
30 | DIR *opendir ( | ||
31 | const char *dirname // directory name | ||
32 | ) | ||
33 | { | ||
34 | DIR *p = (DIR*)malloc(sizeof(DIR)); | ||
35 | struct _finddata_t fd; | ||
36 | unsigned int i; | ||
37 | char *s = (char*)malloc(strlen(dirname) + 5); | ||
38 | wsprintf (s, "%s", dirname); | ||
39 | |||
40 | for (i = 0; i < strlen(s); i++) | ||
41 | if (s[i] == '/') | ||
42 | s[i] = '\\'; | ||
43 | |||
44 | if (s[i - 1] != '\\') | ||
45 | { | ||
46 | s[i] = '\\'; | ||
47 | s[++i] = '\0'; | ||
48 | } | ||
49 | |||
50 | OutputDebugString (s); | ||
51 | |||
52 | wsprintf (s, "%s*.*", s); | ||
53 | |||
54 | if ((p->handle = _findfirst (s, &fd)) == -1) | ||
55 | { | ||
56 | free (s); | ||
57 | free (p); | ||
58 | return 0; | ||
59 | } | ||
60 | free (s); | ||
61 | return p; | ||
62 | } | ||
63 | |||
64 | // closedir | ||
65 | // close directory | ||
66 | int closedir ( | ||
67 | DIR *dir // previously opened dir search | ||
68 | ) | ||
69 | { | ||
70 | free(dir); | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | // read dir | ||
75 | // read next entry in directory | ||
76 | struct dirent *readdir ( | ||
77 | DIR *dir | ||
78 | ) | ||
79 | { | ||
80 | struct _finddata_t fd; | ||
81 | if (_findnext (dir->handle, &fd) == -1) | ||
82 | return 0; | ||
83 | memcpy (dir->fd.d_name, fd.name, 256); | ||
84 | |||
85 | dir->fd.attribute = fd.attrib & 0x3f; | ||
86 | dir->fd.size = fd.size; | ||
87 | dir->fd.startcluster = 0 ; | ||
88 | |||
89 | |||
90 | return &dir->fd; | ||
91 | } | ||