+ char buffer[1024], buf[1024];
+ memset(buffer, 0, 1024);
+ memset(buf, 0, 1024);
+ int connected;
+ long lastidlecheck;
+ char *cmd, *source = NULL, *conf;
+ srand(time(NULL));
+ conf = new char[16];
+ strcpy(conf, "gameserv.conf");
+
+ /*
+ * This needs to be fixed to work for any number of arguments in any
+ * order
+ *
+ */
+ if (argc > 1)
+ {
+ if ( argc > 2 || stricmp(argv[1], "--help") == 0)
+ {
+ cout << "Usage: gameserv [options] [configfile]" << endl;
+ cout << "Options:" << endl;
+ cout << "--help Displays this help dialogue" << endl;
+ return 1;
+ }
+ delete []conf;
+ conf = argv[1];
+ }
+
+ prettyIntro();
+
+ if (load_config_file(conf))
+ {
+ cout << "Config file loaded ok...\n"
+ << "Turning into a daemon" << endl;
+ }
+ else
+ exit(2);
+
+ if (argc <= 1)
+ delete []conf;
+
+ // Turn into a daemon
+ if (daemon(1,0) < 0)
+ {
+ perror("Could not turn into a daemon");
+ exit(3);
+ }
+ if (load_items() == 0)
+ {
+ log("Error loading items");
+ goto end;
+ }
+
+ if (load_store() == 0)
+ {
+ log("Error loading store");
+ goto end;
+ }
+ if (load_tavern() == 0)
+ {
+ log("Error loading tavern");
+ goto end;
+ }
+
+ load_gs_dbase();
+ loadNews(newsdata, todaysnews);
+
+
+ if (load_masters() == false)
+ {
+ log("Error loading masters");
+ goto end;
+ }