More error checking: invalid input file and extra %#endif.