-void lprintf (int loglevel, const char *format, ...);
-void init_sysdep (void);
-void begin_critical_section (int which_one);
-void end_critical_section (int which_one);
-int ig_tcp_server (int port_number, int queue_len);
-struct CitContext *MyContext (void);
-struct CitContext *CreateNewContext (void);
-void InitMyContext (struct CitContext *con);
-void RemoveContext (struct CitContext *con);
-int session_count (void);
-void client_write (char *buf, int nbytes);
+
+#ifndef SYSDEP_DECLS_H
+#define SYSDEP_DECLS_H
+
+#include <stdarg.h>
+#include "sysdep.h"
+
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+#endif
+
+#include <db.h>
+
+#if DB_VERSION_MAJOR < 5
+#error Citadel requires Berkeley DB v5 or newer. Please upgrade.
+#endif
+
+#include "server.h"
+#include "database.h"
+
+#if SIZEOF_SIZE_T == SIZEOF_INT
+#define SIZE_T_FMT "%d"
+#else
+#define SIZE_T_FMT "%ld"
+#endif
+
+#if SIZEOF_LOFF_T == SIZEOF_LONG
+#define LOFF_T_FMT "%ld"
+#else
+#define LOFF_T_FMT "%lld"
+#endif
+
+void cputbuf(const StrBuf *Buf);
+
+#ifdef __GNUC__
+void cprintf (const char *format, ...) __attribute__((__format__(__printf__,1,2)));
+#else