- port to Cygwin (DLL support, etc.)
authorNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 6 Sep 2001 01:26:40 +0000 (01:26 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Thu, 6 Sep 2001 01:26:40 +0000 (01:26 +0000)
 - don't build SMTP module if there's no resolver library (eg on Windows)

39 files changed:
citadel/ChangeLog
citadel/Makefile.in
citadel/auth.c
citadel/citadel.h
citadel/citserver.c
citadel/citserver.h
citadel/clientsocket.c
citadel/config.c
citadel/config.h
citadel/configure.ac
citadel/control.c
citadel/database.c
citadel/database_sleepycat.c
citadel/domain.c
citadel/dynloader.c
citadel/dynloader.h
citadel/file_ops.c
citadel/genstamp.c
citadel/getutline.c
citadel/housekeeping.c
citadel/html.c
citadel/internet_addressing.c
citadel/internet_addressing.h
citadel/locate_host.c
citadel/logging.c
citadel/mime_parser.c
citadel/msgbase.c
citadel/parsedate.y
citadel/policy.c
citadel/room_ops.c
citadel/sendcommand.c
citadel/serv_chat.c
citadel/server.h
citadel/snprintf.c
citadel/support.c
citadel/sysdep.c
citadel/sysdep_decls.h
citadel/tools.c
citadel/user_ops.c

index b2405f4c6f2c660aec21fab43bdab3c6162291f9..548fd583a3b6f636f01cd97a2aec240c001d05b9 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 580.31  2001/09/06 01:26:39  nbryant
+  - port to Cygwin (DLL support, etc.)
+  - don't build SMTP module if there's no resolver library (eg on Windows)
+
  Revision 580.30  2001/09/06 00:54:01  nbryant
  updated to libtool 1.4.1 and automake 1.5
 
@@ -2704,3 +2708,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 44de4329a0ebd342768978436c69a4b14eb25e21..8393acd405223bdd456802e364f211d9493113f0 100644 (file)
@@ -22,22 +22,24 @@ all: $(TARGETS)
 EXEEXT=@EXEEXT@
 CX=@CX@
 
+SMTP=@SMTP@
+
 CLIENT_TARGETS=citadel$(EXEEXT) whobbs$(EXEEXT)
-SERVER_TARGETS=citserver setup $(CHKPWD)
-SERV_MODULES=modules/serv_chat.la modules/serv_vcard.la \
-       modules/serv_upgrade.la \
-       modules/serv_smtp.la \
-       modules/serv_pop3.la \
-       modules/serv_imap.la \
-       modules/serv_network.la \
-       modules/serv_pas2.la \
-       modules/serv_inetcfg.la \
-       modules/serv_rwho.la \
-       modules/serv_moderate.la \
-       modules/serv_bio.la \
-       modules/serv_expire.la \
-       modules/serv_vandelay.la \
-       modules/serv_ical.la
+SERVER_TARGETS=libcitserver.la citserver setup $(CHKPWD)
+SERV_MODULES=modules/libchat.la modules/libvcard.la \
+       modules/libupgrade.la \
+       $(SMTP) \
+       modules/libpop3.la \
+       modules/libimap.la \
+       modules/libnetwork.la \
+       modules/libpas2.la \
+       modules/libinetcfg.la \
+       modules/librwho.la \
+       modules/libmoderate.la \
+       modules/libbio.la \
+       modules/libexpire.la \
+       modules/libvandelay.la \
+       modules/libical.la
 UTIL_TARGETS=aidepost netmailer netproc netsetup msgform readlog rcit \
        stats citmail netpoll mailinglist userlist sendcommand \
        base64 qpdecode
@@ -70,12 +72,14 @@ YACC=@YACC@
 DATABASE=@DATABASE@
 
 LIBTOOL=./libtool
-LTSHARE=$(LIBTOOL) $(CC) -rpath $(prefix)/modules -module -avoid-version
+LTSHARE=cd modules && ../$(LIBTOOL) $(CC) -rpath $(prefix)/modules -no-undefined -avoid-version -module
 
 # End configuration section
 
 VPATH=$(srcdir)
 
+DOMAIN=@DOMAIN@
+
 SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c commands.c \
        config.c control.c $(DATABASE) dynloader.c file_ops.c \
        housekeeping.c internetmail.c ipc_c_tcp.c locate_host.c \
@@ -87,10 +91,10 @@ SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c commands.c \
        whobbs.c sendcommand.c mime_parser.c base64.c qpdecode.c getutline.c \
        auth.c chkpwd.c html.c vcard.c serv_upgrade.c serv_vandelay.c \
        serv_smtp.c serv_pop3.c internet_addressing.c parsedate.c genstamp.c \
-       domain.c clientsocket.c serv_inetcfg.c serv_rwho.c serv_bio.c \
+       $(DOMAIN) clientsocket.c serv_inetcfg.c serv_rwho.c serv_bio.c \
        serv_moderate.c client_passwords.c imap_misc.c \
        serv_imap.c imap_tools.c imap_fetch.c imap_search.c imap_store.c \
-       serv_network.c serv_pas2.c serv_ical.c md5.c
+       serv_network.c serv_pas2.c serv_ical.c md5.c server_main.c
 
 DEP_FILES=$(SOURCES:.c=.d)
 
@@ -102,6 +106,7 @@ utils: $(UTIL_TARGETS)
 
 serv_modules: $(SERV_MODULES)
        @cd modules && mods=`echo .libs/*.s[ol]` && test "$$mods" != '.libs/*.s[ol]' && ln -sf $$mods . || true
+       @cd modules && mods=`echo .libs/*.dll` && test "$$mods" != '.libs/*.dll' && ln -sf $$mods . || true
 
 #
 #
@@ -130,18 +135,22 @@ netpoll: netpoll.o config.o ipc_c_tcp.o tools.o $(LIBOBJS)
 #
 #
 
-SERV_OBJS = citserver.ro user_ops.ro support.ro room_ops.ro file_ops.ro \
-       msgbase.ro config.ro sysdep.ro locate_host.ro housekeeping.ro \
-       $(DATABASE:.c=.ro) control.ro logging.ro policy.ro dynloader.ro tools.ro \
-       mime_parser.ro html.ro internet_addressing.ro \
-       parsedate.ro genstamp.ro clientsocket.ro \
-       $(AUTH) $(LIBOBJS:.o=.ro)
+SERV_OBJS = server_main.ro
 
 parsedate.ro: parsedate.c
 
-citserver: $(SERV_OBJS) $(LIBTOOL)
-       $(LIBTOOL) --mode=link $(CC) -export-dynamic $(SERV_OBJS) $(LDFLAGS) $(PTHREAD_LIBS) \
-       $(LIBS) $(NETLIBS) $(GDBM) $(RESOLV) -o citserver
+LIBSERV_OBJS = user_ops.lo citserver.lo sysdep.lo dynloader.lo tools.lo $(DATABASE:.c=.lo) \
+       control.lo policy.lo config.lo support.lo room_ops.lo file_ops.lo msgbase.lo \
+       locate_host.lo housekeeping.lo logging.lo mime_parser.lo html.lo internet_addressing.lo \
+       parsedate.lo genstamp.lo clientsocket.lo $(AUTH) $(LIBOBJS:.o=.lo)
+
+libcitserver.la: $(LIBSERV_OBJS)
+       $(LIBTOOL) $(CC) -rpath $(prefix) -no-undefined -avoid-version \
+       -o libcitserver.la $(LIBSERV_OBJS) $(GDBM)
+
+citserver: $(SERV_OBJS) $(LIBTOOL) libcitserver.la
+       $(LIBTOOL) --mode=link $(CC) $(SERV_OBJS) $(LDFLAGS) $(PTHREAD_LIBS) \
+       $(LIBS) $(NETLIBS) $(RESOLV) libcitserver.la -o citserver
 
 .c.ro:
        $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(PTHREAD_DEFS) -c $< -o $@
@@ -150,58 +159,59 @@ citserver: $(SERV_OBJS) $(LIBTOOL)
        @test -d modules || mkdir -p modules
        $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(PTHREAD_DEFS) -c $< -o $@
 
-modules/serv_chat.la: serv_chat.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_chat.la serv_chat.lo
+modules/libchat.la: serv_chat.lo libcitserver.la $(LIBTOOL)
+       $(LTSHARE) -o libchat.la ../serv_chat.lo ../libcitserver.la
 
-modules/serv_test.la: serv_test.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_test.la serv_test.lo
+modules/libtest.la: serv_test.lo libcitserver.la $(LIBTOOL)
+       $(LTSHARE) -o libtest.la ../serv_test.lo ../libcitserver.la
 
-modules/serv_pop3.la: serv_pop3.lo md5.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_pop3.la serv_pop3.lo md5.lo
+modules/libpop3.la: serv_pop3.lo md5.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libpop3.la ../serv_pop3.lo ../md5.lo ../libcitserver.la
 
-modules/serv_inetcfg.la: serv_inetcfg.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_inetcfg.la serv_inetcfg.lo
+modules/libinetcfg.la: serv_inetcfg.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libinetcfg.la ../serv_inetcfg.lo ../libcitserver.la
 
-modules/serv_rwho.la: serv_rwho.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_rwho.la serv_rwho.lo
+modules/librwho.la: serv_rwho.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o librwho.la ../serv_rwho.lo ../libcitserver.la
 
-modules/serv_moderate.la: serv_moderate.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_moderate.la serv_moderate.lo
+modules/libmoderate.la: serv_moderate.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libmoderate.la ../serv_moderate.lo ../libcitserver.la
 
-modules/serv_bio.la: serv_bio.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_bio.la serv_bio.lo
+modules/libbio.la: serv_bio.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libbio.la ../serv_bio.lo ../libcitserver.la
 
-modules/serv_expire.la: serv_expire.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_expire.la serv_expire.lo
+modules/libexpire.la: serv_expire.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libexpire.la ../serv_expire.lo ../libcitserver.la
 
-modules/serv_vandelay.la: serv_vandelay.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_vandelay.la serv_vandelay.lo
+modules/libvandelay.la: serv_vandelay.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libvandelay.la ../serv_vandelay.lo ../libcitserver.la
 
-modules/serv_network.la: serv_network.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_network.la serv_network.lo
+modules/libnetwork.la: serv_network.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libnetwork.la ../serv_network.lo ../libcitserver.la
 
-modules/serv_upgrade.la: serv_upgrade.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_upgrade.la serv_upgrade.lo
+modules/libupgrade.la: serv_upgrade.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libupgrade.la ../serv_upgrade.lo ../libcitserver.la
 
-modules/serv_vcard.la: serv_vcard.lo vcard.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_vcard.la serv_vcard.lo vcard.lo
+modules/libvcard.la: serv_vcard.lo vcard.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libvcard.la ../serv_vcard.lo ../vcard.lo ../libcitserver.la
 
-modules/serv_smtp.la: serv_smtp.lo domain.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_smtp.la serv_smtp.lo domain.lo
+modules/libsmtp.la: serv_smtp.lo domain.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libsmtp.la ../serv_smtp.lo ../domain.lo ../libcitserver.la
 
-modules/serv_imap.la: serv_imap.lo imap_tools.lo imap_fetch.lo \
-       imap_search.lo imap_store.lo imap_misc.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_imap.la imap_tools.lo serv_imap.lo \
-               imap_fetch.lo imap_search.lo imap_store.lo imap_misc.lo
 
-aidepost: aidepost.o config.o $(LIBOBJS)
-       $(CC) aidepost.o config.o $(LIBOBJS) $(LDFLAGS) -o aidepost
+modules/libimap.la: serv_imap.lo imap_tools.lo imap_fetch.lo \
+       imap_search.lo imap_store.lo imap_misc.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libimap.la ../imap_tools.lo ../serv_imap.lo \
+               ../imap_fetch.lo ../imap_search.lo ../imap_store.lo ../imap_misc.lo ../libcitserver.la
 
-modules/serv_pas2.la: serv_pas2.lo md5.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_pas2.la serv_pas2.lo md5.lo
+aidepost: aidepost.o libcitserver.la $(LIBOBJS)
+       $(LIBTOOL) $(CC) aidepost.o libcitserver.la $(LIBOBJS) $(LDFLAGS) -o aidepost
 
-modules/serv_ical.la: serv_ical.lo $(LIBTOOL)
-       $(LTSHARE) -o modules/serv_ical.la serv_ical.lo
+modules/libpas2.la: serv_pas2.lo md5.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libpas2.la ../serv_pas2.lo ../md5.lo ../libcitserver.la
+
+modules/libical.la: serv_ical.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libical.la ../serv_ical.lo ../libcitserver.la
 
 
 
@@ -236,8 +246,8 @@ netsetup: netsetup.o config.o
 whobbs$(EXEEXT): whobbs.o ipc_c_tcp.o tools.o $(LIBOBJS)
        $(CC) whobbs.o ipc_c_tcp.o tools.o $(LIBOBJS) $(LDFLAGS) -o whobbs $(NETLIBS)
 
-sendcommand: sendcommand.o ipc_c_tcp.o tools.o config.o $(LIBOBJS)
-       $(CC) sendcommand.o ipc_c_tcp.o tools.o config.o \
+sendcommand: sendcommand.o ipc_c_tcp.o libcitserver.la $(LIBOBJS)
+       $(LIBTOOL) $(CC) sendcommand.o ipc_c_tcp.o libcitserver.la \
         $(LIBOBJS) $(LDFLAGS) -o sendcommand $(NETLIBS)
 
 qpdecode: qpdecode.o
@@ -259,8 +269,8 @@ readlog: readlog.o config.o
 rcit: rcit.o config.o
        $(CC) rcit.o config.o $(LDFLAGS) -o rcit
 
-stats: stats.o ipc_c_tcp.o tools.o config.o $(LIBOBJS)
-       $(CC) stats.o ipc_c_tcp.o tools.o config.o $(LIBOBJS) $(LDFLAGS) -o stats $(NETLIBS)
+stats: stats.o ipc_c_tcp.o libcitserver.la $(LIBOBJS)
+       $(LIBTOOL) $(CC) stats.o ipc_c_tcp.o libcitserver.la $(LIBOBJS) $(LDFLAGS) -o stats $(NETLIBS)
 
 .PHONY: install-data install-doc install-exec clean cleaner distclean
 
@@ -292,13 +302,17 @@ install-exec: all weekly
        @for i in bio bitbucket files images info modules userpics; do \
                $(srcdir)/mkinstalldirs $(root)$(prefix)/$$i; \
        done
-       @for i in $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) \
-                $(SERV_MODULES) ; do \
+       @for i in $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS); do \
                if test -f $$i; then \
                        echo $(LIBTOOL) --mode=install $(INSTALL) $$i $(root)$(prefix)/$$i; \
                        $(LIBTOOL) --mode=install $(INSTALL) $$i $(root)$(prefix)/$$i; \
                fi \
        done
