-/* main.c - NeonServ v5.2
+/* main.c - NeonServ v5.3
* Copyright (C) 2011 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
#include "ssl.h"
time_t start_time;
-static int running;
+static int running, hard_restart;
static int statistics_requested_lusers = 0;
int statistics_enabled;
TIMEQ_CALLBACK(main_statistics);
return 1;
}
-int main(void) {
+int main(int argc, char *argv[]) {
main:
start_time = time(0);
queue_loop();
}
cleanup();
+ if(hard_restart) {
+ /* Append a NULL to the end of argv[]. */
+ char **restart_argv = (char **)alloca((argc + 1) * sizeof(char *));
+ memcpy(restart_argv, argv, argc * sizeof(char *));
+ restart_argv[argc] = NULL;
+
+ #ifdef WIN32
+ execv(argv[0], (const char * const*)restart_argv);
+ #else
+ execv(argv[0], restart_argv);
+ #endif
+ }
goto main;
}
return c1 - c2;
}
-void restart_bot(int hard_restart) {
+void restart_bot(int do_hard_restart) {
+ hard_restart = do_hard_restart;
running = 0;
}