]> jfr.im git - irc/gameservirc.git/blob - gameserv/configscript.cpp
Fixed some p10, bugs, and gameserv is now running as a true daemon with pid outputtin...
[irc/gameservirc.git] / gameserv / configscript.cpp
1 #include <fstream>
2 #include <iostream>
3
4 using std::cout;
5 using std::cerr;
6 using std::cin;
7 using std::endl;
8 using std::ofstream;
9
10 char menu(int page = 1);
11
12 int main()
13 {
14 ofstream outfile;
15
16 outfile.open("options.h");
17 if (outfile.fail())
18 {
19 cerr << "Error opening options.h" << endl;
20 return 1;
21 }
22 char c = 0;
23
24 do {
25 c = menu();
26 switch(c)
27 {
28 case '1':
29 outfile << "#define UNREAL" << endl;
30 outfile << "#undef BAHAMUT" << endl;
31 outfile << "#undef P10" << endl;
32 outfile << "#undef HYBRID" << endl;
33 break;
34 case '2':
35 outfile << "#undef UNREAL" << endl;
36 outfile << "#define BAHAMUT" << endl;
37 outfile << "#undef P10" << endl;
38 outfile << "#undef HYBRID" << endl;
39 break;
40 case '3':
41 outfile << "#undef UNREAL" << endl;
42 outfile << "#undef BAHAMUT" << endl;
43 outfile << "#define P10" << endl;
44 outfile << "#undef HYBRID" << endl;
45 break;
46 case '4':
47 outfile << "#undef UNREAL" << endl;
48 outfile << "#undef BAHAMUT" << endl;
49 outfile << "#undef P10" << endl;
50 outfile << "#define HYBRID" << endl;
51 break;
52 default:
53 break;
54 }
55 }while (c == 'Q' || c == 'q' || (int(c) < 48) || (int(c) > 57));
56
57 do {
58 c = menu(2);
59 switch(c)
60 {
61 case 'y':
62 case 'Y':
63 outfile << "#define DEBUGMODE" << endl;
64 break;
65 case 'n':
66 case 'N':
67 outfile << "#undef DEBUGMODE" << endl;
68 break;
69 default:
70 break;
71 }
72 }while (c != 'y' && c != 'Y' && c != 'n' && c != 'N');
73 outfile.close();
74 return 0;
75 }
76
77 char menu(int page)
78 {
79 char selection = 0;
80
81 if (page == 2)
82 {
83 cout << "Do you want to enable debug mode? (Y/N): ";
84 }
85 else
86 {
87 cout << "Choose your IRCD" << endl;
88 cout << "1. Unreal3.x" << endl
89 << "2. bahamut-1.4.x" << endl
90 << "3. ircu 2.10.x (P10)" << endl
91 << "4. ircd-hybrid, ircd-ratbox, or csircd" << endl;
92 cout << "Make your selection: ";
93 }
94
95 cin >> selection;
96 return selection;
97 }