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 #include <wchar.h>
33 #endif
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 stat64 csync_stat_t;
55 #define _FILE_OFFSET_BITS 64
56 #else
57 typedef struct stat csync_stat_t;
58 #endif
59 
60 #ifndef HAVE_STRERROR_R
61 #define strerror_r(errnum, buf, buflen) snprintf(buf, buflen, "%s", strerror(errnum))
62 #endif
63 
64 #ifndef HAVE_LSTAT
65 #define lstat _stat
66 #endif
67 
68 #ifndef O_NOATIME
69 #define O_NOATIME 0
70 #endif
71 
72 #if !defined(HAVE_ASPRINTF) && defined(HAVE___MINGW_ASPRINTF)
73 #define asprintf __mingw_asprintf
74 #endif
75 
76 /* tchar definitions for clean win32 filenames */
77 #define _UNICODE
78 
79 #if defined _WIN32 && defined _UNICODE
80 typedef wchar_t _TCHAR;
81 #define _topen _wopen
82 #define _tdirent _wdirent
83 #define _TDIR _WDIR
84 #define _topendir _wopendir
85 #define _tclosedir _wclosedir
86 #define _treaddir _wreaddir
87 #define _trewinddir _wrewinddir
88 #define _ttelldir _wtelldir
89 #define _tseekdir _wseekdir
90 #define _tcreat _wcreat
91 #define _tstat _wstat64
92 #define _tfstat _fstat64
93 #define _tunlink _wunlink
94 #define _tmkdir _wmkdir
95 #define _trmdir _wrmdir
96 #define _tchmod _wchmod
97 #define _trewinddir _wrewinddir
98 #else
99 typedef char _TCHAR;
100 #define _tdirent dirent
101 #define _topen open
102 #define _TDIR DIR
103 #define _topendir opendir
104 #define _tclosedir closedir
105 #define _treaddir readdir
106 #define _trewinddir rewinddir
107 #define _ttelldir telldir
108 #define _tseekdir seekdir
109 #define _tcreat creat
110 #define _tstat lstat
111 #define _tfstat fstat
112 #define _tunlink unlink
113 #define _tmkdir mkdir
114 #define _trmdir rmdir
115 #define _tchmod chmod
116 #define _trewinddir rewinddir
117 #endif
118 
119 #ifdef WITH_ICONV
120 /** @internal */
121 int c_setup_iconv(const char* to);
122 /** @internal */
123 int c_close_iconv(void);
124 #endif
125 
126 #endif //_C_PRIVATE_H
127 
128 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
char _TCHAR
Definition: c_private.h:99
struct stat csync_stat_t
Definition: c_private.h:57