-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
51 lines (38 loc) · 1.13 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Alexandre Reis - 2018019414
* Diogo Barbosa - 2018012425
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "constants/constants.h"
int main(int argc, char *argv[])
{
char option;
int charFlag;
printf("\t########## SISTEMA CHAMPION ##########\n");
printf("Iniciar: \n");
printf("\t 1 -> Arbitro\n");
printf("\t 0 -> SAIR\n");
while (1) {
printf("\nOPCAO $: ");
scanf(" %c", &option);
while( ( charFlag = getchar()) != '\n' && charFlag != EOF);
if (option == '1') {
char duration[INPUT_BUFFER];
char waitTime[INPUT_BUFFER];
printf("\nIntroduzir duracao do campeonato(segundos): \n");
scanf("%29s", duration);
printf("Introduzir tempo de espera do campeonato(segundos): \n");
scanf("%29s", waitTime);
execl("./moderator/moderator", "moderator", "-d", duration, "-w", waitTime, NULL);
exit(0);
}
if (option == '0') {
printf("sair\n");
exit(1);
}
printf("Escolha outra opcao\n");
}
}