/* *cribserv.c *main file for the CribbaGebber server * Copyright (C) 2005 Joseph Pingenot This program 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 (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include /*Local include files*/ #include "options.h" #include "datatypes.h" #include "protocol_details.h" int main(int argc, char* argv[]){ struct cribserv_options opts; struct game the_game; //int i; int control_sock; int err; /*Set up the options*/ setup_opts(&opts, argc, argv); /*print the options*/ /*printf("OPTIONS: port=%d\n", opts.port);*/ /*initialize the game and data structures*/ init_game(&opts, &the_game); /*Start listening!*/ if((control_sock = listen_in(&opts)) < 0) { fprintf(stderr, "ERROR: unable to open socket! (%d)\n", control_sock); exit(3); } /*Let the clients connect*/ if((err = assemble_players(&opts, control_sock, &the_game)) != 0){ fprintf(stderr, "ERROR: unable to collect all the players (%d)!\n", err); close(control_sock); exit(3); } /*Yay! We're ready to play!*/ while(1) { } return 0; }