- infiles = calloc(argc-2, sizeof(FILE*));
-
- for (uint16_t i = 0; i < argc-2; i++) {
- infiles[i] = fopen(argv[i+1], "rb");
- if (infiles[i] == NULL) {
- fprintf(stderr, "Error. Cannot open input file %s", argv[i+1]);
+ } else { // Compress
+
+ infiles = calloc(argc-2, sizeof(FILE*));
+ for (uint16_t i = 0; i < argc-2; i++) {
+ infiles[i] = fopen(argv[i+1], "rb");
+ if (infiles[i] == NULL) {
+ fprintf(stderr, "Error. Cannot open input file %s", argv[i+1]);
+ return -1;
+ }
+ }
+ outfile = fopen(argv[argc-1], "wb");
+ if (outfile == NULL) {
+ fprintf(stderr, "Error. Cannot open output file %s", argv[argc-1]);