tools/nxstyle.c: Trivial improvement to preceding change to allow white space separation.

This commit is contained in:
Gregory Nutt 2019-11-19 11:43:20 -06:00
parent f3c2022b4e
commit 8bc55d4396

View File

@ -1075,6 +1075,7 @@ int main(int argc, char **argv, char **envp)
line[n + 1] != ';') line[n + 1] != ';')
{ {
int sndx = n + 1; int sndx = n + 1;
bool whitespace = false;
/* Skip over spaces */ /* Skip over spaces */
@ -1104,6 +1105,14 @@ int main(int argc, char **argv, char **envp)
endx++; endx++;
} }
/* Skip over spaces */
while (line[endx] == ' ')
{
whitespace = true;
endx++;
}
/* Handle according to what comes after the /* Handle according to what comes after the
* identifier. * identifier.
*/ */
@ -1120,7 +1129,16 @@ int main(int argc, char **argv, char **envp)
"Multiple data definitions on line %d:%d\n", "Multiple data definitions on line %d:%d\n",
lineno, endx); lineno, endx);
} }
else if (line[endx] != ';') else if (line[endx] == ';')
{
if (whitespace)
{
fprintf(stderr,
"Space precedes semi-colon at line %d:%d\n",
lineno, endx);
}
}
else
{ {
fprintf(stderr, fprintf(stderr,
"Garbage follows right bracket at line %d:%d\n", "Garbage follows right bracket at line %d:%d\n",