ok() does not support '%S'. Store the Ansi version, convert to Unicode
[wine] / include / msvcrt / sys / stat.h
1 /*
2  * _stat() definitions
3  *
4  * Derived from the mingw header written by Colin Peters.
5  * Modified for Wine use by Jon Griffiths and Francois Gouget.
6  * This file is in the public domain.
7  */
8 #ifndef __WINE_SYS_STAT_H
9 #define __WINE_SYS_STAT_H
10 #define __WINE_USE_MSVCRT
11
12 #include "sys/types.h"
13
14 #ifndef MSVCRT
15 # ifdef USE_MSVCRT_PREFIX
16 #  define MSVCRT(x)    MSVCRT_##x
17 # else
18 #  define MSVCRT(x)    x
19 # endif
20 #endif
21
22 #ifndef MSVCRT_WCHAR_T_DEFINED
23 #define MSVCRT_WCHAR_T_DEFINED
24 #ifndef __cplusplus
25 typedef unsigned short MSVCRT(wchar_t);
26 #endif
27 #endif
28
29 #ifndef _MSC_VER
30 # ifndef __int64
31 #  define __int64 long long
32 # endif
33 #endif
34
35 #ifndef MSVCRT_DEV_T_DEFINED
36 typedef unsigned int   _dev_t;
37 #define MSVCRT_DEV_T_DEFINED
38 #endif
39
40 #ifndef MSVCRT_INO_T_DEFINED
41 typedef unsigned short _ino_t;
42 #define MSVCRT_INO_T_DEFINED
43 #endif
44
45 #ifndef MSVCRT_TIME_T_DEFINED
46 typedef long MSVCRT(time_t);
47 #define MSVCRT_TIME_T_DEFINED
48 #endif
49
50 #ifndef MSVCRT_OFF_T_DEFINED
51 typedef int MSVCRT(_off_t);
52 #define MSVCRT_OFF_T_DEFINED
53 #endif
54
55 #define _S_IEXEC  0x0040
56 #define _S_IWRITE 0x0080
57 #define _S_IREAD  0x0100
58 #define _S_IFIFO  0x1000
59 #define _S_IFCHR  0x2000
60 #define _S_IFDIR  0x4000
61 #define _S_IFREG  0x8000
62 #define _S_IFMT   0xF000
63
64 /* for FreeBSD */
65 #undef st_atime
66 #undef st_ctime
67 #undef st_mtime
68
69 #ifndef MSVCRT_STAT_DEFINED
70 #define MSVCRT_STAT_DEFINED
71
72 struct _stat {
73   _dev_t         st_dev;
74   _ino_t         st_ino;
75   unsigned short st_mode;
76   short          st_nlink;
77   short          st_uid;
78   short          st_gid;
79   _dev_t         st_rdev;
80   MSVCRT(_off_t) st_size;
81   MSVCRT(time_t) st_atime;
82   MSVCRT(time_t) st_mtime;
83   MSVCRT(time_t) st_ctime;
84 };
85
86 struct MSVCRT(stat) {
87   _dev_t         st_dev;
88   _ino_t         st_ino;
89   unsigned short st_mode;
90   short          st_nlink;
91   short          st_uid;
92   short          st_gid;
93   _dev_t         st_rdev;
94   MSVCRT(_off_t) st_size;
95   MSVCRT(time_t) st_atime;
96   MSVCRT(time_t) st_mtime;
97   MSVCRT(time_t) st_ctime;
98 };
99
100 struct _stati64 {
101   _dev_t         st_dev;
102   _ino_t         st_ino;
103   unsigned short st_mode;
104   short          st_nlink;
105   short          st_uid;
106   short          st_gid;
107   _dev_t         st_rdev;
108   __int64        st_size;
109   MSVCRT(time_t) st_atime;
110   MSVCRT(time_t) st_mtime;
111   MSVCRT(time_t) st_ctime;
112 };
113 #endif /* MSVCRT_STAT_DEFINED */
114
115 #ifdef __cplusplus
116 extern "C" {
117 #endif
118
119 int MSVCRT(_fstat)(int,struct _stat*);
120 int MSVCRT(_stat)(const char*,struct _stat*);
121 int _fstati64(int,struct _stati64*);
122 int _stati64(const char*,struct _stati64*);
123 int _umask(int);
124
125 #ifndef MSVCRT_WSTAT_DEFINED
126 #define MSVCRT_WSTAT_DEFINED
127 int _wstat(const MSVCRT(wchar_t)*,struct _stat*);
128 int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*);
129 #endif /* MSVCRT_WSTAT_DEFINED */
130
131 #ifdef __cplusplus
132 }
133 #endif
134
135
136 #ifndef USE_MSVCRT_PREFIX
137 #define S_IFMT   _S_IFMT
138 #define S_IFDIR  _S_IFDIR
139 #define S_IFCHR  _S_IFCHR
140 #define S_IFREG  _S_IFREG
141 #define S_IREAD  _S_IREAD
142 #define S_IWRITE _S_IWRITE
143 #define S_IEXEC  _S_IEXEC
144
145 static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
146 static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
147 #ifndef MSVCRT_UMASK_DEFINED
148 static inline int umask(int fd) { return _umask(fd); }
149 #define MSVCRT_UMASK_DEFINED
150 #endif
151 #endif /* USE_MSVCRT_PREFIX */
152
153 #endif /* __WINE_SYS_STAT_H */