38 char *valid; |
38 char *valid; |
39 unsigned long int time, port; |
39 unsigned long int time, port; |
40 uint8_t timeunit = 60; |
40 uint8_t timeunit = 60; |
41 size_t len; |
41 size_t len; |
42 |
42 |
43 for (char opt ; (opt = getopt(argc, argv, "a:bhp:rt:")) != -1 ;) { |
43 for (char opt ; (opt = getopt(argc, argv, "a:bhp:rst:")) != -1 ;) { |
44 switch (opt) { |
44 switch (opt) { |
45 case 'b': |
45 case 'b': |
46 settings->gameinfo.servercolor = BLACK; |
46 settings->gameinfo.servercolor = BLACK; |
47 break; |
47 break; |
48 case 'r': |
48 case 'r': |
49 settings->gameinfo.servercolor = rand() & 1 ? WHITE : BLACK; |
49 settings->gameinfo.servercolor = rand() & 1 ? WHITE : BLACK; |
|
50 break; |
|
51 case 's': |
|
52 settings->singlemachine = 1; |
50 break; |
53 break; |
51 case 't': |
54 case 't': |
52 case 'a': |
55 case 'a': |
53 len = strlen(optarg); |
56 len = strlen(optarg); |
54 if (optarg[len-1] == 's') { |
57 if (optarg[len-1] == 's') { |
148 " -p TCP port to use (default: 27015)\n" |
151 " -p TCP port to use (default: 27015)\n" |
149 "\nServer options\n" |
152 "\nServer options\n" |
150 " -a <time> Specifies the time to add after each move\n" |
153 " -a <time> Specifies the time to add after each move\n" |
151 " -b Server plays black pieces (default: white)\n" |
154 " -b Server plays black pieces (default: white)\n" |
152 " -r Distribute color randomly\n" |
155 " -r Distribute color randomly\n" |
|
156 " -s Single machine mode\n" |
153 " -t <time> Specifies time limit (default: no limit)\n" |
157 " -t <time> Specifies time limit (default: no limit)\n" |
154 "\nNotes\n" |
158 "\nNotes\n" |
155 "White pieces are displayed as uppercase and black pieces as " |
|
156 "lowercase letters.\n" |
|
157 "The time unit for -a is seconds and for -t minutes by default. To " |
159 "The time unit for -a is seconds and for -t minutes by default. To " |
158 "specify\nseconds for the -t option, use the s suffix.\n" |
160 "specify\nseconds for the -t option, use the s suffix.\n" |
159 "Example: -t 150s\n" |
161 "Example: -t 150s\n" |
160 ); |
162 ); |
161 return EXIT_SUCCESS; |
163 return EXIT_SUCCESS; |