29 lines
613 B
C
29 lines
613 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
#include <../inc/server.h>
|
||
|
#include <../inc/errExit.h>
|
||
|
|
||
|
void check_input(int argc, char *argv[]){
|
||
|
if (argc < 5) {
|
||
|
//TODO: print help
|
||
|
exit(0); //TODO: togliere
|
||
|
} else if (argc > 5) {
|
||
|
//TODO: print error
|
||
|
exit(EXIT_FAILURE);
|
||
|
}
|
||
|
|
||
|
int collums = atoi(argv[1]);
|
||
|
int rows = atoi(argv[2]);
|
||
|
|
||
|
char *player1 = argv[3];
|
||
|
char *player2 = argv[4];
|
||
|
|
||
|
if (collums<5 || rows<5) {
|
||
|
errExitMsg("To few rows or collums");
|
||
|
}
|
||
|
|
||
|
if (player1 == NULL || player2 == NULL) {
|
||
|
errExitMsg("Invalid player names");
|
||
|
}
|
||
|
}
|