doc
c_private.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 by Dominik Schmidt <dev@dominik-schmidt.de>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef _C_PRIVATE_H
20 #define _C_PRIVATE_H
21 
22 #include "config.h"
23 
24 /* cross platform defines */
25 #include "config.h"
26 #include <sys/types.h>
27 #include <sys/stat.h>
28 
29 #ifdef _WIN32
30 #include <windef.h>
31 #include <winbase.h>
32 #endif
33 
34 
35 #ifdef _WIN32
36 #define EDQUOT 0
37 #define ENODATA 0
38 #define S_IRGRP 0
39 #define S_IROTH 0
40 #define S_IXGRP 0
41 #define S_IXOTH 0
42 #define O_NOFOLLOW 0
43 #define O_NOATIME 0
44 #define O_NOCTTY 0
45 
46 #define uid_t int
47 #define gid_t int
48 #define nlink_t int
49 #define getuid() 0
50 #define geteuid() 0
51 #endif
52 
53 #ifdef _WIN32
54 typedef struct _stat csync_stat_t;
55 #else
56 typedef struct stat csync_stat_t;
57 #endif
58 
59 #ifndef HAVE_STRERROR_R
60 #define strerror_r(errnum, buf, buflen) snprintf(buf, buflen, "%s", strerror(errnum))
61 #endif
62 
63 #ifndef HAVE_LSTAT
64 #define lstat _stat
65 #endif
66 #ifdef _WIN32
67 #define fstat _fstat
68 #endif
69 
70 #ifndef O_NOATIME
71 #define O_NOATIME 0
72 #endif
73 
74 /* tchar definitions for clean win32 filenames */
75 #define _UNICODE
76 
77 #if defined _WIN32 && defined _UNICODE
78 typedef wchar_t _TCHAR;
79 #define _tcslen wcslen
80 #define _topen _wopen
81 #define _tdirent _wdirent
82 #define _TDIR _WDIR
83 #define _topendir _wopendir
84 #define _tclosedir _wclosedir
85 #define _treaddir _wreaddir
86 #define _trewinddir _wrewinddir
87 #define _ttelldir _wtelldir
88 #define _tseekdir _wseekdir
89 #define _tcreat _wcreat
90 #define _tstat _wstat
91 #define _tunlink _wunlink
92 #define _tmkdir _wmkdir
93 #define _trmdir _wrmdir
94 #define _tchmod _wchmod
95 #define _trewinddir _wrewinddir
96 #else
97 typedef char _TCHAR;
98 #define _tdirent dirent
99 #define _tcslen strlen
100 #define _topen open
101 #define _TDIR DIR
102 #define _topendir opendir
103 #define _tclosedir closedir
104 #define _treaddir readdir
105 #define _trewinddir rewinddir
106 #define _ttelldir telldir
107 #define _tseekdir seekdir
108 #define _tcreat creat
109 #define _tstat lstat
110 #define _tunlink unlink
111 #define _tmkdir mkdir
112 #define _trmdir rmdir
113 #define _tchmod chmod
114 #define _trewinddir rewinddir
115 #endif
116 
117 #endif //_C_PRIVATE_H
118 
119 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */