(current_file_idx): New static variable. (add_file): Use and increment current_file_idx instead of indx parameter. Also removed trailing whitespace from lines.