]> code.citadel.org Git - citadel.git/blobdiff - citadel/logging.c
- port to Cygwin (DLL support, etc.)
[citadel.git] / citadel / logging.c
index a9022876557211d92559bad7c81b17e1b71ecb36..1e0f7bf303e0b44ad8fa474e18c39e7b2f681d26 100644 (file)
@@ -1,21 +1,35 @@
 /*
- * Everything which needs some logging...
  * $Id$
+ *
+ * Everything which needs some logging...
+ *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <signal.h>
-#include <time.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
 #include <ctype.h>
 #include <string.h>
 #include <errno.h>
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#endif
 #include <syslog.h>
 #include "citadel.h"
 #include "server.h"
@@ -28,6 +42,8 @@ void rec_log(unsigned int lrtype, char *name) {
 
        time(&now);
        fp = fopen("citadel.log", "a");
-       fprintf(fp, "%ld|%u|%s\n", now, lrtype, name);
-       fclose(fp);
+       if (fp != NULL) {
+               fprintf(fp, "%ld|%u|%s\n", (long)now, lrtype, name);
+               fclose(fp);
        }
+}