https://git.reactos.org/?p=reactos.git;a=commitdiff;h=04eef6d20c0bb7f140f6f…
commit 04eef6d20c0bb7f140f6fe3e7ceb8a985fcbbc9e
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Jul 26 20:32:11 2020 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Aug 19 20:35:54 2020 +0200
[CMD] parser.c, cmd.c/h : Code style and formatting fixes.
- Change C_IFFAILURE, C_IFSUCCESS into C_OR, C_AND respectively.
---
base/shell/cmd/cmd.c | 4 ++--
base/shell/cmd/cmd.h | 2 +-
base/shell/cmd/parser.c | 18 ++++++++++++++----
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/base/shell/cmd/cmd.c b/base/shell/cmd/cmd.c
index bef99f272c4..2303f9d787a 100644
--- a/base/shell/cmd/cmd.c
+++ b/base/shell/cmd/cmd.c
@@ -801,7 +801,7 @@ ExecuteCommand(
for (Sub = Cmd->Subcommands; Sub; Sub = Sub->Next)
Ret = ExecuteCommand(Sub);
break;
- case C_IFFAILURE:
+ case C_OR:
Sub = Cmd->Subcommands;
Ret = ExecuteCommand(Sub);
if (Ret != 0)
@@ -810,7 +810,7 @@ ExecuteCommand(
Ret = ExecuteCommand(Sub->Next);
}
break;
- case C_IFSUCCESS:
+ case C_AND:
Sub = Cmd->Subcommands;
Ret = ExecuteCommand(Sub);
if (Ret == 0)
diff --git a/base/shell/cmd/cmd.h b/base/shell/cmd/cmd.h
index 875ce5ec113..f0243414c14 100644
--- a/base/shell/cmd/cmd.h
+++ b/base/shell/cmd/cmd.h
@@ -301,7 +301,7 @@ INT cmd_move (LPTSTR);
INT CommandMsgbox (LPTSTR);
/* Prototypes from PARSER.C */
-enum { C_COMMAND, C_QUIET, C_BLOCK, C_MULTI, C_IFFAILURE, C_IFSUCCESS, C_PIPE, C_IF,
C_FOR };
+enum { C_COMMAND, C_QUIET, C_BLOCK, C_MULTI, C_OR, C_AND, C_PIPE, C_IF, C_FOR };
typedef struct _PARSED_COMMAND
{
struct _PARSED_COMMAND *Subcommands;
diff --git a/base/shell/cmd/parser.c b/base/shell/cmd/parser.c
index abf2353d563..2a7b653be5d 100644
--- a/base/shell/cmd/parser.c
+++ b/base/shell/cmd/parser.c
@@ -823,8 +823,10 @@ EchoCommand(PARSED_COMMAND *Cmd)
if (SubstituteForVars(Cmd->Command.Rest, Buf))
ConOutPrintf(_T("%s"), Buf);
break;
+
case C_QUIET:
return;
+
case C_BLOCK:
ConOutChar(_T('('));
Sub = Cmd->Subcommands;
@@ -846,15 +848,17 @@ EchoCommand(PARSED_COMMAND *Cmd)
}
ConOutChar(_T(')'));
break;
+
case C_MULTI:
- case C_IFFAILURE:
- case C_IFSUCCESS:
+ case C_OR:
+ case C_AND:
case C_PIPE:
Sub = Cmd->Subcommands;
EchoCommand(Sub);
ConOutPrintf(_T(" %s "), OpString[Cmd->Type - C_OP_LOWEST]);
EchoCommand(Sub->Next);
break;
+
case C_IF:
ConOutPrintf(_T("if"));
if (Cmd->If.Flags & IFFLAG_IGNORECASE)
@@ -874,6 +878,7 @@ EchoCommand(PARSED_COMMAND *Cmd)
EchoCommand(Sub->Next);
}
break;
+
case C_FOR:
ConOutPrintf(_T("for"));
if (Cmd->For.Switches & FOR_DIRS) ConOutPrintf(_T(" /D"));
@@ -947,10 +952,12 @@ do { \
if (!SubstituteForVars(Cmd->Command.Rest, Buf)) return NULL;
STRING(Buf);
break;
+
case C_QUIET:
CHAR(_T('@'));
RECURSE(Cmd->Subcommands);
break;
+
case C_BLOCK:
CHAR(_T('('));
for (Sub = Cmd->Subcommands; Sub; Sub = Sub->Next)
@@ -961,15 +968,17 @@ do { \
}
CHAR(_T(')'));
break;
+
case C_MULTI:
- case C_IFFAILURE:
- case C_IFSUCCESS:
+ case C_OR:
+ case C_AND:
case C_PIPE:
Sub = Cmd->Subcommands;
RECURSE(Sub);
PRINTF(_T(" %s "), OpString[Cmd->Type - C_OP_LOWEST]);
RECURSE(Sub->Next);
break;
+
case C_IF:
STRING(_T("if"));
if (Cmd->If.Flags & IFFLAG_IGNORECASE)
@@ -989,6 +998,7 @@ do { \
RECURSE(Sub->Next);
}
break;
+
case C_FOR:
STRING(_T("for"));
if (Cmd->For.Switches & FOR_DIRS) STRING(_T(" /D"));