1 | /* This file is part of the KDE libraries |
2 | Copyright (c) 2006 The KDE Project |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. |
7 | |
8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
16 | Boston, MA 02110-1301, USA. |
17 | */ |
18 | |
19 | #ifndef KDEFAKES_H |
20 | #define KDEFAKES_H |
21 | |
22 | /* This file defines the prototypes for a few (C library) functions for |
23 | platforms which either |
24 | 1) have those functions, but lack the prototypes in their header files. |
25 | 2) don't have those functions, in which case kdecore provides them |
26 | |
27 | You should include this file in any .cpp file that uses any one of these |
28 | functions: |
29 | strlcat, strlcpy, |
30 | strcasestr, |
31 | setenv, unsetenv, |
32 | usleep, initgroups, |
33 | random, srandom (this is for KRandom itself, prefer using KRandom in any other code) |
34 | mkdtemp (this is for KTempDir itself, prefer using KTempDir everywhere else) |
35 | mkstemp, mkstemps (prefer to use QTemporaryfile instead) |
36 | trunc |
37 | getgrouplist |
38 | */ |
39 | |
40 | /* #undef HAVE_STRLCAT_PROTO */ |
41 | #if !defined(HAVE_STRLCAT_PROTO) |
42 | #ifdef __cplusplus |
43 | extern "C" { |
44 | #endif |
45 | unsigned long strlcat(char*, const char*, unsigned long); |
46 | #ifdef __cplusplus |
47 | } |
48 | #endif |
49 | #endif |
50 | |
51 | /* #undef HAVE_STRLCPY_PROTO */ |
52 | #if !defined(HAVE_STRLCPY_PROTO) |
53 | #ifdef __cplusplus |
54 | extern "C" { |
55 | #endif |
56 | unsigned long strlcpy(char*, const char*, unsigned long); |
57 | #ifdef __cplusplus |
58 | } |
59 | #endif |
60 | #endif |
61 | |
62 | #define HAVE_STRCASESTR_PROTO 1 |
63 | #if !defined(HAVE_STRCASESTR_PROTO) |
64 | #ifdef __cplusplus |
65 | extern "C" { |
66 | #endif |
67 | char *strcasestr(const char *str1, const char *str2); |
68 | #ifdef __cplusplus |
69 | } |
70 | #endif |
71 | #endif |
72 | |
73 | #define HAVE_RANDOM_PROTO 1 |
74 | #if !defined(HAVE_RANDOM_PROTO) |
75 | #ifdef __cplusplus |
76 | extern "C" { |
77 | #endif |
78 | long int random(void); |
79 | #ifdef __cplusplus |
80 | } |
81 | #endif |
82 | #endif |
83 | |
84 | #define HAVE_SRANDOM_PROTO 1 |
85 | #if !defined(HAVE_SRANDOM_PROTO) |
86 | #ifdef __cplusplus |
87 | extern "C" { |
88 | #endif |
89 | void srandom(unsigned int); |
90 | #ifdef __cplusplus |
91 | } |
92 | #endif |
93 | #endif |
94 | |
95 | #define HAVE_SETENV_PROTO 1 |
96 | #if !defined(HAVE_SETENV_PROTO) |
97 | #ifdef __cplusplus |
98 | extern "C" { |
99 | #endif |
100 | int setenv (const char *, const char *, int); |
101 | #ifdef __cplusplus |
102 | } |
103 | #endif |
104 | #endif |
105 | |
106 | #define HAVE_UNSETENV_PROTO 1 |
107 | #if !defined(HAVE_UNSETENV_PROTO) |
108 | #ifdef __cplusplus |
109 | extern "C" { |
110 | #endif |
111 | int unsetenv (const char *); |
112 | #ifdef __cplusplus |
113 | } |
114 | #endif |
115 | #endif |
116 | |
117 | #define HAVE_USLEEP_PROTO 1 |
118 | #if !defined(HAVE_USLEEP_PROTO) |
119 | #ifdef __cplusplus |
120 | extern "C" { |
121 | #endif |
122 | int usleep (unsigned int); |
123 | #ifdef __cplusplus |
124 | } |
125 | #endif |
126 | #endif |
127 | |
128 | #define HAVE_INITGROUPS_PROTO 1 |
129 | #if !defined(HAVE_INITGROUPS_PROTO) |
130 | #include <unistd.h> |
131 | #ifdef __cplusplus |
132 | extern "C" { |
133 | #endif |
134 | int initgroups(const char *, gid_t); |
135 | #ifdef __cplusplus |
136 | } |
137 | #endif |
138 | #endif |
139 | |
140 | #define HAVE_MKDTEMP_PROTO 1 |
141 | #if !defined(HAVE_MKDTEMP_PROTO) |
142 | #ifdef __cplusplus |
143 | extern "C" { |
144 | #endif |
145 | char *mkdtemp(char *); |
146 | #ifdef __cplusplus |
147 | } |
148 | #endif |
149 | #endif |
150 | |
151 | #define HAVE_MKSTEMPS_PROTO 1 |
152 | #if !defined(HAVE_MKSTEMPS_PROTO) |
153 | #ifdef __cplusplus |
154 | extern "C" { |
155 | #endif |
156 | int mkstemps(char *, int); |
157 | #ifdef __cplusplus |
158 | } |
159 | #endif |
160 | #endif |
161 | |
162 | #define HAVE_MKSTEMP_PROTO 1 |
163 | #if !defined(HAVE_MKSTEMP_PROTO) |
164 | #ifdef __cplusplus |
165 | extern "C" { |
166 | #endif |
167 | int mkstemp(char *); |
168 | #ifdef __cplusplus |
169 | } |
170 | #endif |
171 | #endif |
172 | |
173 | #define HAVE_TRUNC 1 |
174 | #if !defined(HAVE_TRUNC) |
175 | #ifdef __cplusplus |
176 | extern "C" { |
177 | #endif |
178 | double trunc(double); |
179 | #ifdef __cplusplus |
180 | } |
181 | #endif |
182 | #endif |
183 | |
184 | #define HAVE_GETGROUPLIST 1 |
185 | #if !defined(HAVE_GETGROUPLIST) |
186 | #include <sys/types.h> /* for gid_t */ |
187 | #ifdef __cplusplus |
188 | extern "C" { |
189 | #endif |
190 | int getgrouplist(const char *, gid_t , gid_t *, int *); |
191 | #ifdef __cplusplus |
192 | } |
193 | #endif |
194 | #endif |
195 | |
196 | |
197 | #endif /* KDEFAKES_H */ |
198 | |