+       @for i in $(SERV_MODULES) ; do \
+               if test -f $$i; then \
+                       (cd modules && ../$(LIBTOOL) --mode=install $(INSTALL) `basename $$i` $(root)$(prefix)/$$i) ; \
+               fi \
+       done
        @for i in utilsmenu weekly dnetsetup; do \
                if test -f $(srcdir)/$$i; then \
                        echo $(INSTALL) $(srcdir)/$$i $(root)$(prefix)/$$i; \
@@ -323,7 +337,7 @@ distclean: cleaner
 
 .c.d:
        @echo Checking dependencies for $<
-       @$(CC) -M $(CPPFLAGS) $(PTHREAD_DEFS) $< | sed -e 's!$*.o!$*.o $*.ro $*.mo $@!' > $@
+       @$(CC) -M $(CPPFLAGS) $(PTHREAD_DEFS) $< | sed -e 's!$*.o!$*.o $*.ro $*.lo $@!' > $@
        @test -s $@ || rm -f $@
 
 Makefile: $(srcdir)/Makefile.in config.status
index 66dc67c7a90468b8722cd3f8fd5f3be7696636cf..a62d6003ca7ea45f25b4f7ff7b64bb83dfb9d74f 100644 (file)
@@ -6,6 +6,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #if defined(__linux) || defined(__sun) /* needed for crypt(): */
 #define _XOPEN_SOURCE
 #define _XOPEN_SOURCE_EXTENDED 1
