nxstyle: Don't parse a file if its type is unknown

This commit is contained in:
YAMAMOTO Takashi 2020-03-06 11:01:42 +09:00 committed by patacongo
parent 730133d84a
commit e5ea0ac32d

View File

@ -571,18 +571,6 @@ int main(int argc, char **argv, char **envp)
}
g_file_name = argv[optind];
instream = fopen(g_file_name, "r");
if (!instream)
{
FATALFL("Failed to open", g_file_name);
return 1;
}
/* Determine the line width */
g_maxline = get_line_width(instream) + excess;
rewind(instream);
/* Are we parsing a header file? */
@ -607,6 +595,19 @@ int main(int argc, char **argv, char **envp)
return 0;
}
instream = fopen(g_file_name, "r");
if (!instream)
{
FATALFL("Failed to open", g_file_name);
return 1;
}
/* Determine the line width */
g_maxline = get_line_width(instream) + excess;
rewind(instream);
btabs = false; /* True: TAB characters found on the line */
bcrs = false; /* True: Carriage return found on the line */
bfunctions = false; /* True: In private or public functions */