Mercurial > dwindows
comparison os2/dirent.c @ 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 | 0e6f09149eaa |
comparison
equal
deleted
inserted
replaced
173:c2b5d0019ec3 | 174:75bf3051235f |
---|---|
1 #ifdef OS2 | |
2 | |
3 #include <stdio.h> | 1 #include <stdio.h> |
4 #include <stdlib.h> | 2 #include <stdlib.h> |
5 #include <string.h> | 3 #include <string.h> |
6 #include <ctype.h> | 4 #include <ctype.h> |
7 | 5 |
98 r = 0; | 96 r = 0; |
99 return cache [unit] = r; | 97 return cache [unit] = r; |
100 } | 98 } |
101 | 99 |
102 char * | 100 char * |
103 abs_path(const char *name, char *buffer, int len) | 101 _abs_path(const char *name, char *buffer, int len) |
104 { | 102 { |
105 char buf[4]; | 103 char buf[4]; |
106 if (isalpha(name[0]) && name[1] == ':' && name[2] == '\0') { | 104 if (isalpha(name[0]) && name[1] == ':' && name[2] == '\0') { |
107 buf[0] = name[0]; | 105 buf[0] = name[0]; |
108 buf[1] = name[1]; | 106 buf[1] = name[1]; |
114 return NULL; | 112 return NULL; |
115 return buffer; | 113 return buffer; |
116 } | 114 } |
117 | 115 |
118 DIR * | 116 DIR * |
119 openxdir(const char *path, unsigned att_mask) | 117 _openxdir(const char *path, unsigned att_mask) |
120 { | 118 { |
121 DIR *dir; | 119 DIR *dir; |
122 char name[MAXPATHLEN+3]; | 120 char name[MAXPATHLEN+3]; |
123 Word rc; | 121 Word rc; |
124 | 122 |
172 | 170 |
173 return (DIR *)dir; | 171 return (DIR *)dir; |
174 } | 172 } |
175 | 173 |
176 DIR * | 174 DIR * |
177 opendir(const char *pathname) | 175 _opendir(const char *pathname) |
178 { | 176 { |
179 return openxdir(pathname, 0); | 177 return openxdir(pathname, 0); |
180 } | 178 } |
181 | 179 |
182 struct dirent * | 180 struct dirent * |
183 readdir(DIR *dir) | 181 _readdir(DIR *dir) |
184 { | 182 { |
185 static int dummy_ino = 2; | 183 static int dummy_ino = 2; |
186 | 184 |
187 if (dir->index == dir->count) { | 185 if (dir->index == dir->count) { |
188 Word rc; | 186 Word rc; |
226 | 224 |
227 return &dir->entry; | 225 return &dir->entry; |
228 } | 226 } |
229 | 227 |
230 long | 228 long |
231 telldir(DIR *dir) | 229 _telldir(DIR *dir) |
232 { | 230 { |
233 return dir->number; | 231 return dir->number; |
234 } | 232 } |
235 | 233 |
236 void | 234 void |
237 seekdir(DIR *dir, long off) | 235 _seekdir(DIR *dir, long off) |
238 { | 236 { |
239 if (dir->number > off) { | 237 if (dir->number > off) { |
240 char name[MAXPATHLEN+2]; | 238 char name[MAXPATHLEN+2]; |
241 Word rc; | 239 Word rc; |
242 | 240 |
266 while (dir->number < off && readdir(dir)) | 264 while (dir->number < off && readdir(dir)) |
267 ; | 265 ; |
268 } | 266 } |
269 | 267 |
270 void | 268 void |
271 closedir(DIR *dir) | 269 _closedir(DIR *dir) |
272 { | 270 { |
273 DosFindClose(dir->handle); | 271 DosFindClose(dir->handle); |
274 free(dir); | 272 free(dir); |
275 } | 273 } |
276 | 274 |
299 return 0; | 297 return 0; |
300 } | 298 } |
301 | 299 |
302 #endif | 300 #endif |
303 | 301 |
304 #endif /* OS2 */ | |
305 |