]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/main.c
Fix for "whats the color" 8ball question formats
[irc/evilnet/x3.git] / src / main.c
index 93247805147b4543c175127be0cf48e5d2aae463..50bcf3b14a631f78015d4e9d7cabff5fcbf54319 100644 (file)
@@ -5,7 +5,7 @@
  *
  * srvx is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -34,6 +34,7 @@
 #include "global.h"
 #include "modules.h"
 #include "opserv.h"
+#include "spamserv.h"
 
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
@@ -114,6 +115,10 @@ int main(int argc, char *argv[])
     GC_enable_incremental();
 #endif
 
+    if (!chdir(PREFIX))
+        log_module(MAIN_LOG, LOG_INFO, "changed to %s\n", PREFIX);
+    else
+        log_module(MAIN_LOG, LOG_WARNING, "unable to change directory to %s, using current directory instead\n", PREFIX);
     run_as_daemon = 1;
     debug = 0;
     tools_init();
@@ -236,7 +241,7 @@ int main(int argc, char *argv[])
     services_argv = argv;
 
     atexit(call_exit_funcs);
-    reg_exit_func(main_shutdown);
+    reg_exit_func(main_shutdown, NULL);
 
     log_init();
     MAIN_LOG = log_register_type("x3", "file:main.log");
@@ -262,7 +267,7 @@ int main(int argc, char *argv[])
     modules_finalize();
 
     /* The first exit func to be called *should* be saxdb_write_all(). */
-    reg_exit_func(saxdb_write_all);
+    reg_exit_func(saxdb_write_all, NULL);
     if (replay_file) {
         char *msg;
         log_module(MAIN_LOG, LOG_INFO, "Beginning replay...");