1.1 --- a/src/main.c Mon Jun 16 15:41:06 2014 +0200 1.2 +++ b/src/main.c Wed Jul 02 15:09:17 2014 +0200 1.3 @@ -41,7 +41,7 @@ 1.4 uint8_t timeunit = 60; 1.5 size_t len; 1.6 1.7 - for (int opt ; (opt = getopt(argc, argv, "a:bc:hp:rsS:t:")) != -1 ;) { 1.8 + for (int opt ; (opt = getopt(argc, argv, "a:bc:hp:rsS:t:v")) != -1 ;) { 1.9 switch (opt) { 1.10 case 'c': 1.11 settings->continuepgn = optarg; 1.12 @@ -92,10 +92,35 @@ 1.13 settings->port = optarg; 1.14 } 1.15 break; 1.16 + case 'v': 1.17 + printf("terminal-chess : Version %s (Netcode Version %d)\n", 1.18 + PROGRAM_VERSION, NETCODE_VERSION); 1.19 + exit(0); 1.20 case 'h': 1.21 case '?': 1.22 - settings->printhelp = 1; 1.23 - break; 1.24 + printf( 1.25 +"Usage: terminal-chess [OPTION]... [HOST]\n" 1.26 +"Starts/joins a network chess game\n" 1.27 +"\nGeneral options\n" 1.28 +" -c <PGN file> Continue the specified game\n" 1.29 +" -h This help page\n" 1.30 +" -p TCP port to use (default: 27015)\n" 1.31 +// TODO: implement and activate feature 1.32 +//" -S <PGN file> Compute and print statistics for the specified game\n" 1.33 +" -v Print version information and exists\n" 1.34 +"\nServer options\n" 1.35 +" -a <time> Specifies the time to add after each move\n" 1.36 +" -b Server plays black pieces (default: white)\n" 1.37 +" -r Distribute color randomly\n" 1.38 +" -s Single machine mode\n" 1.39 +" -t <time> Specifies time limit (default: no limit)\n" 1.40 +"\nNotes\n" 1.41 +"The time unit for -a is seconds and for -t minutes by default. To " 1.42 +"specify\nseconds for the -t option, use the s suffix.\n" 1.43 +"Example: -t 150s\n\n" 1.44 +"Use '-' for PGN files to read PGN data from standard input\n" 1.45 + ); 1.46 + exit(0); 1.47 } 1.48 } 1.49 1.50 @@ -180,31 +205,7 @@ 1.51 if (get_settings(argc, argv, &settings)) { 1.52 return 1; 1.53 } 1.54 - 1.55 - if (settings.printhelp) { 1.56 - printf( 1.57 -"Usage: terminal-chess [OPTION]... [HOST]\n" 1.58 -"Starts/joins a network chess game\n" 1.59 -"\nGeneral options\n" 1.60 -" -c <PGN file> Continue the specified game\n" 1.61 -" -h This help page\n" 1.62 -" -p TCP port to use (default: 27015)\n" 1.63 -// TODO: implement and activate feature 1.64 -//" -S <PGN file> Compute and print statistics for the specified game\n" 1.65 -"\nServer options\n" 1.66 -" -a <time> Specifies the time to add after each move\n" 1.67 -" -b Server plays black pieces (default: white)\n" 1.68 -" -r Distribute color randomly\n" 1.69 -" -s Single machine mode\n" 1.70 -" -t <time> Specifies time limit (default: no limit)\n" 1.71 -"\nNotes\n" 1.72 -"The time unit for -a is seconds and for -t minutes by default. To " 1.73 -"specify\nseconds for the -t option, use the s suffix.\n" 1.74 -"Example: -t 150s\n\n" 1.75 -"Use '-' for PGN files to read PGN data from standard input\n" 1.76 - ); 1.77 - return EXIT_SUCCESS; 1.78 - } 1.79 + 1.80 initscr(); 1.81 halfdelay(1); 1.82 keypad(stdscr, TRUE);