Mercurial > dwindows
comparison platform/dirent.h @ 174:75bf3051235f
Fixes so you can mix compilers.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 01 Dec 2002 12:59:24 +0000 |
parents | d9e87e8bcf1d |
children | e3dd5c765775 |
comparison
equal
deleted
inserted
replaced
173:c2b5d0019ec3 | 174:75bf3051235f |
---|---|
1 #ifdef __OS2__ | 1 #if defined(__OS2__) || defined (__EMX__) |
2 #ifndef __DIRENT_H__ | 2 #ifndef __DIRENT_H__ |
3 #define __DIRENT_H__ | 3 #define __DIRENT_H__ |
4 | 4 |
5 #ifdef __EMX__ | |
6 #include <sys/param.h> | |
7 #else | |
8 #if defined(__IBMC__) || defined(__IBMCPP__) || defined(XP_W32_MSVC) | |
9 #include <stdio.h> | 5 #include <stdio.h> |
10 #ifdef MAXPATHLEN | 6 #ifdef MAXPATHLEN |
11 #undef MAXPATHLEN | 7 #undef MAXPATHLEN |
12 #endif | 8 #endif |
13 #define MAXPATHLEN (FILENAME_MAX*4) | 9 #define MAXPATHLEN (FILENAME_MAX*4) |
31 # define A_DIR 0x10 | 27 # define A_DIR 0x10 |
32 # define A_ARCHIVE 0x20 | 28 # define A_ARCHIVE 0x20 |
33 #endif | 29 #endif |
34 | 30 |
35 struct dirent { | 31 struct dirent { |
36 #if defined(__OS2__) || defined(__WIN32__) /* use the layout of EMX to avoid trouble */ | |
37 int d_ino; /* Dummy */ | 32 int d_ino; /* Dummy */ |
38 int d_reclen; /* Dummy, same as d_namlen */ | 33 int d_reclen; /* Dummy, same as d_namlen */ |
39 int d_namlen; /* length of name */ | 34 int d_namlen; /* length of name */ |
40 char d_name[MAXNAMLEN + 1]; | 35 char d_name[MAXNAMLEN + 1]; |
41 unsigned long d_size; | 36 unsigned long d_size; |
42 unsigned short d_attribute; /* attributes (see above) */ | 37 unsigned short d_attribute; /* attributes (see above) */ |
43 unsigned short d_time; /* modification time */ | 38 unsigned short d_time; /* modification time */ |
44 unsigned short d_date; /* modification date */ | 39 unsigned short d_date; /* modification date */ |
45 #else | |
46 char d_name[MAXNAMLEN + 1]; /* garentee null termination */ | |
47 char d_attribute; /* .. extension .. */ | |
48 unsigned long d_size; /* .. extension .. */ | |
49 #endif | |
50 }; | 40 }; |
51 | 41 |
52 typedef struct _dirdescr DIR; | 42 typedef struct _dirdescr DIR; |
53 /* the structs do not have to be defined here */ | 43 /* the structs do not have to be defined here */ |
54 | 44 |
55 extern DIR *opendir(const char *); | 45 extern DIR *_opendir(const char *); |
56 extern DIR *openxdir(const char *, unsigned); | 46 #define opendir(a) _opendir(a) |
57 extern struct dirent *readdir(DIR *); | 47 extern DIR *_openxdir(const char *, unsigned); |
58 extern void seekdir(DIR *, long); | 48 #define openxdir(a, b) _openxdir(a, b) |
59 extern long telldir(DIR *); | 49 extern struct dirent *_readdir(DIR *); |
60 extern void closedir(DIR *); | 50 #define readdir(a) _readdir(a) |
61 #define rewinddir(dirp) seekdir(dirp, 0L) | 51 extern void _seekdir(DIR *, long); |
52 #define seekdir(a, b) _seekdir(a, b) | |
53 extern long _telldir(DIR *); | |
54 #define telldir(a) _telldir(a) | |
55 extern void _closedir(DIR *); | |
56 #define closedir(a) _closedir(a) | |
62 | 57 |
63 extern char * abs_path(const char *name, char *buffer, int len); | 58 #define rewinddir(dirp) _seekdir(dirp, 0L) |
59 extern char * _abs_path(const char *name, char *buffer, int len); | |
60 #define abs_path(a, b, c) _abs_path(a, b, c) | |
64 | 61 |
65 #ifndef S_IFMT | 62 #ifndef S_IFMT |
66 #define S_IFMT ( S_IFDIR | S_IFREG ) | 63 #define S_IFMT ( S_IFDIR | S_IFREG ) |
67 #endif | 64 #endif |
68 | 65 |
74 #define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG) | 71 #define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG) |
75 #endif | 72 #endif |
76 | 73 |
77 #ifdef __cplusplus | 74 #ifdef __cplusplus |
78 } | 75 } |
79 #endif | |
80 | |
81 #endif | |
82 #endif | 76 #endif |
83 | 77 |
84 #ifdef __WIN32__ | 78 #ifdef __WIN32__ |
85 #ifndef __DIRENT_H__ | 79 #ifndef __DIRENT_H__ |
86 #define __DIRENT_H__ | 80 #define __DIRENT_H__ |
100 * AK900712 | 94 * AK900712 |
101 * AK910410 abs_path - make absolute path | 95 * AK910410 abs_path - make absolute path |
102 * | 96 * |
103 */ | 97 */ |
104 | 98 |
105 #ifdef __EMX__ | |
106 #include <sys/param.h> | |
107 #else | |
108 #if defined(__IBMC__) || defined(__IBMCPP__) || defined(MSVC) | 99 #if defined(__IBMC__) || defined(__IBMCPP__) || defined(MSVC) |
109 #include <stdio.h> | 100 #include <stdio.h> |
110 #ifdef MAXPATHLEN | 101 #ifdef MAXPATHLEN |
111 #undef MAXPATHLEN | 102 #undef MAXPATHLEN |
112 #endif | 103 #endif |
130 # define A_DIR 0x10 | 121 # define A_DIR 0x10 |
131 # define A_ARCHIVE 0x20 | 122 # define A_ARCHIVE 0x20 |
132 #endif | 123 #endif |
133 | 124 |
134 struct dirent { | 125 struct dirent { |
135 #if defined(__OS2__) || defined(__WIN32__) /* use the layout of EMX to avoid trouble */ | |
136 int d_ino; /* Dummy */ | 126 int d_ino; /* Dummy */ |
137 int d_reclen; /* Dummy, same as d_namlen */ | 127 int d_reclen; /* Dummy, same as d_namlen */ |
138 int d_namlen; /* length of name */ | 128 int d_namlen; /* length of name */ |
139 char d_name[MAXNAMLEN + 1]; | 129 char d_name[MAXNAMLEN + 1]; |
140 unsigned long d_size; | 130 unsigned long d_size; |
141 unsigned short d_attribute; /* attributes (see above) */ | 131 unsigned short d_attribute; /* attributes (see above) */ |
142 unsigned short d_time; /* modification time */ | 132 unsigned short d_time; /* modification time */ |
143 unsigned short d_date; /* modification date */ | 133 unsigned short d_date; /* modification date */ |
144 #else | |
145 char d_name[MAXNAMLEN + 1]; /* garentee null termination */ | |
146 char d_attribute; /* .. extension .. */ | |
147 unsigned long d_size; /* .. extension .. */ | |
148 #endif | |
149 }; | 134 }; |
150 | 135 |
151 typedef struct _dirdescr DIR; | 136 typedef struct _dirdescr DIR; |
152 /* the structs do not have to be defined here */ | 137 /* the structs do not have to be defined here */ |
153 | 138 |
154 extern DIR *opendir(const char *); | 139 extern DIR *_opendir(const char *); |
155 extern DIR *openxdir(const char *, unsigned); | 140 #define opendir(a) _opendir(a) |
156 extern struct dirent *readdir(DIR *); | 141 extern DIR *_openxdir(const char *, unsigned); |
157 extern void seekdir(DIR *, long); | 142 #define openxdir(a, b) _openxdir(a, b) |
158 extern long telldir(DIR *); | 143 extern struct dirent *_readdir(DIR *); |
159 extern void closedir(DIR *); | 144 #define readdir(a) _readdir(a) |
160 #define rewinddir(dirp) seekdir(dirp, 0L) | 145 extern void _seekdir(DIR *, long); |
146 #define seekdir(a, b) _seekdir(a, b) | |
147 extern long _telldir(DIR *); | |
148 #define telldir(a) _telldir(a) | |
149 extern void _closedir(DIR *); | |
150 #define closedir(a) _closedir(a) | |
161 | 151 |
162 extern char * abs_path(const char *name, char *buffer, int len); | 152 #define rewinddir(dirp) _seekdir(dirp, 0L) |
153 extern char * _abs_path(const char *name, char *buffer, int len); | |
154 #define abs_path(a, b, c) _abs_path(a, b, c) | |
163 | 155 |
164 #ifndef S_IFMT | 156 #ifndef S_IFMT |
165 #define S_IFMT ( S_IFDIR | S_IFREG ) | 157 #define S_IFMT ( S_IFDIR | S_IFREG ) |
166 #endif | 158 #endif |
167 | 159 |
176 #ifdef __cplusplus | 168 #ifdef __cplusplus |
177 } | 169 } |
178 #endif | 170 #endif |
179 | 171 |
180 #endif | 172 #endif |
181 #endif |