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 #ifdef _WIN32
68 #define fstat _fstat64
69 #endif
70 
71 #ifndef O_NOATIME
72 #define O_NOATIME 0
73 #endif
74 
75 /* tchar definitions for clean win32 filenames */
76 #define _UNICODE
77 
78 #if defined _WIN32 && defined _UNICODE
79 typedef wchar_t _TCHAR;
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 _wstat64
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 _topen open
100 #define _TDIR DIR
101 #define _topendir opendir
102 #define _tclosedir closedir
103 #define _treaddir readdir
104 #define _trewinddir rewinddir
105 #define _ttelldir telldir
106 #define _tseekdir seekdir
107 #define _tcreat creat
108 #define _tstat lstat
109 #define _tunlink unlink
110 #define _tmkdir mkdir
111 #define _trmdir rmdir
112 #define _tchmod chmod
113 #define _trewinddir rewinddir
114 #endif
115 
116 #ifdef WITH_ICONV
117 /** @internal */
118 int c_setup_iconv(const char* to);
119 /** @internal */
120 int c_close_iconv(void);
121 #endif
122 
123 #endif //_C_PRIVATE_H
124 
125 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */