summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:13 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit47d20b54f9a65b08aa602a1866c1b59a69088dfc (patch)
treee3241dd169bda79544a36248e834a4bebe298418 /ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
parentc411b485b63a671a1e276700cff025c73997233c (diff)
downloadedk2-47d20b54f9a65b08aa602a1866c1b59a69088dfc.tar.gz
edk2-47d20b54f9a65b08aa602a1866c1b59a69088dfc.tar.bz2
edk2-47d20b54f9a65b08aa602a1866c1b59a69088dfc.zip
ShellPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the ShellPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c')
-rw-r--r--ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c131
1 files changed, 69 insertions, 62 deletions
diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
index 70f7f28b1d..5a8a21aac7 100644
--- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
+++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
@@ -20,15 +20,15 @@
@retval SHELL_SUCCESS the printout was sucessful
**/
SHELL_STATUS
-PrintSingleShellAlias(
- IN CONST CHAR16 *Alias
+PrintSingleShellAlias (
+ IN CONST CHAR16 *Alias
)
{
- CONST CHAR16 *ConstAliasVal;
- SHELL_STATUS ShellStatus;
- BOOLEAN Volatile;
+ CONST CHAR16 *ConstAliasVal;
+ SHELL_STATUS ShellStatus;
+ BOOLEAN Volatile;
- ShellStatus = SHELL_SUCCESS;
+ ShellStatus = SHELL_SUCCESS;
ConstAliasVal = gEfiShellProtocol->GetAlias (Alias, &Volatile);
if (ConstAliasVal == NULL) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel3HiiHandle, L"alias", Alias);
@@ -37,8 +37,10 @@ PrintSingleShellAlias(
if (ShellCommandIsOnAliasList (Alias)) {
Volatile = FALSE;
}
+
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_ALIAS_OUTPUT), gShellLevel3HiiHandle, !Volatile ? L' ' : L'*', Alias, ConstAliasVal);
}
+
return ShellStatus;
}
@@ -49,35 +51,38 @@ PrintSingleShellAlias(
@return any return code from GetNextVariableName except EFI_NOT_FOUND
**/
SHELL_STATUS
-PrintAllShellAlias(
+PrintAllShellAlias (
VOID
)
{
- CONST CHAR16 *ConstAllAliasList;
- CHAR16 *Alias;
- CHAR16 *Walker;
+ CONST CHAR16 *ConstAllAliasList;
+ CHAR16 *Alias;
+ CHAR16 *Walker;
- ConstAllAliasList = gEfiShellProtocol->GetAlias(NULL, NULL);
+ ConstAllAliasList = gEfiShellProtocol->GetAlias (NULL, NULL);
if (ConstAllAliasList == NULL) {
return (SHELL_SUCCESS);
}
- Alias = AllocateZeroPool(StrSize(ConstAllAliasList));
+
+ Alias = AllocateZeroPool (StrSize (ConstAllAliasList));
if (Alias == NULL) {
return (SHELL_OUT_OF_RESOURCES);
}
- Walker = (CHAR16*)ConstAllAliasList;
+
+ Walker = (CHAR16 *)ConstAllAliasList;
do {
- CopyMem(Alias, Walker, StrSize(Walker));
- Walker = StrStr(Alias, L";");
+ CopyMem (Alias, Walker, StrSize (Walker));
+ Walker = StrStr (Alias, L";");
if (Walker != NULL) {
Walker[0] = CHAR_NULL;
- Walker = Walker + 1;
+ Walker = Walker + 1;
}
- PrintSingleShellAlias(Alias);
+
+ PrintSingleShellAlias (Alias);
} while (Walker != NULL && Walker[0] != CHAR_NULL);
- FreePool(Alias);
+ FreePool (Alias);
return (SHELL_SUCCESS);
}
@@ -104,19 +109,19 @@ PrintAllShellAlias(
@retval SHELL_DEVICE_ERROR Command is null or the empty string.
**/
SHELL_STATUS
-ShellLevel3CommandsLibSetAlias(
- IN CONST CHAR16 *Command,
- IN CONST CHAR16 *Alias,
- IN BOOLEAN Replace,
- IN BOOLEAN Volatile
+ShellLevel3CommandsLibSetAlias (
+ IN CONST CHAR16 *Command,
+ IN CONST CHAR16 *Alias,
+ IN BOOLEAN Replace,
+ IN BOOLEAN Volatile
)
{
- SHELL_STATUS ShellStatus;
- EFI_STATUS Status;
+ SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
ShellStatus = SHELL_SUCCESS;
- Status = gEfiShellProtocol->SetAlias (Command, Alias, Replace, Volatile);
- if (EFI_ERROR(Status)) {
+ Status = gEfiShellProtocol->SetAlias (Command, Alias, Replace, Volatile);
+ if (EFI_ERROR (Status)) {
if (Status == EFI_ACCESS_DENIED) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle, L"alias");
ShellStatus = SHELL_ACCESS_DENIED;
@@ -128,14 +133,15 @@ ShellLevel3CommandsLibSetAlias(
ShellStatus = SHELL_DEVICE_ERROR;
}
}
+
return ShellStatus;
}
-STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- {L"-v", TypeFlag},
- {L"-d", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ { L"-v", TypeFlag },
+ { L"-d", TypeValue },
+ { NULL, TypeMax }
+};
/**
Function for 'alias' command.
@@ -150,59 +156,59 @@ ShellCommandRunAlias (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Package;
- CHAR16 *ProblemParam;
- SHELL_STATUS ShellStatus;
- CONST CHAR16 *Param1;
- CONST CHAR16 *Param2;
- CONST CHAR16 *ParamStrD;
- CHAR16 *CleanParam2;
- BOOLEAN DeleteFlag;
- BOOLEAN VolatileFlag;
-
- ProblemParam = NULL;
- ShellStatus = SHELL_SUCCESS;
- CleanParam2 = NULL;
+ EFI_STATUS Status;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ SHELL_STATUS ShellStatus;
+ CONST CHAR16 *Param1;
+ CONST CHAR16 *Param2;
+ CONST CHAR16 *ParamStrD;
+ CHAR16 *CleanParam2;
+ BOOLEAN DeleteFlag;
+ BOOLEAN VolatileFlag;
+
+ ProblemParam = NULL;
+ ShellStatus = SHELL_SUCCESS;
+ CleanParam2 = NULL;
//
// initialize the shell lib (we must be in non-auto-init...)
//
- Status = ShellInitialize();
- ASSERT_EFI_ERROR(Status);
+ Status = ShellInitialize ();
+ ASSERT_EFI_ERROR (Status);
- Status = CommandInit();
- ASSERT_EFI_ERROR(Status);
+ Status = CommandInit ();
+ ASSERT_EFI_ERROR (Status);
//
// parse the command line
//
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
- if (EFI_ERROR(Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"alias", ProblemParam);
- FreePool(ProblemParam);
+ if (EFI_ERROR (Status)) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"alias", ProblemParam);
+ FreePool (ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
- ASSERT(FALSE);
+ ASSERT (FALSE);
}
} else {
- Param1 = ShellCommandLineGetRawValue(Package, 1);
- Param2 = ShellCommandLineGetRawValue(Package, 2);
+ Param1 = ShellCommandLineGetRawValue (Package, 1);
+ Param2 = ShellCommandLineGetRawValue (Package, 2);
DeleteFlag = ShellCommandLineGetFlag (Package, L"-d");
VolatileFlag = ShellCommandLineGetFlag (Package, L"-v");
if (Param2 != NULL) {
- CleanParam2 = AllocateCopyPool (StrSize(Param2), Param2);
+ CleanParam2 = AllocateCopyPool (StrSize (Param2), Param2);
if (CleanParam2 == NULL) {
ShellCommandLineFreeVarList (Package);
return SHELL_OUT_OF_RESOURCES;
}
- if (CleanParam2[0] == L'\"' && CleanParam2[StrLen(CleanParam2)-1] == L'\"') {
- CleanParam2[StrLen(CleanParam2)-1] = L'\0';
- CopyMem (CleanParam2, CleanParam2 + 1, StrSize(CleanParam2) - sizeof(CleanParam2[0]));
+ if ((CleanParam2[0] == L'\"') && (CleanParam2[StrLen (CleanParam2)-1] == L'\"')) {
+ CleanParam2[StrLen (CleanParam2)-1] = L'\0';
+ CopyMem (CleanParam2, CleanParam2 + 1, StrSize (CleanParam2) - sizeof (CleanParam2[0]));
}
}
@@ -231,7 +237,7 @@ ShellCommandRunAlias (
ShellStatus = SHELL_INVALID_PARAMETER;
}
} else if (DeleteFlag) {
- if (VolatileFlag || ShellCommandLineGetCount (Package) > 1) {
+ if (VolatileFlag || (ShellCommandLineGetCount (Package) > 1)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"alias");
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
@@ -269,6 +275,7 @@ ShellCommandRunAlias (
ShellStatus = SHELL_INVALID_PARAMETER;
}
}
+
//
// free the command line package
//