-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdirute.h
175 lines (140 loc) · 3.54 KB
/
dirute.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
* DIRUTE.H
*
* Released to the public domain.
*/
#ifndef __DIRUTE_H__
#define __DIRUTE_H__
/* file info -- any file size (HPFS) */
#ifdef OS2
struct _dta
{
char reserved[21];
char attrib;
unsigned wr_time;
unsigned wr_date;
long size;
char name[255];
};
#define DIR_DIRECT 0x0010
#define DIR_NORMAL 0x0000
#define DIR_ARCHVD 0x0020
#define DIR_READON 0x0001
#define DIR_HIDDEN 0x0002
#define DIR_SYSTEM 0x0004
#define DIR_ICASE 0 /* HPFS is always case insensitive */
#define DIR_NO_WILDCARDS 0x0
#elif defined (__RSXNT__) || defined (__MINGW32__) || defined (__CYGWIN__)
struct _dta
{
char reserved[21];
unsigned char attrib;
unsigned wr_time;
unsigned wr_date;
long size;
char name[260];
};
#define DIR_DIRECT 0x00000010
#define DIR_NORMAL 0x00000080
#define DIR_ARCHVD 0x00000020
#define DIR_READON 0x00000001
#define DIR_HIDDEN 0x0 /* ? */
#define DIR_SYSTEM 0x0 /* ? */
#define DIR_ICASE 0x0 /* NT is always case insensitive */
#define DIR_NO_WILDCARDS 0x0
#elif defined (UNIX)
#include <stdio.h> /* FILENAME_MAX */
struct _dta
{
char reserved[21];
char attrib;
unsigned wr_time;
unsigned wr_date;
long size;
char name[FILENAME_MAX + 1];
};
#define DIR_DIRECT 1
#define DIR_NORMAL 2
#define DIR_ARCHVD 0
#define DIR_READON 4
#define DIR_HIDDEN 0
#define DIR_SYSTEM 0
#define DIR_ICASE 8
#define DIR_NO_WILDCARDS 16
#elif defined (__WATCOMC__)
#include <stdio.h> /* FILENAME_MAX */
#include <direct.h>
struct _dta
{
char reserved[21];
char attrib;
unsigned short int wr_time;
unsigned short int wr_date;
long size;
char name[FILENAME_MAX + 1];
};
#define DIR_DIRECT _A_SUBDIR
#define DIR_NORMAL _A_NORMAL
#define DIR_ARCHVD _A_ARCH
#define DIR_READON _A_RDONLY
#define DIR_HIDDEN _A_HIDDEN
#define DIR_SYSTEM _A_SYSTEM
#define DIR_ICASE 0
#define DIR_NO_WILDCARDS 0
#else // ifdef OS2
struct _dta
{
char reserved[21];
char attrib;
unsigned wr_time;
unsigned wr_date;
long size;
char name[13];
};
#if defined (__TURBOC__) || defined (__DJGPP__)
#include <dos.h>
#include <dir.h>
#define DIR_DIRECT FA_DIREC
#define DIR_NORMAL 0
#define DIR_ARCHVD FA_ARCH
#define DIR_READON FA_RDONLY
#define DIR_HIDDEN FA_HIDDEN
#define DIR_SYSTEM FA_SYSTEM
#define DIR_ICASE 0
#define DIR_NO_WILDCARDS 0
#elif defined (_MSC_VER)
#include <dos.h>
#define DIR_DIRECT _A_SUBDIR
#define DIR_NORMAL _A_NORMAL
#define DIR_ARCHVD _A_ARCH
#define DIR_READON _A_RDONLY
#define DIR_HIDDEN _A_HIDDEN
#define DIR_SYSTEM _A_SYSTEM
#define DIR_ICASE 0
#define DIR_NO_WILDCARDS 0
#else // if defined (__TURBOC__) || defined (__DJGPP__)
#define DIR_DIRECT _A_DIRECT
#define DIR_NORMAL _A_NORMAL
#define DIR_ARCHVD
#define DIR_READON _A_RDONLY
#define DIR_HIDDEN
#define DIR_SYSTEM
#define DIR_ICASE 0
#define DIR_NO_WILDCARDS 0
#endif // if defined (__TURBOC__) || defined (__DJGPP__)
#endif // ifdef OS2
int dir_findnext(struct _dta * dta);
int dir_findfirst(char * filename, int attribute, struct _dta * dta);
void dir_findclose(struct _dta * dta);
extern const int drive_letters;
/* the following functions will only be available if drive_letters is 1 */
char * dir_getdrivelist(void);
int dir_getdrive(void);
void dir_setdrive(int);
#ifdef UNIX
void adaptcase(char * filename);
#else
#define adaptcase(x) ((void)(x))
#endif
#define DIRUTE_NONE 1
#endif // ifndef __DIRUTE_H__