added program version

Wed, 02 Jul 2014 15:09:17 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 02 Jul 2014 15:09:17 +0200
changeset 52
26707039d5a6
parent 51
84f2e380a434
child 53
78b580bfde33

added program version

src/main.c file | annotate | diff | comparison | revisions
src/terminal-chess.h file | annotate | diff | comparison | revisions
     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);
     2.1 --- a/src/terminal-chess.h	Mon Jun 16 15:41:06 2014 +0200
     2.2 +++ b/src/terminal-chess.h	Wed Jul 02 15:09:17 2014 +0200
     2.3 @@ -36,6 +36,8 @@
     2.4  #ifndef TERMINAL_CHESS_H
     2.5  #define	TERMINAL_CHESS_H
     2.6  
     2.7 +#define PROGRAM_VERSION "0.9-r52"
     2.8 +
     2.9  #ifdef	__cplusplus
    2.10  extern "C" {
    2.11  #endif
    2.12 @@ -46,7 +48,6 @@
    2.13      char* serverhost; /* NULL, if we are about to start a server */
    2.14      char* continuepgn;
    2.15      char* analyzepgn;
    2.16 -    _Bool printhelp;
    2.17      _Bool singlemachine;
    2.18  } Settings;
    2.19  

mercurial