From 4802eb65c550dd395069708594eac5b3fc0a5748 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 12 Mar 2019 14:48:43 -0600 Subject: [PATCH] tools/nxstyle.c: Fix a bacward test in the previous commit. --- tools/nxstyle.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/nxstyle.c b/tools/nxstyle.c index a6334ec4c2..99f2e3e322 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -563,6 +563,10 @@ int main(int argc, char **argv, char **envp) { switch (line[n]) { + /* Sequence containing 'v' may occur at the + * beginning of the identifier. + */ + case 'v': if (n > 1 && line[n - 2] == 'I' && @@ -593,9 +597,12 @@ int main(int argc, char **argv, char **envp) } break; + /* Sequence containing 'p' or 'd' must have been + * preceded by upper case characters. + */ + case 'p': - if (have_upper && - (n < 1 || + if (!have_upper || n < 1 || !isdigit(line[n - 1]) || !isdigit(line[n + 1]))) { @@ -604,7 +611,7 @@ int main(int argc, char **argv, char **envp) break; case 'd': - if (have_upper && !isdigit(line[n + 1])) + if (!have_upper || !isdigit(line[n + 1])) { have_lower = true; }