37 lines
842 B
C
37 lines
842 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "compressor.h"
|
|
|
|
void pomoc(){
|
|
printf("Huffman kompresor\n");
|
|
printf("Pouzitie:\n");
|
|
printf(" ./compressor -c <vstupny_subor> <vystupny_subor>\n");
|
|
printf(" ./compressor -d <komprimovany_subor> <vystupny_subor>\n");
|
|
printf(" ./compressor -h\n");
|
|
}
|
|
|
|
int main(int argc, char *argv[]){
|
|
if(argc==2 && strcmp(argv[1], "-h")==0){
|
|
pomoc();
|
|
return 0;
|
|
}
|
|
|
|
if(argc!=4) {
|
|
printf("Nespravny pocet argumentov!\n");
|
|
pomoc();
|
|
return 1;
|
|
}
|
|
|
|
if(strcmp(argv[1], "-c")==0){
|
|
return compress_file(argv[2], argv[3]);
|
|
}else if(strcmp(argv[1], "-d")==0) {
|
|
return decompress_file(argv[2], argv[3]);
|
|
}else{
|
|
printf("Neznamy prepinac: %s\n", argv[1]);
|
|
pomoc();
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|