diff -r 02c509a44e98 -r 41017d0a72c5 src/main.c --- a/src/main.c Wed Jun 11 16:54:20 2014 +0200 +++ b/src/main.c Mon Jun 16 13:45:31 2014 +0200 @@ -41,7 +41,7 @@ uint8_t timeunit = 60; size_t len; - for (int opt ; (opt = getopt(argc, argv, "a:bc:hp:rst:")) != -1 ;) { + for (int opt ; (opt = getopt(argc, argv, "a:bc:hp:rsS:t:")) != -1 ;) { switch (opt) { case 'c': settings->continuepgn = optarg; @@ -55,6 +55,9 @@ case 's': settings->singlemachine = 1; break; + case 'S': + settings->analyzepgn = optarg; + break; case 't': case 'a': len = strlen(optarg); @@ -103,6 +106,24 @@ return 1; } + + if (settings->continuepgn) { + if (settings->serverhost) { + fprintf(stderr, "Can't continue a game when joining a server.\n"); + return 1; + } + if (settings->analyzepgn) { + fprintf(stderr, "The options -c and -S are mutually exclusive\n"); + return 1; + } + // TODO: implement + if (!settings->singlemachine) { + fprintf(stderr, "Game continuation currently not supported for " + "network games.\n"); + return 1; + } + } + return 0; } @@ -111,7 +132,6 @@ memset(&settings, 0, sizeof(Settings)); settings.gameinfo.servercolor = WHITE; settings.port = "27015"; - settings.continuepgn = NULL; return settings; } @@ -154,17 +174,16 @@ "Usage: terminal-chess [OPTION]... [HOST]\n" "Starts/joins a network chess game\n" "\nGeneral options\n" +" -c Continue the specified game\n" " -h This help page\n" " -p TCP port to use (default: 27015)\n" +// TODO: implement and activate feature +//" -S Compute and print statistics for the specified game\n" "\nServer options\n" " -a