Prevent crash when no URL is specified.
[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 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
12 #endif
13
14 #include <sys/types.h>
15
16 #ifndef _WCHAR_T_DEFINED
17 #define _WCHAR_T_DEFINED
18 #ifndef __cplusplus
19 typedef unsigned short wchar_t;
20 #endif
21 #endif
22
23 #ifndef _MSC_VER
24 # ifndef __int64
25 #  define __int64 long long
26 # endif
27 #endif
28
29 #ifndef _DEV_T_DEFINED
30 typedef unsigned int _dev_t;
31 #define _DEV_T_DEFINED
32 #endif
33
34 #ifndef _INO_T_DEFINED
35 typedef unsigned short _ino_t;
36 #define _INO_T_DEFINED
37 #endif
38
39 #ifndef _TIME_T_DEFINED
40 typedef long time_t;
41 #define _TIME_T_DEFINED
42 #endif
43
44 #ifndef _OFF_T_DEFINED
45 typedef int _off_t;
46 #define _OFF_T_DEFINED
47 #endif
48
49 #define _S_IEXEC  0x0040
50 #define _S_IWRITE 0x0080
51 #define _S_IREAD  0x0100
52 #define _S_IFIFO  0x1000
53 #define _S_IFCHR  0x2000
54 #define _S_IFDIR  0x4000
55 #define _S_IFREG  0x8000
56 #define _S_IFMT   0xF000
57
58 /* for FreeBSD */
59 #undef st_atime
60 #undef st_ctime
61 #undef st_mtime
62
63 #ifndef _STAT_DEFINED
64 #define _STAT_DEFINED
65
66 struct _stat {
67   _dev_t st_dev;
68   _ino_t st_ino;
69   unsigned short st_mode;
70   short          st_nlink;
71   short          st_uid;
72   short          st_gid;
73   _dev_t st_rdev;
74   _off_t st_size;
75   time_t st_atime;
76   time_t st_mtime;
77   time_t st_ctime;
78 };
79
80 struct stat {
81   _dev_t st_dev;
82   _ino_t st_ino;
83   unsigned short st_mode;
84   short          st_nlink;
85   short          st_uid;
86   short          st_gid;
87   _dev_t st_rdev;
88   _off_t st_size;
89   time_t st_atime;
90   time_t st_mtime;
91   time_t st_ctime;
92 };
93
94 struct _stati64 {
95   _dev_t st_dev;
96   _ino_t st_ino;
97   unsigned short st_mode;
98   short          st_nlink;
99   short          st_uid;
100   short          st_gid;
101   _dev_t st_rdev;
102   __int64        st_size;
103   time_t st_atime;
104   time_t st_mtime;
105   time_t st_ctime;
106 };
107 #endif /* _STAT_DEFINED */
108
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112
113 int _fstat(int,struct _stat*);
114 int _stat(const char*,struct _stat*);
115 int _fstati64(int,struct _stati64*);
116 int _stati64(const char*,struct _stati64*);
117 int _umask(int);
118
119 #ifndef _WSTAT_DEFINED
120 #define _WSTAT_DEFINED
121 int _wstat(const wchar_t*,struct _stat*);
122 int _wstati64(const wchar_t*,struct _stati64*);
123 #endif /* _WSTAT_DEFINED */
124
125 #ifdef __cplusplus
126 }
127 #endif
128
129
130 #define S_IFMT   _S_IFMT
131 #define S_IFDIR  _S_IFDIR
132 #define S_IFCHR  _S_IFCHR
133 #define S_IFREG  _S_IFREG
134 #define S_IREAD  _S_IREAD
135 #define S_IWRITE _S_IWRITE
136 #define S_IEXEC  _S_IEXEC
137
138 #define S_ISCHR(m)      (((m)&_S_IFMT) == _S_IFCHR)
139 #define S_ISDIR(m)      (((m)&_S_IFMT) == _S_IFDIR)
140 #define S_ISFIFO(m)     (((m)&_S_IFMT) == _S_IFIFO)
141 #define S_ISREG(m)      (((m)&_S_IFMT) == _S_IFREG)
142
143 static inline int fstat(int fd, struct stat* ptr) { return _fstat(fd, (struct _stat*)ptr); }
144 static inline int stat(const char* path, struct stat* ptr) { return _stat(path, (struct _stat*)ptr); }
145 #ifndef _UMASK_DEFINED
146 static inline int umask(int fd) { return _umask(fd); }
147 #define _UMASK_DEFINED
148 #endif
149
150 #endif /* __WINE_SYS_STAT_H */