-const char errlog_rcs[] = "$Id: errlog.c,v 1.16 2001/07/30 22:08:36 jongfoster Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.20 2001/09/16 23:04:34 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
*
* Revisions :
* $Log: errlog.c,v $
+ * Revision 1.20 2001/09/16 23:04:34 jongfoster
+ * Fixing a warning
+ *
+ * Revision 1.19 2001/09/13 20:08:06 jongfoster
+ * Adding support for LOG_LEVEL_CGI
+ *
+ * Revision 1.18 2001/09/10 11:27:24 oes
+ * Declaration of w32_socket_strerr now conditional
+ *
+ * Revision 1.17 2001/09/10 10:17:13 oes
+ * Removed unused variable; Fixed sprintf format
+ *
* Revision 1.16 2001/07/30 22:08:36 jongfoster
* Tidying up #defines:
* - All feature #defines are now of the form FEATURE_xxx
#include <stdarg.h>
#include <string.h>
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__OS2__)
#include <unistd.h>
-#endif /* ndef _WIN32 */
+#endif /* !defined(_WIN32) && !defined(__OS2__) */
#include <errno.h>
+#include <assert.h>
#ifdef FEATURE_PTHREAD
#include <pthread.h>
#endif /* def FEATURE_PTHREAD */
#endif /* ndef _WIN_CONSOLE */
#endif /* def _WIN32 */
+#ifdef __OS2__
+#define INCL_DOS
+#include <os2.h>
+#endif
+
#include "errlog.h"
#include "project.h"
/* static functions */
static void fatal_error(const char * error_message);
-static char * w32_socket_strerr(int errcode, char * tmp_buf);
-
+#ifdef _WIN32
+static char *w32_socket_strerr(int errcode, char *tmp_buf);
+#endif
/*********************************************************************
*
void log_error(int loglevel, char *fmt, ...)
{
va_list ap;
- char outbuf[BUFFER_SIZE];
+ char *outbuf= NULL;
char * src = fmt;
int outc = 0;
long this_thread = 1; /* was: pthread_t this_thread;*/
+#ifdef __OS2__
+ PTIB ptib;
+ APIRET ulrc;
+#endif /* __OS2__ */
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
/*
/* FIXME get current thread id */
#ifdef FEATURE_PTHREAD
this_thread = (long)pthread_self();
+#elif __OS2__
+
+ ulrc = DosGetInfoBlocks(&ptib, NULL);
+ if (ulrc == 0)
+ this_thread = ptib -> tib_ptib2 -> tib2_ultid;
#endif /* def FEATURE_PTHREAD */
+ outbuf = (char*)malloc(BUFFER_SIZE);
+ assert(outbuf);
switch (loglevel)
{
case LOG_LEVEL_ERROR:
outc = sprintf(outbuf, "IJB(%ld) Kill-Popups: ", this_thread);
break;
#endif /* def FEATURE_KILL_POPUPS */
+ case LOG_LEVEL_CGI:
+ outc = sprintf(outbuf, "IJB(%ld) CGI: ", this_thread);
+ break;
default:
outc = sprintf(outbuf, "IJB(%ld) UNKNOWN LOG TYPE(%d): ", this_thread, loglevel);
break;
* tmp_buf.
*
*********************************************************************/
-static char * w32_socket_strerr(int errcode, char * tmp_buf)
+static char *w32_socket_strerr(int errcode, char *tmp_buf)
{
#define TEXT_FOR_ERROR(code,text) \
if (errcode == code) \
tab-width: 3
end:
*/
-