1 const char errlog_rcs[] = "$Id: errlog.c,v 1.31 2002/03/06 23:02:57 jongfoster Exp $";
2 /*********************************************************************
4 * File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
6 * Purpose : Log errors to a designated destination in an elegant,
9 * Copyright : Written by and Copyright (C) 2001 the SourceForge
10 * IJBSWA team. http://ijbswa.sourceforge.net
12 * Based on the Internet Junkbuster originally written
13 * by and Copyright (C) 1997 Anonymous Coders and
14 * Junkbusters Corporation. http://www.junkbusters.com
16 * This program is free software; you can redistribute it
17 * and/or modify it under the terms of the GNU General
18 * Public License as published by the Free Software
19 * Foundation; either version 2 of the License, or (at
20 * your option) any later version.
22 * This program is distributed in the hope that it will
23 * be useful, but WITHOUT ANY WARRANTY; without even the
24 * implied warranty of MERCHANTABILITY or FITNESS FOR A
25 * PARTICULAR PURPOSE. See the GNU General Public
26 * License for more details.
28 * The GNU General Public License should be included with
29 * this file. If not, you can view it at
30 * http://www.gnu.org/copyleft/gpl.html
31 * or write to the Free Software Foundation, Inc., 59
32 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 * Revision 1.31 2002/03/06 23:02:57 jongfoster
39 * Revision 1.30 2002/03/05 22:43:45 david__schmidt
40 * - Better error reporting on OS/2
41 * - Fix double-slash comment (oops)
43 * Revision 1.29 2002/03/04 23:45:13 jongfoster
44 * Printing thread ID if using Win32 native threads
46 * Revision 1.28 2002/03/04 17:59:59 oes
47 * Deleted deletePidFile(), cosmetics
49 * Revision 1.27 2002/03/04 02:08:01 david__schmidt
50 * Enable web editing of actions file on OS/2 (it had been broken all this time!)
52 * Revision 1.26 2002/01/09 19:05:45 steudten
53 * Fix big memory leak.
55 * Revision 1.25 2002/01/09 14:32:08 oes
56 * Added support for gmtime_r and localtime_r.
58 * Revision 1.24 2001/12/30 14:07:32 steudten
59 * - Add signal handling (unix)
60 * - Add SIGHUP handler (unix)
61 * - Add creation of pidfile (unix)
62 * - Add action 'top' in rc file (RH)
63 * - Add entry 'SIGNALS' to manpage
64 * - Add exit message to logfile (unix)
66 * Revision 1.23 2001/11/07 00:02:13 steudten
67 * Add line number in error output for lineparsing for
68 * actionsfile and configfile.
69 * Special handling for CLF added.
71 * Revision 1.22 2001/11/05 23:43:05 steudten
72 * Add time+date to log files.
74 * Revision 1.21 2001/10/25 03:40:47 david__schmidt
75 * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
76 * threads to call select() simultaneously. So, it's time to do a real, live,
77 * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
78 * (native). Both versions will work, but using __OS2__ offers multi-threading.
80 * Revision 1.20 2001/09/16 23:04:34 jongfoster
83 * Revision 1.19 2001/09/13 20:08:06 jongfoster
84 * Adding support for LOG_LEVEL_CGI
86 * Revision 1.18 2001/09/10 11:27:24 oes
87 * Declaration of w32_socket_strerr now conditional
89 * Revision 1.17 2001/09/10 10:17:13 oes
90 * Removed unused variable; Fixed sprintf format
92 * Revision 1.16 2001/07/30 22:08:36 jongfoster
93 * Tidying up #defines:
94 * - All feature #defines are now of the form FEATURE_xxx
95 * - Permanently turned off WIN_GUI_EDIT
96 * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
98 * Revision 1.15 2001/07/29 17:41:10 jongfoster
99 * Now prints thread ID for each message (pthreads only)
101 * Revision 1.14 2001/07/19 19:03:48 haroon
102 * - Added case for LOG_LEVEL_POPUPS
104 * Revision 1.13 2001/07/13 13:58:58 oes
105 * - Added case for LOG_LEVEL_DEANIMATE
106 * - Removed all #ifdef PCRS
108 * Revision 1.12 2001/06/09 10:55:28 jongfoster
109 * Changing BUFSIZ ==> BUFFER_SIZE
111 * Revision 1.11 2001/06/01 18:14:49 jongfoster
112 * Changing the calls to strerr() to check HAVE_STRERR (which is defined
113 * in config.h if appropriate) rather than the NO_STRERR macro.
115 * Revision 1.10 2001/05/29 11:52:21 oes
116 * Conditional compilation of w32_socket_error
118 * Revision 1.9 2001/05/28 16:15:17 jongfoster
119 * Improved reporting of errors under Win32.
121 * Revision 1.8 2001/05/26 17:25:14 jongfoster
122 * Added support for CLF (Common Log Format) and fixed LOG_LEVEL_LOG
124 * Revision 1.7 2001/05/26 15:21:28 jongfoster
125 * Activity animation in Win32 GUI now works even if debug==0
127 * Revision 1.6 2001/05/25 21:55:08 jongfoster
128 * Now cleans up properly on FATAL (removes taskbar icon etc)
130 * Revision 1.5 2001/05/22 18:46:04 oes
132 * - Enabled filtering banners by size rather than URL
133 * by adding patterns that replace all standard banner
134 * sizes with the "Junkbuster" gif to the re_filterfile
136 * - Enabled filtering WebBugs by providing a pattern
137 * which kills all 1x1 images
139 * - Added support for PCRE_UNGREEDY behaviour to pcrs,
140 * which is selected by the (nonstandard and therefore
141 * capital) letter 'U' in the option string.
142 * It causes the quantifiers to be ungreedy by default.
143 * Appending a ? turns back to greedy (!).
145 * - Added a new interceptor ijb-send-banner, which
146 * sends back the "Junkbuster" gif. Without imagelist or
147 * MSIE detection support, or if tinygif = 1, or the
148 * URL isn't recognized as an imageurl, a lame HTML
149 * explanation is sent instead.
151 * - Added new feature, which permits blocking remote
152 * script redirects and firing back a local redirect
154 * The feature is conditionally compiled, i.e. it
155 * can be disabled with --disable-fast-redirects,
156 * plus it must be activated by a "fast-redirects"
157 * line in the config file, has its own log level
158 * and of course wants to be displayed by show-proxy-args
159 * Note: Boy, all the #ifdefs in 1001 locations and
160 * all the fumbling with configure.in and acconfig.h
161 * were *way* more work than the feature itself :-(
163 * - Because a generic redirect template was needed for
164 * this, tinygif = 3 now uses the same.
166 * - Moved GIFs, and other static HTTP response templates
171 * - Removed some >400 CRs again (Jon, you really worked
174 * Revision 1.4 2001/05/21 19:32:54 jongfoster
175 * Added another #ifdef _WIN_CONSOLE
177 * Revision 1.3 2001/05/20 01:11:40 jongfoster
178 * Added support for LOG_LEVEL_FATAL
179 * Renamed LOG_LEVEL_FRC to LOG_LEVEL_FORCE,
180 * and LOG_LEVEL_REF to LOG_LEVEL_RE_FILTER
182 * Revision 1.2 2001/05/17 22:42:01 oes
183 * - Cleaned CRLF's from the sources and related files
184 * - Repaired logging for REF and FRC
186 * Revision 1.1.1.1 2001/05/15 13:58:51 oes
187 * Initial import of version 2.9.3 source tree
190 *********************************************************************/
194 #include "miscutil.h"
201 #if !defined(_WIN32) && !defined(__OS2__)
203 #endif /* !defined(_WIN32) && !defined(__OS2__) */
207 #ifdef FEATURE_PTHREAD
209 #endif /* def FEATURE_PTHREAD */
215 #endif /* ndef _WIN_CONSOLE */
216 #endif /* def _WIN32 */
227 const char errlog_h_rcs[] = ERRLOG_H_VERSION;
231 * LOG_LEVEL_FATAL cannot be turned off. (There are
232 * some exceptional situations where we need to get a
233 * message to the user).
235 #define LOG_LEVEL_MINIMUM LOG_LEVEL_FATAL
237 /* where to log (default: stderr) */
238 static FILE *logfp = NULL;
240 /* logging detail level. */
241 static int debug = (LOG_LEVEL_FATAL | LOG_LEVEL_ERROR | LOG_LEVEL_INFO);
243 /* static functions */
244 static void fatal_error(const char * error_message);
246 static char *w32_socket_strerr(int errcode, char *tmp_buf);
249 /*********************************************************************
251 * Function : fatal_error
253 * Description : Displays a fatal error to standard error (or, on
254 * a WIN32 GUI, to a dialog box), and exits
255 * JunkBuster with status code 1.
258 * 1 : error_message = The error message to display.
260 * Returns : Does not return.
262 *********************************************************************/
263 static void fatal_error(const char * error_message)
265 #if defined(_WIN32) && !defined(_WIN_CONSOLE)
266 MessageBox(g_hwndLogFrame, error_message, "Internet JunkBuster Error",
267 MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST);
269 /* Cleanup - remove taskbar icon etc. */
272 #else /* if !defined(_WIN32) || defined(_WIN_CONSOLE) */
273 fputs(error_message, stderr);
274 #endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */
284 /*********************************************************************
286 * Function : init_error_log
288 * Description : Initializes the logging module. Must call before
292 * 1 : prog_name = The program name.
293 * 2 : logfname = The logfile name, or NULL for stderr.
294 * 3 : debuglevel = The debugging level.
298 *********************************************************************/
299 void init_error_log(const char *prog_name, const char *logfname, int debuglevel)
303 /* FIXME RACE HAZARD: should start critical section error_log_use here */
305 /* set the logging detail level */
306 debug = debuglevel | LOG_LEVEL_MINIMUM;
308 if ((logfp != NULL) && (logfp != stderr))
310 log_error(LOG_LEVEL_INFO, "(Re-)Open logfile %s", logfname ? logfname : "none");
315 /* set the designated log file */
318 if( !(fp = fopen(logfname, "a")) )
320 log_error(LOG_LEVEL_FATAL, "init_error_log(): can't open logfile: %s", logfname);
323 /* set logging to be completely unbuffered */
329 log_error(LOG_LEVEL_INFO, "Internet JunkBuster version " VERSION);
330 if (prog_name != NULL)
332 log_error(LOG_LEVEL_INFO, "Program name: %s", prog_name);
335 /* FIXME RACE HAZARD: should end critical section error_log_use here */
337 } /* init_error_log */
340 /*********************************************************************
342 * Function : log_error
344 * Description : This is the error-reporting and logging function.
347 * 1 : loglevel = the type of message to be logged
348 * 2 : fmt = the main string we want logged, printf-like
349 * 3 : ... = arguments to be inserted in fmt (printf-like).
353 *********************************************************************/
354 void log_error(int loglevel, char *fmt, ...)
358 static char *outbuf_save = NULL;
361 long this_thread = 1; /* was: pthread_t this_thread;*/
367 #if defined(_WIN32) && !defined(_WIN_CONSOLE)
369 * Irrespective of debug setting, a GET/POST/CONNECT makes
370 * the taskbar icon animate. (There is an option to disable
371 * this but checking that is handled inside LogShowActivity()).
373 if (loglevel == LOG_LEVEL_GPC)
377 #endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */
379 /* verify if loglevel applies to current settings and bail out if negative */
380 if ((loglevel & debug) == 0)
385 /* FIXME get current thread id */
386 #ifdef FEATURE_PTHREAD
387 this_thread = (long)pthread_self();
388 #elif defined(_WIN32)
389 this_thread = GetCurrentThreadId();
390 #elif defined(__OS2__)
391 ulrc = DosGetInfoBlocks(&ptib, NULL);
393 this_thread = ptib -> tib_ptib2 -> tib2_ultid;
394 #endif /* def FEATURE_PTHREAD */
398 outbuf_save = outbuf = (char*)malloc(BUFFER_SIZE);
401 outbuf = outbuf_save;
405 * Write timestamp into tempbuf.
407 * Complex because not all OSs have tm_gmtoff or
408 * the %z field in strftime()
413 #ifdef HAVE_LOCALTIME_R
414 tm_now = *localtime_r(&now, &tm_now);
416 tm_now = *localtime (&now);
418 strftime(outbuf, BUFFER_SIZE-6, "%b %d %H:%M:%S ", &tm_now);
419 outbuf += strlen( outbuf );
423 case LOG_LEVEL_ERROR:
424 outc = sprintf(outbuf, "IJB(%ld) Error: ", this_thread);
426 case LOG_LEVEL_FATAL:
427 outc = sprintf(outbuf, "IJB(%ld) Fatal error: ", this_thread);
430 outc = sprintf(outbuf, "IJB(%ld) Request: ", this_thread);
432 case LOG_LEVEL_CONNECT:
433 outc = sprintf(outbuf, "IJB(%ld) Connect: ", this_thread);
436 outc = sprintf(outbuf, "IJB(%ld) Writing: ", this_thread);
438 case LOG_LEVEL_HEADER:
439 outc = sprintf(outbuf, "IJB(%ld) Header: ", this_thread);
442 outc = sprintf(outbuf, "IJB(%ld) Info: ", this_thread);
444 case LOG_LEVEL_RE_FILTER:
445 outc = sprintf(outbuf, "IJB(%ld) Re-Filter: ", this_thread);
447 #ifdef FEATURE_FORCE_LOAD
448 case LOG_LEVEL_FORCE:
449 outc = sprintf(outbuf, "IJB(%ld) Force: ", this_thread);
451 #endif /* def FEATURE_FORCE_LOAD */
452 #ifdef FEATURE_FAST_REDIRECTS
453 case LOG_LEVEL_REDIRECTS:
454 outc = sprintf(outbuf, "IJB(%ld) Redirect: ", this_thread);
456 #endif /* def FEATURE_FAST_REDIRECTS */
457 case LOG_LEVEL_DEANIMATE:
458 outc = sprintf(outbuf, "IJB(%ld) Gif-Deanimate: ", this_thread);
461 outbuf = outbuf_save;
465 #ifdef FEATURE_KILL_POPUPS
466 case LOG_LEVEL_POPUPS:
467 outc = sprintf(outbuf, "IJB(%ld) Kill-Popups: ", this_thread);
469 #endif /* def FEATURE_KILL_POPUPS */
471 outc = sprintf(outbuf, "IJB(%ld) CGI: ", this_thread);
474 outc = sprintf(outbuf, "IJB(%ld) UNKNOWN LOG TYPE(%d): ", this_thread, loglevel);
478 /* get ready to scan var. args. */
481 /* build formatted message from fmt and var-args */
482 while ((*src) && (outc < BUFFER_SIZE-2))
484 char tempbuf[BUFFER_SIZE];
503 outbuf[outc++] = '%';
506 ival = va_arg( ap, int );
508 outc += sprintf(tempbuf, "%d", ival);
509 if (outc < BUFFER_SIZE-1)
511 strcpy(outbuf + oldoutc, tempbuf);
515 outbuf[oldoutc] = '\0';
519 uval = va_arg( ap, unsigned );
521 outc += sprintf(tempbuf, "%u", uval);
522 if (outc < BUFFER_SIZE-1)
524 strcpy(outbuf + oldoutc, tempbuf);
528 outbuf[oldoutc] = '\0';
532 /* this is a modifier that must be followed by u or d */
536 lval = va_arg( ap, long );
538 outc += sprintf(tempbuf, "%ld", lval);
542 ulval = va_arg( ap, unsigned long );
544 outc += sprintf(tempbuf, "%lu", ulval);
549 sprintf(outbuf, "IJB(%ld) Error: log_error(): Bad format string:\n"
551 "Exiting.", this_thread, fmt);
552 /* FIXME RACE HAZARD: should start critical section error_log_use here */
557 fputs(outbuf, logfp);
558 /* FIXME RACE HAZARD: should end critical section error_log_use here */
563 if (outc < BUFFER_SIZE-1)
565 strcpy(outbuf + oldoutc, tempbuf);
569 outbuf[oldoutc] = '\0';
574 * Note that char paramaters are converted to int, so we need to
575 * pass "int" to va_arg. (See K&R, 2nd ed, section A7.3.2, page 202)
577 outbuf[outc++] = (char) va_arg( ap, int );
580 sval = va_arg( ap, char * );
582 outc += strlen(sval);
583 if (outc < BUFFER_SIZE-1)
585 strcpy(outbuf + oldoutc, sval);
589 outbuf[oldoutc] = '\0';
593 /* Non-standard: Print a counted string. Takes 2 parameters:
594 * int length, const char * string
596 ival = va_arg( ap, int );
597 sval = va_arg( ap, char * );
604 if (outc < BUFFER_SIZE-1)
606 memcpy(outbuf + oldoutc, sval, (size_t) ival);
610 outbuf[oldoutc] = '\0';
614 /* Non-standard: Print error code from errno */
616 ival = WSAGetLastError();
617 sval = w32_socket_strerr(ival, tempbuf);
622 sval = strerror(ival);
623 #else /* ifndef _WIN32 */
626 sval = strerror(ival);
627 #else /* ifndef HAVE_STRERROR */
629 #endif /* ndef HAVE_STRERROR */
632 sprintf(tempbuf, "(errno = %d)", ival);
635 #endif /* ndef _WIN32 */
637 outc += strlen(sval);
638 if (outc < BUFFER_SIZE-1)
640 strcpy(outbuf + oldoutc, sval);
644 outbuf[oldoutc] = '\0';
648 /* Non-standard: Print a Common Log File timestamp */
651 * Write timestamp into tempbuf.
653 * Complex because not all OSs have tm_gmtoff or
654 * the %z field in strftime()
659 #ifdef HAVE_LOCALTIME_R
665 gmt = *gmtime_r(&now, &gmt);
669 #ifdef HAVE_LOCALTIME_R
670 tm_now = localtime_r(&now, &dummy);
672 tm_now = localtime (&now);
674 days = tm_now->tm_yday - gmt.tm_yday;
675 hrs = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) + tm_now->tm_hour - gmt.tm_hour);
676 mins = hrs * 60 + tm_now->tm_min - gmt.tm_min;
677 strftime (tempbuf, BUFFER_SIZE-6, "%d/%b/%Y:%H:%M:%S ", tm_now);
678 sprintf (tempbuf + strlen(tempbuf), "%+03d%02d", mins / 60, abs(mins) % 60);
681 outc += strlen(tempbuf);
682 if (outc < BUFFER_SIZE-1)
684 strcpy(outbuf + oldoutc, tempbuf);
688 outbuf[oldoutc] = '\0';
692 sprintf(outbuf, "IJB(%ld) Error: log_error(): Bad format string:\n"
694 "Exiting.", this_thread, fmt);
695 /* FIXME RACE HAZARD: should start critical section error_log_use here */
700 fputs(outbuf_save, logfp);
701 /* FIXME RACE HAZARD: should end critical section error_log_use here */
702 fatal_error(outbuf_save);
710 /* done with var. args */
713 if (outc >= BUFFER_SIZE-2)
715 /* insufficient room for newline and trailing null. */
717 static const char warning[] = "... [too long, truncated]\n";
719 if (outc < BUFFER_SIZE)
721 /* Need to add terminating null in this case. */
725 /* Truncate output */
726 outbuf[BUFFER_SIZE - sizeof(warning)] = '\0';
729 strcat(outbuf, warning);
733 /* Add terminating newline and null */
734 outbuf[outc++] = '\n';
738 /* FIXME RACE HAZARD: should start critical section error_log_use here */
740 /* deal with glibc stupidity - it won't let you initialize logfp */
746 fputs(outbuf_save, logfp);
748 if (loglevel == LOG_LEVEL_FATAL)
750 fatal_error(outbuf_save);
754 /* FIXME RACE HAZARD: should end critical section error_log_use here */
756 #if defined(_WIN32) && !defined(_WIN_CONSOLE)
757 /* Write to display */
758 LogPutString(outbuf_save);
759 #endif /* defined(_WIN32) && !defined(_WIN_CONSOLE) */
765 /*********************************************************************
767 * Function : w32_socket_strerr
769 * Description : Translate the return value from WSAGetLastError()
773 * 1 : errcode = The return value from WSAGetLastError().
774 * 2 : tmp_buf = A temporary buffer that might be used to
777 * Returns : String representing the error code. This may be
778 * a global string constant or a string stored in
781 *********************************************************************/
782 static char *w32_socket_strerr(int errcode, char *tmp_buf)
784 #define TEXT_FOR_ERROR(code,text) \
785 if (errcode == code) \
787 return #code " - " text; \
790 TEXT_FOR_ERROR(WSAEACCES, "Permission denied")
791 TEXT_FOR_ERROR(WSAEADDRINUSE, "Address already in use.")
792 TEXT_FOR_ERROR(WSAEADDRNOTAVAIL, "Cannot assign requested address.");
793 TEXT_FOR_ERROR(WSAEAFNOSUPPORT, "Address family not supported by protocol family.");
794 TEXT_FOR_ERROR(WSAEALREADY, "Operation already in progress.");
795 TEXT_FOR_ERROR(WSAECONNABORTED, "Software caused connection abort.");
796 TEXT_FOR_ERROR(WSAECONNREFUSED, "Connection refused.");
797 TEXT_FOR_ERROR(WSAECONNRESET, "Connection reset by peer.");
798 TEXT_FOR_ERROR(WSAEDESTADDRREQ, "Destination address required.");
799 TEXT_FOR_ERROR(WSAEFAULT, "Bad address.");
800 TEXT_FOR_ERROR(WSAEHOSTDOWN, "Host is down.");
801 TEXT_FOR_ERROR(WSAEHOSTUNREACH, "No route to host.");
802 TEXT_FOR_ERROR(WSAEINPROGRESS, "Operation now in progress.");
803 TEXT_FOR_ERROR(WSAEINTR, "Interrupted function call.");
804 TEXT_FOR_ERROR(WSAEINVAL, "Invalid argument.");
805 TEXT_FOR_ERROR(WSAEISCONN, "Socket is already connected.");
806 TEXT_FOR_ERROR(WSAEMFILE, "Too many open sockets.");
807 TEXT_FOR_ERROR(WSAEMSGSIZE, "Message too long.");
808 TEXT_FOR_ERROR(WSAENETDOWN, "Network is down.");
809 TEXT_FOR_ERROR(WSAENETRESET, "Network dropped connection on reset.");
810 TEXT_FOR_ERROR(WSAENETUNREACH, "Network is unreachable.");
811 TEXT_FOR_ERROR(WSAENOBUFS, "No buffer space available.");
812 TEXT_FOR_ERROR(WSAENOPROTOOPT, "Bad protocol option.");
813 TEXT_FOR_ERROR(WSAENOTCONN, "Socket is not connected.");
814 TEXT_FOR_ERROR(WSAENOTSOCK, "Socket operation on non-socket.");
815 TEXT_FOR_ERROR(WSAEOPNOTSUPP, "Operation not supported.");
816 TEXT_FOR_ERROR(WSAEPFNOSUPPORT, "Protocol family not supported.");
817 TEXT_FOR_ERROR(WSAEPROCLIM, "Too many processes.");
818 TEXT_FOR_ERROR(WSAEPROTONOSUPPORT, "Protocol not supported.");
819 TEXT_FOR_ERROR(WSAEPROTOTYPE, "Protocol wrong type for socket.");
820 TEXT_FOR_ERROR(WSAESHUTDOWN, "Cannot send after socket shutdown.");
821 TEXT_FOR_ERROR(WSAESOCKTNOSUPPORT, "Socket type not supported.");
822 TEXT_FOR_ERROR(WSAETIMEDOUT, "Connection timed out.");
823 TEXT_FOR_ERROR(WSAEWOULDBLOCK, "Resource temporarily unavailable.");
824 TEXT_FOR_ERROR(WSAHOST_NOT_FOUND, "Host not found.");
825 TEXT_FOR_ERROR(WSANOTINITIALISED, "Successful WSAStartup not yet performed.");
826 TEXT_FOR_ERROR(WSANO_DATA, "Valid name, no data record of requested type.");
827 TEXT_FOR_ERROR(WSANO_RECOVERY, "This is a non-recoverable error.");
828 TEXT_FOR_ERROR(WSASYSNOTREADY, "Network subsystem is unavailable.");
829 TEXT_FOR_ERROR(WSATRY_AGAIN, "Non-authoritative host not found.");
830 TEXT_FOR_ERROR(WSAVERNOTSUPPORTED, "WINSOCK.DLL version out of range.");
831 TEXT_FOR_ERROR(WSAEDISCON, "Graceful shutdown in progress.");
833 * The following error codes are documented in the Microsoft WinSock
834 * reference guide, but don't actually exist.
836 * TEXT_FOR_ERROR(WSA_INVALID_HANDLE, "Specified event object handle is invalid.");
837 * TEXT_FOR_ERROR(WSA_INVALID_PARAMETER, "One or more parameters are invalid.");
838 * TEXT_FOR_ERROR(WSAINVALIDPROCTABLE, "Invalid procedure table from service provider.");
839 * TEXT_FOR_ERROR(WSAINVALIDPROVIDER, "Invalid service provider version number.");
840 * TEXT_FOR_ERROR(WSA_IO_PENDING, "Overlapped operations will complete later.");
841 * TEXT_FOR_ERROR(WSA_IO_INCOMPLETE, "Overlapped I/O event object not in signaled state.");
842 * TEXT_FOR_ERROR(WSA_NOT_ENOUGH_MEMORY, "Insufficient memory available.");
843 * TEXT_FOR_ERROR(WSAPROVIDERFAILEDINIT, "Unable to initialize a service provider.");
844 * TEXT_FOR_ERROR(WSASYSCALLFAILURE, "System call failure.");
845 * TEXT_FOR_ERROR(WSA_OPERATION_ABORTED, "Overlapped operation aborted.");
848 sprintf(tmp_buf, "(error number %d)", errcode);
851 #endif /* def _WIN32 */