src/main.c

changeset 47
d726e4b46c33
parent 46
4dcfb4c58b6d
child 50
41017d0a72c5
     1.1 --- a/src/main.c	Thu Apr 17 12:16:14 2014 +0200
     1.2 +++ b/src/main.c	Wed May 28 15:47:57 2014 +0200
     1.3 @@ -41,8 +41,11 @@
     1.4      uint8_t timeunit = 60;
     1.5      size_t len;
     1.6      
     1.7 -    for (int opt ; (opt = getopt(argc, argv, "a:bhp:rst:")) != -1 ;) {
     1.8 +    for (int opt ; (opt = getopt(argc, argv, "a:bc:hp:rst:")) != -1 ;) {
     1.9          switch (opt) {
    1.10 +        case 'c':
    1.11 +            settings->continuepgn = optarg;
    1.12 +            break;
    1.13          case 'b':
    1.14              settings->gameinfo.servercolor = BLACK;
    1.15              break;
    1.16 @@ -108,6 +111,7 @@
    1.17      memset(&settings, 0, sizeof(Settings));
    1.18      settings.gameinfo.servercolor = WHITE;
    1.19      settings.port = "27015";
    1.20 +    settings.continuepgn = NULL;
    1.21      return settings;
    1.22  }
    1.23  
    1.24 @@ -147,21 +151,26 @@
    1.25      
    1.26      if (settings.printhelp) {
    1.27          printf(
    1.28 -            "Usage: terminal-chess [OPTION]... [HOST]\n"
    1.29 -            "Starts/joins a network chess game\n"
    1.30 -            "\nGeneral options\n"
    1.31 -            "  -h            This help page\n"
    1.32 -            "  -p            TCP port to use (default: 27015)\n"
    1.33 -            "\nServer options\n"
    1.34 -            "  -a <time>     Specifies the time to add after each move\n"
    1.35 -            "  -b            Server plays black pieces (default: white)\n"
    1.36 -            "  -r            Distribute color randomly\n"
    1.37 -            "  -s            Single machine mode\n"
    1.38 -            "  -t <time>     Specifies time limit (default: no limit)\n"
    1.39 -            "\nNotes\n"
    1.40 -            "The time unit for -a is seconds and for -t minutes by default. To "
    1.41 -            "specify\nseconds for the -t option, use the s suffix.\n"
    1.42 -            "Example: -t 150s\n"
    1.43 +"Usage: terminal-chess [OPTION]... [HOST]\n"
    1.44 +"Starts/joins a network chess game\n"
    1.45 +"\nGeneral options\n"
    1.46 +"  -h            This help page\n"
    1.47 +"  -p            TCP port to use (default: 27015)\n"
    1.48 +"\nServer options\n"
    1.49 +"  -a <time>     Specifies the time to add after each move\n"
    1.50 +"  -b            Server plays black pieces (default: white)\n"
    1.51 +// TODO: implement and activate feature
    1.52 +//"  -c <PGN file> Continue the specified game\n"
    1.53 +"  -r            Distribute color randomly\n"
    1.54 +"  -s            Single machine mode\n"
    1.55 +// TODO: implement and activate feature
    1.56 +//"  -S <PGN file> Compute and print statistics for the specified game\n"
    1.57 +"  -t <time>     Specifies time limit (default: no limit)\n"
    1.58 +"\nNotes\n"
    1.59 +"The time unit for -a is seconds and for -t minutes by default. To "
    1.60 +"specify\nseconds for the -t option, use the s suffix.\n"
    1.61 +"Example: -t 150s\n\n"
    1.62 +"Use '-' for PGN files to read PGN data from standard input\n"
    1.63          );
    1.64          return EXIT_SUCCESS;
    1.65      }    

mercurial