using std::endl;
char *PACKAGE = "GameServ";
-char *VERSION = "1.1.8";
+char *VERSION = "1.1.9";
int sock;
int day;
void save_day();
void load_day();
+void prettyIntro();
// Make this a daemon
int daemon(int nochdir, int noclose);
// Close all file descriptors from >= fd
void closeall(int fd);
-int main()
+int main(int argc, char *argv[])
{
char buffer[1024], buf[1024];
int connected = 1;
- char *cmd, *source = NULL;
+ char *cmd, *source = NULL, *conf = "gameserv.conf";
srand(time(NULL));
-
- load_config_file(); // default = gameserv.conf
+ 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;
+ }
+ conf = new char[strlen(argv[1])];
+ strcpy(conf, argv[1]);
+ }
+
+ prettyIntro();
+
+ if (load_config_file(conf))
+ {
+ cout << "Config file loaded ok...\n"
+ << "Turning into a daemon" << endl;
+ }
+ else
+ exit(2);
// Turn into a daemon
if (daemon(1,0) < 0)
case -1: return -1;
default:
ofstream outfile;
- outfile.open("gameserv.pid");
+ outfile.open(pidfile);
if (outfile.fail())
- cerr << "Unable to open gameserv.pid" << endl;
+ cerr << "Unable to open " << pidfile << endl;
outfile << pid << endl;
outfile.close();
close(fd++);
}
-
+void prettyIntro()
+{
+cout << endl;
+cout << " GGGG AAA MM MM EEEEEEE SSSSS EEEEEEE RRRRRR VV VV " << endl;
+cout << " GG GG AAAAA MMM MMM EE SS EE RR RR VV VV " << endl;
+cout << "GG AA AA MM MM MM EEEEE SSSSS EEEEE RRRRRR VV VV " << endl;
+cout << "GG GGG AAAAAAA MM MM EE SS EE RR RR VV VV " << endl;
+cout << "G G AA AA MM MM EEEEEEE SSSSS EEEEEEE RR RR VVV" << endl;
+cout << " GGGGG V\n\n" << endl;
+cout << "Version: " << VERSION << endl;
+}