check_input_file function

Local helper to be reused.