index 41f331c87b069b8febbd56d7c6914fd7d5457280..a613b43baf1d394eecb29f44f3d6dc0e5748ae97 100644 (file)
@@ -6,6 +6,10 @@
  */
 
 /* system customizations are in sysconfig.h */
+
+#ifndef CITADEL_H
+#define CITADEL_H
+
 #include "sysdep.h"
 #include "sysconfig.h"
 #include "ipcdef.h"
@@ -266,3 +270,5 @@ struct floor {
 #ifndef LONG_MAX
 #define LONG_MAX 2147483647L
 #endif
+
+#endif /* CITADEL_H */
index 919156a6a4da8cf039cca909439df48b3b45809c..8bbd76d243afd410fcb7eb111b3a8fb00f9627bf 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -36,6 +40,7 @@
 #include <arpa/inet.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "config.h"
@@ -48,7 +53,6 @@
 #include "locate_host.h"
 #include "room_ops.h"
 #include "file_ops.h"
-#include "dynloader.h"
 #include "policy.h"
 #include "control.h"
 #include "tools.h"
index 391e9d4f4421dce6bee4234412ba8d0e63b33109..5b4f7bc1e3f9adfe4e442bcf9f8a86620f2cf01a 100644 (file)
@@ -1,4 +1,7 @@
 /* $Id$ */
+
+#include "dynloader.h"
+
 void master_startup (void);
 void master_cleanup (void);
 void RemoveContext (struct CitContext *);
@@ -28,7 +31,7 @@ void citproto_begin_session(void);
 void GenerateRoomDisplay(char *real_room,
                         struct CitContext *viewed,
                         struct CitContext *viewer);
-extern int do_defrag;
+extern DLEXP int do_defrag;
 char CtdlCheckExpress(void);
 
 int CtdlAccessCheck(int);
index 00039e5de49c9d449da76a0cbcb7b1772037d9c2..286659aef946e8e4787c3253972ae740d196a51c 100644 (file)
@@ -8,6 +8,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -23,6 +27,8 @@
 #include <errno.h>
 #include <stdarg.h>
 #include "citadel.h"
+#include "server.h"
+#include "dynloader.h"
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
 #endif
index 4f7de769e193ba192a663a85b49e396a23d5a556..534eb58d94f85fc786b8189926d649807a980747 100644 (file)
@@ -6,6 +6,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <sys/stat.h>
@@ -15,6 +19,8 @@
 #include <string.h>
 #include <limits.h>
 #include "citadel.h"
+#include "server.h"
+#include "dynloader.h"
 #include "config.h"
 
 struct config config;
@@ -53,10 +59,12 @@ void get_config(void) {
                perror("citadel.config");
                exit(1);
        }
+#ifndef __CYGWIN__
        if (st.st_uid != BBSUID || st.st_mode != (S_IFREG | S_IRUSR | S_IWUSR)) {
                fprintf(stderr, "check the permissions on citadel.config\n");
                exit(1);
        }
+#endif
        fclose(cfp);
 
        if (config.c_setup_level < REV_MIN) {
index 5804b9ae9b3791eee9b5fcb317214999d73d17aa..e33d5427e244c8a6869e5ff710e009623e9bf771 100644 (file)
@@ -3,8 +3,10 @@
  *
  */
 
+#include "dynloader.h"
+
 void get_config(void);
 void put_config(void);
-extern struct config config;
-extern char bbs_home_directory[PATH_MAX];
-extern int home_specified;
+extern DLEXP struct config config;
+extern DLEXP char bbs_home_directory[PATH_MAX];
+extern DLEXP int home_specified;
index 62f57cb636759cc2c4234c4c5ec62a4016141cca..4534235319586ea7fa6d574712cde305a2cac504 100644 (file)
@@ -101,6 +101,7 @@ if test "$GCC" = yes; then
        esac
 fi
 AC_LIBTOOL_DLOPEN
+AC_LIBTOOL_WIN32_DLL
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 AC_SUBST(LIBTOOL_DEPS)
@@ -173,7 +174,7 @@ if test "$enable_autologin" != no; then
                        AC_DEFINE(ENABLE_CHKPWD)
                        CHKPWD=chkpwd
                else
-                       AUTH=auth.ro
+                       AUTH=auth.lo
                fi
        fi
 fi
@@ -219,6 +220,10 @@ AC_HEADER_SYS_WAIT
 test "$db_dir" && CPPFLAGS="$CPPFLAGS -I$db_dir/include"
 AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h termios.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h utmp.h utmpx.h paths.h)
 
+AC_CHECK_HEADER(resolv.h, [SMTP=modules/libsmtp.la; DOMAIN=domain.c])
+AC_SUBST(SMTP)
+AC_SUBST(DOMAIN)
+
 dnl some systems require -pthread, -D_REENTRANT, etc to be passed to cc if we
 dnl include pthread.h:
 save_CPPFLAGS=$CPPFLAGS
index 94c3ec8c4e1049cd471949dd432ac856d0685774..fd44e0905c6d3aaa0bcd9a6e30931d19cf6e8816 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -32,6 +36,7 @@
 #include "citadel.h"
 #include "server.h"
 #include "control.h"
+#include "dynloader.h"
 #include "sysdep_decls.h"
 #include "support.h"
 #include "config.h"
index 7bb650384037c473d837972350cdb78e896f8cba..c9e4264bc4c5c97386ee24c11a7f724230293fcc 100644 (file)
  * conditions to occur.  (Deadlock is bad.  Eliminate.)
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
index 9bbc86b924ed9e0f80bd70c5712af1b917e0322f..ef648647c8dbc0f35b6d12005473fb5076a2d2e1 100644 (file)
 
 /*****************************************************************************/
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <pthread.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "citserver.h"
 #include "database.h"
 #include "sysdep_decls.h"
-#include "dynloader.h"
 
 static DB *dbp[MAXCDB];                /* One DB handle for each Citadel database */
 static DB_ENV *dbenv;          /* The DB environment (global) */
index 89108f6533456603643c147e4c3f83fe6ceee1bb..ccf62f7c795753d9d09e65f2b7eb035b903eb11d 100644 (file)
@@ -9,6 +9,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <netinet/in.h>
+#include <stdio.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
 #include "sysdep_decls.h"
index 790f1348a0bd7132bfe61540ba4bee1d62f30ea3..251ca2deec08de187cb04e81cf474990de84ec44 100644 (file)
@@ -6,6 +6,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -98,7 +102,11 @@ void DLoader_Init(char *pathname)
        while ((dptr = readdir(dir)) != NULL) {
                if (strlen(dptr->d_name) < 4)
                        continue;
+#ifndef __CYGWIN__
                if (strcasecmp(&dptr->d_name[strlen(dptr->d_name)-3], ".so"))
+#else
+               if (strcasecmp(&dptr->d_name[strlen(dptr->d_name)-4], ".dll"))
+#endif
                        continue;
 
                snprintf(pathbuf, PATH_MAX, "%s/%s", pathname, dptr->d_name);
index 4fec72fe489042cd71604b376fe89fedccd4b5df..d685fcbfbd6913b1965c5ef88cd3e4df8441fef1 100644 (file)
@@ -1,5 +1,10 @@
 /* $Id$ */
 
+#ifndef DYNLOADER_H
+#define DYNLOADER_H
+
+#include "server.h"
+
 void DLoader_Init(char *pathname);
 int DLoader_Exec_Cmd(char *cmdbuf);
 char *Dynamic_Module_Init(void);
@@ -27,3 +32,4 @@ void CtdlRegisterServiceHook(int tcp_port,
                         void (*h_greeting_function) (void),
                         void (*h_command_function) (void) ) ;
 
+#endif /* DYNLOADER_H */
index 38fa138b6a855130fc1ab60c0f7de16b85f14f01..9a6989301047780ff9ff8991dc595863ae7789c8 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -29,6 +33,7 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "config.h"
 #include "file_ops.h"
 #include "sysdep_decls.h"
index 627ffc19cf31aaf31f7e75179b9ef4c322378725..ce9575559059b3965dec7ee042e8f9f271ee1b04 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
index 5eae2a76003cbd5e01a890ad319dbd88a0e0d72a..f64559abce30d9383fc99f2a8ed6753c610479ff 100644 (file)
@@ -6,6 +6,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #ifdef HAVE_UTMP_H
 #include <stdio.h>
index c5b33081d7e283a8c840bd761c4bfd9a0166c121..451f6491dfebbf9bb682b25e0c6cf688c7bf7bd9 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include "tools.h"
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "citserver.h"
 #include "config.h"
 #include "housekeeping.h"
 #include "sysdep_decls.h"
 #include "room_ops.h"
 #include "database.h"
-#include "dynloader.h"
 
 
 
index 29ee1a8ed51f33f079eb51ed2c74588efedabe9b..ea06fb3fe752f27aeaa484d2dc1e0fc3d29b8a49 100644 (file)
@@ -4,6 +4,10 @@
  * Functions which handle translation between HTML and plain text
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -29,6 +33,7 @@
 #include <syslog.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "control.h"
 #include "sysdep_decls.h"
 #include "support.h"
index f60f7a185a62d89a02ecee0547e31eb59b3593fa..ca0530d968bc2dde41f9fe48219bfbff0279a17f 100644 (file)
@@ -5,6 +5,10 @@
  * to users on the Citadel system.
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -32,6 +36,7 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
index dcdafeaecf5aaeaf12d1d625c7c604344a8c6d35..a097dd70d1213838a90913ffc79e9f368746811a 100644 (file)
@@ -3,6 +3,8 @@
  *
  */
 
+#include "server.h"
+
 struct internet_address_list {
        struct internet_address_list *next;
        char ial_user[SIZ];
@@ -39,4 +41,4 @@ enum {
        hostalias_gatewaydomain
 };
 
-extern char *inetcfg;
+extern DLEXP char *inetcfg;
index 5bd0b93a521d80dcaf895d045836d625c068ee9c..e71b0cd14576cffac119a8458c21eddb25d10f68 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -18,6 +22,7 @@
 #include <string.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "locate_host.h"
 #include "sysdep_decls.h"
 #include "config.h"
index 5ec154cb370cd8ff2b4b540e3b020fccf713788f..1e0f7bf303e0b44ad8fa474e18c39e7b2f681d26 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
index 2a870d75f8cc3a6185e5b150cf497d8502f0a0b8..1d35ce7a7fd731f6c84bd757f2b792a993e265f3 100644 (file)
@@ -8,6 +8,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -18,6 +22,8 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include "citadel.h"
+#include "server.h"
+#include "dynloader.h"
 #include "sysdep_decls.h"
 #include "mime_parser.h"
 #include "tools.h"
index 12afea81e35edda7671b9ca2ab8e9caf8624833a..15a3d614d93987e29ad0900f3204b0f043c96d2c 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -31,6 +35,7 @@
 #include <sys/stat.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "database.h"
 #include "msgbase.h"
 #include "support.h"
@@ -40,7 +45,6 @@
 #include "user_ops.h"
 #include "file_ops.h"
 #include "control.h"
-#include "dynloader.h"
 #include "tools.h"
 #include "mime_parser.h"
 #include "html.h"
index b68ca4c24728c9c1c857386b92d135ae63a16307..776781bbb6b8a3d3128d6b52a70f5fea851a7dc2 100644 (file)
 /* SUPPRESS 593 on yynewstate *//* Label was not used */
 /* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 
 #include <stdio.h>
index 076fe8bcd8141358cf70ad6072a63861bf90dd2a..41b833b90715ddb655a7f6161d1d842f12c3daaf 100644 (file)
@@ -4,6 +4,10 @@
  * Functions which manage policy for rooms (such as message expiry)
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -26,6 +30,7 @@
 #include "citadel.h"
 #include "server.h"
 #include "database.h"
+#include "dynloader.h"
 #include "config.h"
 #include "room_ops.h"
 #include "sysdep_decls.h"
index 51b8cf4c081da7fcb352eee4f716be68362698ce..d94fad48d77a8c10e61c6406327de3dee3d7cd4a 100644 (file)
@@ -4,6 +4,11 @@
  * Server functions which perform operations on room objects.
  *
  */
+
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -26,6 +31,7 @@
 #include <errno.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "database.h"
 #include "config.h"
 #include "room_ops.h"
index 8c7f63e5307970636a03d19cb7872891e4c9764c..0ea558c065fb289df2270e8a9eaac01c17f9bcc0 100644 (file)
 #include "citadel.h"
 #include "tools.h"
 #include "ipc.h"
+#include "server.h"
+#include "dynloader.h"
 #include "config.h"
 
 #define LOCKFILE "/tmp/LCK.sendcommand"
 
-struct config config;
-extern int home_specified;
-
-
 /*
  * make sure only one copy of sendcommand runs at a time, using lock files
  */
index c59c62d94b1399f14cb30d9ed6960c4ddbb5d166..afe54a979099c22e2206c67a8146dd72a5b7033e 100644 (file)
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include <syslog.h>
 #include "serv_chat.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "dynloader.h"
 #include "tools.h"
 #include "msgbase.h"
 #include "user_ops.h"
@@ -46,7 +46,6 @@
 struct ChatLine *ChatQueue = NULL;
 int ChatLastMsg = 0;
 
-extern struct CitContext *ContextList;
 
 
 
index 103d5a543e220795aae35f8c9a7b88ac81b64d17..1163899cfca03e0e8ca5d2ab7f22c360b2b5baf4 100644 (file)
@@ -8,6 +8,25 @@
 /*
  * New format for a message in memory
  */
+
+#ifndef SERVER_H
+#define SERVER_H
+
+#ifdef __CYGWIN__
+
+#ifdef IN_LIBCIT
+#define DLEXP __declspec(dllexport)
+#else
+#define DLEXP __declspec(dllimport)
+#endif
+
+#else
+#define DLEXP
+
+#endif /* __CYGWIN__ */
+
+#include "citadel.h"
+
 #define        CTDLMESSAGE_MAGIC               0x159d
 struct CtdlMessage {
        int cm_magic;                   /* Self-check */
@@ -129,9 +148,9 @@ enum {
 struct CitContext *MyContext(void);
 #define CC ((struct CitContext *)MyContext())
 
-extern struct CitContext *ContextList;
-extern int ScheduledShutdown;
-extern struct CitControl CitControl;
+extern DLEXP struct CitContext *ContextList;
+extern DLEXP int ScheduledShutdown;
+extern DLEXP struct CitControl CitControl;
 
 
 struct ExpressMessage {
@@ -229,13 +248,13 @@ struct LogFunctionHook {
        int loglevel;
        void (*h_function_pointer) (char *);
 };
-extern struct LogFunctionHook *LogHookTable;
+extern DLEXP struct LogFunctionHook *LogHookTable;
 
 struct CleanupFunctionHook {
        struct CleanupFunctionHook *next;
        void (*h_function_pointer) (void);
 };
-extern struct CleanupFunctionHook *CleanupHookTable;
+extern DLEXP struct CleanupFunctionHook *CleanupHookTable;
 
 
 
@@ -251,7 +270,7 @@ struct SessionFunctionHook {
        void (*h_function_pointer) (void);
        int eventtype;
 };
-extern struct SessionFunctionHook *SessionHookTable;
+extern DLEXP struct SessionFunctionHook *SessionHookTable;
 
 /* 
  * Event types can't be enum'ed, because they must remain consistent between
@@ -279,7 +298,7 @@ struct UserFunctionHook {
        void (*h_function_pointer) (char *username, long usernum);
        int eventtype;
 };
-extern struct UserFunctionHook *UserHookTable;
+extern DLEXP struct UserFunctionHook *UserHookTable;
 
 #define EVT_PURGEUSER  100     /* Deleting a user */
 #define EVT_OUTPUTMSG  101     /* Outputting a message */
@@ -293,7 +312,7 @@ struct MessageFunctionHook {
        int (*h_function_pointer) (struct CtdlMessage *msg);
        int eventtype;
 };
-extern struct MessageFunctionHook *MessageHookTable;
+extern DLEXP struct MessageFunctionHook *MessageHookTable;
 
 #define EVT_BEFOREREAD 200
 #define EVT_BEFORESAVE 201
@@ -311,7 +330,7 @@ struct XmsgFunctionHook {
        int (*h_function_pointer) (char *, char *, char *);
        int order;
 };
-extern struct XmsgFunctionHook *XmsgHookTable;
+extern DLEXP struct XmsgFunctionHook *XmsgHookTable;
 
 /* Priority levels for paging functions (lower is better) */
 enum {
@@ -335,7 +354,7 @@ struct ServiceFunctionHook {
        void (*h_command_function) (void) ;
        int msock;
 };
-extern struct ServiceFunctionHook *ServiceHookTable;
+extern DLEXP struct ServiceFunctionHook *ServiceHookTable;
 
 
 
@@ -394,7 +413,7 @@ struct TheHeap {
        void *h_ptr;
 };
 
-extern struct TheHeap *heap;
+extern DLEXP struct TheHeap *heap;
 
 #else
 
@@ -421,3 +440,5 @@ struct ser_ret {
 /*                         ***************     Semi-important fields */
 /*                                        *    Message text (MUST be last) */
 #define FORDER "IPTAFONHRDBCEGJKLQSUVWXYZM"
+
+#endif /* SERVER_H */
index dcc9cd81cc8879c94d5d2ca810c993c9c8376cf8..ab014de696300c6750456338ab6c4fb327e8f637 100644 (file)
  * Written July 1997 by Sten Gunterberg (gunterberg@ergon.ch)
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
index e0a098fd427075772dd55daeeee99f1335e02f3c..3262890b2cabec271475df30acbd6b45a5c5b1e5 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
index 5e0e649331007ffed0e618dbc43de58aa4694887..6a77222914922bcae144fe55bdf4657dc5706fdb 100644 (file)
@@ -12,6 +12,9 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
 
 #include "sysdep.h"
 #include <stdlib.h>
 #endif
 #include "citadel.h"
 #include "server.h"
+#include "dynloader.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "database.h"
 #include "housekeeping.h"
-#include "dynloader.h"
 #include "tools.h"
 
 #ifdef HAVE_SYS_SELECT_H
@@ -89,7 +92,7 @@ int num_sessions = 0;                         /* Current number of sessions */
 fd_set masterfds;                              /* Master sockets etc. */
 int masterhighest;
 
-static pthread_t initial_thread;               /* tid for main() thread */
+pthread_t initial_thread;              /* tid for main() thread */
 
 
 /*
@@ -759,17 +762,14 @@ int convert_login(char NameToConvert[]) {
        }
 }
 
-static struct worker_node {
-       pthread_t tid;
-       struct worker_node *next;
-} *worker_list = NULL;
+struct worker_node *worker_list = NULL;
 
 
 /*
  * create a worker thread. this function must always be called from within
  * an S_WORKER_LIST critical section!
  */
-static void create_worker(void) {
+void create_worker(void) {
        int ret;
        struct worker_node *n = mallok(sizeof *n);
 
@@ -936,196 +936,6 @@ void init_master_fdset(void) {
 }
 
 
-
-/*
- * Here's where it all begins.
- */
-int main(int argc, char **argv)
-{
-       char tracefile[128];            /* Name of file to log traces to */
-       int a, i;                       /* General-purpose variables */
-       struct passwd *pw;
-       int drop_root_perms = 1;
-       char *moddir;
-       struct worker_node *wnp;
-        
-       /* specify default port name and trace file */
-       strcpy(tracefile, "");
-
-       /* initialize the master context */
-       InitializeMasterCC();
-
-       /* parse command-line arguments */
-       for (a=1; a<argc; ++a) {
-
-               /* -t specifies where to log trace messages to */
-               if (!strncmp(argv[a], "-t", 2)) {
-                       strcpy(tracefile, argv[a]);
-                       strcpy(tracefile, &tracefile[2]);
-                       freopen(tracefile, "r", stdin);
-                       freopen(tracefile, "w", stdout);
-                       freopen(tracefile, "w", stderr);
-               }
-
-               /* run in the background if -d was specified */
-               else if (!strcmp(argv[a], "-d")) {
-                       start_daemon( (strlen(tracefile) > 0) ? 0 : 1 ) ;
-               }
-
-               /* -x specifies the desired logging level */
-               else if (!strncmp(argv[a], "-x", 2)) {
-                       verbosity = atoi(&argv[a][2]);
-               }
-
-               else if (!strncmp(argv[a], "-h", 2)) {
-                       safestrncpy(bbs_home_directory, &argv[a][2],
-                                   sizeof bbs_home_directory);
-                       home_specified = 1;
-               }
-
-               else if (!strncmp(argv[a], "-f", 2)) {
-                       do_defrag = 1;
-               }
-
-               /* -r tells the server not to drop root permissions. don't use
-                * this unless you know what you're doing. this should be
-                * removed in the next release if it proves unnecessary. */
-               else if (!strcmp(argv[a], "-r"))
-                       drop_root_perms = 0;
-
-               /* any other parameter makes it crash and burn */
-               else {
-                       lprintf(1,      "citserver: usage: "
-                                       "citserver [-tTraceFile] [-d] [-f]"
-                                       " [-xLogLevel] [-hHomeDir]\n");
-                       exit(1);
-               }
-
-       }
-
-       /* Tell 'em who's in da house */
-       lprintf(1,
-"\nMultithreaded message server for Citadel/UX\n"
-"Copyright (C) 1987-2001 by the Citadel/UX development team.\n"
-"Citadel/UX is free software, covered by the GNU General Public License, and\n"
-"you are welcome to change it and/or distribute copies of it under certain\n"
-"conditions.  There is absolutely no warranty for this software.  Please\n"
-"read the 'COPYING.txt' file for details.\n\n");
-
-       /* Initialize... */
-       init_sysdep();
-       openlog("citserver", LOG_PID, LOG_USER);
-
-       /* Load site-specific parameters */
-       lprintf(7, "Loading citadel.config\n");
-       get_config();
-
-
-       /*
-        * Do non system dependent startup functions.
-        */
-       master_startup();
-
-       /*
-        * Bind the server to a Unix-domain socket.
-        */
-       CtdlRegisterServiceHook(0,
-                               "citadel.socket",
-                               citproto_begin_session,
-                               do_command_loop);
-
-       /*
-        * Bind the server to our favorite TCP port (usually 504).
-        */
-       CtdlRegisterServiceHook(config.c_port_number,
-                               NULL,
-                               citproto_begin_session,
-                               do_command_loop);
-
-       /*
-        * Load any server-side modules (plugins) available here.
-        */
-       lprintf(7, "Initializing loadable modules\n");
-       if ((moddir = malloc(strlen(bbs_home_directory) + 9)) != NULL) {
-               sprintf(moddir, "%s/modules", bbs_home_directory);
-               DLoader_Init(moddir);
-               free(moddir);
-       }
-
-       /*
-        * The rescan pipe exists so that worker threads can be woken up and
-        * told to re-scan the context list for fd's to listen on.  This is
-        * necessary, for example, when a context is about to go idle and needs
-        * to get back on that list.
-        */
-       if (pipe(rescan)) {
-               lprintf(1, "Can't create rescan pipe!\n");
-               exit(errno);
-       }
-
-       init_master_fdset();
-
-       /*
-        * Now that we've bound the sockets, change to the BBS user id and its
-        * corresponding group ids
-        */
-       if (drop_root_perms) {
-               if ((pw = getpwuid(BBSUID)) == NULL)
-                       lprintf(1, "WARNING: getpwuid(%d): %s\n"
-                                  "Group IDs will be incorrect.\n", BBSUID,
-                               strerror(errno));
-               else {
-                       initgroups(pw->pw_name, pw->pw_gid);
-                       if (setgid(pw->pw_gid))
-                               lprintf(3, "setgid(%d): %s\n", pw->pw_gid,
-                                       strerror(errno));
-               }
-               lprintf(7, "Changing uid to %d\n", BBSUID);
-               if (setuid(BBSUID) != 0) {
-                       lprintf(3, "setuid() failed: %s\n", strerror(errno));
-               }
-       }
-
-       /* We want to check for idle sessions once per minute */
-       CtdlRegisterSessionHook(terminate_idle_sessions, EVT_TIMER);
-
-       /*
-        * Now create a bunch of worker threads.
-        */
-       lprintf(9, "Starting %d worker threads\n", config.c_min_workers-1);
-       begin_critical_section(S_WORKER_LIST);
-       for (i=0; i<(config.c_min_workers-1); ++i) {
-               create_worker();
-       }
-       end_critical_section(S_WORKER_LIST);
-
-       /* Now this thread can become a worker as well. */
-       initial_thread = pthread_self();
-       worker_thread(NULL);
-
-       /* Server is exiting. Wait for workers to shutdown. */
-       lprintf(7, "Waiting for worker threads to shut down\n");
-
-       begin_critical_section(S_WORKER_LIST);
-       while (worker_list != NULL) {
-               wnp = worker_list;
-               worker_list = wnp->next;
-
-               /* avoid deadlock with an exiting thread */
-               end_critical_section(S_WORKER_LIST);
-               if ((i = pthread_join(wnp->tid, NULL)))
-                       lprintf(1, "pthread_join: %s\n", strerror(i));
-               phree(wnp);
-               begin_critical_section(S_WORKER_LIST);
-       }
-       end_critical_section(S_WORKER_LIST);
-
-       master_cleanup();
-
-       return(0);
-}
-
-
 /*
  * Bind a thread to a context.  (It's inline merely to speed things up.)
  */
index a38ce98c375b8c02c700b8fb6b1f6eb332ee15d3..5113ff3552b2a9b26c51e294346d22914a99a545 100644 (file)
@@ -1,4 +1,7 @@
 /* $Id$ */
+
+#include "dynloader.h"
+
 void lprintf (int loglevel, const char *format, ...);
 void init_sysdep (void);
 void begin_critical_section (int which_one);
@@ -22,6 +25,17 @@ int convert_login (char *NameToConvert);
 void *worker_thread (void *arg);
 inline void become_session(struct CitContext *which_con);
 void CtdlRedirectOutput(FILE *fp, int sock);
+void InitializeMasterCC(void);
+void init_master_fdset(void);
+void create_worker(void);
+
+extern DLEXP int num_sessions;
+extern DLEXP volatile int time_to_die;
+extern DLEXP int verbosity;
+extern DLEXP int rescan[];
+extern DLEXP pthread_t initial_thread;
 
-extern int num_sessions;
-extern volatile int time_to_die;
+extern DLEXP struct worker_node {
+        pthread_t tid;
+        struct worker_node *next;
+} *worker_list;
index 38a4e05974bb3e576e4e70efc37e25a4ddbe0385..28e5c4789c3388e35c46552aab3b6ab67a7fa202 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <stdio.h>
 #include <stdlib.h>
index 86e0166fc5d0da8d750282c06a7c01ee471e2bda..a246e00e4813e253f81adaccd1dee75646f02554 100644 (file)
@@ -5,6 +5,10 @@
  *
  */
 
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
 #include "sysdep.h"
 #include <errno.h>
 #include <stdlib.h>
@@ -37,6 +41,7 @@
 #include "server.h"
 #include "database.h"
 #include "user_ops.h"
+#include "dynloader.h"
 #include "sysdep_decls.h"
 #include "support.h"
 #include "room_ops.h"
@@ -45,7 +50,6 @@
 #include "control.h"
 #include "msgbase.h"
 #include "config.h"
-#include "dynloader.h"
 #include "tools.h"
 #include "citserver.h"