Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1882 | clevermous | 1 | /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ |
2 | /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
||
3 | #include |
||
4 | #include |
||
5 | #include |
||
6 | #include |
||
7 | #include |
||
8 | #include |
||
9 | #include |
||
10 | #include |
||
11 | #include "dirstruc.h" |
||
12 | |||
13 | DIR * |
||
14 | opendir(const char *name) |
||
15 | { |
||
16 | int res; |
||
17 | DIR* dir = (DIR*)malloc(sizeof(DIR)); |
||
18 | if (!dir) |
||
19 | return NULL; |
||
20 | _fixpath(name, dir->fileinfo.name); |
||
21 | struct bdfe_item attr; |
||
22 | dir->fileinfo.command = 5; |
||
23 | dir->fileinfo.file_offset_low = 0; |
||
24 | dir->fileinfo.file_offset_high = 0; |
||
25 | dir->fileinfo.size = 0; |
||
26 | dir->fileinfo.data_pointer = (__u32)&attr; |
||
27 | res = __kolibri__system_tree_access2(&dir->fileinfo); |
||
28 | if (res!=0 && res!=2) |
||
29 | { |
||
30 | free(dir); |
||
31 | return NULL; |
||
32 | } |
||
33 | if (res==0 && (attr.attr & 0x10)==0) |
||
34 | { |
||
35 | free(dir); |
||
36 | return NULL; |
||
37 | } |
||
38 | dir->fileinfo.command = 1; |
||
39 | dir->fileinfo.size = 1; |
||
40 | dir->fileinfo.data_pointer = (__u32)dir->bdfeheader; |
||
41 | dir->fileinfo.file_offset_low = (__u32)-1; |
||
42 | return dir; |
||
43 | } |