]> diplodocus.org Git - mdeliver/commitdiff
Drop gratuitous differences from 3.1.0 .
authorepg@pretzelnet.org <>
Sun, 8 Mar 2009 09:16:30 +0000 (01:16 -0800)
committerepg@pretzelnet.org <>
Sun, 8 Mar 2009 09:16:30 +0000 (01:16 -0800)
Earlier I said this was based on 3.1.3, but actually it's 3.1.0 .

* config.h
  Add this, as libspamc.c expects to include it.  Define autoconf macros it
  expects.  Move includes and declarations for my code here.

* libspamc.c
  Drop gratuitous differences.

* libspamc.h
  Only declare libspamc_log if libspamc_log isn't defined as macro (in
  config.h), same as libspamc.c .

config.h [new file with mode: 0644]
libspamc.c
libspamc.h

diff --git a/config.h b/config.h
new file mode 100644 (file)
index 0000000..ca950a6
--- /dev/null
+++ b/config.h
@@ -0,0 +1,15 @@
+/* Define autoconf macros libspamc.c expects. */
+#define HAVE_SYSEXITS_H 1
+#define HAVE_ERRNO_H 1
+#define HAVE_TIME_H 1
+#define HAVE_H_ERRNO 1
+#define HAVE_EX__MAX 1
+
+/* Includes for my code. */
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <stdbool.h>
+
+/* Swap in my logging replacement. */
+void _err(int, bool, char *, int, char *, ...);
+#define libspamc_log(flags, level, ...) _err(-1, false, __FILE__, __LINE__, __VA_ARGS__)
index 44ab02b..b4d1936 100644 (file)
  * </@LICENSE>
  */
 
  * </@LICENSE>
  */
 
+#include "config.h"
 #include "libspamc.h"
 #include "utils.h"
 
 #include "libspamc.h"
 #include "utils.h"
 
-#include <sys/mman.h>
-#include <sys/stat.h>
-
-#include <stdbool.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
-#include <strings.h>
+#ifdef _WIN32
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#define strcasecmp stricmp
+#define sleep Sleep
+#include <io.h>
+#else
+#include <syslog.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
 #define closesocket(x) close(x)
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
 #define closesocket(x) close(x)
+#endif
 
 
+#ifdef HAVE_SYSEXITS_H
 #include <sysexits.h>
 #include <sysexits.h>
+#endif
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
 #include <errno.h>
+#endif
+#ifdef HAVE_SYS_ERRNO_H
+#include <sys/errno.h>
+#endif
+#ifdef HAVE_TIME_H
 #include <time.h>
 #include <time.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #include <sys/time.h>
-
-void _err(int, bool, char *, int, char *, ...);
-#define libspamc_log(flags, level, ...) _err(-1, false, __FILE__, __LINE__, __VA_ARGS__)
-
-enum { LOG_ERR, LOG_DEBUG, LOG_NOTICE };
+#endif
 
 /* FIXME: Make this configurable */
 #define MAX_CONNECT_RETRIES 3
 
 /* FIXME: Make this configurable */
 #define MAX_CONNECT_RETRIES 3
@@ -63,6 +74,10 @@ enum { LOG_ERR, LOG_DEBUG, LOG_NOTICE };
 #  define SHUT_RDWR 2          /* no more receptions or transmissions */
 #endif
 
 #  define SHUT_RDWR 2          /* no more receptions or transmissions */
 #endif
 
+#ifndef HAVE_H_ERRNO
+#define h_errno errno
+#endif
+
 #ifndef HAVE_OPTARG
 extern char *optarg;
 #endif
 #ifndef HAVE_OPTARG
 extern char *optarg;
 #endif
@@ -74,6 +89,11 @@ extern char *optarg;
 /* jm: turned off for now, it should not be necessary. */
 #undef USE_TCP_NODELAY
 
 /* jm: turned off for now, it should not be necessary. */
 #undef USE_TCP_NODELAY
 
+#ifndef HAVE_EX__MAX
+/* jm: very conservative figure, should be well out of range on almost all NIXes */
+#define EX__MAX 200
+#endif
+
 #undef DO_CONNECT_DEBUG_SYSLOGS
 /* or #define DO_CONNECT_DEBUG_SYSLOGS 1 */
 
 #undef DO_CONNECT_DEBUG_SYSLOGS
 /* or #define DO_CONNECT_DEBUG_SYSLOGS 1 */
 
index 4dfc2e5..be3d0fd 100644 (file)
@@ -254,6 +254,8 @@ int process_message(struct transport *tp, char *username,
                    int max_size, int in_fd, int out_fd,
                    const int check_only, const int safe_fallback);
 
                    int max_size, int in_fd, int out_fd,
                    const int check_only, const int safe_fallback);
 
+#ifndef libspamc_log
 void libspamc_log(int flags, int level, char *msg, ...);
 void libspamc_log(int flags, int level, char *msg, ...);
+#endif
 
 #endif
 
 #endif