-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
34 lines (27 loc) · 732 Bytes
/
main.c
File metadata and controls
34 lines (27 loc) · 732 Bytes
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
#include "application_layer.h"
int main(int argc, char* argv[]){
if (argc < 6) {
printf("Insufficient arguments provided.\n");
return 1;
}
char* port = argv[1];
char* filename;
int mode;
if (strcmp(argv[2], "TRANSMITER") == 0)
mode = TRANSMITER;
else if (strcmp(argv[2], "RECEIVER") == 0)
mode = RECEIVER;
else {
printf("Invalid mode provided.\n");
return 1;
}
int baudrate = atoi(argv[3]);
int n_tries = atoi(argv[4]);
int timeout = atoi(argv[5]);
if (mode == TRANSMITER)
filename = argv[6];
else
filename = "";
applicationLayer(port, mode, baudrate, n_tries, timeout, filename);
return 0;
}