Change in infile_format() where file extension is incorrect or empty

This commit is contained in:
szukw000 2018-10-16 20:37:34 +02:00
parent 0e6a5553cf
commit 5acc094611
1 changed files with 17 additions and 4 deletions

View File

@ -538,12 +538,25 @@ static int infile_format(const char *fname)
return ext_format; return ext_format;
} }
s = fname + strlen(fname) - 4; s = fname + strlen(fname) - 1;
fputs("\n===========================================\n", stderr); #ifdef WIN32
while (s > fname && (*s != '.' && *s != '\\')) {
--s;
}
#else
while (s > fname && (*s != '.' && *s != '/')) {
--s;
}
#endif
if (*s != '.') {
s = "";
}
fputs("\n===============================================\n", stderr);
fprintf(stderr, "The extension of this file is incorrect.\n" fprintf(stderr, "The extension of this file is incorrect.\n"
"FOUND %s. SHOULD BE %s\n", s, magic_s); " FOUND '%s'. SHOULD BE '%s'", s, magic_s);
fputs("===========================================\n", stderr); fputs("\n===============================================\n", stderr);
return magic_format; return magic_format;
} }