diff --git a/src/utictactoe.c b/src/utictactoe.c index 669f864..c7a7b0e 100644 --- a/src/utictactoe.c +++ b/src/utictactoe.c @@ -104,12 +104,10 @@ int main(int argc, char* argv[]) { case 'c': if ( OPTIONAL_ARGUMENT_IS_PRESENT ) { - if ( access(optarg, R_OK) == 0) { - printf("Contest file valid\n"); - } - else { + if ( access(optarg, F_OK | R_OK) == -1) { fprintf(stderr, "Can't access to file %s\n", optarg); - } exit (EXIT_FAILURE); + exit (EXIT_FAILURE); + } } else { fprintf(stderr, "Error: contest need a file\n"); @@ -127,11 +125,11 @@ int main(int argc, char* argv[]) { printf("utictactoe %d.%d.%d\n", VERSION, SUBVERSION, REVISION); printf("This software implements a full ultimate tictactoe game.\n"); exit(EXIT_SUCCESS); - case 'h': help(); exit(EXIT_SUCCESS); + default: fprintf(stderr, "Try `utictactie --help' for more information.\n"); exit (EXIT_FAILURE);