fix: fpga_compress : now handles more than two files (@satsuoni)

This commit is contained in:
iceman1001 2017-10-08 15:01:55 +02:00
parent 674db8d5ac
commit 28c3aa61ce

View file

@ -294,12 +294,16 @@ int main(int argc, char **argv)
} else { } else {
num_input_files = argc-2; num_input_files = argc-2;
} }
int adder = (hardnested_mode) ? 2 : 1;
infiles = calloc(num_input_files, sizeof(FILE*)); infiles = calloc(num_input_files, sizeof(FILE*));
for (uint16_t i = 0; i < num_input_files; i++) { for (uint16_t i = 0; i < num_input_files; i++) {
infiles[i] = fopen(argv[i+hardnested_mode?2:1], "rb"); infiles[i] = fopen(argv[i + adder ] , "rb");
if (infiles[i] == NULL) { if (infiles[i] == NULL) {
fprintf(stderr, "Error. Cannot open input file %s", argv[i+hardnested_mode?2:1]); fprintf(stderr, "Error. Cannot open input file %s", argv[i + adder] );
return(EXIT_FAILURE); return(EXIT_FAILURE);
} else {
printf("Opening %s %d \n", argv[i + adder], i+adder );
} }
} }
outfile = fopen(argv[argc-1], "wb"); outfile = fopen(argv[argc-1], "wb");