comparison platform/dirent.h @ 24:d9e87e8bcf1d

Updated dynamic windows to build with EMX.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 17 Aug 2001 11:44:05 +0000
parents
children 75bf3051235f
comparison
equal deleted inserted replaced
23:2932f9d2c7d5 24:d9e87e8bcf1d
1 #ifdef __OS2__
2 #ifndef __DIRENT_H__
3 #define __DIRENT_H__
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>
10 #ifdef MAXPATHLEN
11 #undef MAXPATHLEN
12 #endif
13 #define MAXPATHLEN (FILENAME_MAX*4)
14 #define MAXNAMLEN FILENAME_MAX
15
16 #else
17 #include <param.h>
18 #endif
19 #endif
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /* attribute stuff */
26 #ifndef A_RONLY
27 # define A_RONLY 0x01
28 # define A_HIDDEN 0x02
29 # define A_SYSTEM 0x04
30 # define A_LABEL 0x08
31 # define A_DIR 0x10
32 # define A_ARCHIVE 0x20
33 #endif
34
35 struct dirent {
36 #if defined(__OS2__) || defined(__WIN32__) /* use the layout of EMX to avoid trouble */
37 int d_ino; /* Dummy */
38 int d_reclen; /* Dummy, same as d_namlen */
39 int d_namlen; /* length of name */
40 char d_name[MAXNAMLEN + 1];
41 unsigned long d_size;
42 unsigned short d_attribute; /* attributes (see above) */
43 unsigned short d_time; /* modification time */
44 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 };
51
52 typedef struct _dirdescr DIR;
53 /* the structs do not have to be defined here */
54
55 extern DIR *opendir(const char *);
56 extern DIR *openxdir(const char *, unsigned);
57 extern struct dirent *readdir(DIR *);
58 extern void seekdir(DIR *, long);
59 extern long telldir(DIR *);
60 extern void closedir(DIR *);
61 #define rewinddir(dirp) seekdir(dirp, 0L)
62
63 extern char * abs_path(const char *name, char *buffer, int len);
64
65 #ifndef S_IFMT
66 #define S_IFMT ( S_IFDIR | S_IFREG )
67 #endif
68
69 #ifndef S_ISDIR
70 #define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR)
71 #endif
72
73 #ifndef S_ISREG
74 #define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG)
75 #endif
76
77 #ifdef __cplusplus
78 }
79 #endif
80
81 #endif
82 #endif
83
84 #ifdef __WIN32__
85 #ifndef __DIRENT_H__
86 #define __DIRENT_H__
87 /*
88 * @(#)msd_dir.h 1.4 87/11/06 Public Domain.
89 *
90 * A public domain implementation of BSD directory routines for
91 * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
92 * August 1897
93 *
94 * Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks
95 * and returns 2 more pieces of information - file size & attribute.
96 * Plus a little reshuffling of some #define's positions December 1987
97 *
98 * Some modifications by Martin Junius 02-14-89
99 *
100 * AK900712
101 * AK910410 abs_path - make absolute path
102 *
103 */
104
105 #ifdef __EMX__
106 #include <sys/param.h>
107 #else
108 #if defined(__IBMC__) || defined(__IBMCPP__) || defined(MSVC)
109 #include <stdio.h>
110 #ifdef MAXPATHLEN
111 #undef MAXPATHLEN
112 #endif
113 #define MAXPATHLEN (FILENAME_MAX*4)
114 #define MAXNAMLEN FILENAME_MAX
115 #else
116 #include <param.h>
117 #endif
118 #endif
119
120 #ifdef __cplusplus
121 extern "C" {
122 #endif
123
124 /* attribute stuff */
125 #ifndef A_RONLY
126 # define A_RONLY 0x01
127 # define A_HIDDEN 0x02
128 # define A_SYSTEM 0x04
129 # define A_LABEL 0x08
130 # define A_DIR 0x10
131 # define A_ARCHIVE 0x20
132 #endif
133
134 struct dirent {
135 #if defined(__OS2__) || defined(__WIN32__) /* use the layout of EMX to avoid trouble */
136 int d_ino; /* Dummy */
137 int d_reclen; /* Dummy, same as d_namlen */
138 int d_namlen; /* length of name */
139 char d_name[MAXNAMLEN + 1];
140 unsigned long d_size;
141 unsigned short d_attribute; /* attributes (see above) */
142 unsigned short d_time; /* modification time */
143 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 };
150
151 typedef struct _dirdescr DIR;
152 /* the structs do not have to be defined here */
153
154 extern DIR *opendir(const char *);
155 extern DIR *openxdir(const char *, unsigned);
156 extern struct dirent *readdir(DIR *);
157 extern void seekdir(DIR *, long);
158 extern long telldir(DIR *);
159 extern void closedir(DIR *);
160 #define rewinddir(dirp) seekdir(dirp, 0L)
161
162 extern char * abs_path(const char *name, char *buffer, int len);
163
164 #ifndef S_IFMT
165 #define S_IFMT ( S_IFDIR | S_IFREG )
166 #endif
167
168 #ifndef S_ISDIR
169 #define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR)
170 #endif
171
172 #ifndef S_ISREG
173 #define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG)
174 #endif
175
176 #ifdef __cplusplus
177 }
178 #endif
179
180 #endif
181 #endif