-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.c
More file actions
54 lines (49 loc) · 1.08 KB
/
main.c
File metadata and controls
54 lines (49 loc) · 1.08 KB
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
51
52
53
54
#include "structs.h"
#include "hash.h"
#include "lists.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
//./main {files.txt}
int main(int argc, char const *argv[]) {
init_table();
int file = 1;
int opcao;
printf("[1] START\n");
printf("[2] QUIT\n");
printf("Opcao: ");
scanf("%d", &opcao);
system("clear");
if (argc == 1) {
printf("ERROR! NO FILES TO EXECUTE\n");
return 0;
}
while (argv[file] != NULL && opcao != 2) {
system("clear");
printf("File: %d \n", file);
printf("\n");
FILE *fp;
fp = fopen(argv[file], "r");
if (fp == NULL) {
printf("FILE ERROR\n");
return 0;
}
ILIST lista = readList(fp);
fclose(fp);
printf("Lista %d: \n", file);
printList(lista);
printf("\n----------Execução------------\n");
execlist(lista);
++file;
printf("------------------------------\n\n");
if (argv[file] != NULL) {
printf("[1] CONTINUE\n");
printf("[2] QUIT\n");
printf("Opcao: ");
scanf("%d", &opcao);
printf("\n");
}
}
return 0;
}