sk1
This commit is contained in:
parent
3ccf4cc724
commit
1bf73535d9
20
sk1/main.c
20
sk1/main.c
@ -15,7 +15,7 @@ void print_help() {
|
|||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
fprintf(stderr, "Chyba: Chybaju argumenty. Pouzite -h pre zobrazenie pomoci.\n");
|
fprintf(stderr, "Chyba: Chybaju argumenty. Pouzite -h pre zobrazenie pomoci.\n");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[1], "-h") == 0) {
|
if (strcmp(argv[1], "-h") == 0) {
|
||||||
@ -26,7 +26,7 @@ int main(int argc, char* argv[]) {
|
|||||||
if ((strcmp(argv[1], "-c") == 0 || strcmp(argv[1], "-d") == 0 ||
|
if ((strcmp(argv[1], "-c") == 0 || strcmp(argv[1], "-d") == 0 ||
|
||||||
strcmp(argv[1], "-c2") == 0 || strcmp(argv[1], "-d2") == 0) && argc != 4) {
|
strcmp(argv[1], "-c2") == 0 || strcmp(argv[1], "-d2") == 0) && argc != 4) {
|
||||||
fprintf(stderr, "Chyba: Nespravny pocet argumentov. Pouzite -h pre zobrazenie pomoci.\n");
|
fprintf(stderr, "Chyba: Nespravny pocet argumentov. Pouzite -h pre zobrazenie pomoci.\n");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* input_file = argv[2];
|
const char* input_file = argv[2];
|
||||||
@ -36,26 +36,30 @@ int main(int argc, char* argv[]) {
|
|||||||
if (strcmp(argv[1], "-c") == 0) {
|
if (strcmp(argv[1], "-c") == 0) {
|
||||||
result = compress_1(input_file, output_file);
|
result = compress_1(input_file, output_file);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
return 1;
|
fprintf(stderr, "Chyba: Kompresia zlyhala.\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[1], "-d") == 0) {
|
} else if (strcmp(argv[1], "-d") == 0) {
|
||||||
result = decompress_1(input_file, output_file);
|
result = decompress_1(input_file, output_file);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
return 1;
|
fprintf(stderr, "Chyba: Dekompresia zlyhala.\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[1], "-c2") == 0) {
|
} else if (strcmp(argv[1], "-c2") == 0) {
|
||||||
result = compress_2(input_file, output_file);
|
result = compress_2(input_file, output_file);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
return 1;
|
fprintf(stderr, "Chyba: Kompresia zlyhala.\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[1], "-d2") == 0) {
|
} else if (strcmp(argv[1], "-d2") == 0) {
|
||||||
result = decompress_2(input_file, output_file);
|
result = decompress_2(input_file, output_file);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
return 1;
|
fprintf(stderr, "Chyba: Dekompresia zlyhala.\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Chyba: Neznamy argument. Použite -h pre zobrazenie pomoci.\n");
|
fprintf(stderr, "Chyba: Neznámy argument. Použite -h pre zobrazenie pomoci.\n");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user