From 47d20b54f9a65b08aa602a1866c1b59a69088dfc Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Sun, 5 Dec 2021 14:54:13 -0800 Subject: 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 Cc: Leif Lindholm Cc: Michael D Kinney Signed-off-by: Michael Kubacki Reviewed-by: Ray Ni --- ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c | 96 +++++++++++------------ 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c') diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c index 6f9c1ec..c9082eb 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c @@ -18,31 +18,32 @@ @return any return code from GetNextVariableName except EFI_NOT_FOUND **/ SHELL_STATUS -PrintAllShellEnvVars( +PrintAllShellEnvVars ( VOID ) { - CONST CHAR16 *Value; - CONST CHAR16 *ConstEnvNameList; + CONST CHAR16 *Value; + CONST CHAR16 *ConstEnvNameList; - ConstEnvNameList = gEfiShellProtocol->GetEnv(NULL); + ConstEnvNameList = gEfiShellProtocol->GetEnv (NULL); if (ConstEnvNameList == NULL) { return (SHELL_SUCCESS); } - while (*ConstEnvNameList != CHAR_NULL){ - Value = gEfiShellProtocol->GetEnv(ConstEnvNameList); - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, ConstEnvNameList, Value); - ConstEnvNameList += StrLen(ConstEnvNameList)+1; + + while (*ConstEnvNameList != CHAR_NULL) { + Value = gEfiShellProtocol->GetEnv (ConstEnvNameList); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, ConstEnvNameList, Value); + ConstEnvNameList += StrLen (ConstEnvNameList)+1; } return (SHELL_SUCCESS); } -STATIC CONST SHELL_PARAM_ITEM SetParamList[] = { - {L"-d", TypeValue}, - {L"-v", TypeFlag}, - {NULL, TypeMax} - }; +STATIC CONST SHELL_PARAM_ITEM SetParamList[] = { + { L"-d", TypeValue }, + { L"-v", TypeFlag }, + { NULL, TypeMax } +}; /** Function for 'set' command. @@ -70,90 +71,89 @@ ShellCommandRunSet ( // // initialize the shell lib (we must be in non-auto-init...) // - Status = ShellInitialize(); - ASSERT_EFI_ERROR(Status); + Status = ShellInitialize (); + ASSERT_EFI_ERROR (Status); // // Make sure globals are good... // - Status = CommandInit(); - ASSERT_EFI_ERROR(Status); + Status = CommandInit (); + ASSERT_EFI_ERROR (Status); // // parse the command line // Status = ShellCommandLineParse (SetParamList, &Package, &ProblemParam, TRUE); - if (EFI_ERROR(Status)) { - if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"set", ProblemParam); - FreePool(ProblemParam); + if (EFI_ERROR (Status)) { + if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"set", ProblemParam); + FreePool (ProblemParam); return (SHELL_INVALID_PARAMETER); } else { - ASSERT(FALSE); + ASSERT (FALSE); } } else { // // check for "-?" // - if (ShellCommandLineGetFlag(Package, L"-?")) { - ASSERT(FALSE); - } else if (ShellCommandLineGetRawValue(Package, 3) != NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set"); + if (ShellCommandLineGetFlag (Package, L"-?")) { + ASSERT (FALSE); + } else if (ShellCommandLineGetRawValue (Package, 3) != NULL) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set"); ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetRawValue(Package, 1) != NULL && ShellCommandLineGetFlag(Package, L"-d")) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set"); + } else if ((ShellCommandLineGetRawValue (Package, 1) != NULL) && ShellCommandLineGetFlag (Package, L"-d")) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"set"); ShellStatus = SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag(Package, L"-d")) { + } else if (ShellCommandLineGetFlag (Package, L"-d")) { // // delete a environment variable // - KeyName = ShellCommandLineGetValue(Package, L"-d"); + KeyName = ShellCommandLineGetValue (Package, L"-d"); if (KeyName == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"set", L"-d"); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"set", L"-d"); ShellStatus = SHELL_INVALID_PARAMETER; } else { - Status = ShellSetEnvironmentVariable(KeyName, L"", ShellCommandLineGetFlag(Package, L"-v")); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_ND), gShellLevel2HiiHandle, L"set", KeyName); + Status = ShellSetEnvironmentVariable (KeyName, L"", ShellCommandLineGetFlag (Package, L"-v")); + if (EFI_ERROR (Status)) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_ND), gShellLevel2HiiHandle, L"set", KeyName); ShellStatus = SHELL_DEVICE_ERROR; } } - } else if (ShellCommandLineGetRawValue(Package, 1) == NULL) { + } else if (ShellCommandLineGetRawValue (Package, 1) == NULL) { // // print out all current environment variables // - return(PrintAllShellEnvVars()); + return (PrintAllShellEnvVars ()); } else { // // we are either printing one or assigning one // - KeyName = ShellCommandLineGetRawValue(Package, 1); - Value = ShellCommandLineGetRawValue(Package, 2); - if (KeyName != NULL && Value != NULL) { + KeyName = ShellCommandLineGetRawValue (Package, 1); + Value = ShellCommandLineGetRawValue (Package, 2); + if ((KeyName != NULL) && (Value != NULL)) { // // assigning one // - Status = ShellSetEnvironmentVariable(KeyName, Value, ShellCommandLineGetFlag(Package, L"-v")); - if (EFI_ERROR(Status)) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_ERROR_SET), gShellLevel2HiiHandle, L"set", KeyName); - ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); + Status = ShellSetEnvironmentVariable (KeyName, Value, ShellCommandLineGetFlag (Package, L"-v")); + if (EFI_ERROR (Status)) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_ERROR_SET), gShellLevel2HiiHandle, L"set", KeyName); + ShellStatus = (SHELL_STATUS)(Status & (~MAX_BIT)); } - } else { if (KeyName != NULL) { // // print out value for this one only. // - Value = ShellGetEnvironmentVariable(KeyName); + Value = ShellGetEnvironmentVariable (KeyName); if (Value == NULL) { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_NF), gShellLevel2HiiHandle, L"set", KeyName); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_NF), gShellLevel2HiiHandle, L"set", KeyName); ShellStatus = SHELL_SUCCESS; } else { - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, KeyName, Value); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SET_DISP), gShellLevel2HiiHandle, KeyName, Value); ShellStatus = SHELL_SUCCESS; } } else { - ASSERT(FALSE); + ASSERT (FALSE); } } } -- cgit v1.1