Rework contest argument parsing.
This commit is contained in:
parent
b16d91fb2e
commit
90508a3b3b
1 changed files with 4 additions and 6 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue