/[LeafOK_CVS]/pvpgn-1.7.4/src/compat/strerror.c
ViewVC logotype

Contents of /pvpgn-1.7.4/src/compat/strerror.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-csrc
no message

1 /*
2 * Copyright (C) 1999 Ross Combs (rocombs@cs.nmsu.edu)
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
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "common/setup_before.h"
19 #ifndef HAVE_STRERROR
20
21 #include <errno.h>
22 #include "strerror.h"
23 #include "common/setup_after.h"
24
25 extern char const * pstrerror(int errornum)
26 {
27 if (errornum==0)
28 return "No error";
29 #ifdef EPERM
30 if (errornum==EPERM)
31 return "Operation not permitted";
32 #endif
33 #ifdef ENOENT
34 if (errornum==ENOENT)
35 return "No such file or directory";
36 #endif
37 #ifdef ESRCH
38 if (errornum==ESRCH)
39 return "No such process";
40 #endif
41 #ifdef EINTR
42 if (errornum==EINTR)
43 return "Interrupted system call";
44 #endif
45 #ifdef EIO
46 if (errornum==EIO)
47 return "I/O error";
48 #endif
49 #ifdef ENXIO
50 if (errornum==EIO)
51 return "No such device or address";
52 #endif
53 #ifdef EBADF
54 if (errornum==EBADF)
55 return "Bad file number";
56 #endif
57 #ifdef EAGAIN
58 if (errornum==EAGAIN)
59 return "Try again";
60 #endif
61 #ifdef ENOMEM
62 if (errornum==ENOMEM)
63 return "Out of memory";
64 #endif
65 #ifdef EACCES
66 if (errornum==EACCES)
67 return "Permission denied";
68 #endif
69 #ifdef EFAULT
70 if (errornum==EFAULT)
71 return "Bad address";
72 #endif
73 #ifdef EBUSY
74 if (errornum==EBUSY)
75 return "Device or resource busy";
76 #endif
77 #ifdef EEXIST
78 if (errornum==EEXIST)
79 return "File exists";
80 #endif
81 #ifdef EXDEV
82 if (errornum==EXDEV)
83 return "Cross-device link";
84 #endif
85 #ifdef EDEADLK
86 if (errornum==EXDEV)
87 return "Resource deadlock would occur";
88 #endif
89 #ifdef EDEADLOCK
90 if (errornum==EDEADLOCK)
91 return "Resource deadlock would occur";
92 #endif
93 #ifdef ENODEV
94 if (errornum==ENODEV)
95 return "No such device";
96 #endif
97 #ifdef ENOTDIR
98 if (errornum==ENOTDIR)
99 return "Not a directory";
100 #endif
101 #ifdef EISDIR
102 if (errornum==EISDIR)
103 return "Is a directory";
104 #endif
105 #ifdef EINVAL
106 if (errornum==EINVAL)
107 return "Invalid argument";
108 #endif
109 #ifdef ENFILE
110 if (errornum==ENFILE)
111 return "Too many open files in system";
112 #endif
113 #ifdef EMFILE
114 if (errornum==EMFILE)
115 return "Too many open files";
116 #endif
117 #ifdef ENOTTY
118 if (errornum==ENOTTY)
119 return "Not a typewriter";
120 #endif
121 #ifdef ETXTBSY
122 if (errornum==ETXTBSY)
123 return "Text file busy";
124 #endif
125 #ifdef EFBIG
126 if (errornum==EFBIG)
127 return "File too large";
128 #endif
129 #ifdef ENOSPC
130 if (errornum==ENOSPC)
131 return "No space left on device";
132 #endif
133 #ifdef ESPIPE
134 if (errornum==ESPIPE)
135 return "Illegal seek";
136 #endif
137 #ifdef EROFS
138 if (errornum==EROFS)
139 return "Read-only file system";
140 #endif
141 #ifdef EMLINK
142 if (errornum==EMLINK)
143 return "Too many links";
144 #endif
145 #ifdef EPIPE
146 if (errornum==EPIPE)
147 return "Broken pipe";
148 #endif
149 #ifdef EDOM
150 if (errornum==EDOM)
151 return "Math argument out of domain of func";
152 #endif
153 #ifdef ERANGE
154 if (errornum==ERANGE)
155 return "Math result not representable";
156 #endif
157 #ifdef ENAMETOOLONG
158 if (errornum==ENAMETOOLONG)
159 return "File name too long";
160 #endif
161 #ifdef ENOLCK
162 if (errornum==ENOLCK)
163 return "No record locks available";
164 #endif
165 #ifdef ENOSYS
166 if (errornum==ENOSYS)
167 return "Function not implemented";
168 #endif
169 #ifdef ENOTEMPTY
170 if (errornum==ENOTEMPTY)
171 return "Directory not empty";
172 #endif
173 #ifdef ELOOP
174 if (errornum==ELOOP)
175 return "Too many symbolic links encountered";
176 #endif
177 #ifdef EHOSTDOWN
178 if (errornum==EHOSTDOWN)
179 return "Host is down";
180 #endif
181 #ifdef EHOSTUNREACH
182 if (errornum==EHOSTUNREACH)
183 return "No route to host";
184 #endif
185 #ifdef EALREADY
186 if (errornum==EALREADY)
187 return "Operation already in progress";
188 #endif
189 #ifdef EINPROGRESS
190 if (errornum==EINPROGRESS)
191 return "Operation now in progress";
192 #endif
193 #ifdef ESTALE
194 if (errornum==ESTALE)
195 return "Stale NFS filehandle";
196 #endif
197 #ifdef EDQUOT
198 if (errornum==EDQUOT)
199 return "Quota exceeded";
200 #endif
201 #ifdef EWOULDBLOCK
202 if (errornum==EWOULDBLOCK)
203 return "Operation would block";
204 #endif
205 #ifdef ECOMM
206 if (errornum==ECOMM)
207 return "Communication error on send";
208 #endif
209 #ifdef EPROTO
210 if (errornum==EPROTO)
211 return "Protocol error";
212 #endif
213 #ifdef EPROTONOSUPPORT
214 if (errornum==EPROTONOSUPPORT)
215 return "Protocol not supported";
216 #endif
217 #ifdef ESOCKTNOSUPPORT
218 if (errornum==ESOCKTNOSUPPORT)
219 return "Socket type not supported";
220 #endif
221 #ifdef ESOCKTNOSUPPORT
222 if (errornum==EOPNOTSUPP)
223 return "Operation not supported";
224 #endif
225 #ifdef EPFNOSUPPORT
226 if (errornum==EPFNOSUPPORT)
227 return "Protocol family not supported";
228 #endif
229 #ifdef EAFNOSUPPORT
230 if (errornum==EAFNOSUPPORT)
231 return "Address family not supported by protocol family";
232 #endif
233 #ifdef EADDRINUSE
234 if (errornum==EADDRINUSE)
235 return "Address already in use";
236 #endif
237 #ifdef EADDRNOTAVAIL
238 if (errornum==EADDRNOTAVAIL)
239 return "Cannot assign requested address";
240 #endif
241 #ifdef ENETDOWN
242 if (errornum==ENETDOWN)
243 return "Network is down";
244 #endif
245 #ifdef ENETUNREACH
246 if (errornum==ENETUNREACH)
247 return "Network is unreachable";
248 #endif
249 #ifdef ENETRESET
250 if (errornum==ENETRESET)
251 return "Network dropped connection on reset";
252 #endif
253 #ifdef ECONNABORTED
254 if (errornum==ECONNABORTED)
255 return "Software caused connection abort";
256 #endif
257 #ifdef ECONNRESET
258 if (errornum==ECONNRESET)
259 return " Connection reset by peer";
260 #endif
261 #ifdef ENOBUFS
262 if (errornum==ENOBUFS)
263 return "No buffer space available";
264 #endif
265 #ifdef EISCONN
266 if (errornum==EISCONN)
267 return "Socket is already connected";
268 #endif
269 #ifdef ENOTCONN
270 if (errornum==ENOTCONN)
271 return "Socket is not connected";
272 #endif
273 #ifdef ESHUTDOWN
274 if (errornum==ESHUTDOWN)
275 return " Cannot send after socket shutdown";
276 #endif
277 #ifdef ETIMEDOUT
278 if (errornum==ETIMEDOUT)
279 return "Connection timed out";
280 #endif
281 #ifdef ECONNREFUSED
282 if (errornum==ECONNREFUSED)
283 return "Connection refused";
284 #endif
285 return "Unknown error";
286 }
287
288 #else
289 #ifdef HAVE_STRING_H
290 # include <string.h>
291 #else
292 # ifdef HAVE_STRINGS_H
293 # include <strings.h>
294 # endif
295 #endif
296
297 #ifdef WIN32
298 #include <winsock2.h>
299
300 extern char const * pstrerror(int errornum)
301 {
302 switch (errornum)
303 {
304 case WSAEINTR: return "Interrupted function call";
305 case WSAEACCES: return "Permission denied";
306 case WSAEFAULT: return "Bad address";
307 case WSAEINVAL: return "Inavlid argument";
308 case WSAEMFILE: return "Too many open files";
309 case WSAEWOULDBLOCK: return "Resource temorarily unavailable";
310 case WSAEINPROGRESS: return "Operation now in progress";
311 case WSAEALREADY: return "Operation already in progress";
312 case WSAENOTSOCK: return "Socket operation on nonsocket";
313 case WSAEDESTADDRREQ: return "Destination address required";
314 case WSAEMSGSIZE: return "Message too long";
315 case WSAEPROTOTYPE: return "Protocol wrong type fpr socket";
316 case WSAENOPROTOOPT: return "Bad protocol option";
317 case WSAEPROTONOSUPPORT: return "Protocol not supported";
318 case WSAESOCKTNOSUPPORT: return "Socket type not supported";
319 case WSAEOPNOTSUPP: return "Operation not supported";
320 case WSAEPFNOSUPPORT: return "Protocol family not supported";
321 case WSAEAFNOSUPPORT: return "Address family not supported by protocol family";
322 case WSAEADDRINUSE: return "Address already in use";
323 case WSAEADDRNOTAVAIL: return "Cannot assign requested address";
324 case WSAENETDOWN: return "Network is down";
325 case WSAENETUNREACH: return "Network is unreachable";
326 case WSAENETRESET: return "Network dropped connection on reset";
327 case WSAECONNABORTED: return "Software caused connection abort";
328 case WSAECONNRESET: return "Connection reset by peer";
329 case WSAENOBUFS: return "No buffer space available";
330 case WSAEISCONN: return "Socket is already connected";
331 case WSAENOTCONN: return "Socket is not connected";
332 case WSAESHUTDOWN: return "Cannot send after socket shutdown";
333 case WSAETIMEDOUT: return "Connection timed out";
334 case WSAECONNREFUSED: return "Connection refused";
335 case WSAEHOSTDOWN: return "Host is down";
336 case WSAEHOSTUNREACH: return "No route to host";
337 case WSAEPROCLIM: return "Too many processes";
338 case WSASYSNOTREADY: return "Network subsystem is unavailable";
339 case WSAVERNOTSUPPORTED: return "Winsock.dll version out of range";
340 case WSANOTINITIALISED: return "Successful WSAStartup not yet performed";
341 case WSAEDISCON: return "Graceful shutdown in progress";
342 case WSATYPE_NOT_FOUND: return "Class type not found";
343 case WSAHOST_NOT_FOUND: return "Host not found";
344 case WSATRY_AGAIN: return "Nonauthoriative host not found";
345 case WSANO_RECOVERY: return "This is a nonrecoverable error";
346 case WSANO_DATA: return "Valid name, no data record of requested type";
347 case WSA_INVALID_HANDLE: return "Specified event object handle is invalid";
348 case WSA_INVALID_PARAMETER: return "One or more parameters are invalid";
349 case WSA_IO_INCOMPLETE: return "Overlapped I/O event object not in signaled state";
350 case WSA_IO_PENDING: return "Overlapped operation will complete later";
351 case WSA_NOT_ENOUGH_MEMORY: return "Insufficient memory available";
352 case WSA_OPERATION_ABORTED: return "Overlapped operation aborted";
353 case WSASYSCALLFAILURE: return "System call failure";
354 default: return strerror(errornum);
355 }
356 }
357 #endif
358
359 #endif

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1