-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
88 lines (82 loc) · 1.57 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "controller.h"
int main(int argc, char *argv[]){
argc--;
system("clear");
char arg2[30], arg3[30];
if (argc > 3 || argc == 0) {
printf("Comando invalido!\n");
return 0;
}
if (argc == 1){
if(!strcmp("-view", argv[1])){
view();
}
else if(!strcmp("-help", argv[1])){
help();
}
else if(!strcmp("-add", argv[1])){
add(NULL);
}
else if(!strcmp("-remsong", argv[1])){
remsong(NULL);
}
else if(!strcmp("-playsong", argv[1])){
playsong(NULL);
}
else if(!strcmp("-delete", argv[1])){
delete_playlist(NULL);
}
else if(!strcmp("-play", argv[1])){
play(NULL);
}
else if(!strcmp("-sort", argv[1])){
define_sort(NULL);
}
else{
printf("Comando invalido!\n");
}
} else if (argc == 2){
strncpy(arg2, argv[2], 28);
if (!strcmp("-view", argv[1])){
view_playlist (arg2);
}
else if(!strcmp("-update", argv[1])){
update(arg2);
}
else if(!strcmp("-play", argv[1])){
play(arg2);
}
else if(!strcmp("-playsong", argv[1])){
playsong(arg2);
}
else if(!strcmp("-delete", argv[1])){
delete_playlist(arg2);
}
else if(!strcmp("-remsong", argv[1])){
remsong(arg2);
}
else if(!strcmp("-sort", argv[1])){
define_sort(arg2);
}
else if(!strcmp("-create", argv[1])){
create(arg2);
}
else if(!strcmp("-add", argv[1])){
add(arg2);
}
else{
printf("Comando invalido!\n");
}
}
else if (argc == 3){
strncpy(arg2, argv[2], 28);
strncpy(arg3, argv[3], 28);
if(!strcmp("-update", argv[1])){
update_title(arg2, arg3);
}
else{
printf("Comando invalido!\n");
}
}
return 0;
}