Fix color assignment by mamer
[capablanca.git] / lasker-2.2.3 / bots / mamer / main.cc
1 //--------------------------------------------------------------------------
2 // main.cc - main source file that starts Mamer
3 //
4 // Matthew E. Moses
5 //
6 // $Revision: 1.4 $
7 // $Date: 1998/09/10 19:57:17 $
8 //
9 // $Author: mlong $
10 // $Locker:  $
11 //
12 // $Log: main.cc,v $
13 // Revision 1.4  1998/09/10 19:57:17  mlong
14 // lots of little bug fixes and a few new features
15 //
16 // Revision 1.3  1998/04/18 20:05:14  mlong
17 // *** empty log message ***
18 //
19 // Revision 1.2  1998/04/18 18:46:04  mlong
20 // fixed delete bug &
21 // added delete tourney function
22 //
23 // Revision 1.1  1996/09/30 20:52:48  moses
24 // Initial revision
25 //
26 //
27 //--------------------------------------------------------------------------
28
29 //static char RCSid[] = "$Id: main.cc,v 1.4 1998/09/10 19:57:17 mlong Exp $";
30
31 #include "Mamer.hh"
32
33 //- Globals ----------------------------------------------------------------
34 Mamer gMamer;
35
36 //- Prototypes -------------------------------------------------------------
37 int main(int, char **);
38
39 //- main -------------------------------------------------------------------
40 int main(int argc, char **argv) {
41
42     if(gMamer.Initialize(argc, argv)) 
43         if(gMamer.OpenServerConnection()) {
44             gMamer.ListenLoop();
45             gMamer.Shutdown();
46         }
47         else
48             cerr << "ERROR: couldn't open server connection!" << endl;
49     else
50         cerr << "ERROR: couldn't initialize mamer!" << endl;
51
52     exit(0);
53 } //- End of main
54
55 //- HandleSignals ---------------------------------------------------------
56 void HandleSignals(int theSignal) {
57     switch(theSignal) {
58      case SIGTERM:
59      case SIGKILL:
60         gMamer.Shutdown();
61         exit(0);
62         break;
63      case SIGUSR1:
64         gMamer.Shutdown();
65         exit(0);        
66      case SIGUSR2:
67         gMamer.DumpConfiguration();
68      default:
69         break;
70     }
71 } //- End of HandleSignals