:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / include / msvcrt / dir.h
1 /*
2  * dir.h
3  *
4  * Functions for working with directories and path names.
5  *
6  * This file is part of the Mingw32 package.
7  *
8  * Contributors:
9  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10  *
11  *  THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  *  This source code is offered for use in the public domain. You may
14  *  use, modify or distribute it freely.
15  *
16  *  This code is distributed in the hope that it will be useful but
17  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  *  DISCLAMED. This includes but is not limited to warranties of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * $Revision$
22  * $Author$
23  * $Date$
24  *
25  */
26
27 #ifndef __STRICT_ANSI__
28
29 #ifndef _DIR_H_
30 #define _DIR_H_
31
32 #include <msvcrt/stdio.h>       /* To get FILENAME_MAX... ugly. */
33 #include <msvcrt/sys/types.h>   /* To get time_t. */
34
35 #ifdef  __cplusplus
36 extern "C" {
37 #endif
38
39 /*
40  * Attributes of files as returned by _findfirst et al.
41  */
42 #define _A_NORMAL       0x00000000
43 #define _A_RDONLY       0x00000001
44 #define _A_HIDDEN       0x00000002
45 #define _A_SYSTEM       0x00000004
46 #define _A_VOLID        0x00000008
47 #define _A_SUBDIR       0x00000010
48 #define _A_ARCH         0x00000020
49
50 #ifndef _FSIZE_T_DEFINED
51 typedef unsigned long   _fsize_t;
52 #define _FSIZE_T_DEFINED
53 #endif
54
55 /*
56  * The following structures are filled in by _findfirst or _findnext when
57  * they succeed in finding a match.
58  */
59 struct _finddata_t
60 {
61         unsigned        attrib;         /* Attributes, see constants above. */
62         time_t          time_create;
63         time_t          time_access;    /* always midnight local time */
64         time_t          time_write;
65         _fsize_t        size;
66         char            name[FILENAME_MAX];     /* may include spaces. */
67 };
68
69 struct _finddatai64_t
70 {
71         unsigned        attrib;         /* Attributes, see constants above. */
72         time_t          time_create;
73         time_t          time_access;    /* always midnight local time */
74         time_t          time_write;
75         __int64         size;
76         char            name[FILENAME_MAX];     /* may include spaces. */
77 };
78
79 struct _wfinddata_t
80 {
81         unsigned        attrib;         /* Attributes, see constants above. */
82         time_t          time_create;
83         time_t          time_access;    /* always midnight local time */
84         time_t          time_write;
85         _fsize_t        size;
86         wchar_t         name[FILENAME_MAX];     /* may include spaces. */
87 };
88
89 struct _wfinddatai64_t
90 {
91         unsigned        attrib;         /* Attributes, see constants above. */
92         time_t          time_create;
93         time_t          time_access;    /* always midnight local time */
94         time_t          time_write;
95         __int64         size;
96         wchar_t         name[FILENAME_MAX];     /* may include spaces. */
97 };
98
99 /*
100  * Functions for searching for files. _findfirst returns -1 if no match
101  * is found. Otherwise it returns a handle to be used in _findnext and
102  * _findclose calls. _findnext also returns -1 if no match could be found,
103  * and 0 if a match was found. Call _findclose when you are finished.
104  */
105 int     _findclose (int nHandle);
106 int     _findfirst (const char* szFilespec, struct _finddata_t* find);
107 int     _findfirsti64 (const char* szFilespec, struct _finddatai64_t* find);
108 int     _findnext (int nHandle, struct _finddata_t* find);
109 int     _findnexti64 (int nHandle, struct _finddatai64_t* find);
110
111 int     _chdir (const char* szPath);
112 char*   _getcwd (char* caBuffer, int nBufferSize);
113 int     _mkdir (const char* szPath);
114 char*   _mktemp (char* szTemplate);
115 int     _rmdir (const char* szPath);
116
117
118 /* Wide character versions */
119 int     _wfindfirst(const wchar_t *_name, struct _wfinddata_t *result);
120 int     _wfindfirsti64(const wchar_t *_name, struct _wfinddatai64_t *result);
121 int     _wfindnext(int handle, struct _wfinddata_t *result);
122 int     _wfindnexti64(int handle, struct _wfinddatai64_t *result);
123
124 int     _wchdir(const wchar_t *szPath);
125 wchar_t* _wgetcwd(wchar_t *buffer, int maxlen);
126 int     _wmkdir(const wchar_t *_path);
127 wchar_t* _wmktemp (wchar_t *_template);
128 int     _wrmdir(const wchar_t *_path);
129
130
131 #ifndef _NO_OLDNAMES
132
133 int     chdir (const char* szPath);
134 char*   getcwd (char* caBuffer, int nBufferSize);
135 int     mkdir (const char* szPath);
136 char*   mktemp (char* szTemplate);
137 int     rmdir (const char* szPath);
138
139 #endif /* Not _NO_OLDNAMES */
140
141
142 #ifdef  __cplusplus
143 }
144 #endif
145
146 #endif  /* Not _DIR_H_ */
147
148 #endif  /* Not __STRICT_ANSI__ */