PhotoRec: distinguish Fortran from .txt

This commit is contained in:
Christophe Grenier 2008-05-27 00:18:01 +02:00
parent 86d7021cbc
commit f943f53cf5

View file

@ -577,7 +577,18 @@ static int header_check_txt(const unsigned char *buffer, const unsigned int buff
}
{
const char *ext=NULL;
if(strstr(buffer_lower, sign_tex)!=NULL)
/* Detect Fortran */
unsigned int nbr=0;
char *str=buffer_lower;
while((str=strstr(str, "\n "))!=NULL)
{
nbr++;
str++;
}
if(nbr>10)
ext="f";
/* Detect LaTeX, C, PHP, JSP, ASP, HTML, C header */
else if(strstr(buffer_lower, sign_tex)!=NULL)
ext="tex";
else if(strstr(buffer_lower, sign_c)!=NULL)
ext="c";